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 __ Push(LR); |
| 3532 Label miss, done; |
| 3533 __ mov(R1, R0); |
| 3534 __ ComputeRange(R0, R1, R2, &miss); |
| 3535 __ b(&done); |
| 3536 |
| 3537 __ Bind(&miss); |
| 3538 __ LoadImmediate(R0, -1, kNoPP); |
| 3539 |
| 3540 __ Bind(&done); |
| 3541 __ Pop(LR); |
| 3542 __ PopAndUntagPP(); |
| 3543 __ mov(CSP, SP); |
| 3544 __ ret(); |
| 3545 } |
| 3546 |
| 3547 |
| 3548 ASSEMBLER_TEST_RUN(ComputeRange, test) { |
| 3549 typedef intptr_t (*ComputeRange)(RawObject* value) DART_UNUSED; |
| 3550 |
| 3551 #define RANGE_OF(v) \ |
| 3552 (EXECUTE_TEST_CODE_INTPTR_INTPTR( \ |
| 3553 ComputeRange, test->entry(), reinterpret_cast<intptr_t>(v))) |
| 3554 |
| 3555 EXPECT_EQ(ICData::kInt32Bit, RANGE_OF(Smi::New(0))); |
| 3556 EXPECT_EQ(ICData::kInt32Bit, RANGE_OF(Smi::New(1))); |
| 3557 EXPECT_EQ(ICData::kInt32Bit, RANGE_OF(Smi::New(kMaxInt32))); |
| 3558 EXPECT_EQ(ICData::kInt32Bit | ICData::kSignBit, |
| 3559 RANGE_OF(Smi::New(-1))); |
| 3560 EXPECT_EQ(ICData::kInt32Bit | ICData::kSignBit, |
| 3561 RANGE_OF(Smi::New(kMinInt32))); |
| 3562 |
| 3563 EXPECT_EQ(ICData::kUint32Bit, |
| 3564 RANGE_OF(Smi::New(static_cast<int64_t>(kMaxInt32) + 1))); |
| 3565 EXPECT_EQ(ICData::kUint32Bit, |
| 3566 RANGE_OF(Smi::New(kMaxUint32))); |
| 3567 EXPECT_EQ(ICData::kInt64Bit, |
| 3568 RANGE_OF(Smi::New(static_cast<int64_t>(kMaxUint32) + 1))); |
| 3569 EXPECT_EQ(ICData::kInt64Bit, RANGE_OF(Smi::New(Smi::kMaxValue))); |
| 3570 EXPECT_EQ(ICData::kInt64Bit, RANGE_OF(Smi::New(Smi::kMinValue))); |
| 3571 |
| 3572 EXPECT_EQ(ICData::kInt64Bit, RANGE_OF(Integer::New(Smi::kMaxValue + 1))); |
| 3573 EXPECT_EQ(ICData::kInt64Bit, RANGE_OF(Integer::New(Smi::kMinValue - 1))); |
| 3574 EXPECT_EQ(ICData::kInt64Bit, RANGE_OF(Integer::New(kMaxInt64))); |
| 3575 EXPECT_EQ(ICData::kInt64Bit, RANGE_OF(Integer::New(kMinInt64))); |
| 3576 |
| 3577 EXPECT_EQ(-1, RANGE_OF(Bool::True().raw())); |
| 3578 |
| 3579 #undef RANGE_OF |
| 3580 } |
| 3581 |
| 3582 |
3526 } // namespace dart | 3583 } // namespace dart |
3527 | 3584 |
3528 #endif // defined(TARGET_ARCH_ARM64) | 3585 #endif // defined(TARGET_ARCH_ARM64) |
OLD | NEW |