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

Unified Diff: src/ia32/macro-assembler-ia32.cc

Issue 38753007: JS allocations tracking for ia32 architecture (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ia32/macro-assembler-ia32.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « src/ia32/macro-assembler-ia32.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698