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 3505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3516 __ StoreIntoObject(R2, | 3516 __ StoreIntoObject(R2, |
3517 FieldAddress(R2, GrowableObjectArray::data_offset()), | 3517 FieldAddress(R2, GrowableObjectArray::data_offset()), |
3518 R1); | 3518 R1); |
3519 __ Pop(LR); | 3519 __ Pop(LR); |
3520 __ Pop(CTX); | 3520 __ Pop(CTX); |
3521 __ PopAndUntagPP(); | 3521 __ PopAndUntagPP(); |
3522 __ mov(CSP, SP); | 3522 __ mov(CSP, SP); |
3523 __ ret(); | 3523 __ ret(); |
3524 } | 3524 } |
3525 | 3525 |
| 3526 |
| 3527 ASSEMBLER_TEST_GENERATE(ComputeRange, assembler) { |
| 3528 __ SetupDartSP(kTestStackSpace); |
| 3529 __ TagAndPushPP(); |
| 3530 __ LoadPoolPointer(PP); |
| 3531 Label miss, done; |
| 3532 __ mov(R1, R0); |
| 3533 __ ComputeRange(R0, R1, R2, &miss); |
| 3534 __ b(&done); |
| 3535 |
| 3536 __ Bind(&miss); |
| 3537 __ LoadImmediate(R0, -1, kNoPP); |
| 3538 |
| 3539 __ Bind(&done); |
| 3540 __ PopAndUntagPP(); |
| 3541 __ mov(CSP, SP); |
| 3542 __ ret(); |
| 3543 } |
| 3544 |
| 3545 |
| 3546 ASSEMBLER_TEST_RUN(ComputeRange, test) { |
| 3547 typedef intptr_t (*ComputeRange)(intptr_t value) DART_UNUSED; |
| 3548 |
| 3549 #define RANGE_OF(v) \ |
| 3550 (EXECUTE_TEST_CODE_INTPTR_INTPTR( \ |
| 3551 ComputeRange, test->entry(), reinterpret_cast<intptr_t>(v))) |
| 3552 |
| 3553 EXPECT_EQ(ICData::kInt32RangeBit, RANGE_OF(Smi::New(0))); |
| 3554 EXPECT_EQ(ICData::kInt32RangeBit, RANGE_OF(Smi::New(1))); |
| 3555 EXPECT_EQ(ICData::kInt32RangeBit, RANGE_OF(Smi::New(kMaxInt32))); |
| 3556 EXPECT_EQ(ICData::kInt32RangeBit | ICData::kSignedRangeBit, |
| 3557 RANGE_OF(Smi::New(-1))); |
| 3558 EXPECT_EQ(ICData::kInt32RangeBit | ICData::kSignedRangeBit, |
| 3559 RANGE_OF(Smi::New(kMinInt32))); |
| 3560 |
| 3561 EXPECT_EQ(ICData::kUint32RangeBit, |
| 3562 RANGE_OF(Smi::New(static_cast<int64_t>(kMaxInt32) + 1))); |
| 3563 EXPECT_EQ(ICData::kUint32RangeBit, |
| 3564 RANGE_OF(Smi::New(kMaxUint32))); |
| 3565 |
| 3566 // On 64-bit platforms we don't track the sign of the smis outside of |
| 3567 // int32 range because it is not needed to distinguish kInt32Range from |
| 3568 // kUint32Range. |
| 3569 EXPECT_EQ(ICData::kSignedRangeBit, |
| 3570 RANGE_OF(Smi::New(static_cast<int64_t>(kMinInt32) - 1))); |
| 3571 EXPECT_EQ(ICData::kSignedRangeBit, |
| 3572 RANGE_OF(Smi::New(static_cast<int64_t>(kMaxUint32) + 1))); |
| 3573 EXPECT_EQ(ICData::kSignedRangeBit, RANGE_OF(Smi::New(Smi::kMaxValue))); |
| 3574 EXPECT_EQ(ICData::kSignedRangeBit, RANGE_OF(Smi::New(Smi::kMinValue))); |
| 3575 |
| 3576 EXPECT_EQ(ICData::kInt64RangeBit, RANGE_OF(Integer::New(Smi::kMaxValue + 1))); |
| 3577 EXPECT_EQ(ICData::kInt64RangeBit, RANGE_OF(Integer::New(Smi::kMinValue - 1))); |
| 3578 EXPECT_EQ(ICData::kInt64RangeBit, RANGE_OF(Integer::New(kMaxInt64))); |
| 3579 EXPECT_EQ(ICData::kInt64RangeBit, RANGE_OF(Integer::New(kMinInt64))); |
| 3580 |
| 3581 EXPECT_EQ(-1, RANGE_OF(Bool::True().raw())); |
| 3582 |
| 3583 #undef RANGE_OF |
| 3584 } |
| 3585 |
| 3586 |
3526 } // namespace dart | 3587 } // namespace dart |
3527 | 3588 |
3528 #endif // defined(TARGET_ARCH_ARM64) | 3589 #endif // defined(TARGET_ARCH_ARM64) |
OLD | NEW |