Commit 6893da53 authored by jarin's avatar jarin Committed by Commit bot

[turbofan] Do not force stack slot for eager deopt inputs.

R=bmeurer@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#30565}
parent 5fc253a8
...@@ -360,7 +360,8 @@ void InstructionSelector::InitializeCallBuffer(Node* call, CallBuffer* buffer, ...@@ -360,7 +360,8 @@ void InstructionSelector::InitializeCallBuffer(Node* call, CallBuffer* buffer,
Node* frame_state = Node* frame_state =
call->InputAt(static_cast<int>(buffer->descriptor->InputCount())); call->InputAt(static_cast<int>(buffer->descriptor->InputCount()));
AddFrameStateInputs(frame_state, &buffer->instruction_args, AddFrameStateInputs(frame_state, &buffer->instruction_args,
buffer->frame_state_descriptor); buffer->frame_state_descriptor,
FrameStateInputKind::kStackSlot);
} }
DCHECK(1 + buffer->frame_state_value_count() == DCHECK(1 + buffer->frame_state_value_count() ==
buffer->instruction_args.size()); buffer->instruction_args.size());
...@@ -1016,7 +1017,7 @@ void InstructionSelector::VisitDeoptimize(Node* value) { ...@@ -1016,7 +1017,7 @@ void InstructionSelector::VisitDeoptimize(Node* value) {
sequence()->AddFrameStateDescriptor(desc); sequence()->AddFrameStateDescriptor(desc);
args.push_back(g.TempImmediate(state_id.ToInt())); args.push_back(g.TempImmediate(state_id.ToInt()));
AddFrameStateInputs(value, &args, desc); AddFrameStateInputs(value, &args, desc, FrameStateInputKind::kAny);
DCHECK_EQ(args.size(), arg_count); DCHECK_EQ(args.size(), arg_count);
...@@ -1059,7 +1060,8 @@ FrameStateDescriptor* InstructionSelector::GetFrameStateDescriptor( ...@@ -1059,7 +1060,8 @@ FrameStateDescriptor* InstructionSelector::GetFrameStateDescriptor(
} }
static InstructionOperand SlotOrImmediate(OperandGenerator* g, Node* input) { InstructionOperand InstructionSelector::OperandForDeopt(
OperandGenerator* g, Node* input, FrameStateInputKind kind) {
switch (input->opcode()) { switch (input->opcode()) {
case IrOpcode::kInt32Constant: case IrOpcode::kInt32Constant:
case IrOpcode::kNumberConstant: case IrOpcode::kNumberConstant:
...@@ -1067,19 +1069,27 @@ static InstructionOperand SlotOrImmediate(OperandGenerator* g, Node* input) { ...@@ -1067,19 +1069,27 @@ static InstructionOperand SlotOrImmediate(OperandGenerator* g, Node* input) {
case IrOpcode::kHeapConstant: case IrOpcode::kHeapConstant:
return g->UseImmediate(input); return g->UseImmediate(input);
default: default:
return g->UseUniqueSlot(input); switch (kind) {
case FrameStateInputKind::kStackSlot:
return g->UseUniqueSlot(input);
case FrameStateInputKind::kAny:
return g->Use(input);
}
UNREACHABLE();
return InstructionOperand();
} }
} }
void InstructionSelector::AddFrameStateInputs( void InstructionSelector::AddFrameStateInputs(Node* state,
Node* state, InstructionOperandVector* inputs, InstructionOperandVector* inputs,
FrameStateDescriptor* descriptor) { FrameStateDescriptor* descriptor,
FrameStateInputKind kind) {
DCHECK_EQ(IrOpcode::kFrameState, state->op()->opcode()); DCHECK_EQ(IrOpcode::kFrameState, state->op()->opcode());
if (descriptor->outer_state()) { if (descriptor->outer_state()) {
AddFrameStateInputs(state->InputAt(kFrameStateOuterStateInput), inputs, AddFrameStateInputs(state->InputAt(kFrameStateOuterStateInput), inputs,
descriptor->outer_state()); descriptor->outer_state(), kind);
} }
Node* parameters = state->InputAt(kFrameStateParametersInput); Node* parameters = state->InputAt(kFrameStateParametersInput);
...@@ -1098,23 +1108,23 @@ void InstructionSelector::AddFrameStateInputs( ...@@ -1098,23 +1108,23 @@ void InstructionSelector::AddFrameStateInputs(
OperandGenerator g(this); OperandGenerator g(this);
size_t value_index = 0; size_t value_index = 0;
inputs->push_back(SlotOrImmediate(&g, function)); inputs->push_back(OperandForDeopt(&g, function, kind));
descriptor->SetType(value_index++, kMachAnyTagged); descriptor->SetType(value_index++, kMachAnyTagged);
for (StateValuesAccess::TypedNode input_node : for (StateValuesAccess::TypedNode input_node :
StateValuesAccess(parameters)) { StateValuesAccess(parameters)) {
inputs->push_back(SlotOrImmediate(&g, input_node.node)); inputs->push_back(OperandForDeopt(&g, input_node.node, kind));
descriptor->SetType(value_index++, input_node.type); descriptor->SetType(value_index++, input_node.type);
} }
if (descriptor->HasContext()) { if (descriptor->HasContext()) {
inputs->push_back(SlotOrImmediate(&g, context)); inputs->push_back(OperandForDeopt(&g, context, kind));
descriptor->SetType(value_index++, kMachAnyTagged); descriptor->SetType(value_index++, kMachAnyTagged);
} }
for (StateValuesAccess::TypedNode input_node : StateValuesAccess(locals)) { for (StateValuesAccess::TypedNode input_node : StateValuesAccess(locals)) {
inputs->push_back(SlotOrImmediate(&g, input_node.node)); inputs->push_back(OperandForDeopt(&g, input_node.node, kind));
descriptor->SetType(value_index++, input_node.type); descriptor->SetType(value_index++, input_node.type);
} }
for (StateValuesAccess::TypedNode input_node : StateValuesAccess(stack)) { for (StateValuesAccess::TypedNode input_node : StateValuesAccess(stack)) {
inputs->push_back(SlotOrImmediate(&g, input_node.node)); inputs->push_back(OperandForDeopt(&g, input_node.node, kind));
descriptor->SetType(value_index++, input_node.type); descriptor->SetType(value_index++, input_node.type);
} }
DCHECK(value_index == descriptor->GetSize()); DCHECK(value_index == descriptor->GetSize());
......
...@@ -22,6 +22,7 @@ class BasicBlock; ...@@ -22,6 +22,7 @@ class BasicBlock;
struct CallBuffer; // TODO(bmeurer): Remove this. struct CallBuffer; // TODO(bmeurer): Remove this.
class FlagsContinuation; class FlagsContinuation;
class Linkage; class Linkage;
class OperandGenerator;
struct SwitchInfo; struct SwitchInfo;
typedef ZoneVector<InstructionOperand> InstructionOperandVector; typedef ZoneVector<InstructionOperand> InstructionOperandVector;
...@@ -173,8 +174,13 @@ class InstructionSelector final { ...@@ -173,8 +174,13 @@ class InstructionSelector final {
bool call_address_immediate); bool call_address_immediate);
FrameStateDescriptor* GetFrameStateDescriptor(Node* node); FrameStateDescriptor* GetFrameStateDescriptor(Node* node);
enum class FrameStateInputKind { kAny, kStackSlot };
void AddFrameStateInputs(Node* state, InstructionOperandVector* inputs, void AddFrameStateInputs(Node* state, InstructionOperandVector* inputs,
FrameStateDescriptor* descriptor); FrameStateDescriptor* descriptor,
FrameStateInputKind kind);
static InstructionOperand OperandForDeopt(OperandGenerator* g, Node* input,
FrameStateInputKind kind);
// =========================================================================== // ===========================================================================
// ============= Architecture-specific graph covering methods. =============== // ============= Architecture-specific graph covering methods. ===============
......
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