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

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

Issue 2105383003: VM: Don't generate allocation stats code in product mode. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 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_mips.cc ('k') | runtime/vm/class_table.cc » ('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_X64) 6 #if defined(TARGET_ARCH_X64)
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/heap.h" 10 #include "vm/heap.h"
(...skipping 3503 matching lines...) Expand 10 before | Expand all | Expand 10 after
3514 void Assembler::TryAllocate(const Class& cls, 3514 void Assembler::TryAllocate(const Class& cls,
3515 Label* failure, 3515 Label* failure,
3516 bool near_jump, 3516 bool near_jump,
3517 Register instance_reg, 3517 Register instance_reg,
3518 Register temp) { 3518 Register temp) {
3519 ASSERT(failure != NULL); 3519 ASSERT(failure != NULL);
3520 if (FLAG_inline_alloc) { 3520 if (FLAG_inline_alloc) {
3521 // If this allocation is traced, program will jump to failure path 3521 // If this allocation is traced, program will jump to failure path
3522 // (i.e. the allocation stub) which will allocate the object and trace the 3522 // (i.e. the allocation stub) which will allocate the object and trace the
3523 // allocation call site. 3523 // allocation call site.
3524 MaybeTraceAllocation(cls.id(), failure, near_jump); 3524 NOT_IN_PRODUCT(MaybeTraceAllocation(cls.id(), failure, near_jump));
3525 const intptr_t instance_size = cls.instance_size(); 3525 const intptr_t instance_size = cls.instance_size();
3526 Heap::Space space = Heap::SpaceForAllocation(cls.id()); 3526 Heap::Space space = Heap::SpaceForAllocation(cls.id());
3527 movq(temp, Address(THR, Thread::heap_offset())); 3527 movq(temp, Address(THR, Thread::heap_offset()));
3528 movq(instance_reg, Address(temp, Heap::TopOffset(space))); 3528 movq(instance_reg, Address(temp, Heap::TopOffset(space)));
3529 addq(instance_reg, Immediate(instance_size)); 3529 addq(instance_reg, Immediate(instance_size));
3530 // instance_reg: potential next object start. 3530 // instance_reg: potential next object start.
3531 cmpq(instance_reg, Address(temp, Heap::EndOffset(space))); 3531 cmpq(instance_reg, Address(temp, Heap::EndOffset(space)));
3532 j(ABOVE_EQUAL, failure, near_jump); 3532 j(ABOVE_EQUAL, failure, near_jump);
3533 // Successfully allocated the object, now update top to point to 3533 // Successfully allocated the object, now update top to point to
3534 // next object start and store the class in the class field of object. 3534 // next object start and store the class in the class field of object.
3535 movq(Address(temp, Heap::TopOffset(space)), instance_reg); 3535 movq(Address(temp, Heap::TopOffset(space)), instance_reg);
3536 UpdateAllocationStats(cls.id(), space); 3536 NOT_IN_PRODUCT(UpdateAllocationStats(cls.id(), space));
3537 ASSERT(instance_size >= kHeapObjectTag); 3537 ASSERT(instance_size >= kHeapObjectTag);
3538 AddImmediate(instance_reg, Immediate(kHeapObjectTag - instance_size)); 3538 AddImmediate(instance_reg, Immediate(kHeapObjectTag - instance_size));
3539 uword tags = 0; 3539 uword tags = 0;
3540 tags = RawObject::SizeTag::update(instance_size, tags); 3540 tags = RawObject::SizeTag::update(instance_size, tags);
3541 ASSERT(cls.id() != kIllegalCid); 3541 ASSERT(cls.id() != kIllegalCid);
3542 tags = RawObject::ClassIdTag::update(cls.id(), tags); 3542 tags = RawObject::ClassIdTag::update(cls.id(), tags);
3543 MoveImmediate(FieldAddress(instance_reg, Object::tags_offset()), 3543 MoveImmediate(FieldAddress(instance_reg, Object::tags_offset()),
3544 Immediate(tags)); 3544 Immediate(tags));
3545 } else { 3545 } else {
3546 jmp(failure); 3546 jmp(failure);
3547 } 3547 }
3548 } 3548 }
3549 3549
3550 3550
3551 void Assembler::TryAllocateArray(intptr_t cid, 3551 void Assembler::TryAllocateArray(intptr_t cid,
3552 intptr_t instance_size, 3552 intptr_t instance_size,
3553 Label* failure, 3553 Label* failure,
3554 bool near_jump, 3554 bool near_jump,
3555 Register instance, 3555 Register instance,
3556 Register end_address, 3556 Register end_address,
3557 Register temp) { 3557 Register temp) {
3558 ASSERT(failure != NULL); 3558 ASSERT(failure != NULL);
3559 if (FLAG_inline_alloc) { 3559 if (FLAG_inline_alloc) {
3560 // If this allocation is traced, program will jump to failure path 3560 // If this allocation is traced, program will jump to failure path
3561 // (i.e. the allocation stub) which will allocate the object and trace the 3561 // (i.e. the allocation stub) which will allocate the object and trace the
3562 // allocation call site. 3562 // allocation call site.
3563 MaybeTraceAllocation(cid, failure, near_jump); 3563 NOT_IN_PRODUCT(MaybeTraceAllocation(cid, failure, near_jump));
3564 Heap::Space space = Heap::SpaceForAllocation(cid); 3564 Heap::Space space = Heap::SpaceForAllocation(cid);
3565 movq(temp, Address(THR, Thread::heap_offset())); 3565 movq(temp, Address(THR, Thread::heap_offset()));
3566 movq(instance, Address(temp, Heap::TopOffset(space))); 3566 movq(instance, Address(temp, Heap::TopOffset(space)));
3567 movq(end_address, instance); 3567 movq(end_address, instance);
3568 3568
3569 addq(end_address, Immediate(instance_size)); 3569 addq(end_address, Immediate(instance_size));
3570 j(CARRY, failure); 3570 j(CARRY, failure);
3571 3571
3572 // Check if the allocation fits into the remaining space. 3572 // Check if the allocation fits into the remaining space.
3573 // instance: potential new object start. 3573 // instance: potential new object start.
3574 // end_address: potential next object start. 3574 // end_address: potential next object start.
3575 cmpq(end_address, Address(temp, Heap::EndOffset(space))); 3575 cmpq(end_address, Address(temp, Heap::EndOffset(space)));
3576 j(ABOVE_EQUAL, failure); 3576 j(ABOVE_EQUAL, failure);
3577 3577
3578 // Successfully allocated the object(s), now update top to point to 3578 // Successfully allocated the object(s), now update top to point to
3579 // next object start and initialize the object. 3579 // next object start and initialize the object.
3580 movq(Address(temp, Heap::TopOffset(space)), end_address); 3580 movq(Address(temp, Heap::TopOffset(space)), end_address);
3581 addq(instance, Immediate(kHeapObjectTag)); 3581 addq(instance, Immediate(kHeapObjectTag));
3582 UpdateAllocationStatsWithSize(cid, instance_size, space); 3582 NOT_IN_PRODUCT(UpdateAllocationStatsWithSize(cid, instance_size, space));
3583 3583
3584 // Initialize the tags. 3584 // Initialize the tags.
3585 // instance: new object start as a tagged pointer. 3585 // instance: new object start as a tagged pointer.
3586 uword tags = 0; 3586 uword tags = 0;
3587 tags = RawObject::ClassIdTag::update(cid, tags); 3587 tags = RawObject::ClassIdTag::update(cid, tags);
3588 tags = RawObject::SizeTag::update(instance_size, tags); 3588 tags = RawObject::SizeTag::update(instance_size, tags);
3589 movq(FieldAddress(instance, Array::tags_offset()), Immediate(tags)); 3589 movq(FieldAddress(instance, Array::tags_offset()), Immediate(tags));
3590 } else { 3590 } else {
3591 jmp(failure); 3591 jmp(failure);
3592 } 3592 }
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
3918 3918
3919 3919
3920 const char* Assembler::FpuRegisterName(FpuRegister reg) { 3920 const char* Assembler::FpuRegisterName(FpuRegister reg) {
3921 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); 3921 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters));
3922 return xmm_reg_names[reg]; 3922 return xmm_reg_names[reg];
3923 } 3923 }
3924 3924
3925 } // namespace dart 3925 } // namespace dart
3926 3926
3927 #endif // defined TARGET_ARCH_X64 3927 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/assembler_mips.cc ('k') | runtime/vm/class_table.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698