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

Unified Diff: runtime/vm/intermediate_language_arm.cc

Issue 2357343003: Fix lazy deoptimization in the presence of exceptions (Closed)
Patch Set: Ensure space for patching on ARM/MIPS archs Created 4 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 | « runtime/vm/intermediate_language.h ('k') | runtime/vm/intermediate_language_arm64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language_arm.cc
diff --git a/runtime/vm/intermediate_language_arm.cc b/runtime/vm/intermediate_language_arm.cc
index b4e27f061715c7022d02fcfa15d60492624e1b00..9827a4da71857c8b0070209876bbd0ef815a55f1 100644
--- a/runtime/vm/intermediate_language_arm.cc
+++ b/runtime/vm/intermediate_language_arm.cc
@@ -13,6 +13,7 @@
#include "vm/flow_graph.h"
#include "vm/flow_graph_compiler.h"
#include "vm/flow_graph_range_analysis.h"
+#include "vm/instructions.h"
#include "vm/locations.h"
#include "vm/object_store.h"
#include "vm/parser.h"
@@ -232,7 +233,7 @@ void ClosureCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
// deoptimization point in optimized code, after call.
const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id());
if (compiler->is_optimizing()) {
- compiler->AddDeoptIndexAtCall(deopt_id_after, token_pos());
+ compiler->AddDeoptIndexAtCall(deopt_id_after);
}
// Add deoptimization continuation point after the call and before the
// arguments are removed.
@@ -2836,16 +2837,30 @@ LocationSummary* CatchBlockEntryInstr::MakeLocationSummary(Zone* zone,
void CatchBlockEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
+ // Ensure space for patching return sites for lazy deopt.
+ if (!FLAG_precompiled_mode && compiler->is_optimizing()) {
+ for (intptr_t i = 0;
+ i < CallPattern::DeoptCallPatternLengthInInstructions();
+ ++i) {
+ __ nop();
+ }
+ }
__ Bind(compiler->GetJumpLabel(this));
compiler->AddExceptionHandler(catch_try_index(),
try_index(),
compiler->assembler()->CodeSize(),
catch_handler_types_,
needs_stacktrace());
- // Restore the pool pointer.
- __ RestoreCodePointer();
- __ LoadPoolPointer();
-
+ // On lazy deoptimization we patch the optimized code here to enter the
+ // deoptimization stub.
+ const intptr_t deopt_id = Thread::ToDeoptAfter(GetDeoptId());
+ if (compiler->is_optimizing()) {
+ compiler->AddDeoptIndexAtCall(deopt_id);
+ } else {
+ compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt,
+ deopt_id,
+ TokenPosition::kNoSource);
+ }
if (HasParallelMove()) {
compiler->parallel_move_resolver()->EmitNativeCode(parallel_move());
}
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | runtime/vm/intermediate_language_arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698