Commit e065d3ef authored by mstarzinger's avatar mstarzinger Committed by Commit bot

[turbofan] Emit explicit checkpoint before operations.

This is a first step towards explicit checkpoints in the graph. For now
we still use the explicit eager bailout points in the AstGraphBuilder
that are marked by the FrameStateBeforeAndAfter helper. Eventually these
will be implicitly emitted by expression visits having a side-effect.

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

Review-Url: https://codereview.chromium.org/2018403002
Cr-Commit-Position: refs/heads/master@{#36638}
parent d673d890
......@@ -418,6 +418,11 @@ class AstGraphBuilder::FrameStateBeforeAndAfter {
frame_state_before_ = id_before == BailoutId::None()
? builder_->GetEmptyFrameState()
: builder_->environment()->Checkpoint(id_before);
// Create an explicit checkpoint node for before the operation.
Node* node = builder_->NewNode(builder_->common()->Checkpoint());
DCHECK_EQ(IrOpcode::kDead,
NodeProperties::GetFrameStateInput(node, 0)->opcode());
NodeProperties::ReplaceFrameStateInput(node, 0, frame_state_before_);
}
void AddToNode(
......@@ -444,6 +449,7 @@ class AstGraphBuilder::FrameStateBeforeAndAfter {
if (count >= 2) {
// Add the frame state for before the operation.
// TODO(mstarzinger): Get rid of frame state input before!
DCHECK_EQ(IrOpcode::kDead,
NodeProperties::GetFrameStateInput(node, 1)->opcode());
NodeProperties::ReplaceFrameStateInput(node, 1, frame_state_before_);
......
......@@ -109,6 +109,11 @@ class BytecodeGraphBuilder::FrameStateBeforeAndAfter {
id_before, OutputFrameStateCombine::Ignore());
id_after_ = BailoutId(id_before.ToInt() +
builder->bytecode_iterator().current_bytecode_size());
// Create an explicit checkpoint node for before the operation.
Node* node = builder_->NewNode(builder_->common()->Checkpoint());
DCHECK_EQ(IrOpcode::kDead,
NodeProperties::GetFrameStateInput(node, 0)->opcode());
NodeProperties::ReplaceFrameStateInput(node, 0, frame_state_before_);
}
~FrameStateBeforeAndAfter() {
......@@ -136,6 +141,7 @@ class BytecodeGraphBuilder::FrameStateBeforeAndAfter {
if (count >= 2) {
// Add the frame state for before the operation.
// TODO(mstarzinger): Get rid of frame state input before!
DCHECK_EQ(IrOpcode::kDead,
NodeProperties::GetFrameStateInput(node, 1)->opcode());
NodeProperties::ReplaceFrameStateInput(node, 1, frame_state_before_);
......
......@@ -179,7 +179,7 @@ std::ostream& operator<<(std::ostream& os,
V(Terminate, Operator::kKontrol, 0, 1, 1, 0, 0, 1) \
V(OsrNormalEntry, Operator::kFoldable, 0, 1, 1, 0, 1, 1) \
V(OsrLoopEntry, Operator::kFoldable, 0, 1, 1, 0, 1, 1) \
V(Checkpoint, Operator::kKontrol, 1, 1, 1, 0, 1, 0) \
V(Checkpoint, Operator::kKontrol, 0, 1, 1, 0, 1, 0) \
V(BeginRegion, Operator::kNoThrow, 0, 1, 0, 0, 1, 0) \
V(FinishRegion, Operator::kNoThrow, 1, 1, 0, 1, 1, 0)
......
......@@ -298,7 +298,7 @@ void EffectControlLinearizer::ProcessNode(Node* node, Node** effect,
if (node->opcode() == IrOpcode::kCheckpoint) {
// Unlink the check point; effect uses will be updated to the incoming
// effect that is passed.
node->Kill();
node->TrimInputCount(0);
return;
}
......
......@@ -22,6 +22,7 @@ bool OperatorProperties::HasContextInput(const Operator* op) {
// static
int OperatorProperties::GetFrameStateInputCount(const Operator* op) {
switch (op->opcode()) {
case IrOpcode::kCheckpoint:
case IrOpcode::kFrameState:
return 1;
case IrOpcode::kJSCallRuntime: {
......
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