OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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" // NOLINT | 5 #include "vm/globals.h" // NOLINT |
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/longjump.h" | 10 #include "vm/longjump.h" |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 } | 361 } |
362 | 362 |
363 | 363 |
364 intptr_t Assembler::FindImmediate(int64_t imm) { | 364 intptr_t Assembler::FindImmediate(int64_t imm) { |
365 return object_pool_wrapper_.FindImmediate(imm); | 365 return object_pool_wrapper_.FindImmediate(imm); |
366 } | 366 } |
367 | 367 |
368 | 368 |
369 bool Assembler::CanLoadFromObjectPool(const Object& object) const { | 369 bool Assembler::CanLoadFromObjectPool(const Object& object) const { |
370 ASSERT(!object.IsICData() || ICData::Cast(object).IsOriginal()); | 370 ASSERT(!object.IsICData() || ICData::Cast(object).IsOriginal()); |
| 371 ASSERT(!object.IsField() || Field::Cast(object).IsOriginal()); |
371 ASSERT(!Thread::CanLoadFromThread(object)); | 372 ASSERT(!Thread::CanLoadFromThread(object)); |
372 if (!constant_pool_allowed()) { | 373 if (!constant_pool_allowed()) { |
373 return false; | 374 return false; |
374 } | 375 } |
375 | 376 |
376 // TODO(zra, kmillikin): Also load other large immediates from the object | 377 // TODO(zra, kmillikin): Also load other large immediates from the object |
377 // pool | 378 // pool |
378 if (object.IsSmi()) { | 379 if (object.IsSmi()) { |
379 // If the raw smi does not fit into a 32-bit signed int, then we'll keep | 380 // If the raw smi does not fit into a 32-bit signed int, then we'll keep |
380 // the raw value in the object pool. | 381 // the raw value in the object pool. |
(...skipping 15 matching lines...) Expand all Loading... |
396 | 397 |
397 void Assembler::LoadIsolate(Register dst) { | 398 void Assembler::LoadIsolate(Register dst) { |
398 ldr(dst, Address(THR, Thread::isolate_offset())); | 399 ldr(dst, Address(THR, Thread::isolate_offset())); |
399 } | 400 } |
400 | 401 |
401 | 402 |
402 void Assembler::LoadObjectHelper(Register dst, | 403 void Assembler::LoadObjectHelper(Register dst, |
403 const Object& object, | 404 const Object& object, |
404 bool is_unique) { | 405 bool is_unique) { |
405 ASSERT(!object.IsICData() || ICData::Cast(object).IsOriginal()); | 406 ASSERT(!object.IsICData() || ICData::Cast(object).IsOriginal()); |
| 407 ASSERT(!object.IsField() || Field::Cast(object).IsOriginal()); |
406 if (Thread::CanLoadFromThread(object)) { | 408 if (Thread::CanLoadFromThread(object)) { |
407 ldr(dst, Address(THR, Thread::OffsetFromThread(object))); | 409 ldr(dst, Address(THR, Thread::OffsetFromThread(object))); |
408 } else if (CanLoadFromObjectPool(object)) { | 410 } else if (CanLoadFromObjectPool(object)) { |
409 const int32_t offset = ObjectPool::element_offset( | 411 const int32_t offset = ObjectPool::element_offset( |
410 is_unique ? object_pool_wrapper_.AddObject(object) | 412 is_unique ? object_pool_wrapper_.AddObject(object) |
411 : object_pool_wrapper_.FindObject(object)); | 413 : object_pool_wrapper_.FindObject(object)); |
412 LoadWordFromPoolOffset(dst, offset); | 414 LoadWordFromPoolOffset(dst, offset); |
413 } else { | 415 } else { |
414 ASSERT(object.IsSmi() || object.InVMHeap()); | 416 ASSERT(object.IsSmi() || object.InVMHeap()); |
415 ASSERT(object.IsSmi() || FLAG_allow_absolute_addresses); | 417 ASSERT(object.IsSmi() || FLAG_allow_absolute_addresses); |
(...skipping 19 matching lines...) Expand all Loading... |
435 } | 437 } |
436 | 438 |
437 | 439 |
438 void Assembler::LoadUniqueObject(Register dst, const Object& object) { | 440 void Assembler::LoadUniqueObject(Register dst, const Object& object) { |
439 LoadObjectHelper(dst, object, true); | 441 LoadObjectHelper(dst, object, true); |
440 } | 442 } |
441 | 443 |
442 | 444 |
443 void Assembler::CompareObject(Register reg, const Object& object) { | 445 void Assembler::CompareObject(Register reg, const Object& object) { |
444 ASSERT(!object.IsICData() || ICData::Cast(object).IsOriginal()); | 446 ASSERT(!object.IsICData() || ICData::Cast(object).IsOriginal()); |
| 447 ASSERT(!object.IsField() || Field::Cast(object).IsOriginal()); |
445 if (Thread::CanLoadFromThread(object)) { | 448 if (Thread::CanLoadFromThread(object)) { |
446 ldr(TMP, Address(THR, Thread::OffsetFromThread(object))); | 449 ldr(TMP, Address(THR, Thread::OffsetFromThread(object))); |
447 CompareRegisters(reg, TMP); | 450 CompareRegisters(reg, TMP); |
448 } else if (CanLoadFromObjectPool(object)) { | 451 } else if (CanLoadFromObjectPool(object)) { |
449 LoadObject(TMP, object); | 452 LoadObject(TMP, object); |
450 CompareRegisters(reg, TMP); | 453 CompareRegisters(reg, TMP); |
451 } else { | 454 } else { |
452 ASSERT(object.IsSmi() || FLAG_allow_absolute_addresses); | 455 ASSERT(object.IsSmi() || FLAG_allow_absolute_addresses); |
453 CompareImmediate(reg, reinterpret_cast<int64_t>(object.raw())); | 456 CompareImmediate(reg, reinterpret_cast<int64_t>(object.raw())); |
454 } | 457 } |
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
941 AddImmediate(TMP, object, offset - kHeapObjectTag); | 944 AddImmediate(TMP, object, offset - kHeapObjectTag); |
942 StoreIntoObjectNoBarrier(object, Address(TMP), value); | 945 StoreIntoObjectNoBarrier(object, Address(TMP), value); |
943 } | 946 } |
944 } | 947 } |
945 | 948 |
946 | 949 |
947 void Assembler::StoreIntoObjectNoBarrier(Register object, | 950 void Assembler::StoreIntoObjectNoBarrier(Register object, |
948 const Address& dest, | 951 const Address& dest, |
949 const Object& value) { | 952 const Object& value) { |
950 ASSERT(!value.IsICData() || ICData::Cast(value).IsOriginal()); | 953 ASSERT(!value.IsICData() || ICData::Cast(value).IsOriginal()); |
| 954 ASSERT(!value.IsField() || Field::Cast(value).IsOriginal()); |
951 ASSERT(value.IsSmi() || value.InVMHeap() || | 955 ASSERT(value.IsSmi() || value.InVMHeap() || |
952 (value.IsOld() && value.IsNotTemporaryScopedHandle())); | 956 (value.IsOld() && value.IsNotTemporaryScopedHandle())); |
953 // No store buffer update. | 957 // No store buffer update. |
954 LoadObject(TMP2, value); | 958 LoadObject(TMP2, value); |
955 str(TMP2, dest); | 959 str(TMP2, dest); |
956 } | 960 } |
957 | 961 |
958 | 962 |
959 void Assembler::StoreIntoObjectOffsetNoBarrier(Register object, | 963 void Assembler::StoreIntoObjectOffsetNoBarrier(Register object, |
960 int32_t offset, | 964 int32_t offset, |
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1481 add(base, array, Operand(index, LSL, shift)); | 1485 add(base, array, Operand(index, LSL, shift)); |
1482 } | 1486 } |
1483 const OperandSize size = Address::OperandSizeFor(cid); | 1487 const OperandSize size = Address::OperandSizeFor(cid); |
1484 ASSERT(Address::CanHoldOffset(offset, Address::Offset, size)); | 1488 ASSERT(Address::CanHoldOffset(offset, Address::Offset, size)); |
1485 return Address(base, offset, Address::Offset, size); | 1489 return Address(base, offset, Address::Offset, size); |
1486 } | 1490 } |
1487 | 1491 |
1488 } // namespace dart | 1492 } // namespace dart |
1489 | 1493 |
1490 #endif // defined TARGET_ARCH_ARM64 | 1494 #endif // defined TARGET_ARCH_ARM64 |
OLD | NEW |