Index: runtime/vm/intermediate_language_ia32.cc |
diff --git a/runtime/vm/intermediate_language_ia32.cc b/runtime/vm/intermediate_language_ia32.cc |
index 1595297274d20bf943469181f58d63b28494b2ad..2d0a4c2860909633c0d7cac0f44a774bc9734f4d 100644 |
--- a/runtime/vm/intermediate_language_ia32.cc |
+++ b/runtime/vm/intermediate_language_ia32.cc |
@@ -12,6 +12,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" |
@@ -2547,12 +2548,25 @@ LocationSummary* CatchBlockEntryInstr::MakeLocationSummary(Zone* zone, |
void CatchBlockEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
+ // Ensure space for patching return sites for lazy deopt. |
+ __ nop(CallPattern::pattern_length_in_bytes()); |
Florian Schneider
2016/09/23 19:53:34
Needed to ensure, patching a return-address does n
rmacnak
2016/09/26 20:21:48
Just noting that space might disappear on the RISC
Florian Schneider
2016/09/26 23:05:28
Actually, I'll add space on ARM/MIPS archs as well
|
+ |
__ Bind(compiler->GetJumpLabel(this)); |
compiler->AddExceptionHandler(catch_try_index(), |
try_index(), |
compiler->assembler()->CodeSize(), |
catch_handler_types_, |
needs_stacktrace()); |
+ // 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()); |
} |
@@ -6784,7 +6798,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. |