Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(210)

Side by Side Diff: runtime/vm/assembler_arm.cc

Issue 1911253002: Never include_isolate or allow_embedded_addresses. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/assembler_arm.h ('k') | runtime/vm/assembler_arm64.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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" // NOLINT 5 #include "vm/globals.h" // NOLINT
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/longjump.h" 10 #include "vm/longjump.h"
(...skipping 1583 matching lines...) Expand 10 before | Expand all | Expand 10 after
1594 // Relocation doesn't apply to Smis. 1594 // Relocation doesn't apply to Smis.
1595 LoadImmediate(rd, reinterpret_cast<int32_t>(object.raw()), cond); 1595 LoadImmediate(rd, reinterpret_cast<int32_t>(object.raw()), cond);
1596 } else if (CanLoadFromObjectPool(object)) { 1596 } else if (CanLoadFromObjectPool(object)) {
1597 // Make sure that class CallPattern is able to decode this load from the 1597 // Make sure that class CallPattern is able to decode this load from the
1598 // object pool. 1598 // object pool.
1599 const int32_t offset = ObjectPool::element_offset( 1599 const int32_t offset = ObjectPool::element_offset(
1600 is_unique ? object_pool_wrapper_.AddObject(object) 1600 is_unique ? object_pool_wrapper_.AddObject(object)
1601 : object_pool_wrapper_.FindObject(object)); 1601 : object_pool_wrapper_.FindObject(object));
1602 LoadWordFromPoolOffset(rd, offset - kHeapObjectTag, pp, cond); 1602 LoadWordFromPoolOffset(rd, offset - kHeapObjectTag, pp, cond);
1603 } else { 1603 } else {
1604 ASSERT(FLAG_allow_absolute_addresses); 1604 UNREACHABLE();
1605 ASSERT(object.IsOld());
1606 // Make sure that class CallPattern is able to decode this load immediate.
1607 const int32_t object_raw = reinterpret_cast<int32_t>(object.raw());
1608 LoadImmediate(rd, object_raw, cond);
1609 } 1605 }
1610 } 1606 }
1611 1607
1612 1608
1613 void Assembler::LoadObject(Register rd, const Object& object, Condition cond) { 1609 void Assembler::LoadObject(Register rd, const Object& object, Condition cond) {
1614 LoadObjectHelper(rd, object, cond, /* is_unique = */ false, PP); 1610 LoadObjectHelper(rd, object, cond, /* is_unique = */ false, PP);
1615 } 1611 }
1616 1612
1617 1613
1618 void Assembler::LoadUniqueObject(Register rd, 1614 void Assembler::LoadUniqueObject(Register rd,
(...skipping 1782 matching lines...) Expand 10 before | Expand all | Expand 10 after
3401 EnterDartFrame(0); 3397 EnterDartFrame(0);
3402 } 3398 }
3403 3399
3404 3400
3405 void Assembler::LeaveStubFrame() { 3401 void Assembler::LeaveStubFrame() {
3406 LeaveDartFrame(); 3402 LeaveDartFrame();
3407 } 3403 }
3408 3404
3409 3405
3410 void Assembler::LoadAllocationStatsAddress(Register dest, 3406 void Assembler::LoadAllocationStatsAddress(Register dest,
3411 intptr_t cid, 3407 intptr_t cid) {
3412 bool inline_isolate) {
3413 ASSERT(dest != kNoRegister); 3408 ASSERT(dest != kNoRegister);
3414 ASSERT(dest != TMP); 3409 ASSERT(dest != TMP);
3415 ASSERT(cid > 0); 3410 ASSERT(cid > 0);
3416 const intptr_t class_offset = ClassTable::ClassOffsetFor(cid); 3411 const intptr_t class_offset = ClassTable::ClassOffsetFor(cid);
3417 if (inline_isolate) { 3412 LoadIsolate(dest);
3418 ASSERT(FLAG_allow_absolute_addresses); 3413 intptr_t table_offset =
3419 ClassTable* class_table = Isolate::Current()->class_table(); 3414 Isolate::class_table_offset() + ClassTable::TableOffsetFor(cid);
3420 ClassHeapStats** table_ptr = class_table->TableAddressFor(cid); 3415 ldr(dest, Address(dest, table_offset));
3421 if (cid < kNumPredefinedCids) { 3416 AddImmediate(dest, class_offset);
3422 LoadImmediate(dest, reinterpret_cast<uword>(*table_ptr) + class_offset);
3423 } else {
3424 LoadImmediate(dest, reinterpret_cast<uword>(table_ptr));
3425 ldr(dest, Address(dest, 0));
3426 AddImmediate(dest, class_offset);
3427 }
3428 } else {
3429 LoadIsolate(dest);
3430 intptr_t table_offset =
3431 Isolate::class_table_offset() + ClassTable::TableOffsetFor(cid);
3432 ldr(dest, Address(dest, table_offset));
3433 AddImmediate(dest, class_offset);
3434 }
3435 } 3417 }
3436 3418
3437 3419
3438 void Assembler::MaybeTraceAllocation(intptr_t cid, 3420 void Assembler::MaybeTraceAllocation(intptr_t cid,
3439 Register temp_reg, 3421 Register temp_reg,
3440 Label* trace, 3422 Label* trace) {
3441 bool inline_isolate) { 3423 LoadAllocationStatsAddress(temp_reg, cid);
3442 LoadAllocationStatsAddress(temp_reg, cid, inline_isolate);
3443 const uword state_offset = ClassHeapStats::state_offset(); 3424 const uword state_offset = ClassHeapStats::state_offset();
3444 ldr(temp_reg, Address(temp_reg, state_offset)); 3425 ldr(temp_reg, Address(temp_reg, state_offset));
3445 tst(temp_reg, Operand(ClassHeapStats::TraceAllocationMask())); 3426 tst(temp_reg, Operand(ClassHeapStats::TraceAllocationMask()));
3446 b(trace, NE); 3427 b(trace, NE);
3447 } 3428 }
3448 3429
3449 3430
3450 void Assembler::IncrementAllocationStats(Register stats_addr_reg, 3431 void Assembler::IncrementAllocationStats(Register stats_addr_reg,
3451 intptr_t cid, 3432 intptr_t cid,
3452 Heap::Space space) { 3433 Heap::Space space) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
3491 Register temp_reg) { 3472 Register temp_reg) {
3492 ASSERT(failure != NULL); 3473 ASSERT(failure != NULL);
3493 if (FLAG_inline_alloc) { 3474 if (FLAG_inline_alloc) {
3494 ASSERT(instance_reg != temp_reg); 3475 ASSERT(instance_reg != temp_reg);
3495 ASSERT(temp_reg != IP); 3476 ASSERT(temp_reg != IP);
3496 const intptr_t instance_size = cls.instance_size(); 3477 const intptr_t instance_size = cls.instance_size();
3497 ASSERT(instance_size != 0); 3478 ASSERT(instance_size != 0);
3498 // If this allocation is traced, program will jump to failure path 3479 // If this allocation is traced, program will jump to failure path
3499 // (i.e. the allocation stub) which will allocate the object and trace the 3480 // (i.e. the allocation stub) which will allocate the object and trace the
3500 // allocation call site. 3481 // allocation call site.
3501 MaybeTraceAllocation(cls.id(), temp_reg, failure, 3482 MaybeTraceAllocation(cls.id(), temp_reg, failure);
3502 /* inline_isolate = */ false);
3503 Heap::Space space = Heap::SpaceForAllocation(cls.id()); 3483 Heap::Space space = Heap::SpaceForAllocation(cls.id());
3504 ldr(temp_reg, Address(THR, Thread::heap_offset())); 3484 ldr(temp_reg, Address(THR, Thread::heap_offset()));
3505 ldr(instance_reg, Address(temp_reg, Heap::TopOffset(space))); 3485 ldr(instance_reg, Address(temp_reg, Heap::TopOffset(space)));
3506 // TODO(koda): Protect against unsigned overflow here. 3486 // TODO(koda): Protect against unsigned overflow here.
3507 AddImmediateSetFlags(instance_reg, instance_reg, instance_size); 3487 AddImmediateSetFlags(instance_reg, instance_reg, instance_size);
3508 3488
3509 // instance_reg: potential next object start. 3489 // instance_reg: potential next object start.
3510 ldr(IP, Address(temp_reg, Heap::EndOffset(space))); 3490 ldr(IP, Address(temp_reg, Heap::EndOffset(space)));
3511 cmp(IP, Operand(instance_reg)); 3491 cmp(IP, Operand(instance_reg));
3512 // fail if heap end unsigned less than or equal to instance_reg. 3492 // fail if heap end unsigned less than or equal to instance_reg.
3513 b(failure, LS); 3493 b(failure, LS);
3514 3494
3515 // Successfully allocated the object, now update top to point to 3495 // Successfully allocated the object, now update top to point to
3516 // next object start and store the class in the class field of object. 3496 // next object start and store the class in the class field of object.
3517 str(instance_reg, Address(temp_reg, Heap::TopOffset(space))); 3497 str(instance_reg, Address(temp_reg, Heap::TopOffset(space)));
3518 3498
3519 LoadAllocationStatsAddress(temp_reg, cls.id(), 3499 LoadAllocationStatsAddress(temp_reg, cls.id());
3520 /* inline_isolate = */ false);
3521 3500
3522 ASSERT(instance_size >= kHeapObjectTag); 3501 ASSERT(instance_size >= kHeapObjectTag);
3523 AddImmediate(instance_reg, -instance_size + kHeapObjectTag); 3502 AddImmediate(instance_reg, -instance_size + kHeapObjectTag);
3524 3503
3525 uword tags = 0; 3504 uword tags = 0;
3526 tags = RawObject::SizeTag::update(instance_size, tags); 3505 tags = RawObject::SizeTag::update(instance_size, tags);
3527 ASSERT(cls.id() != kIllegalCid); 3506 ASSERT(cls.id() != kIllegalCid);
3528 tags = RawObject::ClassIdTag::update(cls.id(), tags); 3507 tags = RawObject::ClassIdTag::update(cls.id(), tags);
3529 LoadImmediate(IP, tags); 3508 LoadImmediate(IP, tags);
3530 str(IP, FieldAddress(instance_reg, Object::tags_offset())); 3509 str(IP, FieldAddress(instance_reg, Object::tags_offset()));
3531 3510
3532 IncrementAllocationStats(temp_reg, cls.id(), space); 3511 IncrementAllocationStats(temp_reg, cls.id(), space);
3533 } else { 3512 } else {
3534 b(failure); 3513 b(failure);
3535 } 3514 }
3536 } 3515 }
3537 3516
3538 3517
3539 void Assembler::TryAllocateArray(intptr_t cid, 3518 void Assembler::TryAllocateArray(intptr_t cid,
3540 intptr_t instance_size, 3519 intptr_t instance_size,
3541 Label* failure, 3520 Label* failure,
3542 Register instance, 3521 Register instance,
3543 Register end_address, 3522 Register end_address,
3544 Register temp1, 3523 Register temp1,
3545 Register temp2) { 3524 Register temp2) {
3546 if (FLAG_inline_alloc) { 3525 if (FLAG_inline_alloc) {
3547 // If this allocation is traced, program will jump to failure path 3526 // If this allocation is traced, program will jump to failure path
3548 // (i.e. the allocation stub) which will allocate the object and trace the 3527 // (i.e. the allocation stub) which will allocate the object and trace the
3549 // allocation call site. 3528 // allocation call site.
3550 MaybeTraceAllocation(cid, temp1, failure, /* inline_isolate = */ false); 3529 MaybeTraceAllocation(cid, temp1, failure);
3551 Heap::Space space = Heap::SpaceForAllocation(cid); 3530 Heap::Space space = Heap::SpaceForAllocation(cid);
3552 ldr(temp1, Address(THR, Thread::heap_offset())); 3531 ldr(temp1, Address(THR, Thread::heap_offset()));
3553 // Potential new object start. 3532 // Potential new object start.
3554 ldr(instance, Address(temp1, Heap::TopOffset(space))); 3533 ldr(instance, Address(temp1, Heap::TopOffset(space)));
3555 AddImmediateSetFlags(end_address, instance, instance_size); 3534 AddImmediateSetFlags(end_address, instance, instance_size);
3556 b(failure, CS); // Branch if unsigned overflow. 3535 b(failure, CS); // Branch if unsigned overflow.
3557 3536
3558 // Check if the allocation fits into the remaining space. 3537 // Check if the allocation fits into the remaining space.
3559 // instance: potential new object start. 3538 // instance: potential new object start.
3560 // end_address: potential next object start. 3539 // end_address: potential next object start.
3561 ldr(temp2, Address(temp1, Heap::EndOffset(space))); 3540 ldr(temp2, Address(temp1, Heap::EndOffset(space)));
3562 cmp(end_address, Operand(temp2)); 3541 cmp(end_address, Operand(temp2));
3563 b(failure, CS); 3542 b(failure, CS);
3564 3543
3565 LoadAllocationStatsAddress(temp2, cid, /* inline_isolate = */ false); 3544 LoadAllocationStatsAddress(temp2, cid);
3566 3545
3567 // Successfully allocated the object(s), now update top to point to 3546 // Successfully allocated the object(s), now update top to point to
3568 // next object start and initialize the object. 3547 // next object start and initialize the object.
3569 str(end_address, Address(temp1, Heap::TopOffset(space))); 3548 str(end_address, Address(temp1, Heap::TopOffset(space)));
3570 add(instance, instance, Operand(kHeapObjectTag)); 3549 add(instance, instance, Operand(kHeapObjectTag));
3571 3550
3572 // Initialize the tags. 3551 // Initialize the tags.
3573 // instance: new object start as a tagged pointer. 3552 // instance: new object start as a tagged pointer.
3574 uword tags = 0; 3553 uword tags = 0;
3575 tags = RawObject::ClassIdTag::update(cid, tags); 3554 tags = RawObject::ClassIdTag::update(cid, tags);
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
3692 3671
3693 3672
3694 const char* Assembler::FpuRegisterName(FpuRegister reg) { 3673 const char* Assembler::FpuRegisterName(FpuRegister reg) {
3695 ASSERT((0 <= reg) && (reg < kNumberOfFpuRegisters)); 3674 ASSERT((0 <= reg) && (reg < kNumberOfFpuRegisters));
3696 return fpu_reg_names[reg]; 3675 return fpu_reg_names[reg];
3697 } 3676 }
3698 3677
3699 } // namespace dart 3678 } // namespace dart
3700 3679
3701 #endif // defined TARGET_ARCH_ARM 3680 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « runtime/vm/assembler_arm.h ('k') | runtime/vm/assembler_arm64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698