Index: src/compiler/ppc/instruction-selector-ppc.cc |
diff --git a/src/compiler/ppc/instruction-selector-ppc.cc b/src/compiler/ppc/instruction-selector-ppc.cc |
index 244e6f44c5b4b61cdfae198186128c5d70ae2bb7..e89506262489db0fa0565240426396571f22d73a 100644 |
--- a/src/compiler/ppc/instruction-selector-ppc.cc |
+++ b/src/compiler/ppc/instruction-selector-ppc.cc |
@@ -144,8 +144,13 @@ void VisitBinop(InstructionSelector* selector, Node* node, |
DCHECK_GE(arraysize(inputs), input_count); |
DCHECK_GE(arraysize(outputs), output_count); |
- selector->Emit(cont->Encode(opcode), output_count, outputs, input_count, |
- inputs); |
+ opcode = cont->Encode(opcode); |
+ if (cont->IsDeoptimize()) { |
+ selector->EmitDeoptimize(opcode, output_count, outputs, input_count, inputs, |
+ cont->frame_state()); |
+ } else { |
+ selector->Emit(opcode, output_count, outputs, input_count, inputs); |
+ } |
} |
@@ -1264,7 +1269,7 @@ void InstructionSelector::VisitFloat64RoundTiesEven(Node* node) { |
void InstructionSelector::VisitInt32AddWithOverflow(Node* node) { |
if (Node* ovf = NodeProperties::FindProjection(node, 1)) { |
- FlagsContinuation cont(kOverflow, ovf); |
+ FlagsContinuation cont = FlagsContinuation::ForSet(kOverflow, ovf); |
return VisitBinop<Int32BinopMatcher>(this, node, kPPC_AddWithOverflow32, |
kInt16Imm, &cont); |
} |
@@ -1276,7 +1281,7 @@ void InstructionSelector::VisitInt32AddWithOverflow(Node* node) { |
void InstructionSelector::VisitInt32SubWithOverflow(Node* node) { |
if (Node* ovf = NodeProperties::FindProjection(node, 1)) { |
- FlagsContinuation cont(kOverflow, ovf); |
+ FlagsContinuation cont = FlagsContinuation::ForSet(kOverflow, ovf); |
return VisitBinop<Int32BinopMatcher>(this, node, kPPC_SubWithOverflow32, |
kInt16Imm_Negate, &cont); |
} |
@@ -1289,7 +1294,7 @@ void InstructionSelector::VisitInt32SubWithOverflow(Node* node) { |
#if V8_TARGET_ARCH_PPC64 |
void InstructionSelector::VisitInt64AddWithOverflow(Node* node) { |
if (Node* ovf = NodeProperties::FindProjection(node, 1)) { |
- FlagsContinuation cont(kOverflow, ovf); |
+ FlagsContinuation cont = FlagsContinuation::ForSet(kOverflow, ovf); |
return VisitBinop<Int64BinopMatcher>(this, node, kPPC_Add, kInt16Imm, |
&cont); |
} |
@@ -1300,7 +1305,7 @@ void InstructionSelector::VisitInt64AddWithOverflow(Node* node) { |
void InstructionSelector::VisitInt64SubWithOverflow(Node* node) { |
if (Node* ovf = NodeProperties::FindProjection(node, 1)) { |
- FlagsContinuation cont(kOverflow, ovf); |
+ FlagsContinuation cont = FlagsContinuation::ForSet(kOverflow, ovf); |
return VisitBinop<Int64BinopMatcher>(this, node, kPPC_Sub, kInt16Imm_Negate, |
&cont); |
} |
@@ -1336,6 +1341,9 @@ void VisitCompare(InstructionSelector* selector, InstructionCode opcode, |
if (cont->IsBranch()) { |
selector->Emit(opcode, g.NoOutput(), left, right, |
g.Label(cont->true_block()), g.Label(cont->false_block())); |
+ } else if (cont->IsDeoptimize()) { |
+ selector->EmitDeoptimize(opcode, g.NoOutput(), left, right, |
+ cont->frame_state()); |
} else { |
DCHECK(cont->IsSet()); |
selector->Emit(opcode, g.DefineAsRegister(cont->result()), left, right); |
@@ -1573,6 +1581,17 @@ void InstructionSelector::VisitBranch(Node* branch, BasicBlock* tbranch, |
VisitWord32CompareZero(this, branch, branch->InputAt(0), &cont); |
} |
+void InstructionSelector::VisitDeoptimizeIf(Node* node) { |
+ FlagsContinuation cont = |
+ FlagsContinuation::ForDeoptimize(kNotEqual, node->InputAt(1)); |
+ VisitWord32CompareZero(this, node, node->InputAt(0), &cont); |
+} |
+ |
+void InstructionSelector::VisitDeoptimizeUnless(Node* node) { |
+ FlagsContinuation cont = |
+ FlagsContinuation::ForDeoptimize(kEqual, node->InputAt(1)); |
+ VisitWord32CompareZero(this, node, node->InputAt(0), &cont); |
+} |
void InstructionSelector::VisitSwitch(Node* node, const SwitchInfo& sw) { |
PPCOperandGenerator g(this); |
@@ -1603,7 +1622,7 @@ void InstructionSelector::VisitSwitch(Node* node, const SwitchInfo& sw) { |
void InstructionSelector::VisitWord32Equal(Node* const node) { |
- FlagsContinuation cont(kEqual, node); |
+ FlagsContinuation cont = FlagsContinuation::ForSet(kEqual, node); |
Int32BinopMatcher m(node); |
if (m.right().Is(0)) { |
return VisitWord32CompareZero(this, m.node(), m.left().node(), &cont); |
@@ -1613,32 +1632,34 @@ void InstructionSelector::VisitWord32Equal(Node* const node) { |
void InstructionSelector::VisitInt32LessThan(Node* node) { |
- FlagsContinuation cont(kSignedLessThan, node); |
+ FlagsContinuation cont = FlagsContinuation::ForSet(kSignedLessThan, node); |
VisitWord32Compare(this, node, &cont); |
} |
void InstructionSelector::VisitInt32LessThanOrEqual(Node* node) { |
- FlagsContinuation cont(kSignedLessThanOrEqual, node); |
+ FlagsContinuation cont = |
+ FlagsContinuation::ForSet(kSignedLessThanOrEqual, node); |
VisitWord32Compare(this, node, &cont); |
} |
void InstructionSelector::VisitUint32LessThan(Node* node) { |
- FlagsContinuation cont(kUnsignedLessThan, node); |
+ FlagsContinuation cont = FlagsContinuation::ForSet(kUnsignedLessThan, node); |
VisitWord32Compare(this, node, &cont); |
} |
void InstructionSelector::VisitUint32LessThanOrEqual(Node* node) { |
- FlagsContinuation cont(kUnsignedLessThanOrEqual, node); |
+ FlagsContinuation cont = |
+ FlagsContinuation::ForSet(kUnsignedLessThanOrEqual, node); |
VisitWord32Compare(this, node, &cont); |
} |
#if V8_TARGET_ARCH_PPC64 |
void InstructionSelector::VisitWord64Equal(Node* const node) { |
- FlagsContinuation cont(kEqual, node); |
+ FlagsContinuation cont = FlagsContinuation::ForSet(kEqual, node); |
Int64BinopMatcher m(node); |
if (m.right().Is(0)) { |
return VisitWord64CompareZero(this, m.node(), m.left().node(), &cont); |
@@ -1648,62 +1669,66 @@ void InstructionSelector::VisitWord64Equal(Node* const node) { |
void InstructionSelector::VisitInt64LessThan(Node* node) { |
- FlagsContinuation cont(kSignedLessThan, node); |
+ FlagsContinuation cont = FlagsContinuation::ForSet(kSignedLessThan, node); |
VisitWord64Compare(this, node, &cont); |
} |
void InstructionSelector::VisitInt64LessThanOrEqual(Node* node) { |
- FlagsContinuation cont(kSignedLessThanOrEqual, node); |
+ FlagsContinuation cont = |
+ FlagsContinuation::ForSet(kSignedLessThanOrEqual, node); |
VisitWord64Compare(this, node, &cont); |
} |
void InstructionSelector::VisitUint64LessThan(Node* node) { |
- FlagsContinuation cont(kUnsignedLessThan, node); |
+ FlagsContinuation cont = FlagsContinuation::ForSet(kUnsignedLessThan, node); |
VisitWord64Compare(this, node, &cont); |
} |
void InstructionSelector::VisitUint64LessThanOrEqual(Node* node) { |
- FlagsContinuation cont(kUnsignedLessThanOrEqual, node); |
+ FlagsContinuation cont = |
+ FlagsContinuation::ForSet(kUnsignedLessThanOrEqual, node); |
VisitWord64Compare(this, node, &cont); |
} |
#endif |
void InstructionSelector::VisitFloat32Equal(Node* node) { |
- FlagsContinuation cont(kEqual, node); |
+ FlagsContinuation cont = FlagsContinuation::ForSet(kEqual, node); |
VisitFloat32Compare(this, node, &cont); |
} |
void InstructionSelector::VisitFloat32LessThan(Node* node) { |
- FlagsContinuation cont(kUnsignedLessThan, node); |
+ FlagsContinuation cont = FlagsContinuation::ForSet(kUnsignedLessThan, node); |
VisitFloat32Compare(this, node, &cont); |
} |
void InstructionSelector::VisitFloat32LessThanOrEqual(Node* node) { |
- FlagsContinuation cont(kUnsignedLessThanOrEqual, node); |
+ FlagsContinuation cont = |
+ FlagsContinuation::ForSet(kUnsignedLessThanOrEqual, node); |
VisitFloat32Compare(this, node, &cont); |
} |
void InstructionSelector::VisitFloat64Equal(Node* node) { |
- FlagsContinuation cont(kEqual, node); |
+ FlagsContinuation cont = FlagsContinuation::ForSet(kEqual, node); |
VisitFloat64Compare(this, node, &cont); |
} |
void InstructionSelector::VisitFloat64LessThan(Node* node) { |
- FlagsContinuation cont(kUnsignedLessThan, node); |
+ FlagsContinuation cont = FlagsContinuation::ForSet(kUnsignedLessThan, node); |
VisitFloat64Compare(this, node, &cont); |
} |
void InstructionSelector::VisitFloat64LessThanOrEqual(Node* node) { |
- FlagsContinuation cont(kUnsignedLessThanOrEqual, node); |
+ FlagsContinuation cont = |
+ FlagsContinuation::ForSet(kUnsignedLessThanOrEqual, node); |
VisitFloat64Compare(this, node, &cont); |
} |