Index: src/x64/macro-assembler-x64.cc |
diff --git a/src/x64/macro-assembler-x64.cc b/src/x64/macro-assembler-x64.cc |
index b301f29e31f804cdca1817216414d1b3f354fa5e..b3336e6eabbce0f7b9d49033035e622b2150cc37 100644 |
--- a/src/x64/macro-assembler-x64.cc |
+++ b/src/x64/macro-assembler-x64.cc |
@@ -4093,6 +4093,10 @@ void MacroAssembler::Allocate(int object_size, |
// Load address of new object into result. |
LoadAllocationTopHelper(result, scratch, flags); |
+ if (isolate()->heap_profiler()->is_tracking_allocations()) { |
+ 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) { |
@@ -4172,6 +4176,10 @@ void MacroAssembler::Allocate(Register object_size, |
// Load address of new object into result. |
LoadAllocationTopHelper(result, scratch, flags); |
+ if (isolate()->heap_profiler()->is_tracking_allocations()) { |
+ 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) { |
@@ -4933,6 +4941,38 @@ void MacroAssembler::TestJSArrayForAllocationMemento( |
} |
+void MacroAssembler::RecordObjectAllocation(Isolate* isolate, |
+ Register object, |
+ Register object_size) { |
+ FrameScope frame(this, StackFrame::EXIT); |
+ 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(); |
+} |
+ |
+ |
+void MacroAssembler::RecordObjectAllocation(Isolate* isolate, |
+ Register object, |
+ int object_size) { |
+ FrameScope frame(this, StackFrame::EXIT); |
+ 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(); |
+} |
+ |
+ |
} } // namespace v8::internal |
#endif // V8_TARGET_ARCH_X64 |