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

Unified Diff: runtime/vm/debugger_mips.cc

Issue 1139403002: VM: Clean up ARM/MIPS breakpoint patching (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 7 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/debugger_arm.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/debugger_mips.cc
diff --git a/runtime/vm/debugger_mips.cc b/runtime/vm/debugger_mips.cc
index e3918e6760c5b9a2bba950a3eb2cae27169f516a..96d463250b58de68910b4dd746ec431eea637be5 100644
--- a/runtime/vm/debugger_mips.cc
+++ b/runtime/vm/debugger_mips.cc
@@ -20,35 +20,25 @@ uword CodeBreakpoint::OrigStubAddress() const {
void CodeBreakpoint::PatchCode() {
ASSERT(!is_enabled_);
- const Code& code = Code::Handle(code_);
- const Instructions& instrs = Instructions::Handle(code.instructions());
- Isolate* isolate = Isolate::Current();
- {
- WritableInstructionsScope writable(instrs.EntryPoint(), instrs.size());
- switch (breakpoint_kind_) {
- case RawPcDescriptors::kIcCall:
- case RawPcDescriptors::kUnoptStaticCall: {
- saved_value_ = CodePatcher::GetStaticCallTargetAt(pc_, code);
- CodePatcher::PatchStaticCallAt(
- pc_, code, isolate->stub_code()->ICCallBreakpointEntryPoint());
- break;
- }
- case RawPcDescriptors::kClosureCall: {
- saved_value_ = CodePatcher::GetStaticCallTargetAt(pc_, code);
- CodePatcher::PatchStaticCallAt(
- pc_, code, isolate->stub_code()->ClosureCallBreakpointEntryPoint());
- break;
- }
- case RawPcDescriptors::kRuntimeCall: {
- saved_value_ = CodePatcher::GetStaticCallTargetAt(pc_, code);
- CodePatcher::PatchStaticCallAt(
- pc_, code, isolate->stub_code()->RuntimeCallBreakpointEntryPoint());
- break;
- }
- default:
- UNREACHABLE();
- }
+ StubCode* stub_code = Isolate::Current()->stub_code();
+ uword stub_target = 0;
+ switch (breakpoint_kind_) {
+ case RawPcDescriptors::kIcCall:
+ case RawPcDescriptors::kUnoptStaticCall:
+ stub_target = stub_code->ICCallBreakpointEntryPoint();
+ break;
+ case RawPcDescriptors::kClosureCall:
+ stub_target = stub_code->ClosureCallBreakpointEntryPoint();
+ break;
+ case RawPcDescriptors::kRuntimeCall:
+ stub_target = stub_code->RuntimeCallBreakpointEntryPoint();
+ break;
+ default:
+ UNREACHABLE();
}
+ const Code& code = Code::Handle(code_);
+ saved_value_ = CodePatcher::GetStaticCallTargetAt(pc_, code);
+ CodePatcher::PatchStaticCallAt(pc_, code, stub_target);
is_enabled_ = true;
}
@@ -56,20 +46,16 @@ void CodeBreakpoint::PatchCode() {
void CodeBreakpoint::RestoreCode() {
ASSERT(is_enabled_);
const Code& code = Code::Handle(code_);
- const Instructions& instrs = Instructions::Handle(code.instructions());
- {
- WritableInstructionsScope writable(instrs.EntryPoint(), instrs.size());
- switch (breakpoint_kind_) {
- case RawPcDescriptors::kIcCall:
- case RawPcDescriptors::kUnoptStaticCall:
- case RawPcDescriptors::kClosureCall:
- case RawPcDescriptors::kRuntimeCall: {
- CodePatcher::PatchStaticCallAt(pc_, code, saved_value_);
- break;
- }
- default:
- UNREACHABLE();
+ switch (breakpoint_kind_) {
+ case RawPcDescriptors::kIcCall:
+ case RawPcDescriptors::kUnoptStaticCall:
+ case RawPcDescriptors::kClosureCall:
+ case RawPcDescriptors::kRuntimeCall: {
+ CodePatcher::PatchStaticCallAt(pc_, code, saved_value_);
+ break;
}
+ default:
+ UNREACHABLE();
}
is_enabled_ = false;
}
« no previous file with comments | « runtime/vm/debugger_arm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698