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 __ PushList(1 << LR); | |
zra
2014/12/15 16:01:40
Same comment.
Vyacheslav Egorov (Google)
2014/12/15 17:20:05
Done.
| |
4221 Label miss, done; | |
4222 __ mov(R1, Operand(R0)); | |
4223 __ ComputeRange(R0, R1, R2, &miss); | |
4224 __ b(&done); | |
4225 | |
4226 __ Bind(&miss); | |
4227 __ LoadImmediate(R0, -1); | |
4228 | |
4229 __ Bind(&done); | |
4230 __ PopList(1 << LR); | |
4231 __ Ret(); | |
4232 } | |
4233 | |
4234 | |
4235 ASSEMBLER_TEST_RUN(ComputeRange, test) { | |
4236 typedef intptr_t (*ComputeRange)(intptr_t value) DART_UNUSED; | |
4237 | |
4238 #define RANGE_OF(v) \ | |
4239 (EXECUTE_TEST_CODE_INTPTR_INTPTR( \ | |
4240 ComputeRange, test->entry(), reinterpret_cast<intptr_t>(v))) | |
4241 | |
4242 EXPECT_EQ(0, RANGE_OF(Smi::New(0))); | |
4243 EXPECT_EQ(0, RANGE_OF(Smi::New(1))); | |
4244 EXPECT_EQ(ICData::kSignBit, RANGE_OF(Smi::New(-1))); | |
4245 EXPECT_EQ(0, RANGE_OF(Smi::New(Smi::kMaxValue))); | |
4246 EXPECT_EQ(ICData::kSignBit, RANGE_OF(Smi::New(Smi::kMinValue))); | |
4247 | |
4248 EXPECT_EQ(ICData::kInt32Bit, RANGE_OF(Integer::New(Smi::kMaxValue + 1))); | |
4249 EXPECT_EQ(ICData::kInt32Bit | ICData::kSignBit, | |
4250 RANGE_OF(Integer::New(Smi::kMinValue - 1))); | |
4251 EXPECT_EQ(ICData::kInt32Bit, RANGE_OF(Integer::New(kMaxInt32))); | |
4252 EXPECT_EQ(ICData::kInt32Bit | ICData::kSignBit, | |
4253 RANGE_OF(Integer::New(kMinInt32))); | |
4254 | |
4255 EXPECT_EQ(ICData::kUint32Bit, | |
4256 RANGE_OF(Integer::New(static_cast<int64_t>(kMaxInt32) + 1))); | |
4257 EXPECT_EQ(ICData::kUint32Bit, | |
4258 RANGE_OF(Integer::New(kMaxUint32))); | |
4259 | |
4260 EXPECT_EQ(ICData::kInt64Bit, | |
4261 RANGE_OF(Integer::New(static_cast<int64_t>(kMaxUint32) + 1))); | |
4262 EXPECT_EQ(ICData::kInt64Bit, | |
4263 RANGE_OF(Integer::New(static_cast<int64_t>(kMinInt32) - 1))); | |
4264 EXPECT_EQ(ICData::kInt64Bit, RANGE_OF(Integer::New(kMaxInt64))); | |
4265 EXPECT_EQ(ICData::kInt64Bit, RANGE_OF(Integer::New(kMinInt64))); | |
4266 | |
4267 EXPECT_EQ(-1, RANGE_OF(Bool::True().raw())); | |
4268 | |
4269 #undef RANGE_OF | |
4270 } | |
4271 | |
4272 | |
4218 } // namespace dart | 4273 } // namespace dart |
4219 | 4274 |
4220 #endif // defined TARGET_ARCH_ARM | 4275 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |