Commit 84163df3 authored by zhengxing.li's avatar zhengxing.li Committed by Commit bot

X87: [crankshaft] Always generate lazy bailout points for tail calls ...

  port 66e22b79 (r34979)

  original commit message:
  ... because Debugger could still require them to inspect optimized frames.

BUG=

Review URL: https://codereview.chromium.org/1826673003

Cr-Commit-Position: refs/heads/master@{#35019}
parent 7f82fcdc
...@@ -935,6 +935,11 @@ void LChunkBuilder::AddInstruction(LInstruction* instr, ...@@ -935,6 +935,11 @@ void LChunkBuilder::AddInstruction(LInstruction* instr,
// Push return value on top of outer environment. // Push return value on top of outer environment.
hydrogen_env = hydrogen_env->Copy(); hydrogen_env = hydrogen_env->Copy();
hydrogen_env->Push(hydrogen_val); hydrogen_env->Push(hydrogen_val);
} else {
// Although we don't need this lazy bailout for normal execution
// (because when we tail call from the outermost function we should pop
// its frame) we still need it when debugger is on.
hydrogen_env = current_block_->last_environment();
} }
} else { } else {
if (hydrogen_val->HasObservableSideEffects()) { if (hydrogen_val->HasObservableSideEffects()) {
...@@ -943,16 +948,10 @@ void LChunkBuilder::AddInstruction(LInstruction* instr, ...@@ -943,16 +948,10 @@ void LChunkBuilder::AddInstruction(LInstruction* instr,
hydrogen_value_for_lazy_bailout = sim; hydrogen_value_for_lazy_bailout = sim;
} }
} }
if (hydrogen_env != nullptr) { LInstruction* bailout = LChunkBuilderBase::AssignEnvironment(
// The |hydrogen_env| can be null at this point only if we are generating new (zone()) LLazyBailout(), hydrogen_env);
// a syntactic tail call from the outermost function but in this case bailout->set_hydrogen_value(hydrogen_value_for_lazy_bailout);
// it would be a real tail call which will pop function's frame and chunk_->AddInstruction(bailout, current_block_);
// therefore this lazy bailout can be skipped.
LInstruction* bailout = LChunkBuilderBase::AssignEnvironment(
new (zone()) LLazyBailout(), hydrogen_env);
bailout->set_hydrogen_value(hydrogen_value_for_lazy_bailout);
chunk_->AddInstruction(bailout, current_block_);
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment