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

Unified Diff: runtime/vm/object.cc

Issue 1376963002: Cleanup: we are not patching entries any longer (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Address review comments Created 5 years, 3 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/weak_code.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 11cd82bf551d184b8534b81d16cf345d63d33828..7358be4c51cb029ece13591e2ed79a3cc6e82739 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -3752,11 +3752,9 @@ void Class::DisableAllocationStub() const {
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,
- Code::Handle(StubCode::FixAllocationStubTarget_entry()->code()));
+ ASSERT(!existing_stub.IsDisabled());
+ // Change the stub so that the next caller will regenerate the stub.
+ existing_stub.DisableStubCode();
// Disassociate the existing stub from class.
StorePointer(&raw_ptr()->allocation_stub_, Code::null());
}
@@ -5313,9 +5311,7 @@ void Function::SwitchToUnoptimizedCode() const {
ToFullyQualifiedCString(),
current_code.EntryPoint());
}
- // Patch entry of the optimized code.
- CodePatcher::PatchEntry(
- current_code, Code::Handle(StubCode::FixCallersTarget_entry()->code()));
+ current_code.DisableDartCode();
const Error& error = Error::Handle(zone,
Compiler::EnsureUnoptimizedCode(thread, *this));
if (!error.IsNull()) {
@@ -5323,7 +5319,7 @@ void Function::SwitchToUnoptimizedCode() const {
}
const Code& unopt_code = Code::Handle(zone, unoptimized_code());
AttachCode(unopt_code);
- CodePatcher::RestoreEntry(unopt_code);
+ unopt_code.Enable();
isolate->TrackDeoptimizedCode(current_code);
}
@@ -10579,7 +10575,7 @@ class PrefixDependentArray : public WeakCodeReferences {
THR_Print("Prefix '%s': disabling %s code for %s function '%s'\n",
String::Handle(prefix_.name()).ToCString(),
code.is_optimized() ? "optimized" : "unoptimized",
- CodePatcher::IsEntryPatched(code) ? "patched" : "unpatched",
+ code.IsDisabled() ? "'patched'" : "'unpatched'",
Function::Handle(code.function()).ToCString());
}
}
@@ -13285,6 +13281,24 @@ bool Code::IsFunctionCode() const {
}
+void Code::DisableDartCode() const {
+ ASSERT(IsFunctionCode());
+ ASSERT(instructions() == active_instructions());
+ const Code& new_code =
+ Code::Handle(StubCode::FixCallersTarget_entry()->code());
+ set_active_instructions(new_code.instructions());
+}
+
+
+void Code::DisableStubCode() const {
+ASSERT(IsAllocationStubCode());
+ ASSERT(instructions() == active_instructions());
+ const Code& new_code =
+ Code::Handle(StubCode::FixAllocationStubTarget_entry()->code());
+ set_active_instructions(new_code.instructions());
+}
+
+
void Code::PrintJSONImpl(JSONStream* stream, bool ref) const {
JSONObject jsobj(stream);
AddCommonObjectProperties(&jsobj, "Code", ref);
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/weak_code.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698