Index: src/compiler/mips/instruction-selector-mips.cc |
diff --git a/src/compiler/mips/instruction-selector-mips.cc b/src/compiler/mips/instruction-selector-mips.cc |
index 459baf53d5ce897615bc68f3001511cf97f084ce..3dcf70834951217f39126bf7a247a349f0db1891 100644 |
--- a/src/compiler/mips/instruction-selector-mips.cc |
+++ b/src/compiler/mips/instruction-selector-mips.cc |
@@ -188,6 +188,8 @@ static void VisitBinop(InstructionSelector* selector, Node* node, |
if (cont->IsBranch()) { |
inputs[input_count++] = g.Label(cont->true_block()); |
inputs[input_count++] = g.Label(cont->false_block()); |
+ } else if (cont->IsTrap()) { |
+ inputs[input_count++] = g.TempImmediate(cont->trap_id()); |
} |
if (cont->IsDeoptimize()) { |
@@ -1368,9 +1370,12 @@ static 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.TempImmediate(cont->trap_id())); |
} |
} |
@@ -1578,10 +1583,13 @@ void VisitWordCompareZero(InstructionSelector* selector, Node* user, |
selector->EmitDeoptimize(opcode, g.NoOutput(), value_operand, |
g.TempImmediate(0), cont->reason(), |
cont->frame_state()); |
- } else { |
- DCHECK(cont->IsSet()); |
+ } else if (cont->IsSet()) { |
selector->Emit(opcode, g.DefineAsRegister(cont->result()), value_operand, |
g.TempImmediate(0)); |
+ } else { |
+ DCHECK(cont->IsTrap()); |
+ selector->Emit(opcode, g.NoOutput(), value_operand, g.TempImmediate(0), |
+ g.TempImmediate(cont->trap_id())); |
} |
} |
@@ -1606,12 +1614,16 @@ void InstructionSelector::VisitDeoptimizeUnless(Node* node) { |
} |
void InstructionSelector::VisitTrapIf(Node* node, Runtime::FunctionId func_id) { |
- UNREACHABLE(); |
+ FlagsContinuation cont = |
+ FlagsContinuation::ForTrap(kNotEqual, func_id, node->InputAt(1)); |
+ VisitWordCompareZero(this, node, node->InputAt(0), &cont); |
} |
void InstructionSelector::VisitTrapUnless(Node* node, |
Runtime::FunctionId func_id) { |
- UNREACHABLE(); |
+ FlagsContinuation cont = |
+ FlagsContinuation::ForTrap(kEqual, func_id, node->InputAt(1)); |
+ VisitWordCompareZero(this, node, node->InputAt(0), &cont); |
} |
void InstructionSelector::VisitSwitch(Node* node, const SwitchInfo& sw) { |