| Index: src/ia32/macro-assembler-ia32.cc
|
| diff --git a/src/ia32/macro-assembler-ia32.cc b/src/ia32/macro-assembler-ia32.cc
|
| index ed69fd07686f8d1df9287782fc9f40459744a420..e1b81e6ff9391ad5a7761963d4b2a6cdc3de6a1a 100644
|
| --- a/src/ia32/macro-assembler-ia32.cc
|
| +++ b/src/ia32/macro-assembler-ia32.cc
|
| @@ -1581,6 +1581,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, scratch);
|
| + }
|
| +
|
| ExternalReference allocation_limit =
|
| AllocationUtils::GetAllocationLimitReference(isolate(), flags);
|
|
|
| @@ -1658,6 +1662,15 @@ void MacroAssembler::Allocate(int header_size,
|
| // Load address of new object into result.
|
| LoadAllocationTopHelper(result, scratch, flags);
|
|
|
| + if (isolate()->heap_profiler()->is_tracking_allocations()) {
|
| + RecordObjectAllocation(isolate(),
|
| + result,
|
| + header_size,
|
| + element_size,
|
| + element_count,
|
| + scratch);
|
| + }
|
| +
|
| ExternalReference allocation_limit =
|
| AllocationUtils::GetAllocationLimitReference(isolate(), flags);
|
|
|
| @@ -1733,6 +1746,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, scratch);
|
| + }
|
| +
|
| ExternalReference allocation_limit =
|
| AllocationUtils::GetAllocationLimitReference(isolate(), flags);
|
|
|
| @@ -3550,6 +3567,73 @@ void MacroAssembler::TestJSArrayForAllocationMemento(
|
| }
|
|
|
|
|
| +void MacroAssembler::RecordObjectAllocation(Isolate* isolate,
|
| + Register object,
|
| + Register object_size,
|
| + Register scratch) {
|
| + FrameScope frame(this, StackFrame::EXIT);
|
| + PushSafepointRegisters();
|
| + if (scratch.is_valid()) {
|
| + PrepareCallCFunction(3, scratch);
|
| + } else {
|
| + PrepareCallCFunction(3, eax);
|
| + }
|
| + mov(Operand(esp, 0 * kPointerSize),
|
| + Immediate(ExternalReference::isolate_address(isolate)));
|
| + mov(Operand(esp, 1 * kPointerSize), object);
|
| + mov(Operand(esp, 2 * kPointerSize), object_size);
|
| + CallCFunction(
|
| + ExternalReference::record_object_allocation_function(isolate), 3);
|
| + PopSafepointRegisters();
|
| +}
|
| +
|
| +
|
| +void MacroAssembler::RecordObjectAllocation(Isolate* isolate,
|
| + Register object,
|
| + int object_size,
|
| + Register scratch) {
|
| + FrameScope frame(this, StackFrame::EXIT);
|
| + PushSafepointRegisters();
|
| + if (scratch.is_valid()) {
|
| + PrepareCallCFunction(3, scratch);
|
| + } else {
|
| + PrepareCallCFunction(3, eax);
|
| + }
|
| + mov(Operand(esp, 0 * kPointerSize),
|
| + Immediate(ExternalReference::isolate_address(isolate)));
|
| + mov(Operand(esp, 1 * kPointerSize), object);
|
| + mov(Operand(esp, 2 * kPointerSize), Immediate(object_size));
|
| + CallCFunction(
|
| + ExternalReference::record_object_allocation_function(isolate), 3);
|
| + PopSafepointRegisters();
|
| +}
|
| +
|
| +
|
| +void MacroAssembler::RecordObjectAllocation(Isolate* isolate,
|
| + Register object,
|
| + int header_size,
|
| + ScaleFactor element_size,
|
| + Register element_count,
|
| + Register scratch) {
|
| + FrameScope frame(this, StackFrame::EXIT);
|
| + PushSafepointRegisters();
|
| + if (scratch.is_valid()) {
|
| + PrepareCallCFunction(3, scratch);
|
| + } else {
|
| + PrepareCallCFunction(3, eax);
|
| + }
|
| + mov(Operand(esp, 0 * kPointerSize),
|
| + Immediate(ExternalReference::isolate_address(isolate)));
|
| + mov(Operand(esp, 1 * kPointerSize), object);
|
| + shl(element_count, element_size);
|
| + add(element_count, Immediate(header_size));
|
| + mov(Operand(esp, 2 * kPointerSize), element_count);
|
| + CallCFunction(
|
| + ExternalReference::record_object_allocation_function(isolate), 3);
|
| + PopSafepointRegisters();
|
| +}
|
| +
|
| +
|
| } } // namespace v8::internal
|
|
|
| #endif // V8_TARGET_ARCH_IA32
|
|
|