| 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 // Bigint natives. | 404 // Bigint natives. |
| 405 | 405 |
| 406 DEFINE_NATIVE_ENTRY(Bigint_getNeg, 1) { | 406 DEFINE_NATIVE_ENTRY(Bigint_getNeg, 1) { |
| 407 const Bigint& bigint = Bigint::CheckedHandle(arguments->NativeArgAt(0)); | 407 const Bigint& bigint = Bigint::CheckedHandle(arguments->NativeArgAt(0)); |
| 408 return bigint.neg(); | 408 return bigint.neg(); |
| 409 } | 409 } |
| 410 | 410 |
| 411 | 411 |
| 412 DEFINE_NATIVE_ENTRY(Bigint_setNeg, 2) { | |
| 413 const Bigint& bigint = Bigint::CheckedHandle(arguments->NativeArgAt(0)); | |
| 414 const Bool& neg = Bool::CheckedHandle(arguments->NativeArgAt(1)); | |
| 415 bigint.set_neg(neg); | |
| 416 return Object::null(); | |
| 417 } | |
| 418 | |
| 419 | |
| 420 DEFINE_NATIVE_ENTRY(Bigint_getUsed, 1) { | 412 DEFINE_NATIVE_ENTRY(Bigint_getUsed, 1) { |
| 421 const Bigint& bigint = Bigint::CheckedHandle(arguments->NativeArgAt(0)); | 413 const Bigint& bigint = Bigint::CheckedHandle(arguments->NativeArgAt(0)); |
| 422 return bigint.used(); | 414 return bigint.used(); |
| 423 } | 415 } |
| 424 | 416 |
| 425 | 417 |
| 426 DEFINE_NATIVE_ENTRY(Bigint_setUsed, 2) { | |
| 427 const Bigint& bigint = Bigint::CheckedHandle(arguments->NativeArgAt(0)); | |
| 428 const Smi& used = Smi::CheckedHandle(arguments->NativeArgAt(1)); | |
| 429 bigint.set_used(used); | |
| 430 return Object::null(); | |
| 431 } | |
| 432 | |
| 433 | |
| 434 DEFINE_NATIVE_ENTRY(Bigint_getDigits, 1) { | 418 DEFINE_NATIVE_ENTRY(Bigint_getDigits, 1) { |
| 435 const Bigint& bigint = Bigint::CheckedHandle(arguments->NativeArgAt(0)); | 419 const Bigint& bigint = Bigint::CheckedHandle(arguments->NativeArgAt(0)); |
| 436 return bigint.digits(); | 420 return bigint.digits(); |
| 437 } | 421 } |
| 438 | 422 |
| 439 | 423 |
| 440 DEFINE_NATIVE_ENTRY(Bigint_setDigits, 2) { | 424 DEFINE_NATIVE_ENTRY(Bigint_allocate, 4) { |
| 441 const Bigint& bigint = Bigint::CheckedHandle(arguments->NativeArgAt(0)); | 425 // First arg is null type arguments, since class Bigint is not parameterized. |
| 442 const TypedData& digits = TypedData::CheckedHandle(arguments->NativeArgAt(1)); | 426 const Bool& neg = Bool::CheckedHandle(arguments->NativeArgAt(1)); |
| 427 const Smi& used = Smi::CheckedHandle(arguments->NativeArgAt(2)); |
| 428 const TypedData& digits = TypedData::CheckedHandle(arguments->NativeArgAt(3)); |
| 443 ASSERT(!digits.IsNull()); | 429 ASSERT(!digits.IsNull()); |
| 444 bigint.set_digits(digits); | 430 return Bigint::New(neg.value(), used.Value(), digits); |
| 445 return Object::null(); | |
| 446 } | |
| 447 | |
| 448 | |
| 449 DEFINE_NATIVE_ENTRY(Bigint_allocate, 1) { | |
| 450 // Argument is null type arguments, since class Bigint is not parameterized. | |
| 451 return Bigint::New(); | |
| 452 } | 431 } |
| 453 | 432 |
| 454 } // namespace dart | 433 } // namespace dart |
| OLD | NEW |