OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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/globals.h" | 5 #include "vm/globals.h" |
6 #if defined(TARGET_ARCH_ARM64) | 6 #if defined(TARGET_ARCH_ARM64) |
7 | 7 |
8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
9 #include "vm/cpu.h" | 9 #include "vm/cpu.h" |
10 #include "vm/os.h" | 10 #include "vm/os.h" |
(...skipping 3616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3627 __ StoreIntoObject(R1, | 3627 __ StoreIntoObject(R1, |
3628 FieldAddress(R1, GrowableObjectArray::data_offset()), | 3628 FieldAddress(R1, GrowableObjectArray::data_offset()), |
3629 R0); | 3629 R0); |
3630 __ Pop(LR); | 3630 __ Pop(LR); |
3631 __ Pop(THR); | 3631 __ Pop(THR); |
3632 __ Pop(CODE_REG); | 3632 __ Pop(CODE_REG); |
3633 __ RestoreCSP(); | 3633 __ RestoreCSP(); |
3634 __ ret(); | 3634 __ ret(); |
3635 } | 3635 } |
3636 | 3636 |
3637 | |
3638 ASSEMBLER_TEST_GENERATE(ComputeRange, assembler) { | |
3639 __ SetupDartSP(); | |
3640 EnterTestFrame(assembler); | |
3641 Label miss, done; | |
3642 __ ComputeRange(R0, R2, R3, &miss); | |
3643 __ b(&done); | |
3644 | |
3645 __ Bind(&miss); | |
3646 __ LoadImmediate(R0, -1); | |
3647 | |
3648 __ Bind(&done); | |
3649 LeaveTestFrame(assembler); | |
3650 __ RestoreCSP(); | |
3651 __ ret(); | |
3652 } | |
3653 | |
3654 | |
3655 ASSEMBLER_TEST_RUN(ComputeRange, test) { | |
3656 #define RANGE_OF(arg_type, v) \ | |
3657 test->InvokeWithCodeAndThread<intptr_t, arg_type>(v) | |
3658 | |
3659 EXPECT_EQ(ICData::kInt32RangeBit, RANGE_OF(RawSmi*, Smi::New(0))); | |
3660 EXPECT_EQ(ICData::kInt32RangeBit, RANGE_OF(RawSmi*, Smi::New(1))); | |
3661 EXPECT_EQ(ICData::kInt32RangeBit, RANGE_OF(RawSmi*, Smi::New(kMaxInt32))); | |
3662 EXPECT_EQ(ICData::kInt32RangeBit | ICData::kSignedRangeBit, | |
3663 RANGE_OF(RawSmi*, Smi::New(-1))); | |
3664 EXPECT_EQ(ICData::kInt32RangeBit | ICData::kSignedRangeBit, | |
3665 RANGE_OF(RawSmi*, Smi::New(kMinInt32))); | |
3666 | |
3667 EXPECT_EQ(ICData::kUint32RangeBit, | |
3668 RANGE_OF(RawSmi*, Smi::New(static_cast<int64_t>(kMaxInt32) + 1))); | |
3669 EXPECT_EQ(ICData::kUint32RangeBit, | |
3670 RANGE_OF(RawSmi*, Smi::New(kMaxUint32))); | |
3671 | |
3672 // On 64-bit platforms we don't track the sign of the smis outside of | |
3673 // int32 range because it is not needed to distinguish kInt32Range from | |
3674 // kUint32Range. | |
3675 EXPECT_EQ(ICData::kSignedRangeBit, | |
3676 RANGE_OF(RawSmi*, Smi::New(static_cast<int64_t>(kMinInt32) - 1))); | |
3677 EXPECT_EQ(ICData::kSignedRangeBit, | |
3678 RANGE_OF(RawSmi*, Smi::New(static_cast<int64_t>(kMaxUint32) + 1))); | |
3679 EXPECT_EQ(ICData::kSignedRangeBit, | |
3680 RANGE_OF(RawSmi*, Smi::New(Smi::kMaxValue))); | |
3681 EXPECT_EQ(ICData::kSignedRangeBit, RANGE_OF(RawSmi*, | |
3682 Smi::New(Smi::kMinValue))); | |
3683 | |
3684 EXPECT_EQ(ICData::kInt64RangeBit, | |
3685 RANGE_OF(RawInteger*, Integer::New(Smi::kMaxValue + 1))); | |
3686 EXPECT_EQ(ICData::kInt64RangeBit, | |
3687 RANGE_OF(RawInteger*, Integer::New(Smi::kMinValue - 1))); | |
3688 EXPECT_EQ(ICData::kInt64RangeBit, | |
3689 RANGE_OF(RawInteger*, Integer::New(kMaxInt64))); | |
3690 EXPECT_EQ(ICData::kInt64RangeBit, | |
3691 RANGE_OF(RawInteger*, Integer::New(kMinInt64))); | |
3692 | |
3693 EXPECT_EQ(-1, RANGE_OF(RawBool*, Bool::True().raw())); | |
3694 | |
3695 #undef RANGE_OF | |
3696 } | |
3697 | |
3698 | |
3699 } // namespace dart | 3637 } // namespace dart |
3700 | 3638 |
3701 #endif // defined(TARGET_ARCH_ARM64) | 3639 #endif // defined(TARGET_ARCH_ARM64) |
OLD | NEW |