OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 "vm/bigint_operations.h" | 7 #include "vm/bigint_operations.h" |
8 #include "vm/dart_entry.h" | 8 #include "vm/dart_entry.h" |
9 #include "vm/exceptions.h" | 9 #include "vm/exceptions.h" |
10 #include "vm/native_entry.h" | 10 #include "vm/native_entry.h" |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 Bigint::Handle(AsBigint(left)), right.Value()); | 471 Bigint::Handle(AsBigint(left)), right.Value()); |
472 } else { | 472 } else { |
473 int64_t left_64 = left.Value(); | 473 int64_t left_64 = left.Value(); |
474 return Integer::New(left_64 << right.Value()); | 474 return Integer::New(left_64 << right.Value()); |
475 } | 475 } |
476 } | 476 } |
477 } | 477 } |
478 result = left.Value() << right.Value(); | 478 result = left.Value() << right.Value(); |
479 break; | 479 break; |
480 case Token::kSAR: { | 480 case Token::kSAR: { |
| 481 #if defined(TARGET_ARCH_X64) // TODO(regis): Revisit. |
| 482 int shift_amount = (right.Value() > 0x3F) ? 0x3F : right.Value(); |
| 483 #else |
481 int shift_amount = (right.Value() > 0x1F) ? 0x1F : right.Value(); | 484 int shift_amount = (right.Value() > 0x1F) ? 0x1F : right.Value(); |
| 485 #endif |
482 result = left.Value() >> shift_amount; | 486 result = left.Value() >> shift_amount; |
483 break; | 487 break; |
484 } | 488 } |
485 default: | 489 default: |
486 UNIMPLEMENTED(); | 490 UNIMPLEMENTED(); |
487 } | 491 } |
488 ASSERT(Smi::IsValid(result)); | 492 ASSERT(Smi::IsValid(result)); |
489 return Smi::New(result); | 493 return Smi::New(result); |
490 } | 494 } |
491 | 495 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 | 593 |
590 DEFINE_NATIVE_ENTRY(Bigint_bitNegate, 1) { | 594 DEFINE_NATIVE_ENTRY(Bigint_bitNegate, 1) { |
591 const Bigint& value = Bigint::CheckedHandle(arguments->At(0)); | 595 const Bigint& value = Bigint::CheckedHandle(arguments->At(0)); |
592 const Bigint& result = Bigint::Handle(BigintOperations::BitNot(value)); | 596 const Bigint& result = Bigint::Handle(BigintOperations::BitNot(value)); |
593 ASSERT(CheckInteger(value)); | 597 ASSERT(CheckInteger(value)); |
594 ASSERT(CheckInteger(result)); | 598 ASSERT(CheckInteger(result)); |
595 arguments->SetReturn(Integer::Handle(AsInteger(result))); | 599 arguments->SetReturn(Integer::Handle(AsInteger(result))); |
596 } | 600 } |
597 | 601 |
598 } // namespace dart | 602 } // namespace dart |
OLD | NEW |