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 4197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4208 ASSEMBLER_TEST_GENERATE(StoreIntoObject, assembler) { | 4208 ASSEMBLER_TEST_GENERATE(StoreIntoObject, assembler) { |
4209 __ PushList((1 << CTX) | (1 << LR)); | 4209 __ PushList((1 << CTX) | (1 << LR)); |
4210 __ mov(CTX, Operand(R0)); | 4210 __ mov(CTX, Operand(R0)); |
4211 __ StoreIntoObject(R2, | 4211 __ StoreIntoObject(R2, |
4212 FieldAddress(R2, GrowableObjectArray::data_offset()), | 4212 FieldAddress(R2, GrowableObjectArray::data_offset()), |
4213 R1); | 4213 R1); |
4214 __ PopList((1 << CTX) | (1 << LR)); | 4214 __ PopList((1 << CTX) | (1 << LR)); |
4215 __ Ret(); | 4215 __ Ret(); |
4216 } | 4216 } |
4217 | 4217 |
| 4218 |
| 4219 ASSEMBLER_TEST_GENERATE(ComputeRange, assembler) { |
| 4220 Label miss, done; |
| 4221 __ mov(R1, Operand(R0)); |
| 4222 __ ComputeRange(R0, R1, R2, &miss); |
| 4223 __ b(&done); |
| 4224 |
| 4225 __ Bind(&miss); |
| 4226 __ LoadImmediate(R0, -1); |
| 4227 |
| 4228 __ Bind(&done); |
| 4229 __ Ret(); |
| 4230 } |
| 4231 |
| 4232 |
| 4233 ASSEMBLER_TEST_RUN(ComputeRange, test) { |
| 4234 typedef intptr_t (*ComputeRange)(intptr_t value) DART_UNUSED; |
| 4235 |
| 4236 #define RANGE_OF(v) \ |
| 4237 (EXECUTE_TEST_CODE_INTPTR_INTPTR( \ |
| 4238 ComputeRange, test->entry(), reinterpret_cast<intptr_t>(v))) |
| 4239 |
| 4240 EXPECT_EQ(0, RANGE_OF(Smi::New(0))); |
| 4241 EXPECT_EQ(0, RANGE_OF(Smi::New(1))); |
| 4242 EXPECT_EQ(ICData::kSignedRangeBit, RANGE_OF(Smi::New(-1))); |
| 4243 EXPECT_EQ(0, RANGE_OF(Smi::New(Smi::kMaxValue))); |
| 4244 EXPECT_EQ(ICData::kSignedRangeBit, RANGE_OF(Smi::New(Smi::kMinValue))); |
| 4245 |
| 4246 EXPECT_EQ(ICData::kInt32RangeBit, RANGE_OF(Integer::New(Smi::kMaxValue + 1))); |
| 4247 EXPECT_EQ(ICData::kInt32RangeBit | ICData::kSignedRangeBit, |
| 4248 RANGE_OF(Integer::New(Smi::kMinValue - 1))); |
| 4249 EXPECT_EQ(ICData::kInt32RangeBit, RANGE_OF(Integer::New(kMaxInt32))); |
| 4250 EXPECT_EQ(ICData::kInt32RangeBit | ICData::kSignedRangeBit, |
| 4251 RANGE_OF(Integer::New(kMinInt32))); |
| 4252 |
| 4253 EXPECT_EQ(ICData::kUint32RangeBit, |
| 4254 RANGE_OF(Integer::New(static_cast<int64_t>(kMaxInt32) + 1))); |
| 4255 EXPECT_EQ(ICData::kUint32RangeBit, |
| 4256 RANGE_OF(Integer::New(kMaxUint32))); |
| 4257 |
| 4258 EXPECT_EQ(ICData::kInt64RangeBit, |
| 4259 RANGE_OF(Integer::New(static_cast<int64_t>(kMaxUint32) + 1))); |
| 4260 EXPECT_EQ(ICData::kInt64RangeBit, |
| 4261 RANGE_OF(Integer::New(static_cast<int64_t>(kMinInt32) - 1))); |
| 4262 EXPECT_EQ(ICData::kInt64RangeBit, RANGE_OF(Integer::New(kMaxInt64))); |
| 4263 EXPECT_EQ(ICData::kInt64RangeBit, RANGE_OF(Integer::New(kMinInt64))); |
| 4264 |
| 4265 EXPECT_EQ(-1, RANGE_OF(Bool::True().raw())); |
| 4266 |
| 4267 #undef RANGE_OF |
| 4268 } |
| 4269 |
| 4270 |
4218 } // namespace dart | 4271 } // namespace dart |
4219 | 4272 |
4220 #endif // defined TARGET_ARCH_ARM | 4273 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |