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

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

Issue 2177483002: [turbofan] Handle impossible types (Type::None()) in the backend. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix?? Created 4 years, 5 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
Index: src/compiler/instruction-selector.cc
diff --git a/src/compiler/instruction-selector.cc b/src/compiler/instruction-selector.cc
index ec34fe8c09aeef0fbf365601e1a43ec80aadea6b..0f046d681be8c96118bca4d91621b315fcf77dae 100644
--- a/src/compiler/instruction-selector.cc
+++ b/src/compiler/instruction-selector.cc
@@ -344,9 +344,9 @@ namespace {
enum class FrameStateInputKind { kAny, kStackSlot };
-
InstructionOperand OperandForDeopt(OperandGenerator* g, Node* input,
- FrameStateInputKind kind) {
+ FrameStateInputKind kind,
+ MachineRepresentation rep) {
switch (input->opcode()) {
case IrOpcode::kInt32Constant:
case IrOpcode::kNumberConstant:
@@ -358,11 +358,15 @@ InstructionOperand OperandForDeopt(OperandGenerator* g, Node* input,
UNREACHABLE();
break;
default:
- switch (kind) {
- case FrameStateInputKind::kStackSlot:
- return g->UseUniqueSlot(input);
- case FrameStateInputKind::kAny:
- return g->UseAny(input);
+ if (rep == MachineRepresentation::kNone) {
+ return g->TempImmediate(FrameStateDescriptor::kImpossibleValue);
+ } else {
+ switch (kind) {
+ case FrameStateInputKind::kStackSlot:
+ return g->UseUniqueSlot(input);
+ case FrameStateInputKind::kAny:
+ return g->UseAny(input);
+ }
}
}
UNREACHABLE();
@@ -428,7 +432,7 @@ size_t AddOperandToStateValueDescriptor(StateValueDescriptor* descriptor,
break;
}
default: {
- inputs->push_back(OperandForDeopt(g, input, kind));
+ inputs->push_back(OperandForDeopt(g, input, kind, type.representation()));
descriptor->fields().push_back(StateValueDescriptor::Plain(zone, type));
return 1;
}
@@ -885,6 +889,7 @@ void InstructionSelector::VisitNode(Node* node) {
return MarkAsReference(node), VisitOsrValue(node);
case IrOpcode::kPhi: {
MachineRepresentation rep = PhiRepresentationOf(node->op());
+ if (rep == MachineRepresentation::kNone) return;
MarkAsRepresentation(rep, node);
return VisitPhi(node);
}
@@ -1048,6 +1053,19 @@ void InstructionSelector::VisitNode(Node* node) {
return MarkAsWord32(node), VisitChangeFloat64ToInt32(node);
case IrOpcode::kChangeFloat64ToUint32:
return MarkAsWord32(node), VisitChangeFloat64ToUint32(node);
+ case IrOpcode::kImpossibleToWord32:
+ return MarkAsWord32(node), VisitImpossibleToWord32(node);
+ case IrOpcode::kImpossibleToWord64:
+ return MarkAsWord64(node), VisitImpossibleToWord64(node);
+ case IrOpcode::kImpossibleToFloat32:
+ return MarkAsFloat32(node), VisitImpossibleToFloat32(node);
+ case IrOpcode::kImpossibleToFloat64:
+ return MarkAsFloat64(node), VisitImpossibleToFloat64(node);
+ case IrOpcode::kImpossibleToTagged:
+ MarkAsRepresentation(MachineType::PointerRepresentation(), node);
+ return VisitImpossibleToTagged(node);
+ case IrOpcode::kImpossibleToBit:
+ return MarkAsWord32(node), VisitImpossibleToBit(node);
case IrOpcode::kFloat64SilenceNaN:
MarkAsFloat64(node);
if (CanProduceSignalingNaN(node->InputAt(0))) {
@@ -1277,13 +1295,47 @@ void InstructionSelector::VisitNode(Node* node) {
}
}
+void InstructionSelector::VisitImpossibleToWord32(Node* node) {
+ OperandGenerator g(this);
+ Emit(kArchImpossible, g.DefineAsConstant(node, Constant(0)));
+}
+
+void InstructionSelector::VisitImpossibleToWord64(Node* node) {
+ OperandGenerator g(this);
+ Emit(kArchImpossible,
+ g.DefineAsConstant(node, Constant(static_cast<int64_t>(0))));
+}
+
+void InstructionSelector::VisitImpossibleToFloat32(Node* node) {
+ OperandGenerator g(this);
+ Emit(kArchImpossible, g.DefineAsConstant(node, Constant(0.0f)));
+}
+
+void InstructionSelector::VisitImpossibleToFloat64(Node* node) {
+ OperandGenerator g(this);
+ Emit(kArchImpossible, g.DefineAsConstant(node, Constant(0.0)));
+}
+
+void InstructionSelector::VisitImpossibleToBit(Node* node) {
+ OperandGenerator g(this);
+ Emit(kArchImpossible, g.DefineAsConstant(node, Constant(0)));
+}
+
+void InstructionSelector::VisitImpossibleToTagged(Node* node) {
+ OperandGenerator g(this);
+#if V8_TARGET_ARCH_64_BIT
Benedikt Meurer 2016/07/24 17:23:41 How about a simpler approach? Emit(kArchImpossibl
Jarin 2016/07/24 18:15:40 I tried that, did not compile on Mac. See the diff
Benedikt Meurer 2016/07/25 03:36:51 Mhm, that's weird.
+ Emit(kArchImpossible,
+ g.DefineAsConstant(node, Constant(static_cast<int64_t>(0))));
+#else // V8_TARGET_ARCH_64_BIT
+ Emit(kArchImpossible, g.DefineAsConstant(node, Constant(0)));
+#endif // V8_TARGET_ARCH_64_BIT
+}
void InstructionSelector::VisitLoadStackPointer(Node* node) {
OperandGenerator g(this);
Emit(kArchStackPointer, g.DefineAsRegister(node));
}
-
void InstructionSelector::VisitLoadFramePointer(Node* node) {
OperandGenerator g(this);
Emit(kArchFramePointer, g.DefineAsRegister(node));

Powered by Google App Engine
This is Rietveld 408576698