Reviewers: Benedikt Meurer,
Message:
Benedikt, could you take a look, please?
Description:
[turbofan] Do not force stack slot for eager deopt inputs.
[email protected]
Please review this at https://codereview.chromium.org/1307203005/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+28, -14 lines):
M src/compiler/instruction-selector.h
M src/compiler/instruction-selector.cc
Index: src/compiler/instruction-selector.cc
diff --git a/src/compiler/instruction-selector.cc
b/src/compiler/instruction-selector.cc
index
0ae1c63fea2a336dc55028d2dfa62267e125490f..03106d69e5b8bf772433d9f9235b0399d1cdc2ab
100644
--- a/src/compiler/instruction-selector.cc
+++ b/src/compiler/instruction-selector.cc
@@ -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,25 @@ static InstructionOperand
SlotOrImmediate(OperandGenerator* g, Node* input) {
case IrOpcode::kHeapConstant:
return g->UseImmediate(input);
default:
- return g->UseUniqueSlot(input);
+ switch (kind) {
+ case FrameStateInputKind::kStackSlot:
+ return g->UseUniqueSlot(input);
+ case FrameStateInputKind::kAny:
+ return g->Use(input);
+ }
}
}
-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 +1106,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());
Index: src/compiler/instruction-selector.h
diff --git a/src/compiler/instruction-selector.h
b/src/compiler/instruction-selector.h
index
9a0744720a099295361e8ab603bb7f6277d0bfcc..b8354fcfd1e2aa07bcda1337c1c18687fe444a41
100644
--- a/src/compiler/instruction-selector.h
+++ b/src/compiler/instruction-selector.h
@@ -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.
===============
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.