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

Unified Diff: runtime/vm/code_generator.cc

Issue 136563002: Landing: Write protect executable pages in the VM. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 10 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/assembler_x64.h ('k') | runtime/vm/code_patcher.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/code_generator.cc
===================================================================
--- runtime/vm/code_generator.cc (revision 32487)
+++ runtime/vm/code_generator.cc (working copy)
@@ -666,9 +666,14 @@
// target.
ASSERT(target_code.EntryPoint() !=
CodePatcher::GetStaticCallTargetAt(caller_frame->pc(), caller_code));
- CodePatcher::PatchStaticCallAt(caller_frame->pc(), caller_code,
- target_code.EntryPoint());
- caller_code.SetStaticCallTargetCodeAt(caller_frame->pc(), target_code);
+ const Instructions& instrs =
+ Instructions::Handle(caller_code.instructions());
+ {
+ WritableInstructionsScope writable(instrs.EntryPoint(), instrs.size());
+ CodePatcher::PatchStaticCallAt(caller_frame->pc(), caller_code,
+ target_code.EntryPoint());
+ caller_code.SetStaticCallTargetCodeAt(caller_frame->pc(), target_code);
+ }
if (FLAG_trace_patching) {
OS::PrintErr("PatchStaticCall: patching from %#" Px " to '%s' %#" Px "\n",
caller_frame->pc(),
@@ -1363,9 +1368,13 @@
ASSERT(target_function.raw() == target_code.function());
const Code& current_target_code = Code::Handle(target_function.CurrentCode());
- CodePatcher::PatchStaticCallAt(frame->pc(), caller_code,
- current_target_code.EntryPoint());
- caller_code.SetStaticCallTargetCodeAt(frame->pc(), current_target_code);
+ const Instructions& instrs = Instructions::Handle(caller_code.instructions());
+ {
+ WritableInstructionsScope writable(instrs.EntryPoint(), instrs.size());
+ CodePatcher::PatchStaticCallAt(frame->pc(), caller_code,
+ current_target_code.EntryPoint());
+ caller_code.SetStaticCallTargetCodeAt(frame->pc(), current_target_code);
+ }
if (FLAG_trace_patching) {
OS::PrintErr("FixCallersTarget: patching from %#" Px " to '%s' %#" Px "\n",
frame->pc(),
@@ -1405,7 +1414,12 @@
// is not a performance issue).
uword lazy_deopt_jump = optimized_code.GetLazyDeoptPc();
ASSERT(lazy_deopt_jump != 0);
- CodePatcher::InsertCallAt(pc, lazy_deopt_jump);
+ const Instructions& instrs =
+ Instructions::Handle(optimized_code.instructions());
+ {
+ WritableInstructionsScope writable(instrs.EntryPoint(), instrs.size());
+ CodePatcher::InsertCallAt(pc, lazy_deopt_jump);
+ }
if (FLAG_trace_patching) {
const String& name = String::Handle(function.name());
OS::PrintErr("InsertCallAt: %" Px " to %" Px " for %s\n", pc,
« no previous file with comments | « runtime/vm/assembler_x64.h ('k') | runtime/vm/code_patcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698