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

Unified Diff: runtime/vm/object.cc

Issue 1211633002: Introduce mechanism to record an allocation of a class (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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/object.h ('k') | runtime/vm/profiler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 1249a5ea2d4d2d5ae71b0d883a220070c1a783bc..4274060f744692799699fa1d821d4330ff7e7647 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -34,6 +34,7 @@
#include "vm/intrinsifier.h"
#include "vm/object_store.h"
#include "vm/parser.h"
+#include "vm/profiler.h"
#include "vm/report.h"
#include "vm/reusable_handles.h"
#include "vm/runtime_entry.h"
@@ -1731,10 +1732,15 @@ RawObject* Object::Allocate(intptr_t cls_id,
Exceptions::Throw(thread, exception);
UNREACHABLE();
}
+ ClassTable* class_table = isolate->class_table();
if (space == Heap::kNew) {
- isolate->class_table()->UpdateAllocatedNew(cls_id, size);
+ class_table->UpdateAllocatedNew(cls_id, size);
} else {
- isolate->class_table()->UpdateAllocatedOld(cls_id, size);
+ class_table->UpdateAllocatedOld(cls_id, size);
+ }
+ const Class& cls = Class::Handle(class_table->At(cls_id));
+ if (cls.trace_allocation()) {
+ Profiler::RecordAllocation(isolate, cls_id);
}
NoSafepointScope no_safepoint;
InitializeObject(address, cls_id, size);
@@ -2725,6 +2731,16 @@ void Class::DisableCHAOptimizedCode() {
}
+void Class::SetTraceAllocation(bool trace_allocation) const {
+ const bool changed = trace_allocation != this->trace_allocation();
+ set_state_bits(
+ TraceAllocationBit::update(trace_allocation, raw_ptr()->state_bits_));
+ if (changed) {
+ // TODO(johnmccutchan): Deoptimize the world?
+ }
+}
+
+
void Class::set_cha_codes(const Array& cache) const {
StorePointer(&raw_ptr()->cha_codes_, cache.raw());
}
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/profiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698