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