Index: test/unittests/compiler/instruction-selector-unittest.cc |
diff --git a/test/unittests/compiler/instruction-selector-unittest.cc b/test/unittests/compiler/instruction-selector-unittest.cc |
index 2ca71b85301d9be158af91d3279a4eb5c66efd5c..89c0a654e947297fddb99cb2aecf18e898803d90 100644 |
--- a/test/unittests/compiler/instruction-selector-unittest.cc |
+++ b/test/unittests/compiler/instruction-selector-unittest.cc |
@@ -158,7 +158,7 @@ InstructionSelectorTest::StreamBuilder::GetFrameStateFunctionInfo( |
TARGET_TEST_F(InstructionSelectorTest, ReturnFloat32Constant) { |
const float kValue = 4.2f; |
- StreamBuilder m(this, kMachFloat32); |
+ StreamBuilder m(this, MachineType::Float32()); |
m.Return(m.Float32Constant(kValue)); |
Stream s = m.Build(kAllInstructions); |
ASSERT_EQ(3U, s.size()); |
@@ -171,7 +171,7 @@ TARGET_TEST_F(InstructionSelectorTest, ReturnFloat32Constant) { |
TARGET_TEST_F(InstructionSelectorTest, ReturnParameter) { |
- StreamBuilder m(this, kMachInt32, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); |
m.Return(m.Parameter(0)); |
Stream s = m.Build(kAllInstructions); |
ASSERT_EQ(3U, s.size()); |
@@ -183,7 +183,7 @@ TARGET_TEST_F(InstructionSelectorTest, ReturnParameter) { |
TARGET_TEST_F(InstructionSelectorTest, ReturnZero) { |
- StreamBuilder m(this, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int32()); |
m.Return(m.Int32Constant(0)); |
Stream s = m.Build(kAllInstructions); |
ASSERT_EQ(3U, s.size()); |
@@ -201,7 +201,7 @@ TARGET_TEST_F(InstructionSelectorTest, ReturnZero) { |
TARGET_TEST_F(InstructionSelectorTest, TruncateFloat64ToInt32WithParameter) { |
- StreamBuilder m(this, kMachInt32, kMachFloat64); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Float64()); |
m.Return( |
m.TruncateFloat64ToInt32(TruncationMode::kJavaScript, m.Parameter(0))); |
Stream s = m.Build(kAllInstructions); |
@@ -219,7 +219,7 @@ TARGET_TEST_F(InstructionSelectorTest, TruncateFloat64ToInt32WithParameter) { |
TARGET_TEST_F(InstructionSelectorTest, DoubleParameter) { |
- StreamBuilder m(this, kMachFloat64, kMachFloat64); |
+ StreamBuilder m(this, MachineType::Float64(), MachineType::Float64()); |
Node* param = m.Parameter(0); |
m.Return(param); |
Stream s = m.Build(kAllInstructions); |
@@ -228,7 +228,7 @@ TARGET_TEST_F(InstructionSelectorTest, DoubleParameter) { |
TARGET_TEST_F(InstructionSelectorTest, ReferenceParameter) { |
- StreamBuilder m(this, kMachAnyTagged, kMachAnyTagged); |
+ StreamBuilder m(this, MachineType::AnyTagged(), MachineType::AnyTagged()); |
Node* param = m.Parameter(0); |
m.Return(param); |
Stream s = m.Build(kAllInstructions); |
@@ -241,7 +241,7 @@ TARGET_TEST_F(InstructionSelectorTest, ReferenceParameter) { |
TARGET_TEST_F(InstructionSelectorTest, FinishRegion) { |
- StreamBuilder m(this, kMachAnyTagged, kMachAnyTagged); |
+ StreamBuilder m(this, MachineType::AnyTagged(), MachineType::AnyTagged()); |
Node* param = m.Parameter(0); |
Node* finish = |
m.AddNode(m.common()->FinishRegion(), param, m.graph()->start()); |
@@ -284,7 +284,7 @@ TARGET_TEST_P(InstructionSelectorPhiTest, Doubleness) { |
m.Bind(&b); |
m.Goto(&c); |
m.Bind(&c); |
- Node* phi = m.Phi(type, param0, param1); |
+ Node* phi = m.Phi(type.representation(), param0, param1); |
m.Return(phi); |
Stream s = m.Build(kAllInstructions); |
EXPECT_EQ(s.IsDouble(phi), s.IsDouble(param0)); |
@@ -304,7 +304,7 @@ TARGET_TEST_P(InstructionSelectorPhiTest, Referenceness) { |
m.Bind(&b); |
m.Goto(&c); |
m.Bind(&c); |
- Node* phi = m.Phi(type, param0, param1); |
+ Node* phi = m.Phi(type.representation(), param0, param1); |
m.Return(phi); |
Stream s = m.Build(kAllInstructions); |
EXPECT_EQ(s.IsReference(phi), s.IsReference(param0)); |
@@ -312,11 +312,14 @@ TARGET_TEST_P(InstructionSelectorPhiTest, Referenceness) { |
} |
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, InstructionSelectorPhiTest, |
- ::testing::Values(kMachFloat64, kMachInt8, kMachUint8, |
- kMachInt16, kMachUint16, kMachInt32, |
- kMachUint32, kMachInt64, kMachUint64, |
- kMachPtr, kMachAnyTagged)); |
+INSTANTIATE_TEST_CASE_P( |
+ InstructionSelectorTest, InstructionSelectorPhiTest, |
+ ::testing::Values(MachineType::Float64(), MachineType::Int8(), |
+ MachineType::Uint8(), MachineType::Int16(), |
+ MachineType::Uint16(), MachineType::Int32(), |
+ MachineType::Uint32(), MachineType::Int64(), |
+ MachineType::Uint64(), MachineType::Pointer(), |
+ MachineType::AnyTagged())); |
// ----------------------------------------------------------------------------- |
@@ -324,15 +327,15 @@ INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, InstructionSelectorPhiTest, |
TARGET_TEST_F(InstructionSelectorTest, ValueEffect) { |
- StreamBuilder m1(this, kMachInt32, kMachPtr); |
+ StreamBuilder m1(this, MachineType::Int32(), MachineType::Pointer()); |
Node* p1 = m1.Parameter(0); |
- m1.Return(m1.Load(kMachInt32, p1, m1.Int32Constant(0))); |
+ m1.Return(m1.Load(MachineType::Int32(), p1, m1.Int32Constant(0))); |
Stream s1 = m1.Build(kAllInstructions); |
- StreamBuilder m2(this, kMachInt32, kMachPtr); |
+ StreamBuilder m2(this, MachineType::Int32(), MachineType::Pointer()); |
Node* p2 = m2.Parameter(0); |
- m2.Return( |
- m2.AddNode(m2.machine()->Load(kMachInt32), p2, m2.Int32Constant(0), |
- m2.AddNode(m2.common()->BeginRegion(), m2.graph()->start()))); |
+ m2.Return(m2.AddNode( |
+ m2.machine()->Load(MachineType::Int32()), p2, m2.Int32Constant(0), |
+ m2.AddNode(m2.common()->BeginRegion(), m2.graph()->start()))); |
Stream s2 = m2.Build(kAllInstructions); |
EXPECT_LE(3U, s1.size()); |
ASSERT_EQ(s1.size(), s2.size()); |
@@ -351,8 +354,8 @@ TARGET_TEST_F(InstructionSelectorTest, ValueEffect) { |
TARGET_TEST_F(InstructionSelectorTest, CallJSFunctionWithDeopt) { |
- StreamBuilder m(this, kMachAnyTagged, kMachAnyTagged, kMachAnyTagged, |
- kMachAnyTagged); |
+ StreamBuilder m(this, MachineType::AnyTagged(), MachineType::AnyTagged(), |
+ MachineType::AnyTagged(), MachineType::AnyTagged()); |
BailoutId bailout_id(42); |
@@ -360,7 +363,7 @@ TARGET_TEST_F(InstructionSelectorTest, CallJSFunctionWithDeopt) { |
Node* receiver = m.Parameter(1); |
Node* context = m.Parameter(2); |
- ZoneVector<MachineType> int32_type(1, kMachInt32, zone()); |
+ ZoneVector<MachineType> int32_type(1, MachineType::Int32(), zone()); |
ZoneVector<MachineType> empty_types(zone()); |
CallDescriptor* descriptor = Linkage::GetJSCallDescriptor( |
@@ -402,8 +405,8 @@ TARGET_TEST_F(InstructionSelectorTest, CallJSFunctionWithDeopt) { |
TARGET_TEST_F(InstructionSelectorTest, CallStubWithDeopt) { |
- StreamBuilder m(this, kMachAnyTagged, kMachAnyTagged, kMachAnyTagged, |
- kMachAnyTagged); |
+ StreamBuilder m(this, MachineType::AnyTagged(), MachineType::AnyTagged(), |
+ MachineType::AnyTagged(), MachineType::AnyTagged()); |
BailoutId bailout_id_before(42); |
@@ -412,9 +415,9 @@ TARGET_TEST_F(InstructionSelectorTest, CallStubWithDeopt) { |
Node* receiver = m.Parameter(1); |
Node* context = m.Int32Constant(1); // Context is ignored. |
- ZoneVector<MachineType> int32_type(1, kMachInt32, zone()); |
- ZoneVector<MachineType> float64_type(1, kMachFloat64, zone()); |
- ZoneVector<MachineType> tagged_type(1, kMachAnyTagged, zone()); |
+ ZoneVector<MachineType> int32_type(1, MachineType::Int32(), zone()); |
+ ZoneVector<MachineType> float64_type(1, MachineType::Float64(), zone()); |
+ ZoneVector<MachineType> tagged_type(1, MachineType::AnyTagged(), zone()); |
Callable callable = CodeFactory::ToObject(isolate()); |
CallDescriptor* descriptor = Linkage::GetStubCallDescriptor( |
@@ -480,13 +483,15 @@ TARGET_TEST_F(InstructionSelectorTest, CallStubWithDeopt) { |
// We inserted 0 here. |
EXPECT_EQ(0.5, s.ToFloat64(call_instr->InputAt(5))); |
EXPECT_TRUE(s.ToHeapObject(call_instr->InputAt(6))->IsUndefined()); |
- EXPECT_EQ(kMachAnyTagged, desc_before->GetType(0)); // function is always |
- // tagged/any. |
- EXPECT_EQ(kMachInt32, desc_before->GetType(1)); |
- EXPECT_EQ(kMachAnyTagged, desc_before->GetType(2)); // context is always |
- // tagged/any. |
- EXPECT_EQ(kMachFloat64, desc_before->GetType(3)); |
- EXPECT_EQ(kMachAnyTagged, desc_before->GetType(4)); |
+ EXPECT_EQ(MachineType::AnyTagged(), |
+ desc_before->GetType(0)); // function is always |
+ // tagged/any. |
+ EXPECT_EQ(MachineType::Int32(), desc_before->GetType(1)); |
+ EXPECT_EQ(MachineType::AnyTagged(), |
+ desc_before->GetType(2)); // context is always |
+ // tagged/any. |
+ EXPECT_EQ(MachineType::Float64(), desc_before->GetType(3)); |
+ EXPECT_EQ(MachineType::AnyTagged(), desc_before->GetType(4)); |
// Function. |
EXPECT_EQ(s.ToVreg(function_node), s.ToVreg(call_instr->InputAt(7))); |
@@ -500,8 +505,8 @@ TARGET_TEST_F(InstructionSelectorTest, CallStubWithDeopt) { |
TARGET_TEST_F(InstructionSelectorTest, CallStubWithDeoptRecursiveFrameState) { |
- StreamBuilder m(this, kMachAnyTagged, kMachAnyTagged, kMachAnyTagged, |
- kMachAnyTagged); |
+ StreamBuilder m(this, MachineType::AnyTagged(), MachineType::AnyTagged(), |
+ MachineType::AnyTagged(), MachineType::AnyTagged()); |
BailoutId bailout_id_before(42); |
BailoutId bailout_id_parent(62); |
@@ -512,9 +517,9 @@ TARGET_TEST_F(InstructionSelectorTest, CallStubWithDeoptRecursiveFrameState) { |
Node* context = m.Int32Constant(66); |
Node* context2 = m.Int32Constant(46); |
- ZoneVector<MachineType> int32_type(1, kMachInt32, zone()); |
- ZoneVector<MachineType> int32x2_type(2, kMachInt32, zone()); |
- ZoneVector<MachineType> float64_type(1, kMachFloat64, zone()); |
+ ZoneVector<MachineType> int32_type(1, MachineType::Int32(), zone()); |
+ ZoneVector<MachineType> int32x2_type(2, MachineType::Int32(), zone()); |
+ ZoneVector<MachineType> float64_type(1, MachineType::Float64(), zone()); |
Callable callable = CodeFactory::ToObject(isolate()); |
CallDescriptor* descriptor = Linkage::GetStubCallDescriptor( |
@@ -586,31 +591,31 @@ TARGET_TEST_F(InstructionSelectorTest, CallStubWithDeoptRecursiveFrameState) { |
EXPECT_EQ(1u, desc_before_outer->locals_count()); |
EXPECT_EQ(1u, desc_before_outer->stack_count()); |
// Values from parent environment. |
- EXPECT_EQ(kMachAnyTagged, desc_before->GetType(0)); |
+ EXPECT_EQ(MachineType::AnyTagged(), desc_before->GetType(0)); |
EXPECT_EQ(63, s.ToInt32(call_instr->InputAt(3))); |
- EXPECT_EQ(kMachInt32, desc_before_outer->GetType(1)); |
+ EXPECT_EQ(MachineType::Int32(), desc_before_outer->GetType(1)); |
// Context: |
EXPECT_EQ(66, s.ToInt32(call_instr->InputAt(4))); |
- EXPECT_EQ(kMachAnyTagged, desc_before_outer->GetType(2)); |
+ EXPECT_EQ(MachineType::AnyTagged(), desc_before_outer->GetType(2)); |
EXPECT_EQ(64, s.ToInt32(call_instr->InputAt(5))); |
- EXPECT_EQ(kMachInt32, desc_before_outer->GetType(3)); |
+ EXPECT_EQ(MachineType::Int32(), desc_before_outer->GetType(3)); |
EXPECT_EQ(65, s.ToInt32(call_instr->InputAt(6))); |
- EXPECT_EQ(kMachInt32, desc_before_outer->GetType(4)); |
+ EXPECT_EQ(MachineType::Int32(), desc_before_outer->GetType(4)); |
// Values from the nested frame. |
EXPECT_EQ(1u, desc_before->parameters_count()); |
EXPECT_EQ(1u, desc_before->locals_count()); |
EXPECT_EQ(2u, desc_before->stack_count()); |
- EXPECT_EQ(kMachAnyTagged, desc_before->GetType(0)); |
+ EXPECT_EQ(MachineType::AnyTagged(), desc_before->GetType(0)); |
EXPECT_EQ(43, s.ToInt32(call_instr->InputAt(8))); |
- EXPECT_EQ(kMachInt32, desc_before->GetType(1)); |
+ EXPECT_EQ(MachineType::Int32(), desc_before->GetType(1)); |
EXPECT_EQ(46, s.ToInt32(call_instr->InputAt(9))); |
- EXPECT_EQ(kMachAnyTagged, desc_before->GetType(2)); |
+ EXPECT_EQ(MachineType::AnyTagged(), desc_before->GetType(2)); |
EXPECT_EQ(0.25, s.ToFloat64(call_instr->InputAt(10))); |
- EXPECT_EQ(kMachFloat64, desc_before->GetType(3)); |
+ EXPECT_EQ(MachineType::Float64(), desc_before->GetType(3)); |
EXPECT_EQ(44, s.ToInt32(call_instr->InputAt(11))); |
- EXPECT_EQ(kMachInt32, desc_before->GetType(4)); |
+ EXPECT_EQ(MachineType::Int32(), desc_before->GetType(4)); |
EXPECT_EQ(45, s.ToInt32(call_instr->InputAt(12))); |
- EXPECT_EQ(kMachInt32, desc_before->GetType(5)); |
+ EXPECT_EQ(MachineType::Int32(), desc_before->GetType(5)); |
// Function. |
EXPECT_EQ(s.ToVreg(function_node), s.ToVreg(call_instr->InputAt(13))); |