[turbofan] Add MachineType to Phi.
TEST=cctest,compiler-unittests,mjsunit R=mstarzinger@chromium.org, titzer@chromium.org Review URL: https://codereview.chromium.org/545153002 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23728 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
1dddf69fdc
commit
99ccab81e2
@ -130,7 +130,7 @@ TARGET_TEST_P(ChangeLoweringCommonTest, ChangeBitToBool) {
|
||||
Node* phi = reduction.replacement();
|
||||
Capture<Node*> branch;
|
||||
EXPECT_THAT(phi,
|
||||
IsPhi(IsTrueConstant(), IsFalseConstant(),
|
||||
IsPhi(kMachAnyTagged, IsTrueConstant(), IsFalseConstant(),
|
||||
IsMerge(IsIfTrue(AllOf(CaptureEq(&branch),
|
||||
IsBranch(val, graph()->start()))),
|
||||
IsIfFalse(CaptureEq(&branch)))));
|
||||
@ -201,7 +201,8 @@ TARGET_TEST_F(ChangeLowering32Test, ChangeInt32ToTagged) {
|
||||
Capture<Node*> add, branch, heap_number, if_true;
|
||||
EXPECT_THAT(
|
||||
phi,
|
||||
IsPhi(IsFinish(
|
||||
IsPhi(kMachAnyTagged,
|
||||
IsFinish(
|
||||
AllOf(CaptureEq(&heap_number),
|
||||
IsAllocateHeapNumber(_, CaptureEq(&if_true))),
|
||||
IsStore(kMachFloat64, kNoWriteBarrier, CaptureEq(&heap_number),
|
||||
@ -231,6 +232,7 @@ TARGET_TEST_F(ChangeLowering32Test, ChangeTaggedToFloat64) {
|
||||
EXPECT_THAT(
|
||||
phi,
|
||||
IsPhi(
|
||||
kMachFloat64,
|
||||
IsLoad(kMachFloat64, val, IsInt32Constant(HeapNumberValueOffset()),
|
||||
IsControlEffect(CaptureEq(&if_true))),
|
||||
IsChangeInt32ToFloat64(
|
||||
@ -258,7 +260,8 @@ TARGET_TEST_F(ChangeLowering32Test, ChangeTaggedToInt32) {
|
||||
Capture<Node*> branch, if_true;
|
||||
EXPECT_THAT(
|
||||
phi,
|
||||
IsPhi(IsChangeFloat64ToInt32(IsLoad(
|
||||
IsPhi(kMachInt32,
|
||||
IsChangeFloat64ToInt32(IsLoad(
|
||||
kMachFloat64, val, IsInt32Constant(HeapNumberValueOffset()),
|
||||
IsControlEffect(CaptureEq(&if_true)))),
|
||||
IsWord32Sar(val, IsInt32Constant(SmiShiftAmount())),
|
||||
@ -283,7 +286,8 @@ TARGET_TEST_F(ChangeLowering32Test, ChangeTaggedToUint32) {
|
||||
Capture<Node*> branch, if_true;
|
||||
EXPECT_THAT(
|
||||
phi,
|
||||
IsPhi(IsChangeFloat64ToUint32(IsLoad(
|
||||
IsPhi(kMachUint32,
|
||||
IsChangeFloat64ToUint32(IsLoad(
|
||||
kMachFloat64, val, IsInt32Constant(HeapNumberValueOffset()),
|
||||
IsControlEffect(CaptureEq(&if_true)))),
|
||||
IsWord32Sar(val, IsInt32Constant(SmiShiftAmount())),
|
||||
@ -309,7 +313,7 @@ TARGET_TEST_F(ChangeLowering32Test, ChangeUint32ToTagged) {
|
||||
EXPECT_THAT(
|
||||
phi,
|
||||
IsPhi(
|
||||
IsWord32Shl(val, IsInt32Constant(SmiShiftAmount())),
|
||||
kMachAnyTagged, IsWord32Shl(val, IsInt32Constant(SmiShiftAmount())),
|
||||
IsFinish(
|
||||
AllOf(CaptureEq(&heap_number),
|
||||
IsAllocateHeapNumber(_, CaptureEq(&if_false))),
|
||||
@ -365,6 +369,7 @@ TARGET_TEST_F(ChangeLowering64Test, ChangeTaggedToFloat64) {
|
||||
EXPECT_THAT(
|
||||
phi,
|
||||
IsPhi(
|
||||
kMachFloat64,
|
||||
IsLoad(kMachFloat64, val, IsInt32Constant(HeapNumberValueOffset()),
|
||||
IsControlEffect(CaptureEq(&if_true))),
|
||||
IsChangeInt32ToFloat64(IsTruncateInt64ToInt32(
|
||||
@ -392,7 +397,8 @@ TARGET_TEST_F(ChangeLowering64Test, ChangeTaggedToInt32) {
|
||||
Capture<Node*> branch, if_true;
|
||||
EXPECT_THAT(
|
||||
phi,
|
||||
IsPhi(IsChangeFloat64ToInt32(IsLoad(
|
||||
IsPhi(kMachInt32,
|
||||
IsChangeFloat64ToInt32(IsLoad(
|
||||
kMachFloat64, val, IsInt32Constant(HeapNumberValueOffset()),
|
||||
IsControlEffect(CaptureEq(&if_true)))),
|
||||
IsTruncateInt64ToInt32(
|
||||
@ -418,7 +424,8 @@ TARGET_TEST_F(ChangeLowering64Test, ChangeTaggedToUint32) {
|
||||
Capture<Node*> branch, if_true;
|
||||
EXPECT_THAT(
|
||||
phi,
|
||||
IsPhi(IsChangeFloat64ToUint32(IsLoad(
|
||||
IsPhi(kMachUint32,
|
||||
IsChangeFloat64ToUint32(IsLoad(
|
||||
kMachFloat64, val, IsInt32Constant(HeapNumberValueOffset()),
|
||||
IsControlEffect(CaptureEq(&if_true)))),
|
||||
IsTruncateInt64ToInt32(
|
||||
@ -445,8 +452,8 @@ TARGET_TEST_F(ChangeLowering64Test, ChangeUint32ToTagged) {
|
||||
EXPECT_THAT(
|
||||
phi,
|
||||
IsPhi(
|
||||
IsWord64Shl(IsChangeUint32ToUint64(val),
|
||||
IsInt32Constant(SmiShiftAmount())),
|
||||
kMachAnyTagged, IsWord64Shl(IsChangeUint32ToUint64(val),
|
||||
IsInt32Constant(SmiShiftAmount())),
|
||||
IsFinish(
|
||||
AllOf(CaptureEq(&heap_number),
|
||||
IsAllocateHeapNumber(_, CaptureEq(&if_false))),
|
||||
|
@ -111,8 +111,9 @@ Reduction ChangeLowering::ChangeBitToBool(Node* val, Node* control) {
|
||||
Node* false_value = jsgraph()->FalseConstant();
|
||||
|
||||
Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false);
|
||||
Node* phi =
|
||||
graph()->NewNode(common()->Phi(2), true_value, false_value, merge);
|
||||
Node* phi = graph()->NewNode(
|
||||
common()->Phi(static_cast<MachineType>(kTypeBool | kRepTagged), 2),
|
||||
true_value, false_value, merge);
|
||||
|
||||
return Replace(phi);
|
||||
}
|
||||
@ -150,7 +151,8 @@ Reduction ChangeLowering::ChangeInt32ToTagged(Node* val, Node* control) {
|
||||
Node* smi = graph()->NewNode(common()->Projection(0), add);
|
||||
|
||||
Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false);
|
||||
Node* phi = graph()->NewNode(common()->Phi(2), heap_number, smi, merge);
|
||||
Node* phi = graph()->NewNode(common()->Phi(kMachAnyTagged, 2), heap_number,
|
||||
smi, merge);
|
||||
|
||||
return Replace(phi);
|
||||
}
|
||||
@ -174,7 +176,9 @@ Reduction ChangeLowering::ChangeTaggedToUI32(Node* val, Node* control,
|
||||
Node* number = ChangeSmiToInt32(val);
|
||||
|
||||
Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false);
|
||||
Node* phi = graph()->NewNode(common()->Phi(2), change, number, merge);
|
||||
Node* phi = graph()->NewNode(
|
||||
common()->Phi((signedness == kSigned) ? kMachInt32 : kMachUint32, 2),
|
||||
change, number, merge);
|
||||
|
||||
return Replace(phi);
|
||||
}
|
||||
@ -196,7 +200,8 @@ Reduction ChangeLowering::ChangeTaggedToFloat64(Node* val, Node* control) {
|
||||
ChangeSmiToInt32(val));
|
||||
|
||||
Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false);
|
||||
Node* phi = graph()->NewNode(common()->Phi(2), load, number, merge);
|
||||
Node* phi =
|
||||
graph()->NewNode(common()->Phi(kMachFloat64, 2), load, number, merge);
|
||||
|
||||
return Replace(phi);
|
||||
}
|
||||
@ -223,7 +228,8 @@ Reduction ChangeLowering::ChangeUint32ToTagged(Node* val, Node* control) {
|
||||
graph()->NewNode(machine()->ChangeUint32ToFloat64(), val), if_false);
|
||||
|
||||
Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false);
|
||||
Node* phi = graph()->NewNode(common()->Phi(2), smi, heap_number, merge);
|
||||
Node* phi = graph()->NewNode(common()->Phi(kMachAnyTagged, 2), smi,
|
||||
heap_number, merge);
|
||||
|
||||
return Replace(phi);
|
||||
}
|
||||
|
@ -5,10 +5,9 @@
|
||||
#ifndef V8_COMPILER_COMMON_OPERATOR_H_
|
||||
#define V8_COMPILER_COMMON_OPERATOR_H_
|
||||
|
||||
#include "src/v8.h"
|
||||
|
||||
#include "src/assembler.h"
|
||||
#include "src/compiler/linkage.h"
|
||||
#include "src/compiler/machine-type.h"
|
||||
#include "src/compiler/opcodes.h"
|
||||
#include "src/compiler/operator.h"
|
||||
#include "src/unique.h"
|
||||
@ -142,10 +141,10 @@ class CommonOperatorBuilder {
|
||||
return new (zone_) Operator1<Unique<Object> >(
|
||||
IrOpcode::kHeapConstant, Operator::kPure, 0, 1, "HeapConstant", value);
|
||||
}
|
||||
Operator* Phi(int arguments) {
|
||||
Operator* Phi(MachineType type, int arguments) {
|
||||
DCHECK(arguments > 0); // Disallow empty phis.
|
||||
return new (zone_) Operator1<int>(IrOpcode::kPhi, Operator::kPure,
|
||||
arguments, 1, "Phi", arguments);
|
||||
return new (zone_) Operator1<MachineType>(IrOpcode::kPhi, Operator::kPure,
|
||||
arguments, 1, "Phi", type);
|
||||
}
|
||||
Operator* EffectPhi(int arguments) {
|
||||
DCHECK(arguments > 0); // Disallow empty phis.
|
||||
|
@ -161,7 +161,7 @@ void StructuredGraphBuilder::Environment::PrepareForLoop() {
|
||||
|
||||
|
||||
Node* StructuredGraphBuilder::NewPhi(int count, Node* input, Node* control) {
|
||||
Operator* phi_op = common()->Phi(count);
|
||||
Operator* phi_op = common()->Phi(kMachAnyTagged, count);
|
||||
Node** buffer = zone()->NewArray<Node*>(count + 1);
|
||||
MemsetPointer(buffer, input, count);
|
||||
buffer[count] = control;
|
||||
@ -224,7 +224,7 @@ Node* StructuredGraphBuilder::MergeValue(Node* value, Node* other,
|
||||
if (value->opcode() == IrOpcode::kPhi &&
|
||||
NodeProperties::GetControlInput(value) == control) {
|
||||
// Phi already exists, add input.
|
||||
value->set_op(common()->Phi(inputs));
|
||||
value->set_op(common()->Phi(kMachAnyTagged, inputs));
|
||||
value->InsertInput(zone(), inputs - 1, other);
|
||||
} else if (value != other) {
|
||||
// Phi does not exist yet, introduce one.
|
||||
|
@ -285,17 +285,21 @@ class IsConstantMatcher FINAL : public NodeMatcher {
|
||||
|
||||
class IsPhiMatcher FINAL : public NodeMatcher {
|
||||
public:
|
||||
IsPhiMatcher(const Matcher<Node*>& value0_matcher,
|
||||
IsPhiMatcher(const Matcher<MachineType>& type_matcher,
|
||||
const Matcher<Node*>& value0_matcher,
|
||||
const Matcher<Node*>& value1_matcher,
|
||||
const Matcher<Node*>& control_matcher)
|
||||
: NodeMatcher(IrOpcode::kPhi),
|
||||
type_matcher_(type_matcher),
|
||||
value0_matcher_(value0_matcher),
|
||||
value1_matcher_(value1_matcher),
|
||||
control_matcher_(control_matcher) {}
|
||||
|
||||
virtual void DescribeTo(std::ostream* os) const OVERRIDE {
|
||||
NodeMatcher::DescribeTo(os);
|
||||
*os << " whose value0 (";
|
||||
*os << " whose type (";
|
||||
type_matcher_.DescribeTo(os);
|
||||
*os << "), value0 (";
|
||||
value0_matcher_.DescribeTo(os);
|
||||
*os << "), value1 (";
|
||||
value1_matcher_.DescribeTo(os);
|
||||
@ -307,6 +311,8 @@ class IsPhiMatcher FINAL : public NodeMatcher {
|
||||
virtual bool MatchAndExplain(Node* node, MatchResultListener* listener) const
|
||||
OVERRIDE {
|
||||
return (NodeMatcher::MatchAndExplain(node, listener) &&
|
||||
PrintMatchAndExplain(OpParameter<MachineType>(node), "type",
|
||||
type_matcher_, listener) &&
|
||||
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0),
|
||||
"value0", value0_matcher_, listener) &&
|
||||
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1),
|
||||
@ -316,6 +322,7 @@ class IsPhiMatcher FINAL : public NodeMatcher {
|
||||
}
|
||||
|
||||
private:
|
||||
const Matcher<MachineType> type_matcher_;
|
||||
const Matcher<Node*> value0_matcher_;
|
||||
const Matcher<Node*> value1_matcher_;
|
||||
const Matcher<Node*> control_matcher_;
|
||||
@ -669,11 +676,12 @@ Matcher<Node*> IsNumberConstant(const Matcher<double>& value_matcher) {
|
||||
}
|
||||
|
||||
|
||||
Matcher<Node*> IsPhi(const Matcher<Node*>& value0_matcher,
|
||||
Matcher<Node*> IsPhi(const Matcher<MachineType>& type_matcher,
|
||||
const Matcher<Node*>& value0_matcher,
|
||||
const Matcher<Node*>& value1_matcher,
|
||||
const Matcher<Node*>& merge_matcher) {
|
||||
return MakeMatcher(
|
||||
new IsPhiMatcher(value0_matcher, value1_matcher, merge_matcher));
|
||||
return MakeMatcher(new IsPhiMatcher(type_matcher, value0_matcher,
|
||||
value1_matcher, merge_matcher));
|
||||
}
|
||||
|
||||
|
||||
|
@ -69,7 +69,8 @@ Matcher<Node*> IsFloat64Constant(const Matcher<double>& value_matcher);
|
||||
Matcher<Node*> IsInt32Constant(const Matcher<int32_t>& value_matcher);
|
||||
Matcher<Node*> IsInt64Constant(const Matcher<int64_t>& value_matcher);
|
||||
Matcher<Node*> IsNumberConstant(const Matcher<double>& value_matcher);
|
||||
Matcher<Node*> IsPhi(const Matcher<Node*>& value0_matcher,
|
||||
Matcher<Node*> IsPhi(const Matcher<MachineType>& type_matcher,
|
||||
const Matcher<Node*>& value0_matcher,
|
||||
const Matcher<Node*>& value1_matcher,
|
||||
const Matcher<Node*>& merge_matcher);
|
||||
Matcher<Node*> IsProjection(const Matcher<int32_t>& index_matcher,
|
||||
|
@ -182,7 +182,7 @@ TARGET_TEST_F(InstructionSelectorTest, ReferenceParameter) {
|
||||
// Finish.
|
||||
|
||||
|
||||
TARGET_TEST_F(InstructionSelectorTest, Parameter) {
|
||||
TARGET_TEST_F(InstructionSelectorTest, Finish) {
|
||||
StreamBuilder m(this, kMachAnyTagged, kMachAnyTagged);
|
||||
Node* param = m.Parameter(0);
|
||||
Node* finish = m.NewNode(m.common()->Finish(1), param, m.graph()->start());
|
||||
@ -201,6 +201,7 @@ TARGET_TEST_F(InstructionSelectorTest, Parameter) {
|
||||
ASSERT_TRUE(s[1]->Output()->IsUnallocated());
|
||||
EXPECT_TRUE(UnallocatedOperand::cast(s[1]->Output())->HasSameAsInputPolicy());
|
||||
EXPECT_EQ(finish->id(), s.ToVreg(s[1]->Output()));
|
||||
EXPECT_TRUE(s.IsReference(finish->id()));
|
||||
}
|
||||
|
||||
|
||||
@ -212,7 +213,7 @@ typedef InstructionSelectorTestWithParam<MachineType>
|
||||
InstructionSelectorPhiTest;
|
||||
|
||||
|
||||
TARGET_TEST_P(InstructionSelectorPhiTest, PropagateDoubleness) {
|
||||
TARGET_TEST_P(InstructionSelectorPhiTest, Doubleness) {
|
||||
const MachineType type = GetParam();
|
||||
StreamBuilder m(this, type, type, type);
|
||||
Node* param0 = m.Parameter(0);
|
||||
@ -224,7 +225,7 @@ TARGET_TEST_P(InstructionSelectorPhiTest, PropagateDoubleness) {
|
||||
m.Bind(&b);
|
||||
m.Goto(&c);
|
||||
m.Bind(&c);
|
||||
Node* phi = m.Phi(param0, param1);
|
||||
Node* phi = m.Phi(type, param0, param1);
|
||||
m.Return(phi);
|
||||
Stream s = m.Build(kAllInstructions);
|
||||
EXPECT_EQ(s.IsDouble(phi->id()), s.IsDouble(param0->id()));
|
||||
@ -232,7 +233,7 @@ TARGET_TEST_P(InstructionSelectorPhiTest, PropagateDoubleness) {
|
||||
}
|
||||
|
||||
|
||||
TARGET_TEST_P(InstructionSelectorPhiTest, PropagateReferenceness) {
|
||||
TARGET_TEST_P(InstructionSelectorPhiTest, Referenceness) {
|
||||
const MachineType type = GetParam();
|
||||
StreamBuilder m(this, type, type, type);
|
||||
Node* param0 = m.Parameter(0);
|
||||
@ -244,7 +245,7 @@ TARGET_TEST_P(InstructionSelectorPhiTest, PropagateReferenceness) {
|
||||
m.Bind(&b);
|
||||
m.Goto(&c);
|
||||
m.Bind(&c);
|
||||
Node* phi = m.Phi(param0, param1);
|
||||
Node* phi = m.Phi(type, param0, param1);
|
||||
m.Return(phi);
|
||||
Stream s = m.Build(kAllInstructions);
|
||||
EXPECT_EQ(s.IsReference(phi->id()), s.IsReference(param0->id()));
|
||||
|
@ -198,19 +198,6 @@ void InstructionSelector::MarkAsDouble(Node* node) {
|
||||
DCHECK_NOT_NULL(node);
|
||||
DCHECK(!IsReference(node));
|
||||
sequence()->MarkAsDouble(node->id());
|
||||
|
||||
// Propagate "doubleness" throughout Phi nodes.
|
||||
for (UseIter i = node->uses().begin(); i != node->uses().end(); ++i) {
|
||||
Node* user = *i;
|
||||
switch (user->opcode()) {
|
||||
case IrOpcode::kPhi:
|
||||
if (IsDouble(user)) continue;
|
||||
MarkAsDouble(user);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -224,19 +211,6 @@ void InstructionSelector::MarkAsReference(Node* node) {
|
||||
DCHECK_NOT_NULL(node);
|
||||
DCHECK(!IsDouble(node));
|
||||
sequence()->MarkAsReference(node->id());
|
||||
|
||||
// Propagate "referenceness" throughout Phi nodes.
|
||||
for (UseIter i = node->uses().begin(); i != node->uses().end(); ++i) {
|
||||
Node* user = *i;
|
||||
switch (user->opcode()) {
|
||||
case IrOpcode::kPhi:
|
||||
if (IsReference(user)) continue;
|
||||
MarkAsReference(user);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -491,8 +465,11 @@ void InstructionSelector::VisitNode(Node* node) {
|
||||
MarkAsRepresentation(type, node);
|
||||
return VisitParameter(node);
|
||||
}
|
||||
case IrOpcode::kPhi:
|
||||
case IrOpcode::kPhi: {
|
||||
MachineType type = OpParameter<MachineType>(node);
|
||||
MarkAsRepresentation(type, node);
|
||||
return VisitPhi(node);
|
||||
}
|
||||
case IrOpcode::kProjection:
|
||||
return VisitProjection(node);
|
||||
case IrOpcode::kInt32Constant:
|
||||
@ -845,10 +822,10 @@ void InstructionSelector::VisitProjection(Node* node) {
|
||||
switch (value->opcode()) {
|
||||
case IrOpcode::kInt32AddWithOverflow:
|
||||
case IrOpcode::kInt32SubWithOverflow:
|
||||
if (OpParameter<int32_t>(node) == 0) {
|
||||
if (OpParameter<int>(node) == 0) {
|
||||
Emit(kArchNop, g.DefineSameAsFirst(node), g.Use(value));
|
||||
} else {
|
||||
DCHECK_EQ(1, OpParameter<int32_t>(node));
|
||||
DCHECK_EQ(1, OpParameter<int>(node));
|
||||
MarkAsUsed(value);
|
||||
}
|
||||
break;
|
||||
@ -956,7 +933,7 @@ void InstructionSelector::VisitBranch(Node* branch, BasicBlock* tbranch,
|
||||
case IrOpcode::kProjection:
|
||||
// Check if this is the overflow output projection of an
|
||||
// <Operation>WithOverflow node.
|
||||
if (OpParameter<int32_t>(value) == 1) {
|
||||
if (OpParameter<int>(value) == 1) {
|
||||
// We cannot combine the <Operation>WithOverflow with this branch
|
||||
// unless the 0th projection (the use of the actual value of the
|
||||
// <Operation> is either NULL, which means there's no use of the
|
||||
|
@ -120,7 +120,7 @@ void Inlinee::UnifyReturn() {
|
||||
|
||||
int predecessors =
|
||||
OperatorProperties::GetControlInputCount(final_merge->op());
|
||||
Operator* op_phi = jsgraph_->common()->Phi(predecessors);
|
||||
Operator* op_phi = jsgraph_->common()->Phi(kMachAnyTagged, predecessors);
|
||||
Operator* op_ephi = jsgraph_->common()->EffectPhi(predecessors);
|
||||
|
||||
NodeVector values(jsgraph_->zone());
|
||||
|
@ -409,12 +409,14 @@ class RawMachineAssembler : public GraphBuilder {
|
||||
void Deoptimize(Node* state);
|
||||
|
||||
// Variables.
|
||||
Node* Phi(Node* n1, Node* n2) { return NewNode(common()->Phi(2), n1, n2); }
|
||||
Node* Phi(Node* n1, Node* n2, Node* n3) {
|
||||
return NewNode(common()->Phi(3), n1, n2, n3);
|
||||
Node* Phi(MachineType type, Node* n1, Node* n2) {
|
||||
return NewNode(common()->Phi(type, 2), n1, n2);
|
||||
}
|
||||
Node* Phi(Node* n1, Node* n2, Node* n3, Node* n4) {
|
||||
return NewNode(common()->Phi(4), n1, n2, n3, n4);
|
||||
Node* Phi(MachineType type, Node* n1, Node* n2, Node* n3) {
|
||||
return NewNode(common()->Phi(type, 3), n1, n2, n3);
|
||||
}
|
||||
Node* Phi(MachineType type, Node* n1, Node* n2, Node* n3, Node* n4) {
|
||||
return NewNode(common()->Phi(type, 4), n1, n2, n3, n4);
|
||||
}
|
||||
|
||||
// MachineAssembler is invalid after export.
|
||||
|
@ -267,7 +267,8 @@ class RepresentationSelector {
|
||||
void VisitUint64Cmp(Node* node) { VisitBinop(node, kMachUint64, kRepBit); }
|
||||
|
||||
// Helper for handling phis.
|
||||
void VisitPhi(Node* node, MachineTypeUnion use) {
|
||||
void VisitPhi(Node* node, MachineTypeUnion use,
|
||||
SimplifiedLowering* lowering) {
|
||||
// First, propagate the usage information to inputs of the phi.
|
||||
if (!lower()) {
|
||||
int values = OperatorProperties::GetValueInputCount(node->op());
|
||||
@ -318,6 +319,13 @@ class RepresentationSelector {
|
||||
|
||||
if (lower()) {
|
||||
int values = OperatorProperties::GetValueInputCount(node->op());
|
||||
|
||||
// Update the phi operator.
|
||||
MachineType type = static_cast<MachineType>(output_type);
|
||||
if (type != OpParameter<MachineType>(node)) {
|
||||
node->set_op(lowering->common()->Phi(type, values));
|
||||
}
|
||||
|
||||
// Convert inputs to the output representation of this phi.
|
||||
Node::Inputs inputs = node->inputs();
|
||||
for (Node::Inputs::iterator iter(inputs.begin()); iter != inputs.end();
|
||||
@ -384,7 +392,7 @@ class RepresentationSelector {
|
||||
Enqueue(NodeProperties::GetControlInput(node, 0));
|
||||
break;
|
||||
case IrOpcode::kPhi:
|
||||
return VisitPhi(node, use);
|
||||
return VisitPhi(node, use, lowering);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// JavaScript operators.
|
||||
|
@ -53,27 +53,32 @@ class PhiReducerTester : HandleAndZoneScope {
|
||||
}
|
||||
|
||||
Node* Phi(Node* a) {
|
||||
return SetSelfReferences(graph.NewNode(common.Phi(1), a));
|
||||
return SetSelfReferences(graph.NewNode(common.Phi(kMachAnyTagged, 1), a));
|
||||
}
|
||||
|
||||
Node* Phi(Node* a, Node* b) {
|
||||
return SetSelfReferences(graph.NewNode(common.Phi(2), a, b));
|
||||
return SetSelfReferences(
|
||||
graph.NewNode(common.Phi(kMachAnyTagged, 2), a, b));
|
||||
}
|
||||
|
||||
Node* Phi(Node* a, Node* b, Node* c) {
|
||||
return SetSelfReferences(graph.NewNode(common.Phi(3), a, b, c));
|
||||
return SetSelfReferences(
|
||||
graph.NewNode(common.Phi(kMachAnyTagged, 3), a, b, c));
|
||||
}
|
||||
|
||||
Node* Phi(Node* a, Node* b, Node* c, Node* d) {
|
||||
return SetSelfReferences(graph.NewNode(common.Phi(4), a, b, c, d));
|
||||
return SetSelfReferences(
|
||||
graph.NewNode(common.Phi(kMachAnyTagged, 4), a, b, c, d));
|
||||
}
|
||||
|
||||
Node* PhiWithControl(Node* a, Node* control) {
|
||||
return SetSelfReferences(graph.NewNode(common.Phi(1), a, control));
|
||||
return SetSelfReferences(
|
||||
graph.NewNode(common.Phi(kMachAnyTagged, 1), a, control));
|
||||
}
|
||||
|
||||
Node* PhiWithControl(Node* a, Node* b, Node* control) {
|
||||
return SetSelfReferences(graph.NewNode(common.Phi(2), a, b, control));
|
||||
return SetSelfReferences(
|
||||
graph.NewNode(common.Phi(kMachAnyTagged, 2), a, b, control));
|
||||
}
|
||||
|
||||
Node* SetSelfReferences(Node* node) {
|
||||
|
@ -209,7 +209,8 @@ TEST(RunLoop) {
|
||||
|
||||
template <typename R>
|
||||
static void BuildDiamondPhi(RawMachineAssemblerTester<R>* m, Node* cond_node,
|
||||
Node* true_node, Node* false_node) {
|
||||
MachineType type, Node* true_node,
|
||||
Node* false_node) {
|
||||
MLabel blocka, blockb;
|
||||
MLabel* end = m->Exit();
|
||||
m->Branch(cond_node, &blocka, &blockb);
|
||||
@ -219,7 +220,7 @@ static void BuildDiamondPhi(RawMachineAssemblerTester<R>* m, Node* cond_node,
|
||||
m->Goto(end);
|
||||
|
||||
m->Bind(end);
|
||||
Node* phi = m->Phi(true_node, false_node);
|
||||
Node* phi = m->Phi(type, true_node, false_node);
|
||||
m->Return(phi);
|
||||
}
|
||||
|
||||
@ -230,7 +231,7 @@ TEST(RunDiamondPhiConst) {
|
||||
int true_val = 0x00DDD;
|
||||
Node* true_node = m.Int32Constant(true_val);
|
||||
Node* false_node = m.Int32Constant(false_val);
|
||||
BuildDiamondPhi(&m, m.Parameter(0), true_node, false_node);
|
||||
BuildDiamondPhi(&m, m.Parameter(0), kMachInt32, true_node, false_node);
|
||||
CHECK_EQ(false_val, m.Call(0));
|
||||
CHECK_EQ(true_val, m.Call(1));
|
||||
}
|
||||
@ -242,7 +243,7 @@ TEST(RunDiamondPhiNumber) {
|
||||
double true_val = 200.1;
|
||||
Node* true_node = m.NumberConstant(true_val);
|
||||
Node* false_node = m.NumberConstant(false_val);
|
||||
BuildDiamondPhi(&m, m.Parameter(0), true_node, false_node);
|
||||
BuildDiamondPhi(&m, m.Parameter(0), kMachAnyTagged, true_node, false_node);
|
||||
m.CheckNumber(false_val, m.Call(0));
|
||||
m.CheckNumber(true_val, m.Call(1));
|
||||
}
|
||||
@ -254,7 +255,7 @@ TEST(RunDiamondPhiString) {
|
||||
const char* true_val = "true";
|
||||
Node* true_node = m.StringConstant(true_val);
|
||||
Node* false_node = m.StringConstant(false_val);
|
||||
BuildDiamondPhi(&m, m.Parameter(0), true_node, false_node);
|
||||
BuildDiamondPhi(&m, m.Parameter(0), kMachAnyTagged, true_node, false_node);
|
||||
m.CheckString(false_val, m.Call(0));
|
||||
m.CheckString(true_val, m.Call(1));
|
||||
}
|
||||
@ -262,7 +263,8 @@ TEST(RunDiamondPhiString) {
|
||||
|
||||
TEST(RunDiamondPhiParam) {
|
||||
RawMachineAssemblerTester<int32_t> m(kMachInt32, kMachInt32, kMachInt32);
|
||||
BuildDiamondPhi(&m, m.Parameter(0), m.Parameter(1), m.Parameter(2));
|
||||
BuildDiamondPhi(&m, m.Parameter(0), kMachInt32, m.Parameter(1),
|
||||
m.Parameter(2));
|
||||
int32_t c1 = 0x260cb75a;
|
||||
int32_t c2 = 0xcd3e9c8b;
|
||||
int result = m.Call(0, c1, c2);
|
||||
@ -287,7 +289,7 @@ TEST(RunLoopPhiConst) {
|
||||
|
||||
m.Goto(&header);
|
||||
m.Bind(&header);
|
||||
Node* phi = m.Phi(false_node, true_node);
|
||||
Node* phi = m.Phi(kMachInt32, false_node, true_node);
|
||||
m.Branch(cond_node, &body, end);
|
||||
m.Bind(&body);
|
||||
m.Goto(&header);
|
||||
@ -307,8 +309,8 @@ TEST(RunLoopPhiParam) {
|
||||
m.Goto(&blocka);
|
||||
|
||||
m.Bind(&blocka);
|
||||
Node* phi = m.Phi(m.Parameter(1), m.Parameter(2));
|
||||
Node* cond = m.Phi(m.Parameter(0), m.Int32Constant(0));
|
||||
Node* phi = m.Phi(kMachInt32, m.Parameter(1), m.Parameter(2));
|
||||
Node* cond = m.Phi(kMachInt32, m.Parameter(0), m.Int32Constant(0));
|
||||
m.Branch(cond, &blockb, end);
|
||||
|
||||
m.Bind(&blockb);
|
||||
@ -339,7 +341,7 @@ TEST(RunLoopPhiInduction) {
|
||||
m.Goto(&header);
|
||||
|
||||
m.Bind(&header);
|
||||
Node* phi = m.Phi(false_node, false_node);
|
||||
Node* phi = m.Phi(kMachInt32, false_node, false_node);
|
||||
m.Branch(m.Int32Constant(0), &body, end);
|
||||
|
||||
m.Bind(&body);
|
||||
@ -366,7 +368,7 @@ TEST(RunLoopIncrement) {
|
||||
m.Goto(&header);
|
||||
|
||||
m.Bind(&header);
|
||||
Node* phi = m.Phi(zero, zero);
|
||||
Node* phi = m.Phi(kMachInt32, zero, zero);
|
||||
m.Branch(m.WordXor(phi, bt.param0), &body, end);
|
||||
|
||||
m.Bind(&body);
|
||||
@ -394,7 +396,7 @@ TEST(RunLoopIncrement2) {
|
||||
m.Goto(&header);
|
||||
|
||||
m.Bind(&header);
|
||||
Node* phi = m.Phi(zero, zero);
|
||||
Node* phi = m.Phi(kMachInt32, zero, zero);
|
||||
m.Branch(m.Int32LessThan(phi, bt.param0), &body, end);
|
||||
|
||||
m.Bind(&body);
|
||||
@ -423,7 +425,7 @@ TEST(RunLoopIncrement3) {
|
||||
m.Goto(&header);
|
||||
|
||||
m.Bind(&header);
|
||||
Node* phi = m.Phi(zero, zero);
|
||||
Node* phi = m.Phi(kMachInt32, zero, zero);
|
||||
m.Branch(m.Uint32LessThan(phi, bt.param0), &body, end);
|
||||
|
||||
m.Bind(&body);
|
||||
@ -451,7 +453,7 @@ TEST(RunLoopDecrement) {
|
||||
m.Goto(&header);
|
||||
|
||||
m.Bind(&header);
|
||||
Node* phi = m.Phi(bt.param0, m.Int32Constant(0));
|
||||
Node* phi = m.Phi(kMachInt32, bt.param0, m.Int32Constant(0));
|
||||
m.Branch(phi, &body, end);
|
||||
|
||||
m.Bind(&body);
|
||||
@ -479,7 +481,7 @@ TEST(RunLoopIncrementFloat64) {
|
||||
m.Goto(&header);
|
||||
|
||||
m.Bind(&header);
|
||||
Node* phi = m.Phi(minus_3, ten);
|
||||
Node* phi = m.Phi(kMachFloat64, minus_3, ten);
|
||||
m.Branch(m.Float64LessThan(phi, ten), &body, end);
|
||||
|
||||
m.Bind(&body);
|
||||
@ -3251,7 +3253,7 @@ TEST(RunLoopPhiInduction2) {
|
||||
Node* false_node = m.Int32Constant(false_val);
|
||||
m.Goto(&header);
|
||||
m.Bind(&header);
|
||||
Node* phi = m.Phi(false_node, false_node);
|
||||
Node* phi = m.Phi(kMachInt32, false_node, false_node);
|
||||
m.Branch(m.Int32Constant(0), &body, &end);
|
||||
m.Bind(&body);
|
||||
Node* add = m.Int32Add(phi, m.Int32Constant(1));
|
||||
@ -3280,7 +3282,7 @@ TEST(RunDoubleDiamond) {
|
||||
m.Bind(&blockb);
|
||||
m.Goto(&end);
|
||||
m.Bind(&end);
|
||||
Node* phi = m.Phi(k2, k1);
|
||||
Node* phi = m.Phi(kMachFloat64, k2, k1);
|
||||
m.Store(kMachFloat64, m.PointerConstant(&buffer), m.Int32Constant(0), phi);
|
||||
m.Return(m.Int32Constant(magic));
|
||||
|
||||
@ -3306,7 +3308,7 @@ TEST(RunRefDiamond) {
|
||||
m.Bind(&blockb);
|
||||
m.Goto(&end);
|
||||
m.Bind(&end);
|
||||
Node* phi = m.Phi(k2, k1);
|
||||
Node* phi = m.Phi(kMachAnyTagged, k2, k1);
|
||||
m.Store(kMachAnyTagged, m.PointerConstant(&buffer), m.Int32Constant(0), phi);
|
||||
m.Return(m.Int32Constant(magic));
|
||||
|
||||
@ -3336,8 +3338,8 @@ TEST(RunDoubleRefDiamond) {
|
||||
m.Bind(&blockb);
|
||||
m.Goto(&end);
|
||||
m.Bind(&end);
|
||||
Node* dphi = m.Phi(d2, d1);
|
||||
Node* rphi = m.Phi(r2, r1);
|
||||
Node* dphi = m.Phi(kMachFloat64, d2, d1);
|
||||
Node* rphi = m.Phi(kMachAnyTagged, r2, r1);
|
||||
m.Store(kMachFloat64, m.PointerConstant(&dbuffer), m.Int32Constant(0), dphi);
|
||||
m.Store(kMachAnyTagged, m.PointerConstant(&rbuffer), m.Int32Constant(0),
|
||||
rphi);
|
||||
@ -3370,8 +3372,8 @@ TEST(RunDoubleRefDoubleDiamond) {
|
||||
m.Bind(&blockb);
|
||||
m.Goto(&mid);
|
||||
m.Bind(&mid);
|
||||
Node* dphi1 = m.Phi(d2, d1);
|
||||
Node* rphi1 = m.Phi(r2, r1);
|
||||
Node* dphi1 = m.Phi(kMachFloat64, d2, d1);
|
||||
Node* rphi1 = m.Phi(kMachAnyTagged, r2, r1);
|
||||
m.Branch(m.Int32Constant(0), &blockd, &blocke);
|
||||
|
||||
m.Bind(&blockd);
|
||||
@ -3379,8 +3381,8 @@ TEST(RunDoubleRefDoubleDiamond) {
|
||||
m.Bind(&blocke);
|
||||
m.Goto(&end);
|
||||
m.Bind(&end);
|
||||
Node* dphi2 = m.Phi(d1, dphi1);
|
||||
Node* rphi2 = m.Phi(r1, rphi1);
|
||||
Node* dphi2 = m.Phi(kMachFloat64, d1, dphi1);
|
||||
Node* rphi2 = m.Phi(kMachAnyTagged, r1, rphi1);
|
||||
|
||||
m.Store(kMachFloat64, m.PointerConstant(&dbuffer), m.Int32Constant(0), dphi2);
|
||||
m.Store(kMachAnyTagged, m.PointerConstant(&rbuffer), m.Int32Constant(0),
|
||||
@ -3406,7 +3408,7 @@ TEST(RunDoubleLoopPhi) {
|
||||
|
||||
m.Goto(&header);
|
||||
m.Bind(&header);
|
||||
Node* phi = m.Phi(dk, dk);
|
||||
Node* phi = m.Phi(kMachFloat64, dk, dk);
|
||||
phi->ReplaceInput(1, phi);
|
||||
m.Branch(zero, &body, &end);
|
||||
m.Bind(&body);
|
||||
@ -3431,8 +3433,8 @@ TEST(RunCountToTenAccRaw) {
|
||||
m.Goto(&header);
|
||||
|
||||
m.Bind(&header);
|
||||
Node* i = m.Phi(zero, zero);
|
||||
Node* j = m.Phi(zero, zero);
|
||||
Node* i = m.Phi(kMachInt32, zero, zero);
|
||||
Node* j = m.Phi(kMachInt32, zero, zero);
|
||||
m.Goto(&body);
|
||||
|
||||
m.Bind(&body);
|
||||
@ -3464,9 +3466,9 @@ TEST(RunCountToTenAccRaw2) {
|
||||
m.Goto(&header);
|
||||
|
||||
m.Bind(&header);
|
||||
Node* i = m.Phi(zero, zero);
|
||||
Node* j = m.Phi(zero, zero);
|
||||
Node* k = m.Phi(zero, zero);
|
||||
Node* i = m.Phi(kMachInt32, zero, zero);
|
||||
Node* j = m.Phi(kMachInt32, zero, zero);
|
||||
Node* k = m.Phi(kMachInt32, zero, zero);
|
||||
m.Goto(&body);
|
||||
|
||||
m.Bind(&body);
|
||||
@ -3973,7 +3975,7 @@ TEST(RunNewSpaceConstantsInPhi) {
|
||||
m.Goto(&end);
|
||||
|
||||
m.Bind(&end);
|
||||
Node* phi = m.Phi(true_node, false_node);
|
||||
Node* phi = m.Phi(kMachAnyTagged, true_node, false_node);
|
||||
m.Return(phi);
|
||||
|
||||
CHECK_EQ(*false_val, m.Call(0));
|
||||
|
@ -844,7 +844,7 @@ TEST(BuildScheduleSimpleLoop) {
|
||||
op = common_builder.Return();
|
||||
Node* n19 = graph.NewNode(op, nil, nil, nil);
|
||||
USE(n19);
|
||||
op = common_builder.Phi(2);
|
||||
op = common_builder.Phi(kMachAnyTagged, 2);
|
||||
Node* n8 = graph.NewNode(op, nil, nil, nil);
|
||||
USE(n8);
|
||||
op = common_builder.Parameter(0);
|
||||
@ -866,7 +866,7 @@ TEST(BuildScheduleSimpleLoop) {
|
||||
Node* n12 = graph.NewNode(op, nil, nil, nil, nil, nil);
|
||||
USE(n12);
|
||||
n12->ReplaceInput(0, n8);
|
||||
op = common_builder.Phi(2);
|
||||
op = common_builder.Phi(kMachAnyTagged, 2);
|
||||
Node* n9 = graph.NewNode(op, nil, nil, nil);
|
||||
USE(n9);
|
||||
op = common_builder.Parameter(0);
|
||||
@ -891,7 +891,7 @@ TEST(BuildScheduleSimpleLoop) {
|
||||
n9->ReplaceInput(2, n6);
|
||||
n12->ReplaceInput(1, n9);
|
||||
n12->ReplaceInput(2, n5);
|
||||
op = common_builder.Phi(2);
|
||||
op = common_builder.Phi(kMachAnyTagged, 2);
|
||||
Node* n10 = graph.NewNode(op, nil, nil, nil);
|
||||
USE(n10);
|
||||
n10->ReplaceInput(0, n0);
|
||||
@ -962,17 +962,17 @@ TEST(BuildScheduleComplexLoops) {
|
||||
op = common_builder.Return();
|
||||
Node* n45 = graph.NewNode(op, nil, nil, nil);
|
||||
USE(n45);
|
||||
op = common_builder.Phi(2);
|
||||
op = common_builder.Phi(kMachAnyTagged, 2);
|
||||
Node* n35 = graph.NewNode(op, nil, nil, nil);
|
||||
USE(n35);
|
||||
op = common_builder.Phi(2);
|
||||
op = common_builder.Phi(kMachAnyTagged, 2);
|
||||
Node* n9 = graph.NewNode(op, nil, nil, nil);
|
||||
USE(n9);
|
||||
op = common_builder.Parameter(0);
|
||||
Node* n2 = graph.NewNode(op, n0);
|
||||
USE(n2);
|
||||
n9->ReplaceInput(0, n2);
|
||||
op = common_builder.Phi(2);
|
||||
op = common_builder.Phi(kMachAnyTagged, 2);
|
||||
Node* n23 = graph.NewNode(op, nil, nil, nil);
|
||||
USE(n23);
|
||||
op = js_builder.Add();
|
||||
@ -990,14 +990,14 @@ TEST(BuildScheduleComplexLoops) {
|
||||
Node* n14 = graph.NewNode(op, nil, nil, nil, nil, nil);
|
||||
USE(n14);
|
||||
n14->ReplaceInput(0, n9);
|
||||
op = common_builder.Phi(2);
|
||||
op = common_builder.Phi(kMachAnyTagged, 2);
|
||||
Node* n10 = graph.NewNode(op, nil, nil, nil);
|
||||
USE(n10);
|
||||
op = common_builder.Parameter(0);
|
||||
Node* n3 = graph.NewNode(op, n0);
|
||||
USE(n3);
|
||||
n10->ReplaceInput(0, n3);
|
||||
op = common_builder.Phi(2);
|
||||
op = common_builder.Phi(kMachAnyTagged, 2);
|
||||
Node* n24 = graph.NewNode(op, nil, nil, nil);
|
||||
USE(n24);
|
||||
n24->ReplaceInput(0, n10);
|
||||
@ -1025,10 +1025,10 @@ TEST(BuildScheduleComplexLoops) {
|
||||
op = js_builder.LessThan();
|
||||
Node* n27 = graph.NewNode(op, nil, nil, nil, nil, nil);
|
||||
USE(n27);
|
||||
op = common_builder.Phi(2);
|
||||
op = common_builder.Phi(kMachAnyTagged, 2);
|
||||
Node* n25 = graph.NewNode(op, nil, nil, nil);
|
||||
USE(n25);
|
||||
op = common_builder.Phi(2);
|
||||
op = common_builder.Phi(kMachAnyTagged, 2);
|
||||
Node* n11 = graph.NewNode(op, nil, nil, nil);
|
||||
USE(n11);
|
||||
op = common_builder.Parameter(0);
|
||||
@ -1065,7 +1065,7 @@ TEST(BuildScheduleComplexLoops) {
|
||||
n27->ReplaceInput(0, n25);
|
||||
n27->ReplaceInput(1, n24);
|
||||
n27->ReplaceInput(2, n6);
|
||||
op = common_builder.Phi(2);
|
||||
op = common_builder.Phi(kMachAnyTagged, 2);
|
||||
Node* n26 = graph.NewNode(op, nil, nil, nil);
|
||||
USE(n26);
|
||||
n26->ReplaceInput(0, n20);
|
||||
@ -1086,7 +1086,7 @@ TEST(BuildScheduleComplexLoops) {
|
||||
n10->ReplaceInput(2, n7);
|
||||
n14->ReplaceInput(1, n10);
|
||||
n14->ReplaceInput(2, n6);
|
||||
op = common_builder.Phi(2);
|
||||
op = common_builder.Phi(kMachAnyTagged, 2);
|
||||
Node* n12 = graph.NewNode(op, nil, nil, nil);
|
||||
USE(n12);
|
||||
n12->ReplaceInput(0, n0);
|
||||
@ -1120,7 +1120,7 @@ TEST(BuildScheduleComplexLoops) {
|
||||
Node* n39 = graph.NewNode(op, nil, nil, nil, nil, nil);
|
||||
USE(n39);
|
||||
n39->ReplaceInput(0, n35);
|
||||
op = common_builder.Phi(2);
|
||||
op = common_builder.Phi(kMachAnyTagged, 2);
|
||||
Node* n36 = graph.NewNode(op, nil, nil, nil);
|
||||
USE(n36);
|
||||
n36->ReplaceInput(0, n10);
|
||||
@ -1146,7 +1146,7 @@ TEST(BuildScheduleComplexLoops) {
|
||||
n36->ReplaceInput(2, n33);
|
||||
n39->ReplaceInput(1, n36);
|
||||
n39->ReplaceInput(2, n6);
|
||||
op = common_builder.Phi(2);
|
||||
op = common_builder.Phi(kMachAnyTagged, 2);
|
||||
Node* n38 = graph.NewNode(op, nil, nil, nil);
|
||||
USE(n38);
|
||||
n38->ReplaceInput(0, n14);
|
||||
@ -1214,14 +1214,14 @@ TEST(BuildScheduleBreakAndContinue) {
|
||||
op = js_builder.Add();
|
||||
Node* n56 = graph.NewNode(op, nil, nil, nil, nil, nil);
|
||||
USE(n56);
|
||||
op = common_builder.Phi(2);
|
||||
op = common_builder.Phi(kMachAnyTagged, 2);
|
||||
Node* n10 = graph.NewNode(op, nil, nil, nil);
|
||||
USE(n10);
|
||||
op = common_builder.Parameter(0);
|
||||
Node* n2 = graph.NewNode(op, n0);
|
||||
USE(n2);
|
||||
n10->ReplaceInput(0, n2);
|
||||
op = common_builder.Phi(2);
|
||||
op = common_builder.Phi(kMachAnyTagged, 2);
|
||||
Node* n25 = graph.NewNode(op, nil, nil, nil);
|
||||
USE(n25);
|
||||
op = js_builder.Add();
|
||||
@ -1239,14 +1239,14 @@ TEST(BuildScheduleBreakAndContinue) {
|
||||
Node* n16 = graph.NewNode(op, nil, nil, nil, nil, nil);
|
||||
USE(n16);
|
||||
n16->ReplaceInput(0, n10);
|
||||
op = common_builder.Phi(2);
|
||||
op = common_builder.Phi(kMachAnyTagged, 2);
|
||||
Node* n11 = graph.NewNode(op, nil, nil, nil);
|
||||
USE(n11);
|
||||
op = common_builder.Parameter(0);
|
||||
Node* n3 = graph.NewNode(op, n0);
|
||||
USE(n3);
|
||||
n11->ReplaceInput(0, n3);
|
||||
op = common_builder.Phi(2);
|
||||
op = common_builder.Phi(kMachAnyTagged, 2);
|
||||
Node* n26 = graph.NewNode(op, nil, nil, nil);
|
||||
USE(n26);
|
||||
n26->ReplaceInput(0, n11);
|
||||
@ -1283,23 +1283,23 @@ TEST(BuildScheduleBreakAndContinue) {
|
||||
USE(n46);
|
||||
n47->ReplaceInput(1, n46);
|
||||
n47->ReplaceInput(2, n6);
|
||||
op = common_builder.Phi(2);
|
||||
op = common_builder.Phi(kMachAnyTagged, 2);
|
||||
Node* n42 = graph.NewNode(op, nil, nil, nil);
|
||||
USE(n42);
|
||||
op = js_builder.LessThan();
|
||||
Node* n30 = graph.NewNode(op, nil, nil, nil, nil, nil);
|
||||
USE(n30);
|
||||
op = common_builder.Phi(2);
|
||||
op = common_builder.Phi(kMachAnyTagged, 2);
|
||||
Node* n27 = graph.NewNode(op, nil, nil, nil);
|
||||
USE(n27);
|
||||
op = common_builder.Phi(2);
|
||||
op = common_builder.Phi(kMachAnyTagged, 2);
|
||||
Node* n12 = graph.NewNode(op, nil, nil, nil);
|
||||
USE(n12);
|
||||
op = common_builder.Parameter(0);
|
||||
Node* n4 = graph.NewNode(op, n0);
|
||||
USE(n4);
|
||||
n12->ReplaceInput(0, n4);
|
||||
op = common_builder.Phi(2);
|
||||
op = common_builder.Phi(kMachAnyTagged, 2);
|
||||
Node* n41 = graph.NewNode(op, nil, nil, nil);
|
||||
USE(n41);
|
||||
n41->ReplaceInput(0, n27);
|
||||
@ -1348,17 +1348,17 @@ TEST(BuildScheduleBreakAndContinue) {
|
||||
op = js_builder.Equal();
|
||||
Node* n37 = graph.NewNode(op, nil, nil, nil, nil, nil);
|
||||
USE(n37);
|
||||
op = common_builder.Phi(2);
|
||||
op = common_builder.Phi(kMachAnyTagged, 2);
|
||||
Node* n28 = graph.NewNode(op, nil, nil, nil);
|
||||
USE(n28);
|
||||
op = common_builder.Phi(2);
|
||||
op = common_builder.Phi(kMachAnyTagged, 2);
|
||||
Node* n13 = graph.NewNode(op, nil, nil, nil);
|
||||
USE(n13);
|
||||
op = common_builder.NumberConstant(0);
|
||||
Node* n7 = graph.NewNode(op);
|
||||
USE(n7);
|
||||
n13->ReplaceInput(0, n7);
|
||||
op = common_builder.Phi(2);
|
||||
op = common_builder.Phi(kMachAnyTagged, 2);
|
||||
Node* n54 = graph.NewNode(op, nil, nil, nil);
|
||||
USE(n54);
|
||||
n54->ReplaceInput(0, n28);
|
||||
@ -1409,7 +1409,7 @@ TEST(BuildScheduleBreakAndContinue) {
|
||||
n30->ReplaceInput(0, n27);
|
||||
n30->ReplaceInput(1, n26);
|
||||
n30->ReplaceInput(2, n6);
|
||||
op = common_builder.Phi(2);
|
||||
op = common_builder.Phi(kMachAnyTagged, 2);
|
||||
Node* n29 = graph.NewNode(op, nil, nil, nil);
|
||||
USE(n29);
|
||||
n29->ReplaceInput(0, n22);
|
||||
@ -1456,11 +1456,11 @@ TEST(BuildScheduleBreakAndContinue) {
|
||||
n11->ReplaceInput(2, n8);
|
||||
n16->ReplaceInput(1, n11);
|
||||
n16->ReplaceInput(2, n6);
|
||||
op = common_builder.Phi(2);
|
||||
op = common_builder.Phi(kMachAnyTagged, 2);
|
||||
Node* n14 = graph.NewNode(op, nil, nil, nil);
|
||||
USE(n14);
|
||||
n14->ReplaceInput(0, n0);
|
||||
op = common_builder.Phi(2);
|
||||
op = common_builder.Phi(kMachAnyTagged, 2);
|
||||
Node* n55 = graph.NewNode(op, nil, nil, nil);
|
||||
USE(n55);
|
||||
n55->ReplaceInput(0, n47);
|
||||
@ -1533,7 +1533,7 @@ TEST(BuildScheduleSimpleLoopWithCodeMotion) {
|
||||
op = common_builder.Return();
|
||||
Node* n21 = graph.NewNode(op, nil, nil, nil);
|
||||
USE(n21);
|
||||
op = common_builder.Phi(2);
|
||||
op = common_builder.Phi(kMachAnyTagged, 2);
|
||||
Node* n9 = graph.NewNode(op, nil, nil, nil);
|
||||
USE(n9);
|
||||
op = common_builder.Parameter(0);
|
||||
@ -1547,7 +1547,7 @@ TEST(BuildScheduleSimpleLoopWithCodeMotion) {
|
||||
op = machine_builder.Int32Add();
|
||||
Node* n19 = graph.NewNode(op, nil, nil);
|
||||
USE(n19);
|
||||
op = common_builder.Phi(2);
|
||||
op = common_builder.Phi(kMachAnyTagged, 2);
|
||||
Node* n10 = graph.NewNode(op, nil, nil, nil);
|
||||
USE(n10);
|
||||
op = common_builder.Parameter(0);
|
||||
@ -1577,7 +1577,7 @@ TEST(BuildScheduleSimpleLoopWithCodeMotion) {
|
||||
Node* n6 = graph.NewNode(op);
|
||||
USE(n6);
|
||||
n14->ReplaceInput(2, n6);
|
||||
op = common_builder.Phi(2);
|
||||
op = common_builder.Phi(kMachAnyTagged, 2);
|
||||
Node* n12 = graph.NewNode(op, nil, nil, nil);
|
||||
USE(n12);
|
||||
n12->ReplaceInput(0, n0);
|
||||
@ -1595,7 +1595,7 @@ TEST(BuildScheduleSimpleLoopWithCodeMotion) {
|
||||
n7->ReplaceInput(1, n17);
|
||||
n10->ReplaceInput(2, n7);
|
||||
n19->ReplaceInput(0, n2);
|
||||
op = common_builder.Phi(2);
|
||||
op = common_builder.Phi(kMachAnyTagged, 2);
|
||||
Node* n11 = graph.NewNode(op, nil, nil, nil);
|
||||
USE(n11);
|
||||
op = common_builder.Parameter(0);
|
||||
@ -1640,7 +1640,7 @@ static Node* CreateDiamond(Graph* graph, CommonOperatorBuilder* common,
|
||||
Node* t = graph->NewNode(common->IfTrue(), br);
|
||||
Node* f = graph->NewNode(common->IfFalse(), br);
|
||||
Node* m = graph->NewNode(common->Merge(2), t, f);
|
||||
Node* phi = graph->NewNode(common->Phi(2), tv, fv, m);
|
||||
Node* phi = graph->NewNode(common->Phi(kMachAnyTagged, 2), tv, fv, m);
|
||||
return phi;
|
||||
}
|
||||
|
||||
|
@ -1420,3 +1420,28 @@ TEST(InsertChangeForStoreField) {
|
||||
CHECK_EQ(t.p0, store->InputAt(0));
|
||||
CheckChangeOf(IrOpcode::kChangeTaggedToFloat64, t.p1, store->InputAt(2));
|
||||
}
|
||||
|
||||
|
||||
TEST(UpdatePhi) {
|
||||
TestingGraph t(Type::Any(), Type::Signed32());
|
||||
static const MachineType kMachineTypes[] = {kMachInt32, kMachUint32,
|
||||
kMachFloat64};
|
||||
|
||||
for (size_t i = 0; i < arraysize(kMachineTypes); i++) {
|
||||
FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize,
|
||||
Handle<Name>::null(), Type::Any(), kMachineTypes[i]};
|
||||
|
||||
Node* load0 =
|
||||
t.graph()->NewNode(t.simplified()->LoadField(access), t.p0, t.start);
|
||||
Node* load1 =
|
||||
t.graph()->NewNode(t.simplified()->LoadField(access), t.p1, t.start);
|
||||
Node* phi = t.graph()->NewNode(t.common()->Phi(kMachAnyTagged, 2), load0,
|
||||
load1, t.start);
|
||||
t.Return(t.Use(phi, kMachineTypes[i]));
|
||||
t.Lower();
|
||||
|
||||
CHECK_EQ(IrOpcode::kPhi, phi->opcode());
|
||||
CHECK_EQ(RepresentationOf(kMachineTypes[i]),
|
||||
RepresentationOf(OpParameter<MachineType>(phi)));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user