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

Side by Side Diff: runtime/vm/assembler_ia32.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_arm64.cc ('k') | runtime/vm/assembler_mips.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_IA32) 6 #if defined(TARGET_ARCH_IA32)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/code_generator.h" 9 #include "vm/code_generator.h"
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 2753 matching lines...) Expand 10 before | Expand all | Expand 10 after
2764 Label* failure, 2764 Label* failure,
2765 bool near_jump, 2765 bool near_jump,
2766 Register instance_reg, 2766 Register instance_reg,
2767 Register temp_reg) { 2767 Register temp_reg) {
2768 ASSERT(failure != NULL); 2768 ASSERT(failure != NULL);
2769 ASSERT(temp_reg != kNoRegister); 2769 ASSERT(temp_reg != kNoRegister);
2770 if (FLAG_inline_alloc) { 2770 if (FLAG_inline_alloc) {
2771 // If this allocation is traced, program will jump to failure path 2771 // If this allocation is traced, program will jump to failure path
2772 // (i.e. the allocation stub) which will allocate the object and trace the 2772 // (i.e. the allocation stub) which will allocate the object and trace the
2773 // allocation call site. 2773 // allocation call site.
2774 MaybeTraceAllocation(cls.id(), temp_reg, failure, near_jump); 2774 NOT_IN_PRODUCT(
2775 MaybeTraceAllocation(cls.id(), temp_reg, failure, near_jump));
2775 const intptr_t instance_size = cls.instance_size(); 2776 const intptr_t instance_size = cls.instance_size();
2776 Heap::Space space = Heap::SpaceForAllocation(cls.id()); 2777 Heap::Space space = Heap::SpaceForAllocation(cls.id());
2777 movl(temp_reg, Address(THR, Thread::heap_offset())); 2778 movl(temp_reg, Address(THR, Thread::heap_offset()));
2778 movl(instance_reg, Address(temp_reg, Heap::TopOffset(space))); 2779 movl(instance_reg, Address(temp_reg, Heap::TopOffset(space)));
2779 addl(instance_reg, Immediate(instance_size)); 2780 addl(instance_reg, Immediate(instance_size));
2780 // instance_reg: potential next object start. 2781 // instance_reg: potential next object start.
2781 cmpl(instance_reg, Address(temp_reg, Heap::EndOffset(space))); 2782 cmpl(instance_reg, Address(temp_reg, Heap::EndOffset(space)));
2782 j(ABOVE_EQUAL, failure, near_jump); 2783 j(ABOVE_EQUAL, failure, near_jump);
2783 // Successfully allocated the object, now update top to point to 2784 // Successfully allocated the object, now update top to point to
2784 // next object start and store the class in the class field of object. 2785 // next object start and store the class in the class field of object.
2785 movl(Address(temp_reg, Heap::TopOffset(space)), instance_reg); 2786 movl(Address(temp_reg, Heap::TopOffset(space)), instance_reg);
2786 UpdateAllocationStats(cls.id(), temp_reg, space); 2787 NOT_IN_PRODUCT(UpdateAllocationStats(cls.id(), temp_reg, space));
2787 ASSERT(instance_size >= kHeapObjectTag); 2788 ASSERT(instance_size >= kHeapObjectTag);
2788 subl(instance_reg, Immediate(instance_size - kHeapObjectTag)); 2789 subl(instance_reg, Immediate(instance_size - kHeapObjectTag));
2789 uword tags = 0; 2790 uword tags = 0;
2790 tags = RawObject::SizeTag::update(instance_size, tags); 2791 tags = RawObject::SizeTag::update(instance_size, tags);
2791 ASSERT(cls.id() != kIllegalCid); 2792 ASSERT(cls.id() != kIllegalCid);
2792 tags = RawObject::ClassIdTag::update(cls.id(), tags); 2793 tags = RawObject::ClassIdTag::update(cls.id(), tags);
2793 movl(FieldAddress(instance_reg, Object::tags_offset()), Immediate(tags)); 2794 movl(FieldAddress(instance_reg, Object::tags_offset()), Immediate(tags));
2794 } else { 2795 } else {
2795 jmp(failure); 2796 jmp(failure);
2796 } 2797 }
2797 } 2798 }
2798 2799
2799 2800
2800 void Assembler::TryAllocateArray(intptr_t cid, 2801 void Assembler::TryAllocateArray(intptr_t cid,
2801 intptr_t instance_size, 2802 intptr_t instance_size,
2802 Label* failure, 2803 Label* failure,
2803 bool near_jump, 2804 bool near_jump,
2804 Register instance, 2805 Register instance,
2805 Register end_address, 2806 Register end_address,
2806 Register temp_reg) { 2807 Register temp_reg) {
2807 ASSERT(failure != NULL); 2808 ASSERT(failure != NULL);
2808 ASSERT(temp_reg != kNoRegister); 2809 ASSERT(temp_reg != kNoRegister);
2809 if (FLAG_inline_alloc) { 2810 if (FLAG_inline_alloc) {
2810 // If this allocation is traced, program will jump to failure path 2811 // If this allocation is traced, program will jump to failure path
2811 // (i.e. the allocation stub) which will allocate the object and trace the 2812 // (i.e. the allocation stub) which will allocate the object and trace the
2812 // allocation call site. 2813 // allocation call site.
2813 MaybeTraceAllocation(cid, temp_reg, failure, near_jump); 2814 NOT_IN_PRODUCT(MaybeTraceAllocation(cid, temp_reg, failure, near_jump));
2814 Heap::Space space = Heap::SpaceForAllocation(cid); 2815 Heap::Space space = Heap::SpaceForAllocation(cid);
2815 movl(temp_reg, Address(THR, Thread::heap_offset())); 2816 movl(temp_reg, Address(THR, Thread::heap_offset()));
2816 movl(instance, Address(temp_reg, Heap::TopOffset(space))); 2817 movl(instance, Address(temp_reg, Heap::TopOffset(space)));
2817 movl(end_address, instance); 2818 movl(end_address, instance);
2818 2819
2819 addl(end_address, Immediate(instance_size)); 2820 addl(end_address, Immediate(instance_size));
2820 j(CARRY, failure); 2821 j(CARRY, failure);
2821 2822
2822 // Check if the allocation fits into the remaining space. 2823 // Check if the allocation fits into the remaining space.
2823 // EAX: potential new object start. 2824 // EAX: potential new object start.
2824 // EBX: potential next object start. 2825 // EBX: potential next object start.
2825 cmpl(end_address, Address(temp_reg, Heap::EndOffset(space))); 2826 cmpl(end_address, Address(temp_reg, Heap::EndOffset(space)));
2826 j(ABOVE_EQUAL, failure); 2827 j(ABOVE_EQUAL, failure);
2827 2828
2828 // Successfully allocated the object(s), now update top to point to 2829 // Successfully allocated the object(s), now update top to point to
2829 // next object start and initialize the object. 2830 // next object start and initialize the object.
2830 movl(Address(temp_reg, Heap::TopOffset(space)), end_address); 2831 movl(Address(temp_reg, Heap::TopOffset(space)), end_address);
2831 addl(instance, Immediate(kHeapObjectTag)); 2832 addl(instance, Immediate(kHeapObjectTag));
2832 UpdateAllocationStatsWithSize(cid, instance_size, temp_reg, space); 2833 NOT_IN_PRODUCT(
2834 UpdateAllocationStatsWithSize(cid, instance_size, temp_reg, space));
2833 2835
2834 // Initialize the tags. 2836 // Initialize the tags.
2835 uword tags = 0; 2837 uword tags = 0;
2836 tags = RawObject::ClassIdTag::update(cid, tags); 2838 tags = RawObject::ClassIdTag::update(cid, tags);
2837 tags = RawObject::SizeTag::update(instance_size, tags); 2839 tags = RawObject::SizeTag::update(instance_size, tags);
2838 movl(FieldAddress(instance, Object::tags_offset()), Immediate(tags)); 2840 movl(FieldAddress(instance, Object::tags_offset()), Immediate(tags));
2839 } else { 2841 } else {
2840 jmp(failure); 2842 jmp(failure);
2841 } 2843 }
2842 } 2844 }
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
3178 3180
3179 const char* Assembler::FpuRegisterName(FpuRegister reg) { 3181 const char* Assembler::FpuRegisterName(FpuRegister reg) {
3180 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); 3182 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters));
3181 return xmm_reg_names[reg]; 3183 return xmm_reg_names[reg];
3182 } 3184 }
3183 3185
3184 3186
3185 } // namespace dart 3187 } // namespace dart
3186 3188
3187 #endif // defined TARGET_ARCH_IA32 3189 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/assembler_arm64.cc ('k') | runtime/vm/assembler_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698