Index: src/compiler/x64/instruction-selector-x64.cc |
diff --git a/src/compiler/x64/instruction-selector-x64.cc b/src/compiler/x64/instruction-selector-x64.cc |
index b43d42679e449c9ee7b9f675e123988f9964946c..f77aec9c920766b627ef534e0011595c812b9099 100644 |
--- a/src/compiler/x64/instruction-selector-x64.cc |
+++ b/src/compiler/x64/instruction-selector-x64.cc |
@@ -1687,10 +1687,13 @@ void VisitCompareWithMemoryOperand(InstructionSelector* selector, |
} else if (cont->IsDeoptimize()) { |
selector->EmitDeoptimize(opcode, 0, nullptr, input_count, inputs, |
cont->reason(), cont->frame_state()); |
- } else { |
- DCHECK(cont->IsSet()); |
+ } else if (cont->IsSet()) { |
InstructionOperand output = g.DefineAsRegister(cont->result()); |
selector->Emit(opcode, 1, &output, input_count, inputs); |
+ } else { |
+ DCHECK(cont->IsTrap()); |
+ inputs[input_count++] = g.UseImmediate(cont->trap_id()); |
+ selector->Emit(opcode, 0, nullptr, input_count, inputs); |
} |
} |
@@ -1706,9 +1709,12 @@ void VisitCompare(InstructionSelector* selector, InstructionCode opcode, |
} else if (cont->IsDeoptimize()) { |
selector->EmitDeoptimize(opcode, g.NoOutput(), left, right, cont->reason(), |
cont->frame_state()); |
- } else { |
- DCHECK(cont->IsSet()); |
+ } else if (cont->IsSet()) { |
selector->Emit(opcode, g.DefineAsRegister(cont->result()), left, right); |
+ } else { |
+ DCHECK(cont->IsTrap()); |
+ selector->Emit(opcode, g.NoOutput(), left, right, |
+ g.UseImmediate(cont->trap_id())); |
} |
} |
@@ -1858,9 +1864,11 @@ void VisitWord64Compare(InstructionSelector* selector, Node* node, |
} else if (cont->IsDeoptimize()) { |
selector->EmitDeoptimize(opcode, 0, nullptr, 0, nullptr, cont->reason(), |
cont->frame_state()); |
- } else { |
- DCHECK(cont->IsSet()); |
+ } else if (cont->IsSet()) { |
selector->Emit(opcode, g.DefineAsRegister(cont->result())); |
+ } else { |
+ DCHECK(cont->IsTrap()); |
+ selector->Emit(opcode, g.NoOutput(), g.UseImmediate(cont->trap_id())); |
} |
return; |
} |
@@ -2068,6 +2076,19 @@ void InstructionSelector::VisitDeoptimizeUnless(Node* node) { |
VisitWordCompareZero(this, node, node->InputAt(0), &cont); |
} |
+void InstructionSelector::VisitTrapIf(Node* node) { |
+ FlagsContinuation cont = FlagsContinuation::ForTrap( |
+ kNotEqual, OpParameter<Runtime::FunctionId>(node->op()), |
+ node->InputAt(1)); |
+ VisitWordCompareZero(this, node, node->InputAt(0), &cont); |
+} |
+ |
+void InstructionSelector::VisitTrapUnless(Node* node) { |
+ FlagsContinuation cont = FlagsContinuation::ForTrap( |
+ kEqual, OpParameter<Runtime::FunctionId>(node->op()), node->InputAt(1)); |
+ VisitWordCompareZero(this, node, node->InputAt(0), &cont); |
+} |
+ |
void InstructionSelector::VisitSwitch(Node* node, const SwitchInfo& sw) { |
X64OperandGenerator g(this); |
InstructionOperand value_operand = g.UseRegister(node->InputAt(0)); |