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

Unified Diff: runtime/vm/stub_code_x64.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 6 years, 11 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 | « runtime/vm/stub_code_mips.cc ('k') | runtime/vm/symbols.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/stub_code_x64.cc
diff --git a/runtime/vm/stub_code_x64.cc b/runtime/vm/stub_code_x64.cc
index 4dd6e9fa0ed6e661eb92fef6c391c1fc1f65def8..bfec0631a2ebc6f0a34b454497d8a6c4ad1ce53c 100644
--- a/runtime/vm/stub_code_x64.cc
+++ b/runtime/vm/stub_code_x64.cc
@@ -591,6 +591,10 @@ void StubCode::GenerateAllocateArrayStub(Assembler* assembler) {
// R13: Points to new space object.
__ movq(Address(R13, Scavenger::top_offset()), R12);
__ addq(RAX, Immediate(kHeapObjectTag));
+ // R13: Size of allocation in bytes.
+ __ movq(R13, R12);
+ __ subq(R13, RAX);
+ __ UpdateAllocationStatsWithSize(kArrayCid, R13);
// RAX: new object start as a tagged pointer.
// R12: new object end address.
@@ -945,6 +949,9 @@ void StubCode::GenerateAllocateContextStub(Assembler* assembler) {
__ movq(RDI, Immediate(heap->TopAddress()));
__ movq(Address(RDI, 0), R13);
__ addq(RAX, Immediate(kHeapObjectTag));
+ // R13: Size of allocation in bytes.
+ __ subq(R13, RAX);
+ __ UpdateAllocationStatsWithSize(context_class.id(), R13);
// Calculate the size tag.
// RAX: new object.
@@ -1144,6 +1151,7 @@ void StubCode::GenerateAllocationStubForClass(Assembler* assembler,
// next object start and initialize the object.
__ movq(RDI, Immediate(heap->TopAddress()));
__ movq(Address(RDI, 0), RBX);
+ __ UpdateAllocationStats(cls.id());
if (is_cls_parameterized) {
// Initialize the type arguments field in the object.
@@ -1310,6 +1318,17 @@ void StubCode::GenerateAllocationStubForClosure(Assembler* assembler,
// RAX: new closure object.
// RBX: new context object (only if is_implicit_closure).
+ if (is_implicit_instance_closure) {
+ // This closure allocates a context, update allocation stats.
+ // RDI: context size.
+ __ movq(RDI, Immediate(context_size));
+ __ UpdateAllocationStatsWithSize(kContextCid, RDI);
+ }
+ // The closure allocation is attributed to the signature class.
+ __ UpdateAllocationStats(cls.id());
+
+ // RAX: new closure object.
+ // RBX: new context object (only if is_implicit_closure).
// Set the tags.
uword tags = 0;
tags = RawObject::SizeTag::update(closure_size, tags);
« no previous file with comments | « runtime/vm/stub_code_mips.cc ('k') | runtime/vm/symbols.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698