Index: src/compiler/bytecode-graph-builder.cc |
diff --git a/src/compiler/bytecode-graph-builder.cc b/src/compiler/bytecode-graph-builder.cc |
index 302b494d31685a953a6403f583e6b4c99d3951e9..ba88d6278de59c002acc2818e6816bfa8599465b 100644 |
--- a/src/compiler/bytecode-graph-builder.cc |
+++ b/src/compiler/bytecode-graph-builder.cc |
@@ -113,8 +113,8 @@ class BytecodeGraphBuilder::FrameStateBeforeAndAfter { |
// 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_); |
+ NodeProperties::GetFrameStateInput(node)->opcode()); |
+ NodeProperties::ReplaceFrameStateInput(node, frame_state_before_); |
} |
~FrameStateBeforeAndAfter() { |
@@ -129,30 +129,21 @@ class BytecodeGraphBuilder::FrameStateBeforeAndAfter { |
void AddToNode(Node* node, OutputFrameStateCombine combine) { |
DCHECK(!added_to_node_); |
- int count = OperatorProperties::GetFrameStateInputCount(node->op()); |
- DCHECK_LE(count, 2); |
- if (count >= 1) { |
+ bool has_frame_state = OperatorProperties::HasFrameStateInput(node->op()); |
+ if (has_frame_state) { |
// Add the frame state for after the operation. |
DCHECK_EQ(IrOpcode::kDead, |
- NodeProperties::GetFrameStateInput(node, 0)->opcode()); |
+ NodeProperties::GetFrameStateInput(node)->opcode()); |
Node* frame_state_after = |
builder_->environment()->Checkpoint(id_after_, combine); |
- NodeProperties::ReplaceFrameStateInput(node, 0, frame_state_after); |
- } |
- |
- 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_); |
+ NodeProperties::ReplaceFrameStateInput(node, frame_state_after); |
} |
if (!combine.IsOutputIgnored()) { |
output_poke_offset_ = static_cast<int>(combine.GetOffsetToPokeAt()); |
output_poke_count_ = node->op()->ValueOutputCount(); |
} |
- frame_states_unused_ = count == 0; |
+ frame_states_unused_ = !has_frame_state; |
added_to_node_ = true; |
} |
@@ -1681,7 +1672,7 @@ Node* BytecodeGraphBuilder::MakeNode(const Operator* op, int value_input_count, |
DCHECK_EQ(op->ValueInputCount(), value_input_count); |
bool has_context = OperatorProperties::HasContextInput(op); |
- int frame_state_count = OperatorProperties::GetFrameStateInputCount(op); |
+ bool has_frame_state = OperatorProperties::HasFrameStateInput(op); |
bool has_control = op->ControlInputCount() == 1; |
bool has_effect = op->EffectInputCount() == 1; |
@@ -1689,13 +1680,13 @@ Node* BytecodeGraphBuilder::MakeNode(const Operator* op, int value_input_count, |
DCHECK_LT(op->EffectInputCount(), 2); |
Node* result = nullptr; |
- if (!has_context && frame_state_count == 0 && !has_control && !has_effect) { |
+ if (!has_context && !has_frame_state && !has_control && !has_effect) { |
result = graph()->NewNode(op, value_input_count, value_inputs, incomplete); |
} else { |
bool inside_handler = !exception_handlers_.empty(); |
int input_count_with_deps = value_input_count; |
if (has_context) ++input_count_with_deps; |
- input_count_with_deps += frame_state_count; |
+ if (has_frame_state) ++input_count_with_deps; |
if (has_control) ++input_count_with_deps; |
if (has_effect) ++input_count_with_deps; |
Node** buffer = EnsureInputBufferSize(input_count_with_deps); |
@@ -1704,7 +1695,7 @@ Node* BytecodeGraphBuilder::MakeNode(const Operator* op, int value_input_count, |
if (has_context) { |
*current_input++ = environment()->Context(); |
} |
- for (int i = 0; i < frame_state_count; i++) { |
+ if (has_frame_state) { |
// The frame state will be inserted later. Here we misuse |
// the {Dead} node as a sentinel to be later overwritten |
// with the real frame state. |