| 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/simulator.h" | 9 #include "vm/simulator.h" |
| 10 #include "vm/runtime_entry.h" | 10 #include "vm/runtime_entry.h" |
| (...skipping 1278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1289 } | 1289 } |
| 1290 | 1290 |
| 1291 | 1291 |
| 1292 void Assembler::CompareObject(Register rn, const Object& object) { | 1292 void Assembler::CompareObject(Register rn, const Object& object) { |
| 1293 ASSERT(rn != IP); | 1293 ASSERT(rn != IP); |
| 1294 LoadObject(IP, object); | 1294 LoadObject(IP, object); |
| 1295 cmp(rn, ShifterOperand(IP)); | 1295 cmp(rn, ShifterOperand(IP)); |
| 1296 } | 1296 } |
| 1297 | 1297 |
| 1298 | 1298 |
| 1299 void Assembler::LoadClassId(Register result, Register object) { |
| 1300 ASSERT(RawObject::kClassIdTagBit == 16); |
| 1301 ASSERT(RawObject::kClassIdTagSize == 16); |
| 1302 const intptr_t class_id_offset = Object::tags_offset() + |
| 1303 RawObject::kClassIdTagBit / kBitsPerByte; |
| 1304 ldrh(result, FieldAddress(object, class_id_offset)); |
| 1305 } |
| 1306 |
| 1307 |
| 1308 void Assembler::LoadClassById(Register result, Register class_id) { |
| 1309 ASSERT(result != class_id); |
| 1310 ldr(result, FieldAddress(CTX, Context::isolate_offset())); |
| 1311 const intptr_t table_offset_in_isolate = |
| 1312 Isolate::class_table_offset() + ClassTable::table_offset(); |
| 1313 ldr(result, Address(result, table_offset_in_isolate)); |
| 1314 ldr(result, Address(result, class_id, LSL, 2)); |
| 1315 } |
| 1316 |
| 1317 |
| 1318 void Assembler::LoadClass(Register result, Register object, Register scratch) { |
| 1319 ASSERT(scratch != result); |
| 1320 LoadClassId(scratch, object); |
| 1321 |
| 1322 ldr(result, FieldAddress(CTX, Context::isolate_offset())); |
| 1323 const intptr_t table_offset_in_isolate = |
| 1324 Isolate::class_table_offset() + ClassTable::table_offset(); |
| 1325 ldr(result, Address(result, table_offset_in_isolate)); |
| 1326 ldr(result, Address(result, scratch, LSL, 2)); |
| 1327 } |
| 1328 |
| 1329 |
| 1330 void Assembler::CompareClassId(Register object, |
| 1331 intptr_t class_id, |
| 1332 Register scratch) { |
| 1333 LoadClassId(scratch, object); |
| 1334 CompareImmediate(scratch, class_id); |
| 1335 } |
| 1336 |
| 1337 |
| 1299 void Assembler::Bind(Label* label) { | 1338 void Assembler::Bind(Label* label) { |
| 1300 ASSERT(!label->IsBound()); | 1339 ASSERT(!label->IsBound()); |
| 1301 int bound_pc = buffer_.Size(); | 1340 int bound_pc = buffer_.Size(); |
| 1302 while (label->IsLinked()) { | 1341 while (label->IsLinked()) { |
| 1303 int32_t position = label->Position(); | 1342 int32_t position = label->Position(); |
| 1304 int32_t next = buffer_.Load<int32_t>(position); | 1343 int32_t next = buffer_.Load<int32_t>(position); |
| 1305 int32_t encoded = Assembler::EncodeBranchOffset(bound_pc - position, next); | 1344 int32_t encoded = Assembler::EncodeBranchOffset(bound_pc - position, next); |
| 1306 buffer_.Store<int32_t>(position, encoded); | 1345 buffer_.Store<int32_t>(position, encoded); |
| 1307 label->position_ = Assembler::DecodeBranchOffset(next); | 1346 label->position_ = Assembler::DecodeBranchOffset(next); |
| 1308 } | 1347 } |
| (...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1963 // Do not reuse an existing entry, since each reference may be patched | 2002 // Do not reuse an existing entry, since each reference may be patched |
| 1964 // independently. | 2003 // independently. |
| 1965 object_pool_.Add(smi, Heap::kOld); | 2004 object_pool_.Add(smi, Heap::kOld); |
| 1966 return object_pool_.Length() - 1; | 2005 return object_pool_.Length() - 1; |
| 1967 } | 2006 } |
| 1968 | 2007 |
| 1969 } // namespace dart | 2008 } // namespace dart |
| 1970 | 2009 |
| 1971 #endif // defined TARGET_ARCH_ARM | 2010 #endif // defined TARGET_ARCH_ARM |
| 1972 | 2011 |
| OLD | NEW |