diff options
Diffstat (limited to 'deps/v8/test/unittests/compiler')
20 files changed, 321 insertions, 402 deletions
diff --git a/deps/v8/test/unittests/compiler/arm/instruction-selector-arm-unittest.cc b/deps/v8/test/unittests/compiler/arm/instruction-selector-arm-unittest.cc index a26a8d9192..bb4848db6c 100644 --- a/deps/v8/test/unittests/compiler/arm/instruction-selector-arm-unittest.cc +++ b/deps/v8/test/unittests/compiler/arm/instruction-selector-arm-unittest.cc @@ -3225,54 +3225,6 @@ TEST_F(InstructionSelectorTest, Float64Neg) { EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); } -TEST_F(InstructionSelectorTest, StackCheck0) { - StreamBuilder m(this, MachineType::Int32(), MachineType::Pointer()); - Node* const sp = m.LoadStackPointer(); - Node* const stack_limit = m.Load(MachineType::Int32(), m.Parameter(0)); - Node* const interrupt = m.UintPtrLessThan(sp, stack_limit); - - RawMachineLabel if_true, if_false; - m.Branch(interrupt, &if_true, &if_false); - - m.Bind(&if_true); - m.Return(m.Int32Constant(1)); - - m.Bind(&if_false); - m.Return(m.Int32Constant(0)); - - Stream s = m.Build(); - - ASSERT_EQ(2U, s.size()); - EXPECT_EQ(kArmLdr, s[0]->arch_opcode()); - EXPECT_EQ(kArmCmp, s[1]->arch_opcode()); - EXPECT_EQ(4U, s[1]->InputCount()); - EXPECT_EQ(0U, s[1]->OutputCount()); -} - -TEST_F(InstructionSelectorTest, StackCheck1) { - StreamBuilder m(this, MachineType::Int32(), MachineType::Pointer()); - Node* const sp = m.LoadStackPointer(); - Node* const stack_limit = m.Load(MachineType::Int32(), m.Parameter(0)); - Node* const sp_within_limit = m.UintPtrLessThan(stack_limit, sp); - - RawMachineLabel if_true, if_false; - m.Branch(sp_within_limit, &if_true, &if_false); - - m.Bind(&if_true); - m.Return(m.Int32Constant(1)); - - m.Bind(&if_false); - m.Return(m.Int32Constant(0)); - - Stream s = m.Build(); - - ASSERT_EQ(2U, s.size()); - EXPECT_EQ(kArmLdr, s[0]->arch_opcode()); - EXPECT_EQ(kArmCmp, s[1]->arch_opcode()); - EXPECT_EQ(4U, s[1]->InputCount()); - EXPECT_EQ(0U, s[1]->OutputCount()); -} - } // namespace compiler } // namespace internal } // namespace v8 diff --git a/deps/v8/test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc b/deps/v8/test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc index 867f89abfd..b969d9a278 100644 --- a/deps/v8/test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc +++ b/deps/v8/test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc @@ -4571,54 +4571,6 @@ TEST_F(InstructionSelectorTest, CompareFloat64HighGreaterThanOrEqualZero64) { EXPECT_EQ(63, s.ToInt32(s[1]->InputAt(1))); } -TEST_F(InstructionSelectorTest, StackCheck0) { - StreamBuilder m(this, MachineType::Int32(), MachineType::Pointer()); - Node* const sp = m.LoadStackPointer(); - Node* const stack_limit = m.Load(MachineType::Int64(), m.Parameter(0)); - Node* const interrupt = m.UintPtrLessThan(sp, stack_limit); - - RawMachineLabel if_true, if_false; - m.Branch(interrupt, &if_true, &if_false); - - m.Bind(&if_true); - m.Return(m.Int32Constant(1)); - - m.Bind(&if_false); - m.Return(m.Int32Constant(0)); - - Stream s = m.Build(); - - ASSERT_EQ(2U, s.size()); - EXPECT_EQ(kArm64Ldr, s[0]->arch_opcode()); - EXPECT_EQ(kArm64Cmp, s[1]->arch_opcode()); - EXPECT_EQ(4U, s[1]->InputCount()); - EXPECT_EQ(0U, s[1]->OutputCount()); -} - -TEST_F(InstructionSelectorTest, StackCheck1) { - StreamBuilder m(this, MachineType::Int32(), MachineType::Pointer()); - Node* const sp = m.LoadStackPointer(); - Node* const stack_limit = m.Load(MachineType::Int64(), m.Parameter(0)); - Node* const sp_within_limit = m.UintPtrLessThan(stack_limit, sp); - - RawMachineLabel if_true, if_false; - m.Branch(sp_within_limit, &if_true, &if_false); - - m.Bind(&if_true); - m.Return(m.Int32Constant(1)); - - m.Bind(&if_false); - m.Return(m.Int32Constant(0)); - - Stream s = m.Build(); - - ASSERT_EQ(2U, s.size()); - EXPECT_EQ(kArm64Ldr, s[0]->arch_opcode()); - EXPECT_EQ(kArm64Cmp, s[1]->arch_opcode()); - EXPECT_EQ(4U, s[1]->InputCount()); - EXPECT_EQ(0U, s[1]->OutputCount()); -} - TEST_F(InstructionSelectorTest, ExternalReferenceLoad1) { // Test offsets we can use kMode_Root for. const int64_t kOffsets[] = {0, 1, 4, INT32_MIN, INT32_MAX}; diff --git a/deps/v8/test/unittests/compiler/backend/instruction-selector-unittest.cc b/deps/v8/test/unittests/compiler/backend/instruction-selector-unittest.cc index a48ad1b359..c29979c600 100644 --- a/deps/v8/test/unittests/compiler/backend/instruction-selector-unittest.cc +++ b/deps/v8/test/unittests/compiler/backend/instruction-selector-unittest.cc @@ -25,7 +25,7 @@ InstructionSelectorTest::Stream InstructionSelectorTest::StreamBuilder::Build( InstructionSelector::Features features, InstructionSelectorTest::StreamBuilderMode mode, InstructionSelector::SourcePositionMode source_position_mode) { - Schedule* schedule = Export(); + Schedule* schedule = ExportForTest(); if (FLAG_trace_turbo) { StdoutStream{} << "=== Schedule before instruction selection ===" << std::endl @@ -40,11 +40,13 @@ InstructionSelectorTest::Stream InstructionSelectorTest::StreamBuilder::Build( instruction_blocks); SourcePositionTable source_position_table(graph()); TickCounter tick_counter; + size_t max_unoptimized_frame_height = 0; InstructionSelector selector( test_->zone(), node_count, &linkage, &sequence, schedule, &source_position_table, nullptr, InstructionSelector::kEnableSwitchJumpTable, &tick_counter, - source_position_mode, features, InstructionSelector::kDisableScheduling, + &max_unoptimized_frame_height, source_position_mode, features, + InstructionSelector::kDisableScheduling, InstructionSelector::kEnableRootsRelativeAddressing, PoisoningMitigationLevel::kPoisonAll); selector.SelectInstructions(); diff --git a/deps/v8/test/unittests/compiler/branch-elimination-unittest.cc b/deps/v8/test/unittests/compiler/branch-elimination-unittest.cc index 34fb84957c..a231539f6f 100644 --- a/deps/v8/test/unittests/compiler/branch-elimination-unittest.cc +++ b/deps/v8/test/unittests/compiler/branch-elimination-unittest.cc @@ -39,7 +39,6 @@ class BranchEliminationTest : public GraphTest { MachineOperatorBuilder machine_; }; - TEST_F(BranchEliminationTest, NestedBranchSameTrue) { // { return (x ? (x ? 1 : 2) : 3; } // should be reduced to @@ -80,7 +79,6 @@ TEST_F(BranchEliminationTest, NestedBranchSameTrue) { IsInt32Constant(2), IsMerge(outer_if_true, IsDead()))); } - TEST_F(BranchEliminationTest, NestedBranchSameFalse) { // { return (x ? 1 : (x ? 2 : 3); } // should be reduced to @@ -122,10 +120,9 @@ TEST_F(BranchEliminationTest, NestedBranchSameFalse) { IsInt32Constant(3), IsMerge(IsDead(), outer_if_false))); } - TEST_F(BranchEliminationTest, BranchAfterDiamond) { // { var y = x ? 1 : 2; return y + x ? 3 : 4; } - // should not be reduced. + // second branch's condition should be replaced with a phi. Node* condition = Parameter(0); Node* branch1 = @@ -136,7 +133,7 @@ TEST_F(BranchEliminationTest, BranchAfterDiamond) { Node* phi1 = graph()->NewNode(common()->Phi(MachineRepresentation::kWord32, 2), Int32Constant(1), Int32Constant(2), merge1); - + // Second branch use the same condition. Node* branch2 = graph()->NewNode(common()->Branch(), condition, merge1); Node* if_true2 = graph()->NewNode(common()->IfTrue(), branch2); Node* if_false2 = graph()->NewNode(common()->IfFalse(), branch2); @@ -145,7 +142,6 @@ TEST_F(BranchEliminationTest, BranchAfterDiamond) { graph()->NewNode(common()->Phi(MachineRepresentation::kWord32, 2), Int32Constant(3), Int32Constant(4), merge1); - Node* add = graph()->NewNode(machine()->Int32Add(), phi1, phi2); Node* zero = graph()->NewNode(common()->Int32Constant(0)); Node* ret = @@ -154,13 +150,13 @@ TEST_F(BranchEliminationTest, BranchAfterDiamond) { Reduce(); - // Outer branch should not be rewritten, the inner branch condition should - // be true. - EXPECT_THAT(branch1, IsBranch(condition, graph()->start())); - EXPECT_THAT(branch2, IsBranch(condition, merge1)); + // The branch condition for branch2 should be a phi with constants. + EXPECT_THAT(branch2, + IsBranch(IsPhi(MachineRepresentation::kWord32, IsInt32Constant(1), + IsInt32Constant(0), merge1), + merge1)); } - TEST_F(BranchEliminationTest, BranchInsideLoopSame) { // if (x) while (x) { return 2; } else { return 1; } // should be rewritten to @@ -172,7 +168,6 @@ TEST_F(BranchEliminationTest, BranchInsideLoopSame) { graph()->NewNode(common()->Branch(), condition, graph()->start()); Node* outer_if_true = graph()->NewNode(common()->IfTrue(), outer_branch); - Node* loop = graph()->NewNode(common()->Loop(1), outer_if_true); Node* effect = graph()->NewNode(common()->EffectPhi(1), graph()->start(), loop); diff --git a/deps/v8/test/unittests/compiler/code-assembler-unittest.cc b/deps/v8/test/unittests/compiler/code-assembler-unittest.cc index 0541f68440..43dfd9876f 100644 --- a/deps/v8/test/unittests/compiler/code-assembler-unittest.cc +++ b/deps/v8/test/unittests/compiler/code-assembler-unittest.cc @@ -13,6 +13,7 @@ #include "test/unittests/compiler/node-test-utils.h" using ::testing::_; +using ::testing::Eq; namespace v8 { namespace internal { @@ -28,29 +29,29 @@ TARGET_TEST_F(CodeAssemblerTest, IntPtrAdd) { CodeAssemblerForTest m(&state); { Node* a = m.Parameter(0); - Node* b = m.Int32Constant(1); - Node* add = m.IntPtrAdd(a, b); - EXPECT_THAT(add, IsIntPtrAdd(a, b)); + TNode<IntPtrT> b = m.IntPtrConstant(1); + TNode<WordT> add = m.IntPtrAdd(a, b); + EXPECT_THAT(add, IsIntPtrAdd(Eq(a), Eq(b))); } // x + 0 => x { Node* a = m.Parameter(0); - Node* b = m.Int32Constant(0); - Node* add = m.IntPtrAdd(a, b); + TNode<IntPtrT> b = m.IntPtrConstant(0); + TNode<WordT> add = m.IntPtrAdd(a, b); EXPECT_THAT(add, a); } // 0 + x => x { Node* a = m.Parameter(0); - Node* b = m.Int32Constant(0); - Node* add = m.IntPtrAdd(b, a); + TNode<IntPtrT> b = m.IntPtrConstant(0); + TNode<WordT> add = m.IntPtrAdd(b, a); EXPECT_THAT(add, a); } // CONST_a + CONST_b => CONST_c { - Node* a = m.IntPtrConstant(22); - Node* b = m.IntPtrConstant(33); - Node* c = m.IntPtrAdd(a, b); + TNode<IntPtrT> a = m.IntPtrConstant(22); + TNode<IntPtrT> b = m.IntPtrConstant(33); + TNode<IntPtrT> c = m.IntPtrAdd(a, b); EXPECT_THAT(c, IsIntPtrConstant(55)); } } @@ -60,22 +61,22 @@ TARGET_TEST_F(CodeAssemblerTest, IntPtrSub) { CodeAssemblerForTest m(&state); { Node* a = m.Parameter(0); - Node* b = m.Int32Constant(1); - Node* sub = m.IntPtrSub(a, b); - EXPECT_THAT(sub, IsIntPtrSub(a, b)); + TNode<IntPtrT> b = m.IntPtrConstant(1); + TNode<WordT> sub = m.IntPtrSub(a, b); + EXPECT_THAT(sub, IsIntPtrSub(Eq(a), Eq(b))); } // x - 0 => x { Node* a = m.Parameter(0); - Node* b = m.Int32Constant(0); - Node* c = m.IntPtrSub(a, b); + TNode<IntPtrT> b = m.IntPtrConstant(0); + TNode<WordT> c = m.IntPtrSub(a, b); EXPECT_THAT(c, a); } // CONST_a - CONST_b => CONST_c { - Node* a = m.IntPtrConstant(100); - Node* b = m.IntPtrConstant(1); - Node* c = m.IntPtrSub(a, b); + TNode<IntPtrT> a = m.IntPtrConstant(100); + TNode<IntPtrT> b = m.IntPtrConstant(1); + TNode<IntPtrT> c = m.IntPtrSub(a, b); EXPECT_THAT(c, IsIntPtrConstant(99)); } } @@ -85,43 +86,43 @@ TARGET_TEST_F(CodeAssemblerTest, IntPtrMul) { CodeAssemblerForTest m(&state); { Node* a = m.Parameter(0); - Node* b = m.Int32Constant(100); - Node* mul = m.IntPtrMul(a, b); - EXPECT_THAT(mul, IsIntPtrMul(a, b)); + TNode<IntPtrT> b = m.IntPtrConstant(100); + TNode<WordT> mul = m.IntPtrMul(a, b); + EXPECT_THAT(mul, IsIntPtrMul(Eq(a), Eq(b))); } // x * 1 => x { Node* a = m.Parameter(0); - Node* b = m.Int32Constant(1); - Node* mul = m.IntPtrMul(a, b); + TNode<IntPtrT> b = m.IntPtrConstant(1); + TNode<WordT> mul = m.IntPtrMul(a, b); EXPECT_THAT(mul, a); } // 1 * x => x { Node* a = m.Parameter(0); - Node* b = m.Int32Constant(1); - Node* mul = m.IntPtrMul(b, a); + TNode<IntPtrT> b = m.IntPtrConstant(1); + TNode<WordT> mul = m.IntPtrMul(b, a); EXPECT_THAT(mul, a); } // CONST_a * CONST_b => CONST_c { - Node* a = m.IntPtrConstant(100); - Node* b = m.IntPtrConstant(5); - Node* c = m.IntPtrMul(a, b); + TNode<IntPtrT> a = m.IntPtrConstant(100); + TNode<IntPtrT> b = m.IntPtrConstant(5); + TNode<IntPtrT> c = m.IntPtrMul(a, b); EXPECT_THAT(c, IsIntPtrConstant(500)); } // x * 2^CONST => x << CONST { Node* a = m.Parameter(0); - Node* b = m.IntPtrConstant(1 << 3); - Node* c = m.IntPtrMul(a, b); + TNode<IntPtrT> b = m.IntPtrConstant(1 << 3); + TNode<WordT> c = m.IntPtrMul(a, b); EXPECT_THAT(c, IsWordShl(a, IsIntPtrConstant(3))); } // 2^CONST * x => x << CONST { - Node* a = m.IntPtrConstant(1 << 3); + TNode<IntPtrT> a = m.IntPtrConstant(1 << 3); Node* b = m.Parameter(0); - Node* c = m.IntPtrMul(a, b); + TNode<WordT> c = m.IntPtrMul(a, b); EXPECT_THAT(c, IsWordShl(b, IsIntPtrConstant(3))); } } @@ -169,19 +170,19 @@ TARGET_TEST_F(CodeAssemblerTest, WordShl) { CodeAssemblerForTest m(&state); { Node* a = m.Parameter(0); - Node* add = m.WordShl(a, 10); + TNode<WordT> add = m.WordShl(a, 10); EXPECT_THAT(add, IsWordShl(a, IsIntPtrConstant(10))); } // x << 0 => x { Node* a = m.Parameter(0); - Node* add = m.WordShl(a, 0); + TNode<WordT> add = m.WordShl(a, 0); EXPECT_THAT(add, a); } // CONST_a << CONST_b => CONST_c { - Node* a = m.IntPtrConstant(1024); - Node* shl = m.WordShl(a, 2); + TNode<IntPtrT> a = m.IntPtrConstant(1024); + TNode<WordT> shl = m.WordShl(a, 2); EXPECT_THAT(shl, IsIntPtrConstant(4096)); } } @@ -191,25 +192,25 @@ TARGET_TEST_F(CodeAssemblerTest, WordShr) { CodeAssemblerForTest m(&state); { Node* a = m.Parameter(0); - Node* shr = m.WordShr(a, 10); + TNode<WordT> shr = m.WordShr(a, 10); EXPECT_THAT(shr, IsWordShr(a, IsIntPtrConstant(10))); } // x >> 0 => x { Node* a = m.Parameter(0); - Node* shr = m.WordShr(a, 0); + TNode<WordT> shr = m.WordShr(a, 0); EXPECT_THAT(shr, a); } // +CONST_a >> CONST_b => CONST_c { - Node* a = m.IntPtrConstant(4096); - Node* shr = m.WordShr(a, 2); + TNode<IntPtrT> a = m.IntPtrConstant(4096); + TNode<IntPtrT> shr = m.WordShr(a, 2); EXPECT_THAT(shr, IsIntPtrConstant(1024)); } // -CONST_a >> CONST_b => CONST_c { - Node* a = m.IntPtrConstant(-1234); - Node* shr = m.WordShr(a, 2); + TNode<IntPtrT> a = m.IntPtrConstant(-1234); + TNode<IntPtrT> shr = m.WordShr(a, 2); EXPECT_THAT(shr, IsIntPtrConstant(static_cast<uintptr_t>(-1234) >> 2)); } } @@ -219,25 +220,25 @@ TARGET_TEST_F(CodeAssemblerTest, WordSar) { CodeAssemblerForTest m(&state); { Node* a = m.Parameter(0); - Node* sar = m.WordSar(a, m.IntPtrConstant(10)); + TNode<WordT> sar = m.WordSar(a, m.IntPtrConstant(10)); EXPECT_THAT(sar, IsWordSar(a, IsIntPtrConstant(10))); } // x >>> 0 => x { Node* a = m.Parameter(0); - Node* sar = m.WordSar(a, m.IntPtrConstant(0)); + TNode<WordT> sar = m.WordSar(a, m.IntPtrConstant(0)); EXPECT_THAT(sar, a); } // +CONST_a >>> CONST_b => CONST_c { - Node* a = m.IntPtrConstant(4096); - Node* sar = m.WordSar(a, m.IntPtrConstant(2)); + TNode<IntPtrT> a = m.IntPtrConstant(4096); + TNode<IntPtrT> sar = m.WordSar(a, m.IntPtrConstant(2)); EXPECT_THAT(sar, IsIntPtrConstant(1024)); } // -CONST_a >>> CONST_b => CONST_c { - Node* a = m.IntPtrConstant(-1234); - Node* sar = m.WordSar(a, m.IntPtrConstant(2)); + TNode<IntPtrT> a = m.IntPtrConstant(-1234); + TNode<IntPtrT> sar = m.WordSar(a, m.IntPtrConstant(2)); EXPECT_THAT(sar, IsIntPtrConstant(static_cast<intptr_t>(-1234) >> 2)); } } @@ -247,25 +248,25 @@ TARGET_TEST_F(CodeAssemblerTest, WordOr) { CodeAssemblerForTest m(&state); { Node* a = m.Parameter(0); - Node* z = m.WordOr(a, m.IntPtrConstant(8)); + TNode<WordT> z = m.WordOr(a, m.IntPtrConstant(8)); EXPECT_THAT(z, IsWordOr(a, IsIntPtrConstant(8))); } // x | 0 => x { Node* a = m.Parameter(0); - Node* z = m.WordOr(a, m.IntPtrConstant(0)); + TNode<WordT> z = m.WordOr(a, m.IntPtrConstant(0)); EXPECT_THAT(z, a); } // 0 | x => x { Node* a = m.Parameter(0); - Node* z = m.WordOr(m.IntPtrConstant(0), a); + TNode<WordT> z = m.WordOr(m.IntPtrConstant(0), a); EXPECT_THAT(z, a); } // CONST_a | CONST_b => CONST_c { - Node* a = m.IntPtrConstant(3); - Node* b = m.WordOr(a, m.IntPtrConstant(7)); + TNode<IntPtrT> a = m.IntPtrConstant(3); + TNode<WordT> b = m.WordOr(a, m.IntPtrConstant(7)); EXPECT_THAT(b, IsIntPtrConstant(7)); } } @@ -275,13 +276,13 @@ TARGET_TEST_F(CodeAssemblerTest, WordAnd) { CodeAssemblerForTest m(&state); { Node* a = m.Parameter(0); - Node* z = m.WordAnd(a, m.IntPtrConstant(8)); + TNode<WordT> z = m.WordAnd(a, m.IntPtrConstant(8)); EXPECT_THAT(z, IsWordAnd(a, IsIntPtrConstant(8))); } // CONST_a & CONST_b => CONST_c { - Node* a = m.IntPtrConstant(3); - Node* b = m.WordAnd(a, m.IntPtrConstant(7)); + TNode<IntPtrT> a = m.IntPtrConstant(3); + TNode<IntPtrT> b = m.WordAnd(a, m.IntPtrConstant(7)); EXPECT_THAT(b, IsIntPtrConstant(3)); } } @@ -291,13 +292,13 @@ TARGET_TEST_F(CodeAssemblerTest, WordXor) { CodeAssemblerForTest m(&state); { Node* a = m.Parameter(0); - Node* z = m.WordXor(a, m.IntPtrConstant(8)); + TNode<WordT> z = m.WordXor(a, m.IntPtrConstant(8)); EXPECT_THAT(z, IsWordXor(a, IsIntPtrConstant(8))); } // CONST_a ^ CONST_b => CONST_c { - Node* a = m.IntPtrConstant(3); - Node* b = m.WordXor(a, m.IntPtrConstant(7)); + TNode<IntPtrT> a = m.IntPtrConstant(3); + TNode<WordT> b = m.WordXor(a, m.IntPtrConstant(7)); EXPECT_THAT(b, IsIntPtrConstant(4)); } } diff --git a/deps/v8/test/unittests/compiler/graph-unittest.cc b/deps/v8/test/unittests/compiler/graph-unittest.cc index 485df8e401..ee6b7c02a3 100644 --- a/deps/v8/test/unittests/compiler/graph-unittest.cc +++ b/deps/v8/test/unittests/compiler/graph-unittest.cc @@ -23,7 +23,7 @@ GraphTest::GraphTest(int num_parameters) node_origins_(&graph_) { graph()->SetStart(graph()->NewNode(common()->Start(num_parameters))); graph()->SetEnd(graph()->NewNode(common()->End(1), graph()->start())); - broker()->SetNativeContextRef(); + broker()->SetTargetNativeContextRef(isolate()->native_context()); } GraphTest::~GraphTest() = default; diff --git a/deps/v8/test/unittests/compiler/ia32/instruction-selector-ia32-unittest.cc b/deps/v8/test/unittests/compiler/ia32/instruction-selector-ia32-unittest.cc index 8851a6a2df..ba6d3f299e 100644 --- a/deps/v8/test/unittests/compiler/ia32/instruction-selector-ia32-unittest.cc +++ b/deps/v8/test/unittests/compiler/ia32/instruction-selector-ia32-unittest.cc @@ -836,58 +836,6 @@ TEST_F(InstructionSelectorTest, Word32Clz) { EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); } -TEST_F(InstructionSelectorTest, StackCheck0) { - ExternalReference js_stack_limit = - ExternalReference::Create(isolate()->stack_guard()->address_of_jslimit()); - StreamBuilder m(this, MachineType::Int32()); - Node* const sp = m.LoadStackPointer(); - Node* const stack_limit = - m.Load(MachineType::Pointer(), m.ExternalConstant(js_stack_limit)); - Node* const interrupt = m.UintPtrLessThan(sp, stack_limit); - - RawMachineLabel if_true, if_false; - m.Branch(interrupt, &if_true, &if_false); - - m.Bind(&if_true); - m.Return(m.Int32Constant(1)); - - m.Bind(&if_false); - m.Return(m.Int32Constant(0)); - - Stream s = m.Build(); - - ASSERT_EQ(1U, s.size()); - EXPECT_EQ(kIA32Cmp, s[0]->arch_opcode()); - EXPECT_EQ(4U, s[0]->InputCount()); - EXPECT_EQ(0U, s[0]->OutputCount()); -} - -TEST_F(InstructionSelectorTest, StackCheck1) { - ExternalReference js_stack_limit = - ExternalReference::Create(isolate()->stack_guard()->address_of_jslimit()); - StreamBuilder m(this, MachineType::Int32()); - Node* const sp = m.LoadStackPointer(); - Node* const stack_limit = - m.Load(MachineType::Pointer(), m.ExternalConstant(js_stack_limit)); - Node* const sp_within_limit = m.UintPtrLessThan(stack_limit, sp); - - RawMachineLabel if_true, if_false; - m.Branch(sp_within_limit, &if_true, &if_false); - - m.Bind(&if_true); - m.Return(m.Int32Constant(1)); - - m.Bind(&if_false); - m.Return(m.Int32Constant(0)); - - Stream s = m.Build(); - - ASSERT_EQ(1U, s.size()); - EXPECT_EQ(kIA32StackCheck, s[0]->arch_opcode()); - EXPECT_EQ(2U, s[0]->InputCount()); - EXPECT_EQ(0U, s[0]->OutputCount()); -} - } // namespace compiler } // namespace internal } // namespace v8 diff --git a/deps/v8/test/unittests/compiler/int64-lowering-unittest.cc b/deps/v8/test/unittests/compiler/int64-lowering-unittest.cc index 84d42b31d0..52769b09de 100644 --- a/deps/v8/test/unittests/compiler/int64-lowering-unittest.cc +++ b/deps/v8/test/unittests/compiler/int64-lowering-unittest.cc @@ -3,6 +3,9 @@ // found in the LICENSE file. #include "src/compiler/int64-lowering.h" + +#include "src/codegen/interface-descriptors.h" +#include "src/codegen/machine-type.h" #include "src/codegen/signature.h" #include "src/compiler/common-operator.h" #include "src/compiler/linkage.h" @@ -10,7 +13,6 @@ #include "src/compiler/node-properties.h" #include "src/compiler/node.h" #include "src/compiler/wasm-compiler.h" -#include "src/objects/objects-inl.h" #include "src/wasm/value-type.h" #include "src/wasm/wasm-module.h" #include "test/unittests/compiler/graph-unittest.h" @@ -48,6 +50,25 @@ class Int64LoweringTest : public GraphTest { lowering.LowerGraph(); } + void LowerGraphWithSpecialCase( + Node* node, std::unique_ptr<Int64LoweringSpecialCase> special_case, + MachineRepresentation rep) { + Node* zero = graph()->NewNode(common()->Int32Constant(0)); + Node* ret = graph()->NewNode(common()->Return(), zero, node, + graph()->start(), graph()->start()); + NodeProperties::MergeControlToEnd(graph(), common(), ret); + + // Create a signature for the outer wasm<>js call; for these tests we focus + // on lowering the special cases rather than the wrapper node at the + // JavaScript boundaries. + Signature<MachineRepresentation>::Builder sig_builder(zone(), 1, 0); + sig_builder.AddReturn(rep); + + Int64Lowering lowering(graph(), machine(), common(), zone(), + sig_builder.Build(), std::move(special_case)); + lowering.LowerGraph(); + } + void LowerGraph(Node* node, MachineRepresentation return_type, MachineRepresentation rep = MachineRepresentation::kWord32, int num_params = 0) { @@ -968,6 +989,100 @@ TEST_F(Int64LoweringTest, LoopCycle) { LowerGraph(load, MachineRepresentation::kWord64); } + +TEST_F(Int64LoweringTest, WasmBigIntSpecialCaseBigIntToI64) { + Node* target = Int32Constant(1); + Node* context = Int32Constant(2); + Node* bigint = Int32Constant(4); + + CallDescriptor* bigint_to_i64_call_descriptor = + Linkage::GetStubCallDescriptor( + zone(), // zone + BigIntToI64Descriptor(), // descriptor + BigIntToI64Descriptor() + .GetStackParameterCount(), // stack parameter count + CallDescriptor::kNoFlags, // flags + Operator::kNoProperties, // properties + StubCallMode::kCallCodeObject); // stub call mode + + CallDescriptor* bigint_to_i32_pair_call_descriptor = + Linkage::GetStubCallDescriptor( + zone(), // zone + BigIntToI32PairDescriptor(), // descriptor + BigIntToI32PairDescriptor() + .GetStackParameterCount(), // stack parameter count + CallDescriptor::kNoFlags, // flags + Operator::kNoProperties, // properties + StubCallMode::kCallCodeObject); // stub call mode + + auto lowering_special_case = base::make_unique<Int64LoweringSpecialCase>(); + lowering_special_case->bigint_to_i64_call_descriptor = + bigint_to_i64_call_descriptor; + lowering_special_case->bigint_to_i32_pair_call_descriptor = + bigint_to_i32_pair_call_descriptor; + + Node* call_node = + graph()->NewNode(common()->Call(bigint_to_i64_call_descriptor), target, + bigint, context, start(), start()); + + LowerGraphWithSpecialCase(call_node, std::move(lowering_special_case), + MachineRepresentation::kWord64); + + Capture<Node*> call; + Matcher<Node*> call_matcher = + IsCall(bigint_to_i32_pair_call_descriptor, target, bigint, context, + start(), start()); + + EXPECT_THAT(graph()->end()->InputAt(1), + IsReturn2(IsProjection(0, AllOf(CaptureEq(&call), call_matcher)), + IsProjection(1, AllOf(CaptureEq(&call), call_matcher)), + start(), start())); +} + +TEST_F(Int64LoweringTest, WasmBigIntSpecialCaseI64ToBigInt) { + Node* target = Int32Constant(1); + Node* i64 = Int64Constant(value(0)); + + CallDescriptor* i64_to_bigint_call_descriptor = + Linkage::GetStubCallDescriptor( + zone(), // zone + I64ToBigIntDescriptor(), // descriptor + I64ToBigIntDescriptor() + .GetStackParameterCount(), // stack parameter count + CallDescriptor::kNoFlags, // flags + Operator::kNoProperties, // properties + StubCallMode::kCallCodeObject); // stub call mode + + CallDescriptor* i32_pair_to_bigint_call_descriptor = + Linkage::GetStubCallDescriptor( + zone(), // zone + I32PairToBigIntDescriptor(), // descriptor + I32PairToBigIntDescriptor() + .GetStackParameterCount(), // stack parameter count + CallDescriptor::kNoFlags, // flags + Operator::kNoProperties, // properties + StubCallMode::kCallCodeObject); // stub call mode + + auto lowering_special_case = base::make_unique<Int64LoweringSpecialCase>(); + lowering_special_case->i64_to_bigint_call_descriptor = + i64_to_bigint_call_descriptor; + lowering_special_case->i32_pair_to_bigint_call_descriptor = + i32_pair_to_bigint_call_descriptor; + + Node* call = graph()->NewNode(common()->Call(i64_to_bigint_call_descriptor), + target, i64, start(), start()); + + LowerGraphWithSpecialCase(call, std::move(lowering_special_case), + MachineRepresentation::kTaggedPointer); + + EXPECT_THAT( + graph()->end()->InputAt(1), + IsReturn(IsCall(i32_pair_to_bigint_call_descriptor, target, + IsInt32Constant(low_word_value(0)), + IsInt32Constant(high_word_value(0)), start(), start()), + start(), start())); +} + } // namespace compiler } // namespace internal } // namespace v8 diff --git a/deps/v8/test/unittests/compiler/js-call-reducer-unittest.cc b/deps/v8/test/unittests/compiler/js-call-reducer-unittest.cc index 3d4e16ac68..7c062698c4 100644 --- a/deps/v8/test/unittests/compiler/js-call-reducer-unittest.cc +++ b/deps/v8/test/unittests/compiler/js-call-reducer-unittest.cc @@ -6,6 +6,7 @@ #include "src/codegen/tick-counter.h" #include "src/compiler/compilation-dependencies.h" +#include "src/compiler/feedback-source.h" #include "src/compiler/js-call-reducer.h" #include "src/compiler/js-graph.h" #include "src/compiler/simplified-operator.h" @@ -23,7 +24,6 @@ class JSCallReducerTest : public TypedGraphTest { public: JSCallReducerTest() : TypedGraphTest(3), javascript_(zone()), deps_(broker(), zone()) { - broker()->SerializeStandardObjects(); } ~JSCallReducerTest() override = default; @@ -113,7 +113,7 @@ class JSCallReducerTest : public TypedGraphTest { ClosureFeedbackCellArray::New(isolate(), shared); Handle<FeedbackVector> vector = FeedbackVector::New(isolate(), shared, closure_feedback_cell_array); - VectorSlotPair feedback(vector, FeedbackSlot(0), UNINITIALIZED); + FeedbackSource feedback(vector, FeedbackSlot(0)); return javascript()->Call(arity, CallFrequency(), feedback, ConvertReceiverMode::kAny, SpeculationMode::kAllowSpeculation); diff --git a/deps/v8/test/unittests/compiler/js-create-lowering-unittest.cc b/deps/v8/test/unittests/compiler/js-create-lowering-unittest.cc index 95c03e543f..fb5254903d 100644 --- a/deps/v8/test/unittests/compiler/js-create-lowering-unittest.cc +++ b/deps/v8/test/unittests/compiler/js-create-lowering-unittest.cc @@ -172,7 +172,8 @@ TEST_F(JSCreateLoweringTest, JSCreateFunctionContextViaInlinedAllocation) { // JSCreateWithContext TEST_F(JSCreateLoweringTest, JSCreateWithContext) { - Handle<ScopeInfo> scope_info = ScopeInfo::CreateForEmptyFunction(isolate()); + Handle<ScopeInfo> scope_info = + ReadOnlyRoots(isolate()).empty_function_scope_info_handle(); Node* const object = Parameter(Type::Receiver()); Node* const context = Parameter(Type::Any()); Node* const effect = graph()->start(); @@ -192,7 +193,8 @@ TEST_F(JSCreateLoweringTest, JSCreateWithContext) { // JSCreateCatchContext TEST_F(JSCreateLoweringTest, JSCreateCatchContext) { - Handle<ScopeInfo> scope_info = ScopeInfo::CreateForEmptyFunction(isolate()); + Handle<ScopeInfo> scope_info = + ReadOnlyRoots(isolate()).empty_function_scope_info_handle(); Node* const exception = Parameter(Type::Receiver()); Node* const context = Parameter(Type::Any()); Node* const effect = graph()->start(); diff --git a/deps/v8/test/unittests/compiler/js-intrinsic-lowering-unittest.cc b/deps/v8/test/unittests/compiler/js-intrinsic-lowering-unittest.cc index 3510cd4b74..5b4088f28e 100644 --- a/deps/v8/test/unittests/compiler/js-intrinsic-lowering-unittest.cc +++ b/deps/v8/test/unittests/compiler/js-intrinsic-lowering-unittest.cc @@ -37,7 +37,7 @@ class JSIntrinsicLoweringTest : public GraphTest { &machine); // TODO(titzer): mock the GraphReducer here for better unit testing. GraphReducer graph_reducer(zone(), graph(), tick_counter()); - JSIntrinsicLowering reducer(&graph_reducer, &jsgraph); + JSIntrinsicLowering reducer(&graph_reducer, &jsgraph, broker()); return reducer.Reduce(node); } diff --git a/deps/v8/test/unittests/compiler/js-typed-lowering-unittest.cc b/deps/v8/test/unittests/compiler/js-typed-lowering-unittest.cc index 0d7bb946e3..0d85253847 100644 --- a/deps/v8/test/unittests/compiler/js-typed-lowering-unittest.cc +++ b/deps/v8/test/unittests/compiler/js-typed-lowering-unittest.cc @@ -322,12 +322,13 @@ TEST_F(JSTypedLoweringTest, JSLoadContext) { Reduction const r2 = Reduce(graph()->NewNode( javascript()->LoadContext(1, index, immutable), context, effect)); ASSERT_TRUE(r2.Changed()); - EXPECT_THAT(r2.replacement(), - IsLoadField(AccessBuilder::ForContextSlot(index), - IsLoadField(AccessBuilder::ForContextSlot( - Context::PREVIOUS_INDEX), - context, effect, graph()->start()), - _, graph()->start())); + EXPECT_THAT( + r2.replacement(), + IsLoadField(AccessBuilder::ForContextSlot(index), + IsLoadField(AccessBuilder::ForContextSlotKnownPointer( + Context::PREVIOUS_INDEX), + context, effect, graph()->start()), + _, graph()->start())); } } } @@ -357,12 +358,13 @@ TEST_F(JSTypedLoweringTest, JSStoreContext) { Reduce(graph()->NewNode(javascript()->StoreContext(1, index), value, context, effect, control)); ASSERT_TRUE(r2.Changed()); - EXPECT_THAT(r2.replacement(), - IsStoreField(AccessBuilder::ForContextSlot(index), - IsLoadField(AccessBuilder::ForContextSlot( - Context::PREVIOUS_INDEX), - context, effect, graph()->start()), - value, _, control)); + EXPECT_THAT( + r2.replacement(), + IsStoreField(AccessBuilder::ForContextSlot(index), + IsLoadField(AccessBuilder::ForContextSlotKnownPointer( + Context::PREVIOUS_INDEX), + context, effect, graph()->start()), + value, _, control)); } } } @@ -373,7 +375,7 @@ TEST_F(JSTypedLoweringTest, JSStoreContext) { TEST_F(JSTypedLoweringTest, JSLoadNamedStringLength) { - VectorSlotPair feedback; + FeedbackSource feedback; Handle<Name> name = factory()->length_string(); Node* const receiver = Parameter(Type::String(), 0); Node* const context = UndefinedConstant(); diff --git a/deps/v8/test/unittests/compiler/linkage-tail-call-unittest.cc b/deps/v8/test/unittests/compiler/linkage-tail-call-unittest.cc index 17dc998f6d..d86771a8c3 100644 --- a/deps/v8/test/unittests/compiler/linkage-tail-call-unittest.cc +++ b/deps/v8/test/unittests/compiler/linkage-tail-call-unittest.cc @@ -55,8 +55,8 @@ TEST_F(LinkageTailCall, EmptyToEmpty) { CommonOperatorBuilder common(zone()); const Operator* op = common.Call(desc); Node* const node = Node::New(zone(), 1, op, 0, nullptr, false); - EXPECT_TRUE(desc->CanTailCall(node)); const CallDescriptor* callee = CallDescriptorOf(node->op()); + EXPECT_TRUE(desc->CanTailCall(callee)); int stack_param_delta = callee->GetStackParameterDelta(desc); EXPECT_EQ(0, stack_param_delta); } @@ -74,7 +74,7 @@ TEST_F(LinkageTailCall, SameReturn) { CommonOperatorBuilder common(zone()); const Operator* op = common.Call(desc2); Node* const node = Node::New(zone(), 1, op, 0, nullptr, false); - EXPECT_TRUE(desc1->CanTailCall(node)); + EXPECT_TRUE(desc1->CanTailCall(CallDescriptorOf(node->op()))); int stack_param_delta = desc2->GetStackParameterDelta(desc1); EXPECT_EQ(0, stack_param_delta); } @@ -94,7 +94,7 @@ TEST_F(LinkageTailCall, DifferingReturn) { CommonOperatorBuilder common(zone()); const Operator* op = common.Call(desc2); Node* const node = Node::New(zone(), 1, op, 0, nullptr, false); - EXPECT_TRUE(!desc1->CanTailCall(node)); + EXPECT_FALSE(desc1->CanTailCall(CallDescriptorOf(node->op()))); } @@ -113,7 +113,7 @@ TEST_F(LinkageTailCall, MoreRegisterParametersCallee) { CommonOperatorBuilder common(zone()); const Operator* op = common.Call(desc2); Node* const node = Node::New(zone(), 1, op, 0, nullptr, false); - EXPECT_TRUE(desc1->CanTailCall(node)); + EXPECT_TRUE(desc1->CanTailCall(CallDescriptorOf(node->op()))); int stack_param_delta = desc2->GetStackParameterDelta(desc1); EXPECT_EQ(0, stack_param_delta); } @@ -134,7 +134,7 @@ TEST_F(LinkageTailCall, MoreRegisterParametersCaller) { CommonOperatorBuilder common(zone()); const Operator* op = common.Call(desc2); Node* const node = Node::New(zone(), 1, op, 0, nullptr, false); - EXPECT_TRUE(desc1->CanTailCall(node)); + EXPECT_TRUE(desc1->CanTailCall(CallDescriptorOf(node->op()))); int stack_param_delta = desc2->GetStackParameterDelta(desc1); EXPECT_EQ(0, stack_param_delta); } @@ -155,7 +155,7 @@ TEST_F(LinkageTailCall, MoreRegisterAndStackParametersCallee) { CommonOperatorBuilder common(zone()); const Operator* op = common.Call(desc2); Node* const node = Node::New(zone(), 1, op, 0, nullptr, false); - EXPECT_TRUE(desc1->CanTailCall(node)); + EXPECT_TRUE(desc1->CanTailCall(CallDescriptorOf(node->op()))); int stack_param_delta = desc2->GetStackParameterDelta(desc1); // We might need to add one slot of padding to the callee arguments. int expected = kPadArguments ? 2 : 1; @@ -178,7 +178,7 @@ TEST_F(LinkageTailCall, MoreRegisterAndStackParametersCaller) { CommonOperatorBuilder common(zone()); const Operator* op = common.Call(desc2); Node* const node = Node::New(zone(), 1, op, 0, nullptr, false); - EXPECT_TRUE(desc1->CanTailCall(node)); + EXPECT_TRUE(desc1->CanTailCall(CallDescriptorOf(node->op()))); int stack_param_delta = desc2->GetStackParameterDelta(desc1); // We might need to drop one slot of padding from the caller's arguments. int expected = kPadArguments ? -2 : -1; @@ -206,7 +206,7 @@ TEST_F(LinkageTailCall, MatchingStackParameters) { const Operator* op = common.Call(desc2); Node* const node = Node::New(zone(), 1, op, arraysize(parameters), parameters, false); - EXPECT_TRUE(desc1->CanTailCall(node)); + EXPECT_TRUE(desc1->CanTailCall(CallDescriptorOf(node->op()))); int stack_param_delta = desc2->GetStackParameterDelta(desc1); EXPECT_EQ(0, stack_param_delta); } @@ -232,7 +232,7 @@ TEST_F(LinkageTailCall, NonMatchingStackParameters) { const Operator* op = common.Call(desc2); Node* const node = Node::New(zone(), 1, op, arraysize(parameters), parameters, false); - EXPECT_TRUE(desc1->CanTailCall(node)); + EXPECT_TRUE(desc1->CanTailCall(CallDescriptorOf(node->op()))); int stack_param_delta = desc2->GetStackParameterDelta(desc1); EXPECT_EQ(0, stack_param_delta); } @@ -259,7 +259,7 @@ TEST_F(LinkageTailCall, MatchingStackParametersExtraCallerRegisters) { const Operator* op = common.Call(desc2); Node* const node = Node::New(zone(), 1, op, arraysize(parameters), parameters, false); - EXPECT_TRUE(desc1->CanTailCall(node)); + EXPECT_TRUE(desc1->CanTailCall(CallDescriptorOf(node->op()))); int stack_param_delta = desc2->GetStackParameterDelta(desc1); EXPECT_EQ(0, stack_param_delta); } @@ -287,7 +287,7 @@ TEST_F(LinkageTailCall, MatchingStackParametersExtraCalleeRegisters) { const Operator* op = common.Call(desc2); Node* const node = Node::New(zone(), 1, op, arraysize(parameters), parameters, false); - EXPECT_TRUE(desc1->CanTailCall(node)); + EXPECT_TRUE(desc1->CanTailCall(CallDescriptorOf(node->op()))); int stack_param_delta = desc2->GetStackParameterDelta(desc1); EXPECT_EQ(0, stack_param_delta); } @@ -315,7 +315,7 @@ TEST_F(LinkageTailCall, MatchingStackParametersExtraCallerRegistersAndStack) { const Operator* op = common.Call(desc2); Node* const node = Node::New(zone(), 1, op, arraysize(parameters), parameters, false); - EXPECT_TRUE(desc1->CanTailCall(node)); + EXPECT_TRUE(desc1->CanTailCall(CallDescriptorOf(node->op()))); int stack_param_delta = desc2->GetStackParameterDelta(desc1); // We might need to add one slot of padding to the callee arguments. int expected = kPadArguments ? 0 : -1; @@ -345,7 +345,7 @@ TEST_F(LinkageTailCall, MatchingStackParametersExtraCalleeRegistersAndStack) { const Operator* op = common.Call(desc2); Node* const node = Node::New(zone(), 1, op, arraysize(parameters), parameters, false); - EXPECT_TRUE(desc1->CanTailCall(node)); + EXPECT_TRUE(desc1->CanTailCall(CallDescriptorOf(node->op()))); int stack_param_delta = desc2->GetStackParameterDelta(desc1); // We might need to drop one slot of padding from the caller's arguments. int expected = kPadArguments ? 0 : 1; diff --git a/deps/v8/test/unittests/compiler/machine-operator-unittest.cc b/deps/v8/test/unittests/compiler/machine-operator-unittest.cc index 24fc6a31c7..d0acbf341c 100644 --- a/deps/v8/test/unittests/compiler/machine-operator-unittest.cc +++ b/deps/v8/test/unittests/compiler/machine-operator-unittest.cc @@ -245,7 +245,7 @@ const PureOperator kPureOperators[] = { PURE(Float64Equal, 2, 0, 1), // -- PURE(Float64LessThan, 2, 0, 1), // -- PURE(Float64LessThanOrEqual, 2, 0, 1), // -- - PURE(LoadStackPointer, 0, 0, 1), // -- + PURE(StackPointerGreaterThan, 1, 0, 1), // -- PURE(Float64ExtractLowWord32, 1, 0, 1), // -- PURE(Float64ExtractHighWord32, 1, 0, 1), // -- PURE(Float64InsertLowWord32, 2, 0, 1), // -- diff --git a/deps/v8/test/unittests/compiler/node-test-utils.cc b/deps/v8/test/unittests/compiler/node-test-utils.cc index fc6f1d5500..6fa4ce0cf0 100644 --- a/deps/v8/test/unittests/compiler/node-test-utils.cc +++ b/deps/v8/test/unittests/compiler/node-test-utils.cc @@ -2204,6 +2204,7 @@ IS_UNOP_MATCHER(ChangeInt32ToInt64) IS_UNOP_MATCHER(ChangeUint32ToFloat64) IS_UNOP_MATCHER(ChangeUint32ToUint64) IS_UNOP_MATCHER(ChangeCompressedToTagged) +IS_UNOP_MATCHER(ChangeCompressedPointerToTaggedPointer) IS_UNOP_MATCHER(TruncateFloat64ToFloat32) IS_UNOP_MATCHER(TruncateInt64ToInt32) IS_UNOP_MATCHER(Float32Abs) diff --git a/deps/v8/test/unittests/compiler/node-test-utils.h b/deps/v8/test/unittests/compiler/node-test-utils.h index be8d67cb35..a71aff913b 100644 --- a/deps/v8/test/unittests/compiler/node-test-utils.h +++ b/deps/v8/test/unittests/compiler/node-test-utils.h @@ -427,6 +427,8 @@ Matcher<Node*> IsChangeInt32ToInt64(const Matcher<Node*>& input_matcher); Matcher<Node*> IsChangeUint32ToFloat64(const Matcher<Node*>& input_matcher); Matcher<Node*> IsChangeUint32ToUint64(const Matcher<Node*>& input_matcher); Matcher<Node*> IsChangeCompressedToTagged(const Matcher<Node*>& input_matcher); +Matcher<Node*> IsChangeCompressedPointerToTaggedPointer( + const Matcher<Node*>& input_matcher); Matcher<Node*> IsTruncateFloat64ToFloat32(const Matcher<Node*>& input_matcher); Matcher<Node*> IsTruncateInt64ToInt32(const Matcher<Node*>& input_matcher); Matcher<Node*> IsFloat32Abs(const Matcher<Node*>& input_matcher); diff --git a/deps/v8/test/unittests/compiler/redundancy-elimination-unittest.cc b/deps/v8/test/unittests/compiler/redundancy-elimination-unittest.cc index 76fbc4a368..9655fc70b2 100644 --- a/deps/v8/test/unittests/compiler/redundancy-elimination-unittest.cc +++ b/deps/v8/test/unittests/compiler/redundancy-elimination-unittest.cc @@ -5,6 +5,7 @@ #include "src/compiler/redundancy-elimination.h" #include "src/codegen/tick-counter.h" #include "src/compiler/common-operator.h" +#include "src/compiler/feedback-source.h" #include "test/unittests/compiler/graph-reducer-unittest.h" #include "test/unittests/compiler/graph-unittest.h" #include "test/unittests/compiler/node-test-utils.h" @@ -40,26 +41,24 @@ class RedundancyEliminationTest : public GraphTest { ClosureFeedbackCellArray::New(isolate(), shared); Handle<FeedbackVector> feedback_vector = FeedbackVector::New(isolate(), shared, closure_feedback_cell_array); - vector_slot_pairs_.push_back(VectorSlotPair()); - vector_slot_pairs_.push_back( - VectorSlotPair(feedback_vector, slot1, UNINITIALIZED)); - vector_slot_pairs_.push_back( - VectorSlotPair(feedback_vector, slot2, UNINITIALIZED)); + vector_slot_pairs_.push_back(FeedbackSource()); + vector_slot_pairs_.push_back(FeedbackSource(feedback_vector, slot1)); + vector_slot_pairs_.push_back(FeedbackSource(feedback_vector, slot2)); } ~RedundancyEliminationTest() override = default; protected: Reduction Reduce(Node* node) { return reducer_.Reduce(node); } - std::vector<VectorSlotPair> const& vector_slot_pairs() const { + std::vector<FeedbackSource> const& vector_slot_pairs() const { return vector_slot_pairs_; } SimplifiedOperatorBuilder* simplified() { return &simplified_; } private: NiceMock<MockAdvancedReducerEditor> editor_; - std::vector<VectorSlotPair> vector_slot_pairs_; - VectorSlotPair feedback2_; + std::vector<FeedbackSource> vector_slot_pairs_; + FeedbackSource feedback2_; RedundancyElimination reducer_; SimplifiedOperatorBuilder simplified_; }; @@ -88,8 +87,8 @@ const NumberOperationHint kNumberOperationHints[] = { // CheckBounds TEST_F(RedundancyEliminationTest, CheckBounds) { - TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { - TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback2, vector_slot_pairs()) { Node* index = Parameter(0); Node* length = Parameter(1); Node* effect = graph()->start(); @@ -114,8 +113,8 @@ TEST_F(RedundancyEliminationTest, CheckBounds) { // CheckNumber TEST_F(RedundancyEliminationTest, CheckNumberSubsumedByCheckSmi) { - TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { - TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback2, vector_slot_pairs()) { Node* value = Parameter(0); Node* effect = graph()->start(); Node* control = graph()->start(); @@ -201,7 +200,7 @@ TEST_F(RedundancyEliminationTest, TEST_F(RedundancyEliminationTest, CheckStringSubsumedByCheckInternalizedString) { - TRACED_FOREACH(VectorSlotPair, feedback, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback, vector_slot_pairs()) { Node* value = Parameter(0); Node* effect = graph()->start(); Node* control = graph()->start(); @@ -245,8 +244,8 @@ TEST_F(RedundancyEliminationTest, CheckSymbol) { // CheckedFloat64ToInt32 TEST_F(RedundancyEliminationTest, CheckedFloat64ToInt32) { - TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { - TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback2, vector_slot_pairs()) { TRACED_FOREACH(CheckForMinusZeroMode, mode, kCheckForMinusZeroModes) { Node* value = Parameter(0); Node* effect = graph()->start(); @@ -274,8 +273,8 @@ TEST_F(RedundancyEliminationTest, CheckedFloat64ToInt32) { // CheckedFloat64ToInt64 TEST_F(RedundancyEliminationTest, CheckedFloat64ToInt64) { - TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { - TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback2, vector_slot_pairs()) { TRACED_FOREACH(CheckForMinusZeroMode, mode, kCheckForMinusZeroModes) { Node* value = Parameter(0); Node* effect = graph()->start(); @@ -306,8 +305,8 @@ TEST_F(RedundancyEliminationTest, CheckedInt32ToCompressedSigned) { if (!COMPRESS_POINTERS_BOOL) { return; } - TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { - TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback2, vector_slot_pairs()) { Node* value = Parameter(0); Node* effect = graph()->start(); Node* control = graph()->start(); @@ -333,8 +332,8 @@ TEST_F(RedundancyEliminationTest, CheckedInt32ToCompressedSigned) { // CheckedInt32ToTaggedSigned TEST_F(RedundancyEliminationTest, CheckedInt32ToTaggedSigned) { - TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { - TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback2, vector_slot_pairs()) { Node* value = Parameter(0); Node* effect = graph()->start(); Node* control = graph()->start(); @@ -360,8 +359,8 @@ TEST_F(RedundancyEliminationTest, CheckedInt32ToTaggedSigned) { // CheckedInt64ToInt32 TEST_F(RedundancyEliminationTest, CheckedInt64ToInt32) { - TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { - TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback2, vector_slot_pairs()) { Node* value = Parameter(0); Node* effect = graph()->start(); Node* control = graph()->start(); @@ -385,8 +384,8 @@ TEST_F(RedundancyEliminationTest, CheckedInt64ToInt32) { // CheckedInt64ToTaggedSigned TEST_F(RedundancyEliminationTest, CheckedInt64ToTaggedSigned) { - TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { - TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback2, vector_slot_pairs()) { Node* value = Parameter(0); Node* effect = graph()->start(); Node* control = graph()->start(); @@ -412,8 +411,8 @@ TEST_F(RedundancyEliminationTest, CheckedInt64ToTaggedSigned) { // CheckedTaggedSignedToInt32 TEST_F(RedundancyEliminationTest, CheckedTaggedSignedToInt32) { - TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { - TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback2, vector_slot_pairs()) { Node* value = Parameter(0); Node* effect = graph()->start(); Node* control = graph()->start(); @@ -439,8 +438,8 @@ TEST_F(RedundancyEliminationTest, CheckedTaggedSignedToInt32) { // CheckedTaggedToFloat64 TEST_F(RedundancyEliminationTest, CheckedTaggedToFloat64) { - TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { - TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback2, vector_slot_pairs()) { TRACED_FOREACH(CheckTaggedInputMode, mode, kCheckTaggedInputModes) { Node* value = Parameter(0); Node* effect = graph()->start(); @@ -466,8 +465,8 @@ TEST_F(RedundancyEliminationTest, CheckedTaggedToFloat64) { TEST_F(RedundancyEliminationTest, CheckedTaggedToFloat64SubsubmedByCheckedTaggedToFloat64) { - TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { - TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback2, vector_slot_pairs()) { Node* value = Parameter(0); Node* effect = graph()->start(); Node* control = graph()->start(); @@ -497,8 +496,8 @@ TEST_F(RedundancyEliminationTest, // CheckedTaggedToInt32 TEST_F(RedundancyEliminationTest, CheckedTaggedToInt32) { - TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { - TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback2, vector_slot_pairs()) { TRACED_FOREACH(CheckForMinusZeroMode, mode, kCheckForMinusZeroModes) { Node* value = Parameter(0); Node* effect = graph()->start(); @@ -524,8 +523,8 @@ TEST_F(RedundancyEliminationTest, CheckedTaggedToInt32) { TEST_F(RedundancyEliminationTest, CheckedTaggedToInt32SubsumedByCheckedTaggedSignedToInt32) { - TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { - TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback2, vector_slot_pairs()) { TRACED_FOREACH(CheckForMinusZeroMode, mode, kCheckForMinusZeroModes) { Node* value = Parameter(0); Node* effect = graph()->start(); @@ -553,8 +552,8 @@ TEST_F(RedundancyEliminationTest, // CheckedTaggedToInt64 TEST_F(RedundancyEliminationTest, CheckedTaggedToInt64) { - TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { - TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback2, vector_slot_pairs()) { TRACED_FOREACH(CheckForMinusZeroMode, mode, kCheckForMinusZeroModes) { Node* value = Parameter(0); Node* effect = graph()->start(); @@ -582,8 +581,8 @@ TEST_F(RedundancyEliminationTest, CheckedTaggedToInt64) { // CheckedTaggedToTaggedPointer TEST_F(RedundancyEliminationTest, CheckedTaggedToTaggedPointer) { - TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { - TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback2, vector_slot_pairs()) { Node* value = Parameter(0); Node* effect = graph()->start(); Node* control = graph()->start(); @@ -609,8 +608,8 @@ TEST_F(RedundancyEliminationTest, CheckedTaggedToTaggedPointer) { // CheckedTaggedToTaggedSigned TEST_F(RedundancyEliminationTest, CheckedTaggedToTaggedSigned) { - TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { - TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback2, vector_slot_pairs()) { Node* value = Parameter(0); Node* effect = graph()->start(); Node* control = graph()->start(); @@ -636,8 +635,8 @@ TEST_F(RedundancyEliminationTest, CheckedTaggedToTaggedSigned) { // CheckedCompressedToTaggedPointer TEST_F(RedundancyEliminationTest, CheckedCompressedToTaggedPointer) { - TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { - TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback2, vector_slot_pairs()) { Node* value = Parameter(0); Node* effect = graph()->start(); Node* control = graph()->start(); @@ -663,8 +662,8 @@ TEST_F(RedundancyEliminationTest, CheckedCompressedToTaggedPointer) { // CheckedCompressedToTaggedSigned TEST_F(RedundancyEliminationTest, CheckedCompressedToTaggedSigned) { - TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { - TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback2, vector_slot_pairs()) { Node* value = Parameter(0); Node* effect = graph()->start(); Node* control = graph()->start(); @@ -690,8 +689,8 @@ TEST_F(RedundancyEliminationTest, CheckedCompressedToTaggedSigned) { // CheckedTaggedToCompressedPointer TEST_F(RedundancyEliminationTest, CheckedTaggedToCompressedPointer) { - TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { - TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback2, vector_slot_pairs()) { Node* value = Parameter(0); Node* effect = graph()->start(); Node* control = graph()->start(); @@ -717,8 +716,8 @@ TEST_F(RedundancyEliminationTest, CheckedTaggedToCompressedPointer) { // CheckedTaggedToCompressedSigned TEST_F(RedundancyEliminationTest, CheckedTaggedToCompressedSigned) { - TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { - TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback2, vector_slot_pairs()) { Node* value = Parameter(0); Node* effect = graph()->start(); Node* control = graph()->start(); @@ -744,8 +743,8 @@ TEST_F(RedundancyEliminationTest, CheckedTaggedToCompressedSigned) { // CheckedTruncateTaggedToWord32 TEST_F(RedundancyEliminationTest, CheckedTruncateTaggedToWord32) { - TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { - TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback2, vector_slot_pairs()) { TRACED_FOREACH(CheckTaggedInputMode, mode, kCheckTaggedInputModes) { Node* value = Parameter(0); Node* effect = graph()->start(); @@ -771,8 +770,8 @@ TEST_F(RedundancyEliminationTest, CheckedTruncateTaggedToWord32) { TEST_F(RedundancyEliminationTest, CheckedTruncateTaggedToWord32SubsumedByCheckedTruncateTaggedToWord32) { - TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { - TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback2, vector_slot_pairs()) { Node* value = Parameter(0); Node* effect = graph()->start(); Node* control = graph()->start(); @@ -802,8 +801,8 @@ TEST_F(RedundancyEliminationTest, // CheckedUint32Bounds TEST_F(RedundancyEliminationTest, CheckedUint32Bounds) { - TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { - TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback2, vector_slot_pairs()) { Node* index = Parameter(0); Node* length = Parameter(1); Node* effect = graph()->start(); @@ -832,8 +831,8 @@ TEST_F(RedundancyEliminationTest, CheckedUint32Bounds) { // CheckedUint32ToInt32 TEST_F(RedundancyEliminationTest, CheckedUint32ToInt32) { - TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { - TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback2, vector_slot_pairs()) { Node* value = Parameter(0); Node* effect = graph()->start(); Node* control = graph()->start(); @@ -859,8 +858,8 @@ TEST_F(RedundancyEliminationTest, CheckedUint32ToInt32) { // CheckedUint32ToTaggedSigned TEST_F(RedundancyEliminationTest, CheckedUint32ToTaggedSigned) { - TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { - TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback2, vector_slot_pairs()) { Node* value = Parameter(0); Node* effect = graph()->start(); Node* control = graph()->start(); @@ -886,8 +885,8 @@ TEST_F(RedundancyEliminationTest, CheckedUint32ToTaggedSigned) { // CheckedUint64Bounds TEST_F(RedundancyEliminationTest, CheckedUint64Bounds) { - TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { - TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback2, vector_slot_pairs()) { Node* index = Parameter(0); Node* length = Parameter(1); Node* effect = graph()->start(); @@ -914,8 +913,8 @@ TEST_F(RedundancyEliminationTest, CheckedUint64Bounds) { // CheckedUint64ToInt32 TEST_F(RedundancyEliminationTest, CheckedUint64ToInt32) { - TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { - TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback2, vector_slot_pairs()) { Node* value = Parameter(0); Node* effect = graph()->start(); Node* control = graph()->start(); @@ -941,8 +940,8 @@ TEST_F(RedundancyEliminationTest, CheckedUint64ToInt32) { // CheckedUint64ToTaggedSigned TEST_F(RedundancyEliminationTest, CheckedUint64ToTaggedSigned) { - TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { - TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback2, vector_slot_pairs()) { Node* value = Parameter(0); Node* effect = graph()->start(); Node* control = graph()->start(); @@ -970,8 +969,8 @@ TEST_F(RedundancyEliminationTest, CheckedUint64ToTaggedSigned) { TEST_F(RedundancyEliminationTest, SpeculativeNumberEqualWithCheckBoundsBetterType) { Typer typer(broker(), Typer::kNoFlags, graph(), tick_counter()); - TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { - TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback2, vector_slot_pairs()) { Node* lhs = Parameter(Type::Any(), 0); Node* rhs = Parameter(Type::Any(), 1); Node* length = Parameter(Type::Unsigned31(), 2); @@ -1006,8 +1005,8 @@ TEST_F(RedundancyEliminationTest, TEST_F(RedundancyEliminationTest, SpeculativeNumberEqualWithCheckBoundsSameType) { Typer typer(broker(), Typer::kNoFlags, graph(), tick_counter()); - TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { - TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback2, vector_slot_pairs()) { Node* lhs = Parameter(Type::UnsignedSmall(), 0); Node* rhs = Parameter(Type::UnsignedSmall(), 1); Node* length = Parameter(Type::Unsigned31(), 2); @@ -1045,8 +1044,8 @@ TEST_F(RedundancyEliminationTest, TEST_F(RedundancyEliminationTest, SpeculativeNumberLessThanWithCheckBoundsBetterType) { Typer typer(broker(), Typer::kNoFlags, graph(), tick_counter()); - TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { - TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback2, vector_slot_pairs()) { Node* lhs = Parameter(Type::Any(), 0); Node* rhs = Parameter(Type::Any(), 1); Node* length = Parameter(Type::Unsigned31(), 2); @@ -1081,8 +1080,8 @@ TEST_F(RedundancyEliminationTest, TEST_F(RedundancyEliminationTest, SpeculativeNumberLessThanWithCheckBoundsSameType) { Typer typer(broker(), Typer::kNoFlags, graph(), tick_counter()); - TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { - TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback2, vector_slot_pairs()) { Node* lhs = Parameter(Type::UnsignedSmall(), 0); Node* rhs = Parameter(Type::UnsignedSmall(), 1); Node* length = Parameter(Type::Unsigned31(), 2); @@ -1120,8 +1119,8 @@ TEST_F(RedundancyEliminationTest, TEST_F(RedundancyEliminationTest, SpeculativeNumberLessThanOrEqualWithCheckBoundsBetterType) { Typer typer(broker(), Typer::kNoFlags, graph(), tick_counter()); - TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { - TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback2, vector_slot_pairs()) { Node* lhs = Parameter(Type::Any(), 0); Node* rhs = Parameter(Type::Any(), 1); Node* length = Parameter(Type::Unsigned31(), 2); @@ -1156,8 +1155,8 @@ TEST_F(RedundancyEliminationTest, TEST_F(RedundancyEliminationTest, SpeculativeNumberLessThanOrEqualWithCheckBoundsSameType) { Typer typer(broker(), Typer::kNoFlags, graph(), tick_counter()); - TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { - TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback2, vector_slot_pairs()) { Node* lhs = Parameter(Type::UnsignedSmall(), 0); Node* rhs = Parameter(Type::UnsignedSmall(), 1); Node* length = Parameter(Type::Unsigned31(), 2); @@ -1195,7 +1194,7 @@ TEST_F(RedundancyEliminationTest, TEST_F(RedundancyEliminationTest, SpeculativeNumberAddWithCheckBoundsBetterType) { Typer typer(broker(), Typer::kNoFlags, graph(), tick_counter()); - TRACED_FOREACH(VectorSlotPair, feedback, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback, vector_slot_pairs()) { TRACED_FOREACH(NumberOperationHint, hint, kNumberOperationHints) { Node* lhs = Parameter(Type::Any(), 0); Node* rhs = Parameter(Type::Any(), 1); @@ -1221,7 +1220,7 @@ TEST_F(RedundancyEliminationTest, TEST_F(RedundancyEliminationTest, SpeculativeNumberAddWithCheckBoundsSameType) { Typer typer(broker(), Typer::kNoFlags, graph(), tick_counter()); - TRACED_FOREACH(VectorSlotPair, feedback, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback, vector_slot_pairs()) { TRACED_FOREACH(NumberOperationHint, hint, kNumberOperationHints) { Node* lhs = Parameter(Type::Range(42.0, 42.0, zone()), 0); Node* rhs = Parameter(Type::Any(), 0); @@ -1251,7 +1250,7 @@ TEST_F(RedundancyEliminationTest, SpeculativeNumberAddWithCheckBoundsSameType) { TEST_F(RedundancyEliminationTest, SpeculativeNumberSubtractWithCheckBoundsBetterType) { Typer typer(broker(), Typer::kNoFlags, graph(), tick_counter()); - TRACED_FOREACH(VectorSlotPair, feedback, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback, vector_slot_pairs()) { TRACED_FOREACH(NumberOperationHint, hint, kNumberOperationHints) { Node* lhs = Parameter(Type::Any(), 0); Node* rhs = Parameter(Type::Any(), 1); @@ -1279,7 +1278,7 @@ TEST_F(RedundancyEliminationTest, TEST_F(RedundancyEliminationTest, SpeculativeNumberSubtractWithCheckBoundsSameType) { Typer typer(broker(), Typer::kNoFlags, graph(), tick_counter()); - TRACED_FOREACH(VectorSlotPair, feedback, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback, vector_slot_pairs()) { TRACED_FOREACH(NumberOperationHint, hint, kNumberOperationHints) { Node* lhs = Parameter(Type::Range(42.0, 42.0, zone()), 0); Node* rhs = Parameter(Type::Any(), 0); @@ -1310,7 +1309,7 @@ TEST_F(RedundancyEliminationTest, TEST_F(RedundancyEliminationTest, SpeculativeSafeIntegerAddWithCheckBoundsBetterType) { Typer typer(broker(), Typer::kNoFlags, graph(), tick_counter()); - TRACED_FOREACH(VectorSlotPair, feedback, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback, vector_slot_pairs()) { TRACED_FOREACH(NumberOperationHint, hint, kNumberOperationHints) { Node* lhs = Parameter(Type::Any(), 0); Node* rhs = Parameter(Type::Any(), 1); @@ -1338,7 +1337,7 @@ TEST_F(RedundancyEliminationTest, TEST_F(RedundancyEliminationTest, SpeculativeSafeIntegerAddWithCheckBoundsSameType) { Typer typer(broker(), Typer::kNoFlags, graph(), tick_counter()); - TRACED_FOREACH(VectorSlotPair, feedback, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback, vector_slot_pairs()) { TRACED_FOREACH(NumberOperationHint, hint, kNumberOperationHints) { Node* lhs = Parameter(Type::Range(42.0, 42.0, zone()), 0); Node* rhs = Parameter(Type::Any(), 0); @@ -1369,7 +1368,7 @@ TEST_F(RedundancyEliminationTest, TEST_F(RedundancyEliminationTest, SpeculativeSafeIntegerSubtractWithCheckBoundsBetterType) { Typer typer(broker(), Typer::kNoFlags, graph(), tick_counter()); - TRACED_FOREACH(VectorSlotPair, feedback, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback, vector_slot_pairs()) { TRACED_FOREACH(NumberOperationHint, hint, kNumberOperationHints) { Node* lhs = Parameter(Type::Any(), 0); Node* rhs = Parameter(Type::Any(), 1); @@ -1397,7 +1396,7 @@ TEST_F(RedundancyEliminationTest, TEST_F(RedundancyEliminationTest, SpeculativeSafeIntegerSubtractWithCheckBoundsSameType) { Typer typer(broker(), Typer::kNoFlags, graph(), tick_counter()); - TRACED_FOREACH(VectorSlotPair, feedback, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback, vector_slot_pairs()) { TRACED_FOREACH(NumberOperationHint, hint, kNumberOperationHints) { Node* lhs = Parameter(Type::Range(42.0, 42.0, zone()), 0); Node* rhs = Parameter(Type::Any(), 0); @@ -1428,8 +1427,8 @@ TEST_F(RedundancyEliminationTest, TEST_F(RedundancyEliminationTest, SpeculativeToNumberWithCheckBoundsBetterType) { Typer typer(broker(), Typer::kNoFlags, graph(), tick_counter()); - TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { - TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback2, vector_slot_pairs()) { TRACED_FOREACH(NumberOperationHint, hint, kNumberOperationHints) { Node* index = Parameter(Type::Any(), 0); Node* length = Parameter(Type::Unsigned31(), 1); @@ -1456,8 +1455,8 @@ TEST_F(RedundancyEliminationTest, TEST_F(RedundancyEliminationTest, SpeculativeToNumberWithCheckBoundsSameType) { Typer typer(broker(), Typer::kNoFlags, graph(), tick_counter()); - TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { - TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(FeedbackSource, feedback2, vector_slot_pairs()) { TRACED_FOREACH(NumberOperationHint, hint, kNumberOperationHints) { Node* index = Parameter(Type::Range(42.0, 42.0, zone()), 0); Node* length = Parameter(Type::Unsigned31(), 1); diff --git a/deps/v8/test/unittests/compiler/simplified-operator-reducer-unittest.cc b/deps/v8/test/unittests/compiler/simplified-operator-reducer-unittest.cc index b198592ddd..e2d4f080f5 100644 --- a/deps/v8/test/unittests/compiler/simplified-operator-reducer-unittest.cc +++ b/deps/v8/test/unittests/compiler/simplified-operator-reducer-unittest.cc @@ -360,7 +360,7 @@ TEST_F(SimplifiedOperatorReducerTest, CheckedFloat64ToInt32WithConstant) { TRACED_FOREACH(int32_t, n, kInt32Values) { Reduction r = Reduce(graph()->NewNode( simplified()->CheckedFloat64ToInt32( - CheckForMinusZeroMode::kDontCheckForMinusZero, VectorSlotPair()), + CheckForMinusZeroMode::kDontCheckForMinusZero, FeedbackSource()), Float64Constant(n), effect, control)); ASSERT_TRUE(r.Changed()); EXPECT_THAT(r.replacement(), IsInt32Constant(n)); @@ -418,7 +418,7 @@ TEST_F(SimplifiedOperatorReducerTest, CheckSmiWithChangeInt31ToTaggedSigned) { Node* value = graph()->NewNode(simplified()->ChangeInt31ToTaggedSigned(), param0); Reduction reduction = Reduce(graph()->NewNode( - simplified()->CheckSmi(VectorSlotPair()), value, effect, control)); + simplified()->CheckSmi(FeedbackSource()), value, effect, control)); ASSERT_TRUE(reduction.Changed()); EXPECT_EQ(value, reduction.replacement()); } @@ -428,7 +428,7 @@ TEST_F(SimplifiedOperatorReducerTest, CheckSmiWithNumberConstant) { Node* control = graph()->start(); Node* value = NumberConstant(1.0); Reduction reduction = Reduce(graph()->NewNode( - simplified()->CheckSmi(VectorSlotPair()), value, effect, control)); + simplified()->CheckSmi(FeedbackSource()), value, effect, control)); ASSERT_TRUE(reduction.Changed()); EXPECT_EQ(value, reduction.replacement()); } @@ -438,9 +438,9 @@ TEST_F(SimplifiedOperatorReducerTest, CheckSmiWithCheckSmi) { Node* effect = graph()->start(); Node* control = graph()->start(); Node* value = effect = graph()->NewNode( - simplified()->CheckSmi(VectorSlotPair()), param0, effect, control); + simplified()->CheckSmi(FeedbackSource()), param0, effect, control); Reduction reduction = Reduce(graph()->NewNode( - simplified()->CheckSmi(VectorSlotPair()), value, effect, control)); + simplified()->CheckSmi(FeedbackSource()), value, effect, control)); ASSERT_TRUE(reduction.Changed()); EXPECT_EQ(value, reduction.replacement()); } diff --git a/deps/v8/test/unittests/compiler/typer-unittest.cc b/deps/v8/test/unittests/compiler/typer-unittest.cc index ec68993213..23e4dbe5ae 100644 --- a/deps/v8/test/unittests/compiler/typer-unittest.cc +++ b/deps/v8/test/unittests/compiler/typer-unittest.cc @@ -463,7 +463,7 @@ TEST_MONOTONICITY(Add) #undef TEST_MONOTONICITY TEST_F(TyperTest, Monotonicity_InstanceOf) { - TestBinaryMonotonicity(javascript_.InstanceOf(VectorSlotPair())); + TestBinaryMonotonicity(javascript_.InstanceOf(FeedbackSource())); } // JS BINOPS without hint diff --git a/deps/v8/test/unittests/compiler/x64/instruction-selector-x64-unittest.cc b/deps/v8/test/unittests/compiler/x64/instruction-selector-x64-unittest.cc index f8e3e26aa9..a62e824600 100644 --- a/deps/v8/test/unittests/compiler/x64/instruction-selector-x64-unittest.cc +++ b/deps/v8/test/unittests/compiler/x64/instruction-selector-x64-unittest.cc @@ -1718,58 +1718,6 @@ TEST_F(InstructionSelectorTest, LoadAndWord64ShiftRight32) { } } -TEST_F(InstructionSelectorTest, StackCheck0) { - ExternalReference js_stack_limit = - ExternalReference::Create(isolate()->stack_guard()->address_of_jslimit()); - StreamBuilder m(this, MachineType::Int32()); - Node* const sp = m.LoadStackPointer(); - Node* const stack_limit = - m.Load(MachineType::Pointer(), m.ExternalConstant(js_stack_limit)); - Node* const interrupt = m.UintPtrLessThan(sp, stack_limit); - - RawMachineLabel if_true, if_false; - m.Branch(interrupt, &if_true, &if_false); - - m.Bind(&if_true); - m.Return(m.Int32Constant(1)); - - m.Bind(&if_false); - m.Return(m.Int32Constant(0)); - - Stream s = m.Build(); - - ASSERT_EQ(1U, s.size()); - EXPECT_EQ(kX64Cmp, s[0]->arch_opcode()); - EXPECT_EQ(4U, s[0]->InputCount()); - EXPECT_EQ(0U, s[0]->OutputCount()); -} - -TEST_F(InstructionSelectorTest, StackCheck1) { - ExternalReference js_stack_limit = - ExternalReference::Create(isolate()->stack_guard()->address_of_jslimit()); - StreamBuilder m(this, MachineType::Int32()); - Node* const sp = m.LoadStackPointer(); - Node* const stack_limit = - m.Load(MachineType::Pointer(), m.ExternalConstant(js_stack_limit)); - Node* const sp_within_limit = m.UintPtrLessThan(stack_limit, sp); - - RawMachineLabel if_true, if_false; - m.Branch(sp_within_limit, &if_true, &if_false); - - m.Bind(&if_true); - m.Return(m.Int32Constant(1)); - - m.Bind(&if_false); - m.Return(m.Int32Constant(0)); - - Stream s = m.Build(); - - ASSERT_EQ(1U, s.size()); - EXPECT_EQ(kX64StackCheck, s[0]->arch_opcode()); - EXPECT_EQ(2U, s[0]->InputCount()); - EXPECT_EQ(0U, s[0]->OutputCount()); -} - } // namespace compiler } // namespace internal } // namespace v8 |