Chromium Code Reviews| 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); | |
|
zra
2014/12/15 16:01:40
If there's no call, I don't think you need to push
Vyacheslav Egorov (Google)
2014/12/15 17:20:05
Done.
| |
| 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)(intptr_t 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 | |
| 3568 // On 64-bit platforms we don't track the sign of the smis outside of | |
| 3569 // int32 range because it is not needed to distinguish kInt32Range from | |
| 3570 // kUint32Range. | |
| 3571 EXPECT_EQ(ICData::kSignBit, | |
| 3572 RANGE_OF(Smi::New(static_cast<int64_t>(kMinInt32) - 1))); | |
| 3573 EXPECT_EQ(ICData::kSignBit, | |
| 3574 RANGE_OF(Smi::New(static_cast<int64_t>(kMaxUint32) + 1))); | |
| 3575 EXPECT_EQ(ICData::kSignBit, RANGE_OF(Smi::New(Smi::kMaxValue))); | |
| 3576 EXPECT_EQ(ICData::kSignBit, RANGE_OF(Smi::New(Smi::kMinValue))); | |
| 3577 | |
| 3578 EXPECT_EQ(ICData::kInt64Bit, RANGE_OF(Integer::New(Smi::kMaxValue + 1))); | |
| 3579 EXPECT_EQ(ICData::kInt64Bit, RANGE_OF(Integer::New(Smi::kMinValue - 1))); | |
| 3580 EXPECT_EQ(ICData::kInt64Bit, RANGE_OF(Integer::New(kMaxInt64))); | |
| 3581 EXPECT_EQ(ICData::kInt64Bit, RANGE_OF(Integer::New(kMinInt64))); | |
| 3582 | |
| 3583 EXPECT_EQ(-1, RANGE_OF(Bool::True().raw())); | |
| 3584 | |
| 3585 #undef RANGE_OF | |
| 3586 } | |
| 3587 | |
| 3588 | |
| 3526 } // namespace dart | 3589 } // namespace dart |
| 3527 | 3590 |
| 3528 #endif // defined(TARGET_ARCH_ARM64) | 3591 #endif // defined(TARGET_ARCH_ARM64) |
| OLD | NEW |