Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Unified Diff: src/compiler/instruction-selector.cc

Issue 1015423002: [turbofan] Remember types for deoptimization during simplified lowering. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address review comments Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/instruction-selector.h ('k') | src/compiler/liveness-analyzer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/instruction-selector.cc
diff --git a/src/compiler/instruction-selector.cc b/src/compiler/instruction-selector.cc
index 11d52cfeffca53ccb79ba09dd5eb30d75f5d431b..0d0314dda328d26c78b9bf3f5cf6fcd2c38d69c2 100644
--- a/src/compiler/instruction-selector.cc
+++ b/src/compiler/instruction-selector.cc
@@ -574,147 +574,6 @@ void InstructionSelector::VisitControl(BasicBlock* block) {
}
-MachineType InstructionSelector::GetMachineType(Node* node) {
- DCHECK_NOT_NULL(schedule()->block(node)); // should only use scheduled nodes.
- switch (node->opcode()) {
- case IrOpcode::kStart:
- case IrOpcode::kLoop:
- case IrOpcode::kEnd:
- case IrOpcode::kBranch:
- case IrOpcode::kIfTrue:
- case IrOpcode::kIfFalse:
- case IrOpcode::kSwitch:
- case IrOpcode::kIfValue:
- case IrOpcode::kIfDefault:
- case IrOpcode::kEffectPhi:
- case IrOpcode::kEffectSet:
- case IrOpcode::kMerge:
- // No code needed for these graph artifacts.
- return kMachNone;
- case IrOpcode::kFinish:
- return kMachAnyTagged;
- case IrOpcode::kParameter:
- return linkage()->GetParameterType(OpParameter<int>(node));
- case IrOpcode::kOsrValue:
- return kMachAnyTagged;
- case IrOpcode::kPhi:
- return OpParameter<MachineType>(node);
- case IrOpcode::kProjection:
- // TODO(jarin) Really project from outputs.
- return kMachAnyTagged;
- case IrOpcode::kInt32Constant:
- return kMachInt32;
- case IrOpcode::kInt64Constant:
- return kMachInt64;
- case IrOpcode::kExternalConstant:
- return kMachPtr;
- case IrOpcode::kFloat64Constant:
- return kMachFloat64;
- case IrOpcode::kHeapConstant:
- case IrOpcode::kNumberConstant:
- return kMachAnyTagged;
- case IrOpcode::kCall:
- return kMachAnyTagged;
- case IrOpcode::kFrameState:
- case IrOpcode::kStateValues:
- return kMachNone;
- case IrOpcode::kLoad:
- return OpParameter<LoadRepresentation>(node);
- case IrOpcode::kStore:
- return kMachNone;
- case IrOpcode::kCheckedLoad:
- return OpParameter<MachineType>(node);
- case IrOpcode::kCheckedStore:
- return kMachNone;
- case IrOpcode::kWord32And:
- case IrOpcode::kWord32Or:
- case IrOpcode::kWord32Xor:
- case IrOpcode::kWord32Shl:
- case IrOpcode::kWord32Shr:
- case IrOpcode::kWord32Sar:
- case IrOpcode::kWord32Ror:
- return kMachInt32;
- case IrOpcode::kWord32Equal:
- return kMachBool;
- case IrOpcode::kWord64And:
- case IrOpcode::kWord64Or:
- case IrOpcode::kWord64Xor:
- case IrOpcode::kWord64Shl:
- case IrOpcode::kWord64Shr:
- case IrOpcode::kWord64Sar:
- case IrOpcode::kWord64Ror:
- return kMachInt64;
- case IrOpcode::kWord64Equal:
- return kMachBool;
- case IrOpcode::kInt32Add:
- case IrOpcode::kInt32AddWithOverflow:
- case IrOpcode::kInt32Sub:
- case IrOpcode::kInt32SubWithOverflow:
- case IrOpcode::kInt32Mul:
- case IrOpcode::kInt32Div:
- case IrOpcode::kInt32Mod:
- return kMachInt32;
- case IrOpcode::kInt32LessThan:
- case IrOpcode::kInt32LessThanOrEqual:
- case IrOpcode::kUint32LessThan:
- case IrOpcode::kUint32LessThanOrEqual:
- return kMachBool;
- case IrOpcode::kInt64Add:
- case IrOpcode::kInt64Sub:
- case IrOpcode::kInt64Mul:
- case IrOpcode::kInt64Div:
- case IrOpcode::kInt64Mod:
- return kMachInt64;
- case IrOpcode::kInt64LessThan:
- case IrOpcode::kInt64LessThanOrEqual:
- return kMachBool;
- case IrOpcode::kChangeFloat32ToFloat64:
- case IrOpcode::kChangeInt32ToFloat64:
- case IrOpcode::kChangeUint32ToFloat64:
- return kMachFloat64;
- case IrOpcode::kChangeFloat64ToInt32:
- return kMachInt32;
- case IrOpcode::kChangeFloat64ToUint32:
- return kMachUint32;
- case IrOpcode::kChangeInt32ToInt64:
- return kMachInt64;
- case IrOpcode::kChangeUint32ToUint64:
- return kMachUint64;
- case IrOpcode::kTruncateFloat64ToFloat32:
- return kMachFloat32;
- case IrOpcode::kTruncateFloat64ToInt32:
- case IrOpcode::kTruncateInt64ToInt32:
- return kMachInt32;
- case IrOpcode::kFloat64Add:
- case IrOpcode::kFloat64Sub:
- case IrOpcode::kFloat64Mul:
- case IrOpcode::kFloat64Div:
- case IrOpcode::kFloat64Mod:
- case IrOpcode::kFloat64Max:
- case IrOpcode::kFloat64Min:
- case IrOpcode::kFloat64Sqrt:
- case IrOpcode::kFloat64RoundDown:
- case IrOpcode::kFloat64RoundTruncate:
- case IrOpcode::kFloat64RoundTiesAway:
- return kMachFloat64;
- case IrOpcode::kFloat64Equal:
- case IrOpcode::kFloat64LessThan:
- case IrOpcode::kFloat64LessThanOrEqual:
- return kMachBool;
- case IrOpcode::kFloat64ExtractLowWord32:
- case IrOpcode::kFloat64ExtractHighWord32:
- return kMachInt32;
- case IrOpcode::kFloat64InsertLowWord32:
- case IrOpcode::kFloat64InsertHighWord32:
- return kMachFloat64;
- default:
- V8_Fatal(__FILE__, __LINE__, "Unexpected operator #%d:%s @ node #%d",
- node->opcode(), node->op()->mnemonic(), node->id());
- }
- return kMachNone;
-}
-
-
void InstructionSelector::VisitNode(Node* node) {
DCHECK_NOT_NULL(schedule()->block(node)); // should only use scheduled nodes.
SourcePosition source_position = source_positions_->GetSourcePosition(node);
@@ -1149,9 +1008,9 @@ FrameStateDescriptor* InstructionSelector::GetFrameStateDescriptor(
Node* state) {
DCHECK(state->opcode() == IrOpcode::kFrameState);
DCHECK_EQ(5, state->InputCount());
- DCHECK_EQ(IrOpcode::kStateValues, state->InputAt(0)->opcode());
- DCHECK_EQ(IrOpcode::kStateValues, state->InputAt(1)->opcode());
- DCHECK_EQ(IrOpcode::kStateValues, state->InputAt(2)->opcode());
+ DCHECK_EQ(IrOpcode::kTypedStateValues, state->InputAt(0)->opcode());
+ DCHECK_EQ(IrOpcode::kTypedStateValues, state->InputAt(1)->opcode());
+ DCHECK_EQ(IrOpcode::kTypedStateValues, state->InputAt(2)->opcode());
FrameStateCallInfo state_info = OpParameter<FrameStateCallInfo>(state);
int parameters =
@@ -1197,9 +1056,9 @@ void InstructionSelector::AddFrameStateInputs(
Node* stack = state->InputAt(2);
Node* context = state->InputAt(3);
- DCHECK_EQ(IrOpcode::kStateValues, parameters->op()->opcode());
- DCHECK_EQ(IrOpcode::kStateValues, locals->op()->opcode());
- DCHECK_EQ(IrOpcode::kStateValues, stack->op()->opcode());
+ DCHECK_EQ(IrOpcode::kTypedStateValues, parameters->op()->opcode());
+ DCHECK_EQ(IrOpcode::kTypedStateValues, locals->op()->opcode());
+ DCHECK_EQ(IrOpcode::kTypedStateValues, stack->op()->opcode());
DCHECK_EQ(descriptor->parameters_count(),
StateValuesAccess(parameters).size());
@@ -1211,21 +1070,22 @@ void InstructionSelector::AddFrameStateInputs(
OperandGenerator g(this);
size_t value_index = 0;
- for (Node* input_node : StateValuesAccess(parameters)) {
- inputs->push_back(UseOrImmediate(&g, input_node));
- descriptor->SetType(value_index++, GetMachineType(input_node));
+ for (StateValuesAccess::TypedNode input_node :
+ StateValuesAccess(parameters)) {
+ inputs->push_back(UseOrImmediate(&g, input_node.node));
+ descriptor->SetType(value_index++, input_node.type);
}
if (descriptor->HasContext()) {
inputs->push_back(UseOrImmediate(&g, context));
descriptor->SetType(value_index++, kMachAnyTagged);
}
- for (Node* input_node : StateValuesAccess(locals)) {
- inputs->push_back(UseOrImmediate(&g, input_node));
- descriptor->SetType(value_index++, GetMachineType(input_node));
+ for (StateValuesAccess::TypedNode input_node : StateValuesAccess(locals)) {
+ inputs->push_back(UseOrImmediate(&g, input_node.node));
+ descriptor->SetType(value_index++, input_node.type);
}
- for (Node* input_node : StateValuesAccess(stack)) {
- inputs->push_back(UseOrImmediate(&g, input_node));
- descriptor->SetType(value_index++, GetMachineType(input_node));
+ for (StateValuesAccess::TypedNode input_node : StateValuesAccess(stack)) {
+ inputs->push_back(UseOrImmediate(&g, input_node.node));
+ descriptor->SetType(value_index++, input_node.type);
}
DCHECK(value_index == descriptor->GetSize());
}
« no previous file with comments | « src/compiler/instruction-selector.h ('k') | src/compiler/liveness-analyzer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698