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

Unified Diff: runtime/vm/object.cc

Issue 2143153002: Don't track allocations in product mode. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: other archs Created 4 years, 5 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/heap_test.cc ('k') | runtime/vm/scavenger.cc » ('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 f6a010f9aea279e1e5fc9a9645db258e434d1862..98d7b238584f2c48a85d7ce384475d7cf4e99e58 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -1845,6 +1845,7 @@ RawObject* Object::Allocate(intptr_t cls_id,
Exceptions::Throw(thread, exception);
UNREACHABLE();
}
+#ifndef PRODUCT
ClassTable* class_table = isolate->class_table();
if (space == Heap::kNew) {
class_table->UpdateAllocatedNew(cls_id, size);
@@ -1855,6 +1856,7 @@ RawObject* Object::Allocate(intptr_t cls_id,
if (FLAG_profiler && cls.TraceAllocation(isolate)) {
Profiler::SampleAllocation(thread, cls_id);
}
+#endif // !PRODUCT
NoSafepointScope no_safepoint;
InitializeObject(address, cls_id, size, (isolate == Dart::vm_isolate()));
RawObject* raw_obj = reinterpret_cast<RawObject*>(address + kHeapObjectTag);
@@ -2808,12 +2810,17 @@ void Class::DisableAllCHAOptimizedCode() {
bool Class::TraceAllocation(Isolate* isolate) const {
+#ifndef PRODUCT
ClassTable* class_table = isolate->class_table();
return class_table->TraceAllocationFor(id());
+#else
+ return false;
+#endif
}
void Class::SetTraceAllocation(bool trace_allocation) const {
+#ifndef PRODUCT
Isolate* isolate = Isolate::Current();
const bool changed = trace_allocation != this->TraceAllocation(isolate);
if (changed) {
@@ -2821,6 +2828,9 @@ void Class::SetTraceAllocation(bool trace_allocation) const {
class_table->SetTraceAllocationFor(id(), trace_allocation);
DisableAllocationStub();
}
+#else
+ UNREACHABLE();
+#endif
}
« no previous file with comments | « runtime/vm/heap_test.cc ('k') | runtime/vm/scavenger.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698