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

Unified Diff: runtime/vm/object.cc

Issue 1215773002: Fix allocation stub switching (Closed) Base URL: git@github.com:dart-lang/sdk.git@allocation_profile_test
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 | « no previous file | runtime/vm/profiler_test.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 b1c28aba81f2603a35d78499f7d873d65b55382d..3bf036e706a098b07a7addf4fd0500ab83b97df0 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -2736,7 +2736,7 @@ void Class::SetTraceAllocation(bool trace_allocation) const {
set_state_bits(
TraceAllocationBit::update(trace_allocation, raw_ptr()->state_bits_));
if (changed) {
- // TODO(johnmccutchan): Deoptimize the world?
+ DisableAllocationStub();
}
}
@@ -3633,6 +3633,14 @@ void Class::set_allocation_stub(const Code& value) const {
void Class::DisableAllocationStub() const {
+ const Code& existing_stub = Code::Handle(allocation_stub());
+ if (existing_stub.IsNull()) {
+ return;
+ }
+ ASSERT(!CodePatcher::IsEntryPatched(existing_stub));
+ // Patch the stub so that the next caller will regenerate the stub.
+ CodePatcher::PatchEntry(existing_stub);
+ // Disassociate the existing stub from class.
StorePointer(&raw_ptr()->allocation_stub_, Code::null());
}
« no previous file with comments | « no previous file | runtime/vm/profiler_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698