Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(818)

Side by Side Diff: vm/dart_api_impl.cc

Issue 9481019: Changes to get rid of dependency on openssl in the dart VM. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « vm/bigint_store.h ('k') | vm/isolate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "include/dart_api.h" 5 #include "include/dart_api.h"
6 6
7 #include "vm/bigint_operations.h" 7 #include "vm/bigint_operations.h"
8 #include "vm/class_finalizer.h" 8 #include "vm/class_finalizer.h"
9 #include "vm/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/dart.h" 10 #include "vm/dart.h"
(...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after
948 if (int_obj.IsNull()) { 948 if (int_obj.IsNull()) {
949 RETURN_TYPE_ERROR(integer, Integer); 949 RETURN_TYPE_ERROR(integer, Integer);
950 } 950 }
951 if (int_obj.IsSmi() || int_obj.IsMint()) { 951 if (int_obj.IsSmi() || int_obj.IsMint()) {
952 *fits = true; 952 *fits = true;
953 } else { 953 } else {
954 ASSERT(int_obj.IsBigint()); 954 ASSERT(int_obj.IsBigint());
955 #if defined(DEBUG) 955 #if defined(DEBUG)
956 Bigint& bigint = Bigint::Handle(); 956 Bigint& bigint = Bigint::Handle();
957 bigint ^= int_obj.raw(); 957 bigint ^= int_obj.raw();
958 ASSERT(!BigintOperations::FitsIntoInt64(bigint)); 958 ASSERT(!BigintOperations::FitsIntoMint(bigint));
959 #endif 959 #endif
960 *fits = false; 960 *fits = false;
961 } 961 }
962 return Api::Success(); 962 return Api::Success();
963 } 963 }
964 964
965 965
966 DART_EXPORT Dart_Handle Dart_IntegerFitsIntoUint64(Dart_Handle integer, 966 DART_EXPORT Dart_Handle Dart_IntegerFitsIntoUint64(Dart_Handle integer,
967 bool* fits) { 967 bool* fits) {
968 DARTSCOPE(Isolate::Current()); 968 DARTSCOPE(Isolate::Current());
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1004 if (int_obj.IsNull()) { 1004 if (int_obj.IsNull()) {
1005 RETURN_TYPE_ERROR(integer, Integer); 1005 RETURN_TYPE_ERROR(integer, Integer);
1006 } 1006 }
1007 if (int_obj.IsSmi() || int_obj.IsMint()) { 1007 if (int_obj.IsSmi() || int_obj.IsMint()) {
1008 *value = int_obj.AsInt64Value(); 1008 *value = int_obj.AsInt64Value();
1009 return Api::Success(); 1009 return Api::Success();
1010 } else { 1010 } else {
1011 ASSERT(int_obj.IsBigint()); 1011 ASSERT(int_obj.IsBigint());
1012 Bigint& bigint = Bigint::Handle(); 1012 Bigint& bigint = Bigint::Handle();
1013 bigint ^= int_obj.raw(); 1013 bigint ^= int_obj.raw();
1014 if (BigintOperations::FitsIntoInt64(bigint)) { 1014 if (BigintOperations::FitsIntoMint(bigint)) {
1015 *value = BigintOperations::ToInt64(bigint); 1015 *value = BigintOperations::ToMint(bigint);
1016 return Api::Success(); 1016 return Api::Success();
1017 } 1017 }
1018 } 1018 }
1019 return Api::NewError("%s: Integer %s cannot be represented as an int64_t.", 1019 return Api::NewError("%s: Integer %s cannot be represented as an int64_t.",
1020 CURRENT_FUNC, int_obj.ToCString()); 1020 CURRENT_FUNC, int_obj.ToCString());
1021 } 1021 }
1022 1022
1023 1023
1024 DART_EXPORT Dart_Handle Dart_IntegerToUint64(Dart_Handle integer, 1024 DART_EXPORT Dart_Handle Dart_IntegerToUint64(Dart_Handle integer,
1025 uint64_t* value) { 1025 uint64_t* value) {
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
1449 const Object& retval = Object::Handle( 1449 const Object& retval = Object::Handle(
1450 DartEntry::InvokeDynamic(instance, function, args, kNoArgumentNames)); 1450 DartEntry::InvokeDynamic(instance, function, args, kNoArgumentNames));
1451 if (retval.IsSmi() || retval.IsMint()) { 1451 if (retval.IsSmi() || retval.IsMint()) {
1452 Integer& integer = Integer::Handle(); 1452 Integer& integer = Integer::Handle();
1453 integer ^= retval.raw(); 1453 integer ^= retval.raw();
1454 *len = integer.AsInt64Value(); 1454 *len = integer.AsInt64Value();
1455 return Api::Success(); 1455 return Api::Success();
1456 } else if (retval.IsBigint()) { 1456 } else if (retval.IsBigint()) {
1457 Bigint& bigint = Bigint::Handle(); 1457 Bigint& bigint = Bigint::Handle();
1458 bigint ^= retval.raw(); 1458 bigint ^= retval.raw();
1459 if (BigintOperations::FitsIntoInt64(bigint)) { 1459 if (BigintOperations::FitsIntoMint(bigint)) {
1460 *len = BigintOperations::ToInt64(bigint); 1460 *len = BigintOperations::ToMint(bigint);
1461 return Api::Success(); 1461 return Api::Success();
1462 } else { 1462 } else {
1463 return Api::NewError("Length of List object is greater than the " 1463 return Api::NewError("Length of List object is greater than the "
1464 "maximum value that 'len' parameter can hold"); 1464 "maximum value that 'len' parameter can hold");
1465 } 1465 }
1466 } else if (retval.IsError()) { 1466 } else if (retval.IsError()) {
1467 return Api::NewLocalHandle(retval); 1467 return Api::NewLocalHandle(retval);
1468 } else { 1468 } else {
1469 return Api::NewError("Length of List object is not an integer"); 1469 return Api::NewError("Length of List object is not an integer");
1470 } 1470 }
(...skipping 1239 matching lines...) Expand 10 before | Expand all | Expand 10 after
2710 *buffer = NULL; 2710 *buffer = NULL;
2711 } 2711 }
2712 delete debug_region; 2712 delete debug_region;
2713 } else { 2713 } else {
2714 *buffer = NULL; 2714 *buffer = NULL;
2715 *buffer_size = 0; 2715 *buffer_size = 0;
2716 } 2716 }
2717 } 2717 }
2718 2718
2719 } // namespace dart 2719 } // namespace dart
OLDNEW
« no previous file with comments | « vm/bigint_store.h ('k') | vm/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698