Index: src/arm/lithium-arm.cc |
=================================================================== |
--- src/arm/lithium-arm.cc (revision 6473) |
+++ src/arm/lithium-arm.cc (working copy) |
@@ -653,6 +653,22 @@ |
} |
+LInstruction* LChunkBuilder::SetInstructionPendingDeoptimizationEnvironment( |
+ LInstruction* instr, int ast_id) { |
+ ASSERT(instructions_pending_deoptimization_environment_ == NULL); |
+ ASSERT(pending_deoptimization_ast_id_ == AstNode::kNoNumber); |
+ instructions_pending_deoptimization_environment_ = instr; |
+ pending_deoptimization_ast_id_ = ast_id; |
+ return instr; |
+} |
+ |
+ |
+void LChunkBuilder::ClearInstructionPendingDeoptimizationEnvironment() { |
+ instructions_pending_deoptimization_environment_ = NULL; |
+ pending_deoptimization_ast_id_ = AstNode::kNoNumber; |
+} |
+ |
+ |
LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr, |
HInstruction* hinstr, |
CanDeoptimize can_deoptimize) { |
@@ -662,8 +678,8 @@ |
if (hinstr->HasSideEffects()) { |
ASSERT(hinstr->next()->IsSimulate()); |
HSimulate* sim = HSimulate::cast(hinstr->next()); |
- ASSERT(pending_deoptimization_ast_id_ == AstNode::kNoNumber); |
- pending_deoptimization_ast_id_ = sim->ast_id(); |
+ instr = SetInstructionPendingDeoptimizationEnvironment( |
+ instr, sim->ast_id()); |
} |
// If instruction does not have side-effects lazy deoptimization |
@@ -1811,11 +1827,12 @@ |
// If there is an instruction pending deoptimization environment create a |
// lazy bailout instruction to capture the environment. |
- if (pending_deoptimization_ast_id_ != AstNode::kNoNumber) { |
- ASSERT(pending_deoptimization_ast_id_ == instr->ast_id()); |
- LInstruction* lazy_bailout = new LLazyBailout; |
- LInstruction* result = AssignEnvironment(lazy_bailout); |
- pending_deoptimization_ast_id_ = AstNode::kNoNumber; |
+ if (pending_deoptimization_ast_id_ == instr->ast_id()) { |
+ LInstruction* result = new LLazyBailout; |
+ result = AssignEnvironment(result); |
+ instructions_pending_deoptimization_environment_-> |
+ set_deoptimization_environment(result->environment()); |
+ ClearInstructionPendingDeoptimizationEnvironment(); |
return result; |
} |