Commit 66e22b79 authored by ishell's avatar ishell Committed by Commit bot

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

... because Debugger could still require them to inspect optimized frames.

BUG=chromium:596473, v8:4698
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#34979}
parent 1da4b88e
...@@ -887,6 +887,11 @@ void LChunkBuilder::AddInstruction(LInstruction* instr, ...@@ -887,6 +887,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()) {
...@@ -895,16 +900,10 @@ void LChunkBuilder::AddInstruction(LInstruction* instr, ...@@ -895,16 +900,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_);
}
} }
} }
......
...@@ -730,6 +730,11 @@ void LChunkBuilder::AddInstruction(LInstruction* instr, ...@@ -730,6 +730,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()) {
...@@ -738,16 +743,10 @@ void LChunkBuilder::AddInstruction(LInstruction* instr, ...@@ -738,16 +743,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_);
}
} }
} }
......
...@@ -920,6 +920,11 @@ void LChunkBuilder::AddInstruction(LInstruction* instr, ...@@ -920,6 +920,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()) {
...@@ -928,16 +933,10 @@ void LChunkBuilder::AddInstruction(LInstruction* instr, ...@@ -928,16 +933,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_);
}
} }
} }
......
...@@ -897,6 +897,11 @@ void LChunkBuilder::AddInstruction(LInstruction* instr, ...@@ -897,6 +897,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()) {
...@@ -905,16 +910,10 @@ void LChunkBuilder::AddInstruction(LInstruction* instr, ...@@ -905,16 +910,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_);
}
} }
} }
......
...@@ -897,6 +897,11 @@ void LChunkBuilder::AddInstruction(LInstruction* instr, ...@@ -897,6 +897,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()) {
...@@ -905,16 +910,10 @@ void LChunkBuilder::AddInstruction(LInstruction* instr, ...@@ -905,16 +910,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_);
}
} }
} }
......
...@@ -912,6 +912,11 @@ void LChunkBuilder::AddInstruction(LInstruction* instr, ...@@ -912,6 +912,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()) {
...@@ -920,16 +925,10 @@ void LChunkBuilder::AddInstruction(LInstruction* instr, ...@@ -920,16 +925,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