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

Unified Diff: runtime/vm/code_generator.cc

Issue 8311017: Fix for bug 5442338 (crash in deoptimization): when optimized code calls deoptimization stub, che... (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 9 years, 2 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 | tests/language/src/DeoptimizedFunctionOnStackTest.dart » ('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 464)
+++ runtime/vm/code_generator.cc (working copy)
@@ -916,11 +916,19 @@
function.set_invocation_counter(0);
function.set_deoptimization_counter(function.deoptimization_counter() + 1);
- // Get unoptimized code. Compilation restores (reenables) the entry of
- // unoptimized code.
- Compiler::CompileFunction(function);
+ // We have to skip the following otherwise the compiler will complain
+ // when it attempts to install unoptimized code into a function that
+ // was already deoptimized.
+ if (!Code::Handle(function.code()).is_optimized()) {
+ // Get unoptimized code. Compilation restores (reenables) the entry of
+ // unoptimized code.
+ Compiler::CompileFunction(function);
- DisableOldCode(function, optimized_code, unoptimized_code);
+ DisableOldCode(function, optimized_code, unoptimized_code);
+ }
+ // TODO(srdjan): Handle better complex cases, e.g. when an older optimized
+ // code is alive on frame and gets deoptimized after the function was
+ // optimized a second time.
if (FLAG_trace_deopt) {
OS::Print("After patching ->0x%x:\n", continue_at_pc);
}
« no previous file with comments | « no previous file | tests/language/src/DeoptimizedFunctionOnStackTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698