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 a18ff0d274c75e14eac2701a06f5d93e1cf5e8af..609962c8e543edfa9e9f78b60f1b29c01a20626a 100644 |
| --- a/src/x64/macro-assembler-x64.cc |
| +++ b/src/x64/macro-assembler-x64.cc |
| @@ -4090,8 +4090,15 @@ 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); |
| + if (isolate()->is_allocation_profiler_enabled()) { |
| + // It's always safe to call the allocation profiler stub hook, |
| + // as the hook itself is not allowed to call back to V8. |
| + AllowStubCallsScope allow_scope(this, true); |
| + push(Immediate(object_size)); |
| + push(result); |
| + RecordObjectAllocationStub stub; |
| + CallStub(&stub); |
| + addq(rsp, Immediate(2 * kPointerSize)); |
| } |
| // Align the next allocation. Storing the filler map without checking top is |
| @@ -4173,8 +4180,15 @@ 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); |
| + if (isolate()->is_allocation_profiler_enabled()) { |
| + // It's always safe to call the allocation profiler stub hook, |
| + // as the hook itself is not allowed to call back to V8. |
| + AllowStubCallsScope allow_scope(this, true); |
| + push(object_size); |
| + push(result); |
| + RecordObjectAllocationStub stub; |
| + CallStub(&stub); |
| + addq(rsp, Immediate(2 * kRegisterSize)); |
|
alph
2013/11/05 13:55:20
Just curious why it's kRegisterSize here and kPoin
|
| } |
| // Align the next allocation. Storing the filler map without checking top is |
| @@ -4937,38 +4951,6 @@ 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 |