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

Unified Diff: runtime/vm/code_generator.cc

Issue 10912146: Finish implementing lazy deoptimization (ia32, x64). Ran tests with --deoptimize-alot. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 | « no previous file | 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 12092)
+++ runtime/vm/code_generator.cc (working copy)
@@ -1452,6 +1452,17 @@
uword continue_at_pc =
unoptimized_code.GetDeoptAfterPcAtDeoptId(deopt_id);
ASSERT(continue_at_pc != 0);
+ // The switch to unoptimized code may have already occured.
+ if (function.HasOptimizedCode()) {
+ function.SwitchToUnoptimizedCode();
+ }
+ // Patch call site (lazy deoptimization is quite rare, patching it twice
+ // is not a performance issue).
+ uword lazy_deopt_jump = optimized_code.GetLazyDeoptPc();
+ ASSERT(lazy_deopt_jump != 0);
+ CodePatcher::InsertCallAt(frame->pc(), lazy_deopt_jump);
+ // Mark code as dead (do not GC its embedded objects).
+ optimized_code.set_is_alive(false);
}
frame = iterator.NextFrame();
}
@@ -1628,7 +1639,12 @@
GetDeoptIxDescrAtPc(optimized_code, caller_frame->pc(),
&deopt_id, &deopt_reason, &deopt_index);
ASSERT(deopt_id != Isolate::kNoDeoptId);
- uword continue_at_pc = unoptimized_code.GetDeoptBeforePcAtDeoptId(deopt_id);
+ uword continue_at_pc = 0;
+ if (deopt_reason == kDeoptAtCall) {
+ continue_at_pc = unoptimized_code.GetDeoptAfterPcAtDeoptId(deopt_id);
+ } else {
+ continue_at_pc = unoptimized_code.GetDeoptBeforePcAtDeoptId(deopt_id);
+ }
ASSERT(continue_at_pc != 0);
if (FLAG_trace_deopt) {
OS::Print(" -> continue at %#"Px"\n", continue_at_pc);
« no previous file with comments | « no previous file | runtime/vm/code_patcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698