Commit c1253668 authored by danno's avatar danno Committed by Commit bot

Add constants for FrameState input parameters

R=jarin@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#28519}
parent 1c673a56
......@@ -101,6 +101,13 @@ size_t hash_value(FrameStateCallInfo const&);
std::ostream& operator<<(std::ostream&, FrameStateCallInfo const&);
static const int kFrameStateParametersInput = 0;
static const int kFrameStateLocalsInput = 1;
static const int kFrameStateStackInput = 2;
static const int kFrameStateContextInput = 3;
static const int kFrameStateFunctionInput = 4;
static const int kFrameStateOuterStateInput = 5;
static const int kFrameStateInputCount = kFrameStateOuterStateInput + 1;
} // namespace compiler
} // namespace internal
......
......@@ -1028,19 +1028,24 @@ void InstructionSelector::VisitThrow(Node* value) {
FrameStateDescriptor* InstructionSelector::GetFrameStateDescriptor(
Node* state) {
DCHECK(state->opcode() == IrOpcode::kFrameState);
DCHECK_EQ(6, state->InputCount());
DCHECK_EQ(IrOpcode::kTypedStateValues, state->InputAt(0)->opcode());
DCHECK_EQ(IrOpcode::kTypedStateValues, state->InputAt(1)->opcode());
DCHECK_EQ(IrOpcode::kTypedStateValues, state->InputAt(2)->opcode());
DCHECK_EQ(kFrameStateInputCount, state->InputCount());
DCHECK_EQ(IrOpcode::kTypedStateValues,
state->InputAt(kFrameStateParametersInput)->opcode());
DCHECK_EQ(IrOpcode::kTypedStateValues,
state->InputAt(kFrameStateLocalsInput)->opcode());
DCHECK_EQ(IrOpcode::kTypedStateValues,
state->InputAt(kFrameStateStackInput)->opcode());
FrameStateCallInfo state_info = OpParameter<FrameStateCallInfo>(state);
int parameters =
static_cast<int>(StateValuesAccess(state->InputAt(0)).size());
int locals = static_cast<int>(StateValuesAccess(state->InputAt(1)).size());
int stack = static_cast<int>(StateValuesAccess(state->InputAt(2)).size());
int parameters = static_cast<int>(
StateValuesAccess(state->InputAt(kFrameStateParametersInput)).size());
int locals = static_cast<int>(
StateValuesAccess(state->InputAt(kFrameStateLocalsInput)).size());
int stack = static_cast<int>(
StateValuesAccess(state->InputAt(kFrameStateStackInput)).size());
FrameStateDescriptor* outer_state = NULL;
Node* outer_node = state->InputAt(5);
Node* outer_node = state->InputAt(kFrameStateOuterStateInput);
if (outer_node->opcode() == IrOpcode::kFrameState) {
outer_state = GetFrameStateDescriptor(outer_node);
}
......@@ -1070,14 +1075,15 @@ void InstructionSelector::AddFrameStateInputs(
DCHECK_EQ(IrOpcode::kFrameState, state->op()->opcode());
if (descriptor->outer_state()) {
AddFrameStateInputs(state->InputAt(5), inputs, descriptor->outer_state());
AddFrameStateInputs(state->InputAt(kFrameStateOuterStateInput), inputs,
descriptor->outer_state());
}
Node* parameters = state->InputAt(0);
Node* locals = state->InputAt(1);
Node* stack = state->InputAt(2);
Node* context = state->InputAt(3);
Node* function = state->InputAt(4);
Node* parameters = state->InputAt(kFrameStateParametersInput);
Node* locals = state->InputAt(kFrameStateLocalsInput);
Node* stack = state->InputAt(kFrameStateStackInput);
Node* context = state->InputAt(kFrameStateContextInput);
Node* function = state->InputAt(kFrameStateFunctionInput);
DCHECK_EQ(IrOpcode::kTypedStateValues, parameters->op()->opcode());
DCHECK_EQ(IrOpcode::kTypedStateValues, locals->op()->opcode());
......
......@@ -264,10 +264,13 @@ class JSBinopReduction final {
state_info.type(), state_info.bailout_id(),
OutputFrameStateCombine::PokeAt(1));
return graph()->NewNode(op, frame_state->InputAt(0),
frame_state->InputAt(1), frame_state->InputAt(2),
frame_state->InputAt(3), frame_state->InputAt(4),
frame_state->InputAt(5));
return graph()->NewNode(op,
frame_state->InputAt(kFrameStateParametersInput),
frame_state->InputAt(kFrameStateLocalsInput),
frame_state->InputAt(kFrameStateStackInput),
frame_state->InputAt(kFrameStateContextInput),
frame_state->InputAt(kFrameStateFunctionInput),
frame_state->InputAt(kFrameStateOuterStateInput));
}
Node* CreateFrameStateForRightInput(Node* frame_state, Node* converted_left) {
......@@ -302,10 +305,12 @@ class JSBinopReduction final {
Node* new_stack =
graph()->NewNode(stack->op(), stack->InputCount(), &new_values.front());
return graph()->NewNode(op, frame_state->InputAt(0),
frame_state->InputAt(1), new_stack,
frame_state->InputAt(3), frame_state->InputAt(4),
frame_state->InputAt(5));
return graph()->NewNode(
op, frame_state->InputAt(kFrameStateParametersInput),
frame_state->InputAt(kFrameStateLocalsInput), new_stack,
frame_state->InputAt(kFrameStateContextInput),
frame_state->InputAt(kFrameStateFunctionInput),
frame_state->InputAt(kFrameStateOuterStateInput));
}
Node* ConvertPlainPrimitiveToNumber(Node* node) {
......
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