Index: runtime/vm/stub_code_x64.cc |
diff --git a/runtime/vm/stub_code_x64.cc b/runtime/vm/stub_code_x64.cc |
index 5e0b9af4301aa9587d32747c5b07893668939afe..57474bb2d12a30519c0ceaebd6b68eee89d39ccc 100644 |
--- a/runtime/vm/stub_code_x64.cc |
+++ b/runtime/vm/stub_code_x64.cc |
@@ -581,6 +581,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); |
+ __ BumpAllocationCount(Heap::kNew, kArrayCid, R13); |
// RAX: new object start as a tagged pointer. |
// R12: new object end address. |
@@ -935,6 +939,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); |
+ __ BumpAllocationCount(Heap::kNew, context_class.id(), R13); |
// Calculate the size tag. |
// RAX: new object. |
@@ -1134,6 +1141,7 @@ void StubCode::GenerateAllocationStubForClass(Assembler* assembler, |
// next object start and initialize the object. |
__ movq(RDI, Immediate(heap->TopAddress())); |
__ movq(Address(RDI, 0), RBX); |
+ __ BumpAllocationCount(Heap::kNew, cls.id()); |
if (is_cls_parameterized) { |
// Initialize the type arguments field in the object. |
@@ -1297,6 +1305,8 @@ void StubCode::GenerateAllocationStubForClosure(Assembler* assembler, |
// next object start and initialize the object. |
__ movq(RDI, Immediate(heap->TopAddress())); |
__ movq(Address(RDI, 0), R13); |
+ __ subq(RDI, RAX); |
+ __ BumpAllocationCount(Heap::kNew, cls.id(), RDI); |
// RAX: new closure object. |
// RBX: new context object (only if is_implicit_closure). |