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

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: Cleanup 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
Index: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 9311f7264ea62585ef7cbdbf9f8883bb00b96cac..bb4c7150526b25be5eb586e3aab0bb0dea6abd37 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());
}
}
@@ -13274,6 +13270,22 @@ bool Code::IsFunctionCode() const {
}
+void Code::DisableDartCode() const {
+ ASSERT(instructions() == active_instructions());
rmacnak 2015/09/29 23:30:57 ASSERT(IsFunctionCode())
srdjan 2015/09/30 16:36:18 Done.
+ const Code& new_code =
+ Code::Handle(StubCode::FixCallersTarget_entry()->code());
+ set_active_instructions(new_code.instructions());
+}
+
+
+void Code::DisableStubCode() const {
+ ASSERT(instructions() == active_instructions());
rmacnak 2015/09/29 23:30:57 ASSERT(IsAllocationStubCode())
srdjan 2015/09/30 16:36:18 Done.
+ 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') | runtime/vm/weak_code.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698