Chromium Code Reviews| Index: src/x64/macro-assembler-x64.cc |
| diff --git a/src/x64/macro-assembler-x64.cc b/src/x64/macro-assembler-x64.cc |
| index 74e3fcc33a1701d4a1836090188de51776bc22f5..40f132a019eb0b1034e084497eda12ac23105669 100644 |
| --- a/src/x64/macro-assembler-x64.cc |
| +++ b/src/x64/macro-assembler-x64.cc |
| @@ -3858,6 +3858,8 @@ void MacroAssembler::Allocate(int object_size, |
| // Load address of new object into result. |
| LoadAllocationTopHelper(result, scratch, flags); |
| + RecordObjectAllocation(isolate(), result, object_size); |
| + |
| // Align the next allocation. Storing the filler map without checking top is |
| // safe in new-space because the limit of the heap is aligned there. |
| if (((flags & DOUBLE_ALIGNMENT) != 0) && FLAG_debug_code) { |
| @@ -3937,6 +3939,8 @@ void MacroAssembler::Allocate(Register object_size, |
| // Load address of new object into result. |
| LoadAllocationTopHelper(result, scratch, flags); |
| + RecordObjectAllocation(isolate(), result, object_size); |
| + |
| // Align the next allocation. Storing the filler map without checking top is |
| // safe in new-space because the limit of the heap is aligned there. |
| if (((flags & DOUBLE_ALIGNMENT) != 0) && FLAG_debug_code) { |
| @@ -4698,6 +4702,50 @@ void MacroAssembler::TestJSArrayForAllocationMemento( |
| } |
| +void MacroAssembler::RecordObjectAllocation(Isolate* isolate, |
| + Register object, |
| + Register object_size) { |
| + Label done; |
| + cmpb(ExternalOperand( |
|
Hannes Payer (out of office)
2013/08/28 10:35:05
I am concerned about the performance impact of tha
|
| + ExternalReference::is_tracking_allocations_address(isolate)), |
| + Immediate(0)); |
| + j(zero, &done, Label::kNear); |
| + FrameScope frame(this, StackFrame::MANUAL); |
| + PushSafepointRegisters(); |
| + PrepareCallCFunction(3); |
| + // In case object is rdx |
| + movq(kScratchRegister, object); |
| + movq(arg_reg_3, object_size); |
| + movq(arg_reg_2, kScratchRegister); |
| + movq(arg_reg_1, isolate, RelocInfo::EXTERNAL_REFERENCE); |
| + CallCFunction( |
| + ExternalReference::record_object_allocation_function(isolate), 3); |
| + PopSafepointRegisters(); |
| + bind(&done); |
| +} |
| + |
| + |
| +void MacroAssembler::RecordObjectAllocation(Isolate* isolate, |
| + Register object, |
| + int object_size) { |
| + Label done; |
| + cmpb(ExternalOperand( |
| + ExternalReference::is_tracking_allocations_address(isolate)), |
| + Immediate(0)); |
| + j(zero, &done, Label::kNear); |
| + FrameScope frame(this, StackFrame::MANUAL); |
| + PushSafepointRegisters(); |
| + PrepareCallCFunction(3); |
| + movq(arg_reg_2, object); |
| + movq(arg_reg_3, Immediate(object_size)); |
| + movq(arg_reg_1, isolate, RelocInfo::EXTERNAL_REFERENCE); |
| + CallCFunction( |
| + ExternalReference::record_object_allocation_function(isolate), 3); |
| + PopSafepointRegisters(); |
| + bind(&done); |
| +} |
| + |
| + |
| } } // namespace v8::internal |
| #endif // V8_TARGET_ARCH_X64 |