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_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
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 3943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3954 ASSEMBLER_TEST_GENERATE(StoreIntoObject, assembler) { | 3954 ASSEMBLER_TEST_GENERATE(StoreIntoObject, assembler) { |
3955 __ PushList((1 << LR) | (1 << THR)); | 3955 __ PushList((1 << LR) | (1 << THR)); |
3956 __ mov(THR, Operand(R2)); | 3956 __ mov(THR, Operand(R2)); |
3957 __ StoreIntoObject(R1, | 3957 __ StoreIntoObject(R1, |
3958 FieldAddress(R1, GrowableObjectArray::data_offset()), | 3958 FieldAddress(R1, GrowableObjectArray::data_offset()), |
3959 R0); | 3959 R0); |
3960 __ PopList((1 << LR) | (1 << THR)); | 3960 __ PopList((1 << LR) | (1 << THR)); |
3961 __ Ret(); | 3961 __ Ret(); |
3962 } | 3962 } |
3963 | 3963 |
3964 | |
3965 ASSEMBLER_TEST_GENERATE(ComputeRange, assembler) { | |
3966 Label miss, done; | |
3967 __ mov(R1, Operand(R0)); | |
3968 __ ComputeRange(R0, R1, R2, &miss); | |
3969 __ b(&done); | |
3970 | |
3971 __ Bind(&miss); | |
3972 __ LoadImmediate(R0, -1); | |
3973 | |
3974 __ Bind(&done); | |
3975 __ Ret(); | |
3976 } | |
3977 | |
3978 | |
3979 ASSEMBLER_TEST_RUN(ComputeRange, test) { | |
3980 typedef intptr_t (*ComputeRange)(intptr_t value) DART_UNUSED; | |
3981 | |
3982 #define RANGE_OF(v) \ | |
3983 (EXECUTE_TEST_CODE_INTPTR_INTPTR( \ | |
3984 ComputeRange, test->entry(), reinterpret_cast<intptr_t>(v))) | |
3985 | |
3986 EXPECT_EQ(0, RANGE_OF(Smi::New(0))); | |
3987 EXPECT_EQ(0, RANGE_OF(Smi::New(1))); | |
3988 EXPECT_EQ(ICData::kSignedRangeBit, RANGE_OF(Smi::New(-1))); | |
3989 EXPECT_EQ(0, RANGE_OF(Smi::New(Smi::kMaxValue))); | |
3990 EXPECT_EQ(ICData::kSignedRangeBit, RANGE_OF(Smi::New(Smi::kMinValue))); | |
3991 | |
3992 EXPECT_EQ(ICData::kInt32RangeBit, RANGE_OF(Integer::New(Smi::kMaxValue + 1))); | |
3993 EXPECT_EQ(ICData::kInt32RangeBit | ICData::kSignedRangeBit, | |
3994 RANGE_OF(Integer::New(Smi::kMinValue - 1))); | |
3995 EXPECT_EQ(ICData::kInt32RangeBit, RANGE_OF(Integer::New(kMaxInt32))); | |
3996 EXPECT_EQ(ICData::kInt32RangeBit | ICData::kSignedRangeBit, | |
3997 RANGE_OF(Integer::New(kMinInt32))); | |
3998 | |
3999 EXPECT_EQ(ICData::kUint32RangeBit, | |
4000 RANGE_OF(Integer::New(static_cast<int64_t>(kMaxInt32) + 1))); | |
4001 EXPECT_EQ(ICData::kUint32RangeBit, | |
4002 RANGE_OF(Integer::New(kMaxUint32))); | |
4003 | |
4004 EXPECT_EQ(ICData::kInt64RangeBit, | |
4005 RANGE_OF(Integer::New(static_cast<int64_t>(kMaxUint32) + 1))); | |
4006 EXPECT_EQ(ICData::kInt64RangeBit, | |
4007 RANGE_OF(Integer::New(static_cast<int64_t>(kMinInt32) - 1))); | |
4008 EXPECT_EQ(ICData::kInt64RangeBit, RANGE_OF(Integer::New(kMaxInt64))); | |
4009 EXPECT_EQ(ICData::kInt64RangeBit, RANGE_OF(Integer::New(kMinInt64))); | |
4010 | |
4011 EXPECT_EQ(-1, RANGE_OF(Bool::True().raw())); | |
4012 | |
4013 #undef RANGE_OF | |
4014 } | |
4015 | |
4016 } // namespace dart | 3964 } // namespace dart |
4017 | 3965 |
4018 #endif // defined TARGET_ARCH_ARM | 3966 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |