Commit 74e328ef authored by mstarzinger's avatar mstarzinger Committed by Commit bot

[turbofan] Implicitly emit eager checkpoint at graph building.

This makes preparation of eager checkpoints within the graph builder
implicit. Every sub-expression visitation is now guaranteed to emit
valid checkpoints in AstContext.

R=jarin@chromium.org
BUG=v8:5021

Review-Url: https://codereview.chromium.org/2074703002
Cr-Commit-Position: refs/heads/master@{#37368}
parent 85c9f001
This diff is collapsed.
......@@ -445,8 +445,7 @@ class AstGraphBuilder : public AstVisitor {
// Dispatched from VisitForInStatement.
void VisitForInAssignment(Expression* expr, Node* value,
const VectorSlotPair& feedback,
BailoutId bailout_id_before,
BailoutId bailout_id_after);
BailoutId bailout_id);
// Dispatched from VisitObjectLiteral.
void VisitObjectLiteralAccessor(Node* home_object,
......
......@@ -30,14 +30,39 @@ bool IsRedundantCheckpoint(Node* node) {
} // namespace
Reduction CheckpointElimination::Reduce(Node* node) {
if (node->opcode() != IrOpcode::kCheckpoint) return NoChange();
Reduction CheckpointElimination::ReduceCheckpoint(Node* node) {
DCHECK_EQ(IrOpcode::kCheckpoint, node->opcode());
if (IsRedundantCheckpoint(node)) {
return Replace(NodeProperties::GetEffectInput(node));
}
return NoChange();
}
Reduction CheckpointElimination::ReduceReturn(Node* node) {
DCHECK_EQ(IrOpcode::kReturn, node->opcode());
Node* effect = NodeProperties::GetEffectInput(node);
if (effect->opcode() == IrOpcode::kCheckpoint && effect->OwnedBy(node)) {
// Any checkpoint that is wholly owned by a {Return} node can never be used
// for an actual bailout and can hence be cut out of the effect chain.
Node* replacement = NodeProperties::GetEffectInput(effect);
NodeProperties::ReplaceEffectInput(node, replacement);
return Changed(node);
}
return NoChange();
}
Reduction CheckpointElimination::Reduce(Node* node) {
switch (node->opcode()) {
case IrOpcode::kCheckpoint:
return ReduceCheckpoint(node);
case IrOpcode::kReturn:
return ReduceReturn(node);
default:
break;
}
return NoChange();
}
} // namespace compiler
} // namespace internal
} // namespace v8
......@@ -18,6 +18,10 @@ class CheckpointElimination final : public AdvancedReducer {
~CheckpointElimination() final {}
Reduction Reduce(Node* node) final;
private:
Reduction ReduceCheckpoint(Node* node);
Reduction ReduceReturn(Node* node);
};
} // namespace compiler
......
......@@ -875,7 +875,7 @@ void FullCodeGenerator::VisitDoExpression(DoExpression* expr) {
Comment cmnt(masm_, "[ Do Expression");
SetExpressionPosition(expr);
VisitBlock(expr->block());
EmitVariableLoad(expr->result());
VisitInDuplicateContext(expr->result());
}
......
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