Index: src/compiler/jump-threading.cc |
diff --git a/src/compiler/jump-threading.cc b/src/compiler/jump-threading.cc |
index 7b53b5cbc3eead9e77be56b71f6d7467ddb46804..5abd34633bd1a813d8d7a245af11aabb16879ea8 100644 |
--- a/src/compiler/jump-threading.cc |
+++ b/src/compiler/jump-threading.cc |
@@ -53,10 +53,10 @@ struct JumpThreadingState { |
RpoNumber onstack() { return RpoNumber::FromInt(-2); } |
}; |
- |
bool JumpThreading::ComputeForwarding(Zone* local_zone, |
ZoneVector<RpoNumber>& result, |
- InstructionSequence* code) { |
+ InstructionSequence* code, |
+ bool frame_at_start) { |
ZoneStack<RpoNumber> stack(local_zone); |
JumpThreadingState state = {false, result, stack}; |
state.Clear(code->InstructionBlockCount()); |
@@ -91,7 +91,14 @@ bool JumpThreading::ComputeForwarding(Zone* local_zone, |
} else if (instr->arch_opcode() == kArchJmp) { |
// try to forward the jump instruction. |
TRACE(" jmp\n"); |
- fw = code->InputRpo(instr, 0); |
+ // if this block deconstructs the frame, we can't forward it. |
+ // TODO(mtrofin): we can still forward if we end up building |
+ // the frame at start. So we should move the decision of whether |
+ // to build a frame or not in the register allocator, and trickle it |
+ // here and to the code generator. |
+ if (frame_at_start || !block->must_deconstruct_frame()) { |
+ fw = code->InputRpo(instr, 0); |
+ } |
fallthru = false; |
} else { |
// can't skip other instructions. |