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

Unified Diff: runtime/vm/stub_code_ia32.cc

Issue 51653006: Track live instance and allocation counts for classes (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years 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
Index: runtime/vm/stub_code_ia32.cc
diff --git a/runtime/vm/stub_code_ia32.cc b/runtime/vm/stub_code_ia32.cc
index 9a8f88afb74e4cdc48f9a26ce6b2a55201911d82..718fdb9ac5a2f96b82c4af15b4376c0819243b2e 100644
--- a/runtime/vm/stub_code_ia32.cc
+++ b/runtime/vm/stub_code_ia32.cc
@@ -598,6 +598,10 @@ void StubCode::GenerateAllocateArrayStub(Assembler* assembler) {
// EDI: Points to new space object.
__ movl(Address(EDI, Scavenger::top_offset()), EBX);
__ addl(EAX, Immediate(kHeapObjectTag));
+ // EDI: Size of allocation in bytes.
+ __ movl(EDI, EBX);
+ __ subl(EDI, EAX);
+ __ UpdateAllocationStatsWithSize(kArrayCid, EDI, kNoRegister);
// EAX: new object start as a tagged pointer.
// EBX: new object end address.
@@ -940,6 +944,9 @@ void StubCode::GenerateAllocateContextStub(Assembler* assembler) {
// EDX: number of context variables.
__ movl(Address::Absolute(heap->TopAddress()), EBX);
__ addl(EAX, Immediate(kHeapObjectTag));
+ // EBX: Size of allocation in bytes.
+ __ subl(EBX, EAX);
+ __ UpdateAllocationStatsWithSize(context_class.id(), EBX, kNoRegister);
// Calculate the size tag.
// EAX: new object.
@@ -1141,12 +1148,13 @@ void StubCode::GenerateAllocationStubForClass(Assembler* assembler,
if (FLAG_use_slow_path) {
__ jmp(&slow_case);
} else {
- __ j(ABOVE_EQUAL, &slow_case, Assembler::kNearJump);
+ __ j(ABOVE_EQUAL, &slow_case);
}
// Successfully allocated the object(s), now update top to point to
// next object start and initialize the object.
__ movl(Address::Absolute(heap->TopAddress()), EBX);
+ __ UpdateAllocationStats(cls.id(), EDI);
if (is_cls_parameterized) {
// Initialize the type arguments field in the object.
@@ -1311,6 +1319,10 @@ void StubCode::GenerateAllocationStubForClosure(Assembler* assembler,
// Successfully allocated the object, now update top to point to
// next object start and initialize the object.
__ movl(Address::Absolute(heap->TopAddress()), EBX);
+ // EBX: Size of allocation in bytes.
+ __ subl(EBX, EAX);
+ // EDX: Clobbered.
+ __ UpdateAllocationStatsWithSize(cls.id(), EBX, EDX);
Ivan Posva 2014/01/14 22:54:23 We are potentially allocating two objects here in
Cutch 2014/01/15 19:49:49 Done here and x64,arm, and mips.
// EAX: new closure object.
// ECX: new context object (only if is_implicit_closure).
@@ -1323,7 +1335,6 @@ void StubCode::GenerateAllocationStubForClosure(Assembler* assembler,
// Initialize the function field in the object.
// EAX: new closure object.
// ECX: new context object (only if is_implicit_closure).
- // EBX: next object start.
__ LoadObject(EDX, func); // Load function of closure to be allocated.
__ movl(Address(EAX, Closure::function_offset()), EDX);

Powered by Google App Engine
This is Rietveld 408576698