| OLD | NEW |
| 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 "vm/bootstrap_natives.h" | 5 #include "vm/bootstrap_natives.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 #include "vm/dart_entry.h" | 8 #include "vm/dart_entry.h" |
| 9 #include "vm/dart_api_impl.h" | 9 #include "vm/dart_api_impl.h" |
| 10 #include "vm/exceptions.h" | 10 #include "vm/exceptions.h" |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 } | 402 } |
| 403 | 403 |
| 404 | 404 |
| 405 DEFINE_NATIVE_ENTRY(Bigint_getDigits, 1) { | 405 DEFINE_NATIVE_ENTRY(Bigint_getDigits, 1) { |
| 406 const Bigint& bigint = Bigint::CheckedHandle(arguments->NativeArgAt(0)); | 406 const Bigint& bigint = Bigint::CheckedHandle(arguments->NativeArgAt(0)); |
| 407 return bigint.digits(); | 407 return bigint.digits(); |
| 408 } | 408 } |
| 409 | 409 |
| 410 | 410 |
| 411 DEFINE_NATIVE_ENTRY(Bigint_allocate, 4) { | 411 DEFINE_NATIVE_ENTRY(Bigint_allocate, 4) { |
| 412 if (FLAG_limit_ints_to_64_bits) { |
| 413 // The allocated Bigint value is not necessarily out of range, but it may |
| 414 // be used as an operand in an operation resulting in a Bigint. |
| 415 Exceptions::ThrowRangeErrorMsg( |
| 416 "Integer operand requires conversion to Bigint"); |
| 417 } |
| 412 // First arg is null type arguments, since class Bigint is not parameterized. | 418 // First arg is null type arguments, since class Bigint is not parameterized. |
| 413 const Bool& neg = Bool::CheckedHandle(arguments->NativeArgAt(1)); | 419 const Bool& neg = Bool::CheckedHandle(arguments->NativeArgAt(1)); |
| 414 const Smi& used = Smi::CheckedHandle(arguments->NativeArgAt(2)); | 420 const Smi& used = Smi::CheckedHandle(arguments->NativeArgAt(2)); |
| 415 const TypedData& digits = TypedData::CheckedHandle(arguments->NativeArgAt(3)); | 421 const TypedData& digits = TypedData::CheckedHandle(arguments->NativeArgAt(3)); |
| 416 ASSERT(!digits.IsNull()); | 422 ASSERT(!digits.IsNull()); |
| 417 return Bigint::New(neg.value(), used.Value(), digits); | 423 return Bigint::New(neg.value(), used.Value(), digits); |
| 418 } | 424 } |
| 419 | 425 |
| 420 } // namespace dart | 426 } // namespace dart |
| OLD | NEW |