diff options
Diffstat (limited to 'deps/v8/test/unittests/compiler')
31 files changed, 1643 insertions, 313 deletions
diff --git a/deps/v8/test/unittests/compiler/bytecode-analysis-unittest.cc b/deps/v8/test/unittests/compiler/bytecode-analysis-unittest.cc index 48c15934df..53b9c6a241 100644 --- a/deps/v8/test/unittests/compiler/bytecode-analysis-unittest.cc +++ b/deps/v8/test/unittests/compiler/bytecode-analysis-unittest.cc @@ -22,8 +22,8 @@ using ToBooleanMode = interpreter::BytecodeArrayBuilder::ToBooleanMode; class BytecodeAnalysisTest : public TestWithIsolateAndZone { public: - BytecodeAnalysisTest() {} - ~BytecodeAnalysisTest() override {} + BytecodeAnalysisTest() = default; + ~BytecodeAnalysisTest() override = default; static void SetUpTestCase() { CHECK_NULL(save_flags_); diff --git a/deps/v8/test/unittests/compiler/checkpoint-elimination-unittest.cc b/deps/v8/test/unittests/compiler/checkpoint-elimination-unittest.cc index a201fc9a55..22ed2abf9b 100644 --- a/deps/v8/test/unittests/compiler/checkpoint-elimination-unittest.cc +++ b/deps/v8/test/unittests/compiler/checkpoint-elimination-unittest.cc @@ -18,7 +18,7 @@ namespace compiler { class CheckpointEliminationTest : public GraphTest { public: CheckpointEliminationTest() : GraphTest() {} - ~CheckpointEliminationTest() override {} + ~CheckpointEliminationTest() override = default; protected: Reduction Reduce(AdvancedReducer::Editor* editor, Node* node) { diff --git a/deps/v8/test/unittests/compiler/code-assembler-unittest.h b/deps/v8/test/unittests/compiler/code-assembler-unittest.h index 21f3df5f4b..56f1959765 100644 --- a/deps/v8/test/unittests/compiler/code-assembler-unittest.h +++ b/deps/v8/test/unittests/compiler/code-assembler-unittest.h @@ -15,8 +15,8 @@ namespace compiler { class CodeAssemblerTest : public TestWithIsolateAndZone { public: - CodeAssemblerTest() {} - ~CodeAssemblerTest() override {} + CodeAssemblerTest() = default; + ~CodeAssemblerTest() override = default; }; class CodeAssemblerTestState : public CodeAssemblerState { diff --git a/deps/v8/test/unittests/compiler/common-operator-reducer-unittest.cc b/deps/v8/test/unittests/compiler/common-operator-reducer-unittest.cc index cb5b5fd806..f40cab2758 100644 --- a/deps/v8/test/unittests/compiler/common-operator-reducer-unittest.cc +++ b/deps/v8/test/unittests/compiler/common-operator-reducer-unittest.cc @@ -23,7 +23,7 @@ class CommonOperatorReducerTest : public GraphTest { public: explicit CommonOperatorReducerTest(int num_parameters = 1) : GraphTest(num_parameters), machine_(zone()), simplified_(zone()) {} - ~CommonOperatorReducerTest() override {} + ~CommonOperatorReducerTest() override = default; protected: Reduction Reduce( diff --git a/deps/v8/test/unittests/compiler/common-operator-unittest.cc b/deps/v8/test/unittests/compiler/common-operator-unittest.cc index 2ee0dbb382..4d66ded5f1 100644 --- a/deps/v8/test/unittests/compiler/common-operator-unittest.cc +++ b/deps/v8/test/unittests/compiler/common-operator-unittest.cc @@ -120,7 +120,7 @@ namespace { class CommonOperatorTest : public TestWithZone { public: CommonOperatorTest() : common_(zone()) {} - ~CommonOperatorTest() override {} + ~CommonOperatorTest() override = default; CommonOperatorBuilder* common() { return &common_; } diff --git a/deps/v8/test/unittests/compiler/constant-folding-reducer-unittest.cc b/deps/v8/test/unittests/compiler/constant-folding-reducer-unittest.cc index 464ee3a971..fd0845159f 100644 --- a/deps/v8/test/unittests/compiler/constant-folding-reducer-unittest.cc +++ b/deps/v8/test/unittests/compiler/constant-folding-reducer-unittest.cc @@ -66,7 +66,7 @@ class ConstantFoldingReducerTest : public TypedGraphTest { js_heap_broker_(isolate(), zone()), simplified_(zone()), deps_(isolate(), zone()) {} - ~ConstantFoldingReducerTest() override {} + ~ConstantFoldingReducerTest() override = default; protected: Reduction Reduce(Node* node) { diff --git a/deps/v8/test/unittests/compiler/control-flow-optimizer-unittest.cc b/deps/v8/test/unittests/compiler/control-flow-optimizer-unittest.cc index 607df1fafb..992ddcc55b 100644 --- a/deps/v8/test/unittests/compiler/control-flow-optimizer-unittest.cc +++ b/deps/v8/test/unittests/compiler/control-flow-optimizer-unittest.cc @@ -21,7 +21,7 @@ class ControlFlowOptimizerTest : public GraphTest { public: explicit ControlFlowOptimizerTest(int num_parameters = 3) : GraphTest(num_parameters), machine_(zone()), javascript_(zone()) {} - ~ControlFlowOptimizerTest() override {} + ~ControlFlowOptimizerTest() override = default; protected: void Optimize() { diff --git a/deps/v8/test/unittests/compiler/dead-code-elimination-unittest.cc b/deps/v8/test/unittests/compiler/dead-code-elimination-unittest.cc index 4444ed0ca5..72e02e1416 100644 --- a/deps/v8/test/unittests/compiler/dead-code-elimination-unittest.cc +++ b/deps/v8/test/unittests/compiler/dead-code-elimination-unittest.cc @@ -20,7 +20,7 @@ class DeadCodeEliminationTest : public GraphTest { public: explicit DeadCodeEliminationTest(int num_parameters = 4) : GraphTest(num_parameters) {} - ~DeadCodeEliminationTest() override {} + ~DeadCodeEliminationTest() override = default; protected: Reduction Reduce(AdvancedReducer::Editor* editor, Node* node) { diff --git a/deps/v8/test/unittests/compiler/graph-reducer-unittest.cc b/deps/v8/test/unittests/compiler/graph-reducer-unittest.cc index dc2f2189d1..f506502610 100644 --- a/deps/v8/test/unittests/compiler/graph-reducer-unittest.cc +++ b/deps/v8/test/unittests/compiler/graph-reducer-unittest.cc @@ -751,7 +751,7 @@ TEST_F(GraphReducerTest, Sorter1) { Node* n1 = graph()->NewNode(&kOpA0); Node* n2 = graph()->NewNode(&kOpA1, n1); Node* n3 = graph()->NewNode(&kOpA1, n1); - Node* end = NULL; // Initialize to please the compiler. + Node* end = nullptr; // Initialize to please the compiler. if (i == 0) end = graph()->NewNode(&kOpA2, n2, n3); if (i == 1) end = graph()->NewNode(&kOpA2, n3, n2); diff --git a/deps/v8/test/unittests/compiler/graph-unittest.cc b/deps/v8/test/unittests/compiler/graph-unittest.cc index af2c382f5b..4736ddefa2 100644 --- a/deps/v8/test/unittests/compiler/graph-unittest.cc +++ b/deps/v8/test/unittests/compiler/graph-unittest.cc @@ -4,6 +4,7 @@ #include "test/unittests/compiler/graph-unittest.h" +#include "src/compiler/js-heap-copy-reducer.h" #include "src/compiler/node-properties.h" #include "src/heap/factory.h" #include "src/objects-inl.h" // TODO(everyone): Make typer.h IWYU compliant. @@ -24,16 +25,22 @@ 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())); + js_heap_broker()->SetNativeContextRef(); } -GraphTest::~GraphTest() {} +GraphTest::~GraphTest() = default; Node* GraphTest::Parameter(int32_t index) { return graph()->NewNode(common()->Parameter(index), graph()->start()); } +Node* GraphTest::Parameter(Type type, int32_t index) { + Node* node = GraphTest::Parameter(index); + NodeProperties::SetType(node, type); + return node; +} Node* GraphTest::Float32Constant(volatile float value) { return graph()->NewNode(common()->Float32Constant(value)); @@ -113,15 +120,9 @@ Matcher<Node*> GraphTest::IsUndefinedConstant() { TypedGraphTest::TypedGraphTest(int num_parameters) : GraphTest(num_parameters), - typer_(isolate(), js_heap_broker(), Typer::kNoFlags, graph()) {} - -TypedGraphTest::~TypedGraphTest() {} + typer_(js_heap_broker(), Typer::kNoFlags, graph()) {} -Node* TypedGraphTest::Parameter(Type type, int32_t index) { - Node* node = GraphTest::Parameter(index); - NodeProperties::SetType(node, type); - return node; -} +TypedGraphTest::~TypedGraphTest() = default; namespace graph_unittest { diff --git a/deps/v8/test/unittests/compiler/graph-unittest.h b/deps/v8/test/unittests/compiler/graph-unittest.h index d9b9934770..8317ebf279 100644 --- a/deps/v8/test/unittests/compiler/graph-unittest.h +++ b/deps/v8/test/unittests/compiler/graph-unittest.h @@ -34,6 +34,7 @@ class GraphTest : public virtual TestWithNativeContext, Node* end() { return graph()->end(); } Node* Parameter(int32_t index = 0); + Node* Parameter(Type type, int32_t index = 0); Node* Float32Constant(volatile float value); Node* Float64Constant(volatile double value); Node* Int32Constant(int32_t value); @@ -79,9 +80,6 @@ class TypedGraphTest : public GraphTest { ~TypedGraphTest() override; protected: - Node* Parameter(int32_t index = 0) { return GraphTest::Parameter(index); } - Node* Parameter(Type type, int32_t index = 0); - Typer* typer() { return &typer_; } private: diff --git a/deps/v8/test/unittests/compiler/instruction-selector-unittest.cc b/deps/v8/test/unittests/compiler/instruction-selector-unittest.cc index ed4a1c648a..2d59393f9d 100644 --- a/deps/v8/test/unittests/compiler/instruction-selector-unittest.cc +++ b/deps/v8/test/unittests/compiler/instruction-selector-unittest.cc @@ -20,7 +20,7 @@ namespace compiler { InstructionSelectorTest::InstructionSelectorTest() : rng_(FLAG_random_seed) {} -InstructionSelectorTest::~InstructionSelectorTest() {} +InstructionSelectorTest::~InstructionSelectorTest() = default; InstructionSelectorTest::Stream InstructionSelectorTest::StreamBuilder::Build( @@ -365,7 +365,8 @@ TARGET_TEST_F(InstructionSelectorTest, CallJSFunctionWithDeopt) { ZoneVector<MachineType> empty_types(zone()); auto call_descriptor = Linkage::GetJSCallDescriptor( - zone(), false, 1, CallDescriptor::kNeedsFrameState); + zone(), false, 1, + CallDescriptor::kNeedsFrameState | CallDescriptor::kCanUseRoots); // Build frame state for the state before the call. Node* parameters = m.AddNode( diff --git a/deps/v8/test/unittests/compiler/instruction-unittest.cc b/deps/v8/test/unittests/compiler/instruction-unittest.cc index 96add7fdd8..72deb12d02 100644 --- a/deps/v8/test/unittests/compiler/instruction-unittest.cc +++ b/deps/v8/test/unittests/compiler/instruction-unittest.cc @@ -38,8 +38,8 @@ bool Contains(const ZoneVector<MoveOperands*>* moves, class InstructionTest : public TestWithZone { public: - InstructionTest() {} - virtual ~InstructionTest() {} + InstructionTest() = default; + ~InstructionTest() override = default; ParallelMove* CreateParallelMove( const std::vector<InstructionOperand>& operand_pairs) { 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 53e3b48762..7660f5851e 100644 --- a/deps/v8/test/unittests/compiler/js-call-reducer-unittest.cc +++ b/deps/v8/test/unittests/compiler/js-call-reducer-unittest.cc @@ -21,11 +21,12 @@ namespace compiler { class JSCallReducerTest : public TypedGraphTest { public: JSCallReducerTest() - : TypedGraphTest(3), - javascript_(zone()), - deps_(isolate(), zone()), - js_heap_broker(isolate(), zone()) {} - ~JSCallReducerTest() override {} + : TypedGraphTest(3), javascript_(zone()), deps_(isolate(), zone()) { + if (FLAG_concurrent_compiler_frontend) { + js_heap_broker()->SerializeStandardObjects(); + } + } + ~JSCallReducerTest() override = default; protected: Reduction Reduce(Node* node) { @@ -36,7 +37,7 @@ class JSCallReducerTest : public TypedGraphTest { // TODO(titzer): mock the GraphReducer here for better unit testing. GraphReducer graph_reducer(zone(), graph()); - JSCallReducer reducer(&graph_reducer, &jsgraph, &js_heap_broker, + JSCallReducer reducer(&graph_reducer, &jsgraph, js_heap_broker(), JSCallReducer::kNoFlags, native_context(), &deps_); return reducer.Reduce(node); } @@ -45,16 +46,13 @@ class JSCallReducerTest : public TypedGraphTest { static void SetUpTestCase() { old_flag_lazy_ = i::FLAG_lazy_deserialization; - old_flag_lazy_handler_ = i::FLAG_lazy_handler_deserialization; i::FLAG_lazy_deserialization = false; - i::FLAG_lazy_handler_deserialization = false; TypedGraphTest::SetUpTestCase(); } static void TearDownTestCase() { TypedGraphTest::TearDownTestCase(); i::FLAG_lazy_deserialization = old_flag_lazy_; - i::FLAG_lazy_handler_deserialization = old_flag_lazy_handler_; } Node* GlobalFunction(const char* name) { @@ -124,7 +122,7 @@ class JSCallReducerTest : public TypedGraphTest { // overwriting existing metadata. shared->set_raw_outer_scope_info_or_feedback_metadata(*metadata); Handle<FeedbackVector> vector = FeedbackVector::New(isolate(), shared); - VectorSlotPair feedback(vector, FeedbackSlot(0)); + VectorSlotPair feedback(vector, FeedbackSlot(0), UNINITIALIZED); return javascript()->Call(arity, CallFrequency(), feedback, ConvertReceiverMode::kAny, SpeculationMode::kAllowSpeculation); @@ -133,7 +131,6 @@ class JSCallReducerTest : public TypedGraphTest { private: JSOperatorBuilder javascript_; CompilationDependencies deps_; - JSHeapBroker js_heap_broker; static bool old_flag_lazy_; static bool old_flag_lazy_handler_; 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 2db241aaa9..eafd7fa35e 100644 --- a/deps/v8/test/unittests/compiler/js-create-lowering-unittest.cc +++ b/deps/v8/test/unittests/compiler/js-create-lowering-unittest.cc @@ -33,8 +33,9 @@ class JSCreateLoweringTest : public TypedGraphTest { : TypedGraphTest(3), javascript_(zone()), deps_(isolate(), zone()), - handle_scope_(isolate()) {} - ~JSCreateLoweringTest() override {} + handle_scope_(isolate()) { + } + ~JSCreateLoweringTest() override = default; protected: Reduction Reduce(Node* node) { @@ -45,7 +46,7 @@ class JSCreateLoweringTest : public TypedGraphTest { // TODO(titzer): mock the GraphReducer here for better unit testing. GraphReducer graph_reducer(zone(), graph()); JSCreateLowering reducer(&graph_reducer, &deps_, &jsgraph, js_heap_broker(), - native_context(), zone()); + zone()); return reducer.Reduce(node); } @@ -172,7 +173,7 @@ TEST_F(JSCreateLoweringTest, JSCreateFunctionContextViaInlinedAllocation) { // JSCreateWithContext TEST_F(JSCreateLoweringTest, JSCreateWithContext) { - Handle<ScopeInfo> scope_info(factory()->NewScopeInfo(1)); + Handle<ScopeInfo> scope_info = ScopeInfo::CreateForEmptyFunction(isolate()); Node* const object = Parameter(Type::Receiver()); Node* const context = Parameter(Type::Any()); Node* const effect = graph()->start(); @@ -192,7 +193,7 @@ TEST_F(JSCreateLoweringTest, JSCreateWithContext) { // JSCreateCatchContext TEST_F(JSCreateLoweringTest, JSCreateCatchContext) { - Handle<ScopeInfo> scope_info(factory()->NewScopeInfo(1)); + Handle<ScopeInfo> scope_info = ScopeInfo::CreateForEmptyFunction(isolate()); 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 2b0ccaed24..234fe940eb 100644 --- a/deps/v8/test/unittests/compiler/js-intrinsic-lowering-unittest.cc +++ b/deps/v8/test/unittests/compiler/js-intrinsic-lowering-unittest.cc @@ -26,7 +26,7 @@ namespace compiler { class JSIntrinsicLoweringTest : public GraphTest { public: JSIntrinsicLoweringTest() : GraphTest(3), javascript_(zone()) {} - ~JSIntrinsicLoweringTest() override {} + ~JSIntrinsicLoweringTest() override = default; protected: Reduction Reduce(Node* node) { diff --git a/deps/v8/test/unittests/compiler/js-native-context-specialization-unittest.cc b/deps/v8/test/unittests/compiler/js-native-context-specialization-unittest.cc new file mode 100644 index 0000000000..fdc87904c4 --- /dev/null +++ b/deps/v8/test/unittests/compiler/js-native-context-specialization-unittest.cc @@ -0,0 +1,50 @@ +// Copyright 2014 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "test/unittests/compiler/graph-unittest.h" + +#include "src/compiler/js-native-context-specialization.h" +#include "src/compiler/js-operator.h" +#include "src/compiler/machine-operator.h" +#include "src/compiler/simplified-operator.h" +#include "src/dtoa.h" + +namespace v8 { +namespace internal { +namespace compiler { +namespace js_native_context_specialization_unittest { + +class JSNativeContextSpecializationTest : public GraphTest { + public: + explicit JSNativeContextSpecializationTest(int num_parameters = 1) + : GraphTest(num_parameters), javascript_(zone()) {} + ~JSNativeContextSpecializationTest() override {} + + protected: + JSOperatorBuilder* javascript() { return &javascript_; } + + private: + JSOperatorBuilder javascript_; +}; + +TEST_F(JSNativeContextSpecializationTest, GetMaxStringLengthOfString) { + const size_t str_len = 3; + const size_t num_len = kBase10MaximalLength + 1; + + Node* const str_node = graph()->NewNode( + common()->HeapConstant(factory()->InternalizeUtf8String("str"))); + EXPECT_EQ(JSNativeContextSpecialization::GetMaxStringLength(js_heap_broker(), + str_node), + str_len); + + Node* const num_node = graph()->NewNode(common()->NumberConstant(10.0 / 3)); + EXPECT_EQ(JSNativeContextSpecialization::GetMaxStringLength(js_heap_broker(), + num_node), + num_len); +} + +} // namespace js_native_context_specialization_unittest +} // namespace compiler +} // namespace internal +} // namespace v8 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 9ce837cd8c..43998824d2 100644 --- a/deps/v8/test/unittests/compiler/js-typed-lowering-unittest.cc +++ b/deps/v8/test/unittests/compiler/js-typed-lowering-unittest.cc @@ -38,7 +38,7 @@ Type const kJSTypes[] = {Type::Undefined(), Type::Null(), Type::Boolean(), class JSTypedLoweringTest : public TypedGraphTest { public: JSTypedLoweringTest() : TypedGraphTest(3), javascript_(zone()) {} - ~JSTypedLoweringTest() override {} + ~JSTypedLoweringTest() override = default; protected: Reduction Reduce(Node* node) { @@ -401,12 +401,7 @@ TEST_F(JSTypedLoweringTest, JSAddWithString) { Reduction r = Reduce(graph()->NewNode(javascript()->Add(hint), lhs, rhs, context, frame_state, effect, control)); ASSERT_TRUE(r.Changed()); - EXPECT_THAT(r.replacement(), - IsCall(_, IsHeapConstant( - CodeFactory::StringAdd( - isolate(), STRING_ADD_CHECK_NONE, NOT_TENURED) - .code()), - lhs, rhs, context, frame_state, effect, control)); + EXPECT_THAT(r.replacement(), IsStringConcat(_, lhs, rhs)); } } // namespace compiler diff --git a/deps/v8/test/unittests/compiler/load-elimination-unittest.cc b/deps/v8/test/unittests/compiler/load-elimination-unittest.cc index 5c49468991..042e7e6bbc 100644 --- a/deps/v8/test/unittests/compiler/load-elimination-unittest.cc +++ b/deps/v8/test/unittests/compiler/load-elimination-unittest.cc @@ -26,7 +26,7 @@ class LoadEliminationTest : public TypedGraphTest { simplified_(zone()), jsgraph_(isolate(), graph(), common(), nullptr, simplified(), nullptr) { } - ~LoadEliminationTest() override {} + ~LoadEliminationTest() override = default; protected: JSGraph* jsgraph() { return &jsgraph_; } diff --git a/deps/v8/test/unittests/compiler/loop-peeling-unittest.cc b/deps/v8/test/unittests/compiler/loop-peeling-unittest.cc index d39336dfa5..07013aa52c 100644 --- a/deps/v8/test/unittests/compiler/loop-peeling-unittest.cc +++ b/deps/v8/test/unittests/compiler/loop-peeling-unittest.cc @@ -54,7 +54,7 @@ struct Counter { class LoopPeelingTest : public GraphTest { public: LoopPeelingTest() : GraphTest(1), machine_(zone()) {} - ~LoopPeelingTest() override {} + ~LoopPeelingTest() override = default; protected: MachineOperatorBuilder machine_; diff --git a/deps/v8/test/unittests/compiler/machine-operator-reducer-unittest.cc b/deps/v8/test/unittests/compiler/machine-operator-reducer-unittest.cc index f47e780426..b8b0c9004f 100644 --- a/deps/v8/test/unittests/compiler/machine-operator-reducer-unittest.cc +++ b/deps/v8/test/unittests/compiler/machine-operator-reducer-unittest.cc @@ -71,7 +71,7 @@ class MachineOperatorReducerTestWithParam public: explicit MachineOperatorReducerTestWithParam(int num_parameters = 2) : MachineOperatorReducerTest(num_parameters) {} - ~MachineOperatorReducerTestWithParam() override {} + ~MachineOperatorReducerTestWithParam() override = default; }; @@ -344,6 +344,27 @@ TEST_F(MachineOperatorReducerTest, ChangeFloat64ToInt32WithConstant) { } } +// ----------------------------------------------------------------------------- +// ChangeFloat64ToInt64 + +TEST_F(MachineOperatorReducerTest, + ChangeFloat64ToInt64WithChangeInt64ToFloat64) { + Node* value = Parameter(0); + Reduction reduction = Reduce(graph()->NewNode( + machine()->ChangeFloat64ToInt64(), + graph()->NewNode(machine()->ChangeInt64ToFloat64(), value))); + ASSERT_TRUE(reduction.Changed()); + EXPECT_EQ(value, reduction.replacement()); +} + +TEST_F(MachineOperatorReducerTest, ChangeFloat64ToInt64WithConstant) { + TRACED_FOREACH(int32_t, x, kInt32Values) { + Reduction reduction = Reduce(graph()->NewNode( + machine()->ChangeFloat64ToInt64(), Float64Constant(FastI2D(x)))); + ASSERT_TRUE(reduction.Changed()); + EXPECT_THAT(reduction.replacement(), IsInt64Constant(x)); + } +} // ----------------------------------------------------------------------------- // ChangeFloat64ToUint32 @@ -397,6 +418,27 @@ TEST_F(MachineOperatorReducerTest, ChangeInt32ToInt64WithConstant) { } } +// ----------------------------------------------------------------------------- +// ChangeInt64ToFloat64 + +TEST_F(MachineOperatorReducerTest, + ChangeInt64ToFloat64WithChangeFloat64ToInt64) { + Node* value = Parameter(0); + Reduction reduction = Reduce(graph()->NewNode( + machine()->ChangeInt64ToFloat64(), + graph()->NewNode(machine()->ChangeFloat64ToInt64(), value))); + ASSERT_TRUE(reduction.Changed()); + EXPECT_EQ(value, reduction.replacement()); +} + +TEST_F(MachineOperatorReducerTest, ChangeInt64ToFloat64WithConstant) { + TRACED_FOREACH(int32_t, x, kInt32Values) { + Reduction reduction = Reduce( + graph()->NewNode(machine()->ChangeInt64ToFloat64(), Int64Constant(x))); + ASSERT_TRUE(reduction.Changed()); + EXPECT_THAT(reduction.replacement(), IsFloat64Constant(BitEq(FastI2D(x)))); + } +} // ----------------------------------------------------------------------------- // ChangeUint32ToFloat64 @@ -2020,6 +2062,16 @@ TEST_F(MachineOperatorReducerTest, Float64InsertHighWord32WithConstant) { // ----------------------------------------------------------------------------- // Float64Equal +TEST_F(MachineOperatorReducerTest, Float64EqualWithConstant) { + TRACED_FOREACH(double, x, kFloat64Values) { + TRACED_FOREACH(double, y, kFloat64Values) { + Reduction const r = Reduce(graph()->NewNode( + machine()->Float64Equal(), Float64Constant(x), Float64Constant(y))); + ASSERT_TRUE(r.Changed()); + EXPECT_THAT(r.replacement(), IsInt32Constant(x == y)); + } + } +} TEST_F(MachineOperatorReducerTest, Float64EqualWithFloat32Conversions) { Node* const p0 = Parameter(0); @@ -2049,6 +2101,17 @@ TEST_F(MachineOperatorReducerTest, Float64EqualWithFloat32Constant) { // ----------------------------------------------------------------------------- // Float64LessThan +TEST_F(MachineOperatorReducerTest, Float64LessThanWithConstant) { + TRACED_FOREACH(double, x, kFloat64Values) { + TRACED_FOREACH(double, y, kFloat64Values) { + Reduction const r = + Reduce(graph()->NewNode(machine()->Float64LessThan(), + Float64Constant(x), Float64Constant(y))); + ASSERT_TRUE(r.Changed()); + EXPECT_THAT(r.replacement(), IsInt32Constant(x < y)); + } + } +} TEST_F(MachineOperatorReducerTest, Float64LessThanWithFloat32Conversions) { Node* const p0 = Parameter(0); @@ -2089,6 +2152,17 @@ TEST_F(MachineOperatorReducerTest, Float64LessThanWithFloat32Constant) { // ----------------------------------------------------------------------------- // Float64LessThanOrEqual +TEST_F(MachineOperatorReducerTest, Float64LessThanOrEqualWithConstant) { + TRACED_FOREACH(double, x, kFloat64Values) { + TRACED_FOREACH(double, y, kFloat64Values) { + Reduction const r = + Reduce(graph()->NewNode(machine()->Float64LessThanOrEqual(), + Float64Constant(x), Float64Constant(y))); + ASSERT_TRUE(r.Changed()); + EXPECT_THAT(r.replacement(), IsInt32Constant(x <= y)); + } + } +} TEST_F(MachineOperatorReducerTest, Float64LessThanOrEqualWithFloat32Conversions) { diff --git a/deps/v8/test/unittests/compiler/node-cache-unittest.cc b/deps/v8/test/unittests/compiler/node-cache-unittest.cc index f77377deda..b699fb38ca 100644 --- a/deps/v8/test/unittests/compiler/node-cache-unittest.cc +++ b/deps/v8/test/unittests/compiler/node-cache-unittest.cc @@ -63,7 +63,7 @@ TEST_F(NodeCacheTest, Int32Constant_hits) { for (int i = 0; i < kSize; i++) { int32_t v = i * -55; Node** pos = cache.Find(zone(), v); - if (*pos != NULL) { + if (*pos != nullptr) { EXPECT_EQ(nodes[i], *pos); hits++; } @@ -101,7 +101,7 @@ TEST_F(NodeCacheTest, Int64Constant_hits) { for (int i = 0; i < kSize; i++) { int64_t v = static_cast<int64_t>(i) * static_cast<int64_t>(5003001); Node** pos = cache.Find(zone(), v); - if (*pos != NULL) { + if (*pos != nullptr) { EXPECT_EQ(nodes[i], *pos); hits++; } @@ -118,7 +118,7 @@ TEST_F(NodeCacheTest, GetCachedNodes_int32) { for (size_t i = 0; i < arraysize(constants); i++) { int32_t k = constants[i]; Node** pos = cache.Find(zone(), k); - if (*pos != NULL) { + if (*pos != nullptr) { ZoneVector<Node*> nodes(zone()); cache.GetCachedNodes(&nodes); EXPECT_THAT(nodes, Contains(*pos)); @@ -141,7 +141,7 @@ TEST_F(NodeCacheTest, GetCachedNodes_int64) { for (size_t i = 0; i < arraysize(constants); i++) { int64_t k = constants[i]; Node** pos = cache.Find(zone(), k); - if (*pos != NULL) { + if (*pos != nullptr) { ZoneVector<Node*> nodes(zone()); cache.GetCachedNodes(&nodes); EXPECT_THAT(nodes, Contains(*pos)); diff --git a/deps/v8/test/unittests/compiler/node-matchers-unittest.cc b/deps/v8/test/unittests/compiler/node-matchers-unittest.cc index 7f043049f0..2663e3abb8 100644 --- a/deps/v8/test/unittests/compiler/node-matchers-unittest.cc +++ b/deps/v8/test/unittests/compiler/node-matchers-unittest.cc @@ -19,7 +19,7 @@ namespace compiler { class NodeMatcherTest : public GraphTest { public: NodeMatcherTest() : machine_(zone()) {} - ~NodeMatcherTest() override {} + ~NodeMatcherTest() override = default; MachineOperatorBuilder* machine() { return &machine_; } @@ -150,191 +150,191 @@ TEST_F(NodeMatcherTest, ScaledWithOffset32Matcher) { // (B0 + B1) -> [B0, 0, B1, NULL] BaseWithIndexAndDisplacement32Matcher match1(graph()->NewNode(a_op, b0, b1)); - CheckBaseWithIndexAndDisplacement(&match1, b1, 0, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match1, b1, 0, b0, nullptr); // (B0 + D15) -> [NULL, 0, B0, D15] BaseWithIndexAndDisplacement32Matcher match2(graph()->NewNode(a_op, b0, d15)); - CheckBaseWithIndexAndDisplacement(&match2, NULL, 0, b0, d15); + CheckBaseWithIndexAndDisplacement(&match2, nullptr, 0, b0, d15); // (D15 + B0) -> [NULL, 0, B0, D15] BaseWithIndexAndDisplacement32Matcher match3(graph()->NewNode(a_op, d15, b0)); - CheckBaseWithIndexAndDisplacement(&match3, NULL, 0, b0, d15); + CheckBaseWithIndexAndDisplacement(&match3, nullptr, 0, b0, d15); // (B0 + M1) -> [p1, 0, B0, NULL] BaseWithIndexAndDisplacement32Matcher match4(graph()->NewNode(a_op, b0, m1)); - CheckBaseWithIndexAndDisplacement(&match4, p1, 0, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match4, p1, 0, b0, nullptr); // (M1 + B0) -> [p1, 0, B0, NULL] m1 = graph()->NewNode(m_op, p1, d1); BaseWithIndexAndDisplacement32Matcher match5(graph()->NewNode(a_op, m1, b0)); - CheckBaseWithIndexAndDisplacement(&match5, p1, 0, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match5, p1, 0, b0, nullptr); // (D15 + M1) -> [P1, 0, NULL, D15] m1 = graph()->NewNode(m_op, p1, d1); BaseWithIndexAndDisplacement32Matcher match6(graph()->NewNode(a_op, d15, m1)); - CheckBaseWithIndexAndDisplacement(&match6, p1, 0, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match6, p1, 0, nullptr, d15); // (M1 + D15) -> [P1, 0, NULL, D15] m1 = graph()->NewNode(m_op, p1, d1); BaseWithIndexAndDisplacement32Matcher match7(graph()->NewNode(a_op, m1, d15)); - CheckBaseWithIndexAndDisplacement(&match7, p1, 0, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match7, p1, 0, nullptr, d15); // (B0 + S0) -> [p1, 0, B0, NULL] BaseWithIndexAndDisplacement32Matcher match8(graph()->NewNode(a_op, b0, s0)); - CheckBaseWithIndexAndDisplacement(&match8, p1, 0, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match8, p1, 0, b0, nullptr); // (S0 + B0) -> [p1, 0, B0, NULL] s0 = graph()->NewNode(s_op, p1, d0); BaseWithIndexAndDisplacement32Matcher match9(graph()->NewNode(a_op, s0, b0)); - CheckBaseWithIndexAndDisplacement(&match9, p1, 0, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match9, p1, 0, b0, nullptr); // (D15 + S0) -> [P1, 0, NULL, D15] s0 = graph()->NewNode(s_op, p1, d0); BaseWithIndexAndDisplacement32Matcher match10( graph()->NewNode(a_op, d15, s0)); - CheckBaseWithIndexAndDisplacement(&match10, p1, 0, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match10, p1, 0, nullptr, d15); // (S0 + D15) -> [P1, 0, NULL, D15] s0 = graph()->NewNode(s_op, p1, d0); BaseWithIndexAndDisplacement32Matcher match11( graph()->NewNode(a_op, s0, d15)); - CheckBaseWithIndexAndDisplacement(&match11, p1, 0, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match11, p1, 0, nullptr, d15); // (B0 + M2) -> [p1, 1, B0, NULL] BaseWithIndexAndDisplacement32Matcher match12(graph()->NewNode(a_op, b0, m2)); - CheckBaseWithIndexAndDisplacement(&match12, p1, 1, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match12, p1, 1, b0, nullptr); // (M2 + B0) -> [p1, 1, B0, NULL] m2 = graph()->NewNode(m_op, p1, d2); BaseWithIndexAndDisplacement32Matcher match13(graph()->NewNode(a_op, m2, b0)); - CheckBaseWithIndexAndDisplacement(&match13, p1, 1, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match13, p1, 1, b0, nullptr); // (D15 + M2) -> [P1, 1, NULL, D15] m2 = graph()->NewNode(m_op, p1, d2); BaseWithIndexAndDisplacement32Matcher match14( graph()->NewNode(a_op, d15, m2)); - CheckBaseWithIndexAndDisplacement(&match14, p1, 1, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match14, p1, 1, nullptr, d15); // (M2 + D15) -> [P1, 1, NULL, D15] m2 = graph()->NewNode(m_op, p1, d2); BaseWithIndexAndDisplacement32Matcher match15( graph()->NewNode(a_op, m2, d15)); - CheckBaseWithIndexAndDisplacement(&match15, p1, 1, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match15, p1, 1, nullptr, d15); // (B0 + S1) -> [p1, 1, B0, NULL] BaseWithIndexAndDisplacement32Matcher match16(graph()->NewNode(a_op, b0, s1)); - CheckBaseWithIndexAndDisplacement(&match16, p1, 1, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match16, p1, 1, b0, nullptr); // (S1 + B0) -> [p1, 1, B0, NULL] s1 = graph()->NewNode(s_op, p1, d1); BaseWithIndexAndDisplacement32Matcher match17(graph()->NewNode(a_op, s1, b0)); - CheckBaseWithIndexAndDisplacement(&match17, p1, 1, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match17, p1, 1, b0, nullptr); // (D15 + S1) -> [P1, 1, NULL, D15] s1 = graph()->NewNode(s_op, p1, d1); BaseWithIndexAndDisplacement32Matcher match18( graph()->NewNode(a_op, d15, s1)); - CheckBaseWithIndexAndDisplacement(&match18, p1, 1, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match18, p1, 1, nullptr, d15); // (S1 + D15) -> [P1, 1, NULL, D15] s1 = graph()->NewNode(s_op, p1, d1); BaseWithIndexAndDisplacement32Matcher match19( graph()->NewNode(a_op, s1, d15)); - CheckBaseWithIndexAndDisplacement(&match19, p1, 1, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match19, p1, 1, nullptr, d15); // (B0 + M4) -> [p1, 2, B0, NULL] BaseWithIndexAndDisplacement32Matcher match20(graph()->NewNode(a_op, b0, m4)); - CheckBaseWithIndexAndDisplacement(&match20, p1, 2, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match20, p1, 2, b0, nullptr); // (M4 + B0) -> [p1, 2, B0, NULL] m4 = graph()->NewNode(m_op, p1, d4); BaseWithIndexAndDisplacement32Matcher match21(graph()->NewNode(a_op, m4, b0)); - CheckBaseWithIndexAndDisplacement(&match21, p1, 2, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match21, p1, 2, b0, nullptr); // (D15 + M4) -> [p1, 2, NULL, D15] m4 = graph()->NewNode(m_op, p1, d4); BaseWithIndexAndDisplacement32Matcher match22( graph()->NewNode(a_op, d15, m4)); - CheckBaseWithIndexAndDisplacement(&match22, p1, 2, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match22, p1, 2, nullptr, d15); // (M4 + D15) -> [p1, 2, NULL, D15] m4 = graph()->NewNode(m_op, p1, d4); BaseWithIndexAndDisplacement32Matcher match23( graph()->NewNode(a_op, m4, d15)); - CheckBaseWithIndexAndDisplacement(&match23, p1, 2, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match23, p1, 2, nullptr, d15); // (B0 + S2) -> [p1, 2, B0, NULL] BaseWithIndexAndDisplacement32Matcher match24(graph()->NewNode(a_op, b0, s2)); - CheckBaseWithIndexAndDisplacement(&match24, p1, 2, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match24, p1, 2, b0, nullptr); // (S2 + B0) -> [p1, 2, B0, NULL] s2 = graph()->NewNode(s_op, p1, d2); BaseWithIndexAndDisplacement32Matcher match25(graph()->NewNode(a_op, s2, b0)); - CheckBaseWithIndexAndDisplacement(&match25, p1, 2, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match25, p1, 2, b0, nullptr); // (D15 + S2) -> [p1, 2, NULL, D15] s2 = graph()->NewNode(s_op, p1, d2); BaseWithIndexAndDisplacement32Matcher match26( graph()->NewNode(a_op, d15, s2)); - CheckBaseWithIndexAndDisplacement(&match26, p1, 2, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match26, p1, 2, nullptr, d15); // (S2 + D15) -> [p1, 2, NULL, D15] s2 = graph()->NewNode(s_op, p1, d2); BaseWithIndexAndDisplacement32Matcher match27( graph()->NewNode(a_op, s2, d15)); - CheckBaseWithIndexAndDisplacement(&match27, p1, 2, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match27, p1, 2, nullptr, d15); // (B0 + M8) -> [p1, 2, B0, NULL] BaseWithIndexAndDisplacement32Matcher match28(graph()->NewNode(a_op, b0, m8)); - CheckBaseWithIndexAndDisplacement(&match28, p1, 3, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match28, p1, 3, b0, nullptr); // (M8 + B0) -> [p1, 2, B0, NULL] m8 = graph()->NewNode(m_op, p1, d8); BaseWithIndexAndDisplacement32Matcher match29(graph()->NewNode(a_op, m8, b0)); - CheckBaseWithIndexAndDisplacement(&match29, p1, 3, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match29, p1, 3, b0, nullptr); // (D15 + M8) -> [p1, 2, NULL, D15] m8 = graph()->NewNode(m_op, p1, d8); BaseWithIndexAndDisplacement32Matcher match30( graph()->NewNode(a_op, d15, m8)); - CheckBaseWithIndexAndDisplacement(&match30, p1, 3, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match30, p1, 3, nullptr, d15); // (M8 + D15) -> [p1, 2, NULL, D15] m8 = graph()->NewNode(m_op, p1, d8); BaseWithIndexAndDisplacement32Matcher match31( graph()->NewNode(a_op, m8, d15)); - CheckBaseWithIndexAndDisplacement(&match31, p1, 3, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match31, p1, 3, nullptr, d15); // (B0 + S3) -> [p1, 2, B0, NULL] BaseWithIndexAndDisplacement32Matcher match32(graph()->NewNode(a_op, b0, s3)); - CheckBaseWithIndexAndDisplacement(&match32, p1, 3, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match32, p1, 3, b0, nullptr); // (S3 + B0) -> [p1, 2, B0, NULL] s3 = graph()->NewNode(s_op, p1, d3); BaseWithIndexAndDisplacement32Matcher match33(graph()->NewNode(a_op, s3, b0)); - CheckBaseWithIndexAndDisplacement(&match33, p1, 3, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match33, p1, 3, b0, nullptr); // (D15 + S3) -> [p1, 2, NULL, D15] s3 = graph()->NewNode(s_op, p1, d3); BaseWithIndexAndDisplacement32Matcher match34( graph()->NewNode(a_op, d15, s3)); - CheckBaseWithIndexAndDisplacement(&match34, p1, 3, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match34, p1, 3, nullptr, d15); // (S3 + D15) -> [p1, 2, NULL, D15] s3 = graph()->NewNode(s_op, p1, d3); BaseWithIndexAndDisplacement32Matcher match35( graph()->NewNode(a_op, s3, d15)); - CheckBaseWithIndexAndDisplacement(&match35, p1, 3, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match35, p1, 3, nullptr, d15); // 2 INPUT - NEGATIVE CASES // (M3 + B1) -> [B0, 0, M3, NULL] BaseWithIndexAndDisplacement32Matcher match36(graph()->NewNode(a_op, b1, m3)); - CheckBaseWithIndexAndDisplacement(&match36, m3, 0, b1, NULL); + CheckBaseWithIndexAndDisplacement(&match36, m3, 0, b1, nullptr); // (S4 + B1) -> [B0, 0, S4, NULL] BaseWithIndexAndDisplacement32Matcher match37(graph()->NewNode(a_op, b1, s4)); - CheckBaseWithIndexAndDisplacement(&match37, s4, 0, b1, NULL); + CheckBaseWithIndexAndDisplacement(&match37, s4, 0, b1, nullptr); // 3 INPUT @@ -400,209 +400,209 @@ TEST_F(NodeMatcherTest, ScaledWithOffset32Matcher) { m1 = graph()->NewNode(m_op, p1, d1); ADD_ADDRESSING_OPERAND_USES(m1); BaseWithIndexAndDisplacement32Matcher match47(graph()->NewNode(a_op, b0, m1)); - CheckBaseWithIndexAndDisplacement(&match47, p1, 0, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match47, p1, 0, b0, nullptr); // (M1 + B0) -> [p1, 0, B0, NULL] m1 = graph()->NewNode(m_op, p1, d1); ADD_ADDRESSING_OPERAND_USES(m1); BaseWithIndexAndDisplacement32Matcher match48(graph()->NewNode(a_op, m1, b0)); - CheckBaseWithIndexAndDisplacement(&match48, p1, 0, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match48, p1, 0, b0, nullptr); // (D15 + M1) -> [P1, 0, NULL, D15] m1 = graph()->NewNode(m_op, p1, d1); ADD_ADDRESSING_OPERAND_USES(m1); BaseWithIndexAndDisplacement32Matcher match49( graph()->NewNode(a_op, d15, m1)); - CheckBaseWithIndexAndDisplacement(&match49, p1, 0, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match49, p1, 0, nullptr, d15); // (M1 + D15) -> [P1, 0, NULL, D15] m1 = graph()->NewNode(m_op, p1, d1); ADD_ADDRESSING_OPERAND_USES(m1); BaseWithIndexAndDisplacement32Matcher match50( graph()->NewNode(a_op, m1, d15)); - CheckBaseWithIndexAndDisplacement(&match50, p1, 0, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match50, p1, 0, nullptr, d15); // (B0 + S0) -> [p1, 0, B0, NULL] s0 = graph()->NewNode(s_op, p1, d0); ADD_ADDRESSING_OPERAND_USES(s0); BaseWithIndexAndDisplacement32Matcher match51(graph()->NewNode(a_op, b0, s0)); - CheckBaseWithIndexAndDisplacement(&match51, p1, 0, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match51, p1, 0, b0, nullptr); // (S0 + B0) -> [p1, 0, B0, NULL] s0 = graph()->NewNode(s_op, p1, d0); ADD_ADDRESSING_OPERAND_USES(s0); BaseWithIndexAndDisplacement32Matcher match52(graph()->NewNode(a_op, s0, b0)); - CheckBaseWithIndexAndDisplacement(&match52, p1, 0, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match52, p1, 0, b0, nullptr); // (D15 + S0) -> [P1, 0, NULL, D15] s0 = graph()->NewNode(s_op, p1, d0); ADD_ADDRESSING_OPERAND_USES(s0); BaseWithIndexAndDisplacement32Matcher match53( graph()->NewNode(a_op, d15, s0)); - CheckBaseWithIndexAndDisplacement(&match53, p1, 0, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match53, p1, 0, nullptr, d15); // (S0 + D15) -> [P1, 0, NULL, D15] s0 = graph()->NewNode(s_op, p1, d0); ADD_ADDRESSING_OPERAND_USES(s0); BaseWithIndexAndDisplacement32Matcher match54( graph()->NewNode(a_op, s0, d15)); - CheckBaseWithIndexAndDisplacement(&match54, p1, 0, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match54, p1, 0, nullptr, d15); // (B0 + M2) -> [p1, 1, B0, NULL] m2 = graph()->NewNode(m_op, p1, d2); ADD_ADDRESSING_OPERAND_USES(m2); BaseWithIndexAndDisplacement32Matcher match55(graph()->NewNode(a_op, b0, m2)); - CheckBaseWithIndexAndDisplacement(&match55, p1, 1, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match55, p1, 1, b0, nullptr); // (M2 + B0) -> [p1, 1, B0, NULL] m2 = graph()->NewNode(m_op, p1, d2); ADD_ADDRESSING_OPERAND_USES(m2); BaseWithIndexAndDisplacement32Matcher match56(graph()->NewNode(a_op, m2, b0)); - CheckBaseWithIndexAndDisplacement(&match56, p1, 1, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match56, p1, 1, b0, nullptr); // (D15 + M2) -> [P1, 1, NULL, D15] m2 = graph()->NewNode(m_op, p1, d2); ADD_ADDRESSING_OPERAND_USES(m2); BaseWithIndexAndDisplacement32Matcher match57( graph()->NewNode(a_op, d15, m2)); - CheckBaseWithIndexAndDisplacement(&match57, p1, 1, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match57, p1, 1, nullptr, d15); // (M2 + D15) -> [P1, 1, NULL, D15] m2 = graph()->NewNode(m_op, p1, d2); ADD_ADDRESSING_OPERAND_USES(m2); BaseWithIndexAndDisplacement32Matcher match58( graph()->NewNode(a_op, m2, d15)); - CheckBaseWithIndexAndDisplacement(&match58, p1, 1, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match58, p1, 1, nullptr, d15); // (B0 + S1) -> [p1, 1, B0, NULL] s1 = graph()->NewNode(s_op, p1, d1); ADD_ADDRESSING_OPERAND_USES(s1); BaseWithIndexAndDisplacement32Matcher match59(graph()->NewNode(a_op, b0, s1)); - CheckBaseWithIndexAndDisplacement(&match59, p1, 1, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match59, p1, 1, b0, nullptr); // (S1 + B0) -> [p1, 1, B0, NULL] s1 = graph()->NewNode(s_op, p1, d1); ADD_ADDRESSING_OPERAND_USES(s1); BaseWithIndexAndDisplacement32Matcher match60(graph()->NewNode(a_op, s1, b0)); - CheckBaseWithIndexAndDisplacement(&match60, p1, 1, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match60, p1, 1, b0, nullptr); // (D15 + S1) -> [P1, 1, NULL, D15] s1 = graph()->NewNode(s_op, p1, d1); ADD_ADDRESSING_OPERAND_USES(s1); BaseWithIndexAndDisplacement32Matcher match61( graph()->NewNode(a_op, d15, s1)); - CheckBaseWithIndexAndDisplacement(&match61, p1, 1, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match61, p1, 1, nullptr, d15); // (S1 + D15) -> [P1, 1, NULL, D15] s1 = graph()->NewNode(s_op, p1, d1); ADD_ADDRESSING_OPERAND_USES(s1); BaseWithIndexAndDisplacement32Matcher match62( graph()->NewNode(a_op, s1, d15)); - CheckBaseWithIndexAndDisplacement(&match62, p1, 1, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match62, p1, 1, nullptr, d15); // (B0 + M4) -> [p1, 2, B0, NULL] m4 = graph()->NewNode(m_op, p1, d4); ADD_ADDRESSING_OPERAND_USES(m4); BaseWithIndexAndDisplacement32Matcher match63(graph()->NewNode(a_op, b0, m4)); - CheckBaseWithIndexAndDisplacement(&match63, p1, 2, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match63, p1, 2, b0, nullptr); // (M4 + B0) -> [p1, 2, B0, NULL] m4 = graph()->NewNode(m_op, p1, d4); ADD_ADDRESSING_OPERAND_USES(m4); BaseWithIndexAndDisplacement32Matcher match64(graph()->NewNode(a_op, m4, b0)); - CheckBaseWithIndexAndDisplacement(&match64, p1, 2, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match64, p1, 2, b0, nullptr); // (D15 + M4) -> [p1, 2, NULL, D15] m4 = graph()->NewNode(m_op, p1, d4); ADD_ADDRESSING_OPERAND_USES(m4); BaseWithIndexAndDisplacement32Matcher match65( graph()->NewNode(a_op, d15, m4)); - CheckBaseWithIndexAndDisplacement(&match65, p1, 2, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match65, p1, 2, nullptr, d15); // (M4 + D15) -> [p1, 2, NULL, D15] m4 = graph()->NewNode(m_op, p1, d4); ADD_ADDRESSING_OPERAND_USES(m4); BaseWithIndexAndDisplacement32Matcher match66( graph()->NewNode(a_op, m4, d15)); - CheckBaseWithIndexAndDisplacement(&match66, p1, 2, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match66, p1, 2, nullptr, d15); // (B0 + S2) -> [p1, 2, B0, NULL] s2 = graph()->NewNode(s_op, p1, d2); ADD_ADDRESSING_OPERAND_USES(s2); BaseWithIndexAndDisplacement32Matcher match67(graph()->NewNode(a_op, b0, s2)); - CheckBaseWithIndexAndDisplacement(&match67, p1, 2, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match67, p1, 2, b0, nullptr); // (S2 + B0) -> [p1, 2, B0, NULL] s2 = graph()->NewNode(s_op, p1, d2); ADD_ADDRESSING_OPERAND_USES(s2); BaseWithIndexAndDisplacement32Matcher match68(graph()->NewNode(a_op, s2, b0)); - CheckBaseWithIndexAndDisplacement(&match68, p1, 2, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match68, p1, 2, b0, nullptr); // (D15 + S2) -> [p1, 2, NULL, D15] s2 = graph()->NewNode(s_op, p1, d2); ADD_ADDRESSING_OPERAND_USES(s2); BaseWithIndexAndDisplacement32Matcher match69( graph()->NewNode(a_op, d15, s2)); - CheckBaseWithIndexAndDisplacement(&match69, p1, 2, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match69, p1, 2, nullptr, d15); // (S2 + D15) -> [p1, 2, NULL, D15] s2 = graph()->NewNode(s_op, p1, d2); ADD_ADDRESSING_OPERAND_USES(s2); BaseWithIndexAndDisplacement32Matcher match70( graph()->NewNode(a_op, s2, d15)); - CheckBaseWithIndexAndDisplacement(&match70, p1, 2, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match70, p1, 2, nullptr, d15); // (B0 + M8) -> [p1, 2, B0, NULL] m8 = graph()->NewNode(m_op, p1, d8); ADD_ADDRESSING_OPERAND_USES(m8); BaseWithIndexAndDisplacement32Matcher match71(graph()->NewNode(a_op, b0, m8)); - CheckBaseWithIndexAndDisplacement(&match71, p1, 3, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match71, p1, 3, b0, nullptr); // (M8 + B0) -> [p1, 2, B0, NULL] m8 = graph()->NewNode(m_op, p1, d8); ADD_ADDRESSING_OPERAND_USES(m8); BaseWithIndexAndDisplacement32Matcher match72(graph()->NewNode(a_op, m8, b0)); - CheckBaseWithIndexAndDisplacement(&match72, p1, 3, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match72, p1, 3, b0, nullptr); // (D15 + M8) -> [p1, 2, NULL, D15] m8 = graph()->NewNode(m_op, p1, d8); ADD_ADDRESSING_OPERAND_USES(m8); BaseWithIndexAndDisplacement32Matcher match73( graph()->NewNode(a_op, d15, m8)); - CheckBaseWithIndexAndDisplacement(&match73, p1, 3, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match73, p1, 3, nullptr, d15); // (M8 + D15) -> [p1, 2, NULL, D15] m8 = graph()->NewNode(m_op, p1, d8); ADD_ADDRESSING_OPERAND_USES(m8); BaseWithIndexAndDisplacement32Matcher match74( graph()->NewNode(a_op, m8, d15)); - CheckBaseWithIndexAndDisplacement(&match74, p1, 3, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match74, p1, 3, nullptr, d15); // (B0 + S3) -> [p1, 2, B0, NULL] s3 = graph()->NewNode(s_op, p1, d3); ADD_ADDRESSING_OPERAND_USES(s3); BaseWithIndexAndDisplacement32Matcher match75(graph()->NewNode(a_op, b0, s3)); - CheckBaseWithIndexAndDisplacement(&match75, p1, 3, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match75, p1, 3, b0, nullptr); // (S3 + B0) -> [p1, 2, B0, NULL] s3 = graph()->NewNode(s_op, p1, d3); ADD_ADDRESSING_OPERAND_USES(s3); BaseWithIndexAndDisplacement32Matcher match76(graph()->NewNode(a_op, s3, b0)); - CheckBaseWithIndexAndDisplacement(&match76, p1, 3, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match76, p1, 3, b0, nullptr); // (D15 + S3) -> [p1, 2, NULL, D15] s3 = graph()->NewNode(s_op, p1, d3); ADD_ADDRESSING_OPERAND_USES(s3); BaseWithIndexAndDisplacement32Matcher match77( graph()->NewNode(a_op, d15, s3)); - CheckBaseWithIndexAndDisplacement(&match77, p1, 3, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match77, p1, 3, nullptr, d15); // (S3 + D15) -> [p1, 2, NULL, D15] s3 = graph()->NewNode(s_op, p1, d3); ADD_ADDRESSING_OPERAND_USES(s3); BaseWithIndexAndDisplacement32Matcher match78( graph()->NewNode(a_op, s3, d15)); - CheckBaseWithIndexAndDisplacement(&match78, p1, 3, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match78, p1, 3, nullptr, d15); // (D15 + S3) + B0 -> [p1, 2, b0, d15] s3 = graph()->NewNode(s_op, p1, d3); @@ -627,7 +627,7 @@ TEST_F(NodeMatcherTest, ScaledWithOffset32Matcher) { ADD_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement32Matcher match81( graph()->NewNode(a_op, temp, d15)); - CheckBaseWithIndexAndDisplacement(&match81, NULL, 0, temp, d15); + CheckBaseWithIndexAndDisplacement(&match81, nullptr, 0, temp, d15); // D15 + (S3 + B0) -> [NULL, 0, (s3 + b0), d15] // Avoid changing simple addressing to complex addressing @@ -636,7 +636,7 @@ TEST_F(NodeMatcherTest, ScaledWithOffset32Matcher) { ADD_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement32Matcher match82( graph()->NewNode(a_op, d15, temp)); - CheckBaseWithIndexAndDisplacement(&match82, NULL, 0, temp, d15); + CheckBaseWithIndexAndDisplacement(&match82, nullptr, 0, temp, d15); // B0 + (D15 + S3) -> [p1, 2, b0, d15] s3 = graph()->NewNode(s_op, p1, d3); @@ -686,7 +686,7 @@ TEST_F(NodeMatcherTest, ScaledWithOffset32Matcher) { ADD_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement32Matcher match88( graph()->NewNode(a_op, temp, d15)); - CheckBaseWithIndexAndDisplacement(&match88, NULL, 0, temp, d15); + CheckBaseWithIndexAndDisplacement(&match88, nullptr, 0, temp, d15); // D15 + (B0 + B1) -> [NULL, 0, (b0 + b1), d15] // Avoid changing simple addressing to complex addressing @@ -694,7 +694,7 @@ TEST_F(NodeMatcherTest, ScaledWithOffset32Matcher) { ADD_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement32Matcher match89( graph()->NewNode(a_op, d15, temp)); - CheckBaseWithIndexAndDisplacement(&match89, NULL, 0, temp, d15); + CheckBaseWithIndexAndDisplacement(&match89, nullptr, 0, temp, d15); // 5 INPUT - with none-addressing operand uses @@ -702,219 +702,219 @@ TEST_F(NodeMatcherTest, ScaledWithOffset32Matcher) { m1 = graph()->NewNode(m_op, p1, d1); ADD_NONE_ADDRESSING_OPERAND_USES(m1); BaseWithIndexAndDisplacement32Matcher match90(graph()->NewNode(a_op, b0, m1)); - CheckBaseWithIndexAndDisplacement(&match90, b0, 0, m1, NULL); + CheckBaseWithIndexAndDisplacement(&match90, b0, 0, m1, nullptr); // (M1 + B0) -> [b0, 0, m1, NULL] m1 = graph()->NewNode(m_op, p1, d1); ADD_NONE_ADDRESSING_OPERAND_USES(m1); BaseWithIndexAndDisplacement32Matcher match91(graph()->NewNode(a_op, m1, b0)); - CheckBaseWithIndexAndDisplacement(&match91, b0, 0, m1, NULL); + CheckBaseWithIndexAndDisplacement(&match91, b0, 0, m1, nullptr); // (D15 + M1) -> [NULL, 0, m1, d15] m1 = graph()->NewNode(m_op, p1, d1); ADD_NONE_ADDRESSING_OPERAND_USES(m1); BaseWithIndexAndDisplacement32Matcher match92( graph()->NewNode(a_op, d15, m1)); - CheckBaseWithIndexAndDisplacement(&match92, NULL, 0, m1, d15); + CheckBaseWithIndexAndDisplacement(&match92, nullptr, 0, m1, d15); // (M1 + D15) -> [NULL, 0, m1, d15] m1 = graph()->NewNode(m_op, p1, d1); ADD_NONE_ADDRESSING_OPERAND_USES(m1); BaseWithIndexAndDisplacement32Matcher match93( graph()->NewNode(a_op, m1, d15)); - CheckBaseWithIndexAndDisplacement(&match93, NULL, 0, m1, d15); + CheckBaseWithIndexAndDisplacement(&match93, nullptr, 0, m1, d15); // (B0 + S0) -> [b0, 0, s0, NULL] s0 = graph()->NewNode(s_op, p1, d0); ADD_NONE_ADDRESSING_OPERAND_USES(s0); BaseWithIndexAndDisplacement32Matcher match94(graph()->NewNode(a_op, b0, s0)); - CheckBaseWithIndexAndDisplacement(&match94, b0, 0, s0, NULL); + CheckBaseWithIndexAndDisplacement(&match94, b0, 0, s0, nullptr); // (S0 + B0) -> [b0, 0, s0, NULL] s0 = graph()->NewNode(s_op, p1, d0); ADD_NONE_ADDRESSING_OPERAND_USES(s0); BaseWithIndexAndDisplacement32Matcher match95(graph()->NewNode(a_op, s0, b0)); - CheckBaseWithIndexAndDisplacement(&match95, b0, 0, s0, NULL); + CheckBaseWithIndexAndDisplacement(&match95, b0, 0, s0, nullptr); // (D15 + S0) -> [NULL, 0, s0, d15] s0 = graph()->NewNode(s_op, p1, d0); ADD_NONE_ADDRESSING_OPERAND_USES(s0); BaseWithIndexAndDisplacement32Matcher match96( graph()->NewNode(a_op, d15, s0)); - CheckBaseWithIndexAndDisplacement(&match96, NULL, 0, s0, d15); + CheckBaseWithIndexAndDisplacement(&match96, nullptr, 0, s0, d15); // (S0 + D15) -> [NULL, 0, s0, d15] s0 = graph()->NewNode(s_op, p1, d0); ADD_NONE_ADDRESSING_OPERAND_USES(s0); BaseWithIndexAndDisplacement32Matcher match97( graph()->NewNode(a_op, s0, d15)); - CheckBaseWithIndexAndDisplacement(&match97, NULL, 0, s0, d15); + CheckBaseWithIndexAndDisplacement(&match97, nullptr, 0, s0, d15); // (B0 + M2) -> [b0, 0, m2, NULL] m2 = graph()->NewNode(m_op, p1, d2); ADD_NONE_ADDRESSING_OPERAND_USES(m2); BaseWithIndexAndDisplacement32Matcher match98(graph()->NewNode(a_op, b0, m2)); - CheckBaseWithIndexAndDisplacement(&match98, b0, 0, m2, NULL); + CheckBaseWithIndexAndDisplacement(&match98, b0, 0, m2, nullptr); // (M2 + B0) -> [b0, 0, m2, NULL] m2 = graph()->NewNode(m_op, p1, d2); ADD_NONE_ADDRESSING_OPERAND_USES(m2); BaseWithIndexAndDisplacement32Matcher match99(graph()->NewNode(a_op, m2, b0)); - CheckBaseWithIndexAndDisplacement(&match99, b0, 0, m2, NULL); + CheckBaseWithIndexAndDisplacement(&match99, b0, 0, m2, nullptr); // (D15 + M2) -> [NULL, 0, m2, d15] m2 = graph()->NewNode(m_op, p1, d2); ADD_NONE_ADDRESSING_OPERAND_USES(m2); BaseWithIndexAndDisplacement32Matcher match100( graph()->NewNode(a_op, d15, m2)); - CheckBaseWithIndexAndDisplacement(&match100, NULL, 0, m2, d15); + CheckBaseWithIndexAndDisplacement(&match100, nullptr, 0, m2, d15); // (M2 + D15) -> [NULL, 0, m2, d15] m2 = graph()->NewNode(m_op, p1, d2); ADD_NONE_ADDRESSING_OPERAND_USES(m2); BaseWithIndexAndDisplacement32Matcher match101( graph()->NewNode(a_op, m2, d15)); - CheckBaseWithIndexAndDisplacement(&match101, NULL, 0, m2, d15); + CheckBaseWithIndexAndDisplacement(&match101, nullptr, 0, m2, d15); // (B0 + S1) -> [b0, 0, s1, NULL] s1 = graph()->NewNode(s_op, p1, d1); ADD_NONE_ADDRESSING_OPERAND_USES(s1); BaseWithIndexAndDisplacement32Matcher match102( graph()->NewNode(a_op, b0, s1)); - CheckBaseWithIndexAndDisplacement(&match102, b0, 0, s1, NULL); + CheckBaseWithIndexAndDisplacement(&match102, b0, 0, s1, nullptr); // (S1 + B0) -> [b0, 0, s1, NULL] s1 = graph()->NewNode(s_op, p1, d1); ADD_NONE_ADDRESSING_OPERAND_USES(s1); BaseWithIndexAndDisplacement32Matcher match103( graph()->NewNode(a_op, s1, b0)); - CheckBaseWithIndexAndDisplacement(&match103, b0, 0, s1, NULL); + CheckBaseWithIndexAndDisplacement(&match103, b0, 0, s1, nullptr); // (D15 + S1) -> [NULL, 0, s1, d15] s1 = graph()->NewNode(s_op, p1, d1); ADD_NONE_ADDRESSING_OPERAND_USES(s1); BaseWithIndexAndDisplacement32Matcher match104( graph()->NewNode(a_op, d15, s1)); - CheckBaseWithIndexAndDisplacement(&match104, NULL, 0, s1, d15); + CheckBaseWithIndexAndDisplacement(&match104, nullptr, 0, s1, d15); // (S1 + D15) -> [NULL, 0, s1, d15] s1 = graph()->NewNode(s_op, p1, d1); ADD_NONE_ADDRESSING_OPERAND_USES(s1); BaseWithIndexAndDisplacement32Matcher match105( graph()->NewNode(a_op, s1, d15)); - CheckBaseWithIndexAndDisplacement(&match105, NULL, 0, s1, d15); + CheckBaseWithIndexAndDisplacement(&match105, nullptr, 0, s1, d15); // (B0 + M4) -> [b0, 0, m4, NULL] m4 = graph()->NewNode(m_op, p1, d4); ADD_NONE_ADDRESSING_OPERAND_USES(m4); BaseWithIndexAndDisplacement32Matcher match106( graph()->NewNode(a_op, b0, m4)); - CheckBaseWithIndexAndDisplacement(&match106, b0, 0, m4, NULL); + CheckBaseWithIndexAndDisplacement(&match106, b0, 0, m4, nullptr); // (M4 + B0) -> [b0, 0, m4, NULL] m4 = graph()->NewNode(m_op, p1, d4); ADD_NONE_ADDRESSING_OPERAND_USES(m4); BaseWithIndexAndDisplacement32Matcher match107( graph()->NewNode(a_op, m4, b0)); - CheckBaseWithIndexAndDisplacement(&match107, b0, 0, m4, NULL); + CheckBaseWithIndexAndDisplacement(&match107, b0, 0, m4, nullptr); // (D15 + M4) -> [NULL, 0, m4, d15] m4 = graph()->NewNode(m_op, p1, d4); ADD_NONE_ADDRESSING_OPERAND_USES(m4); BaseWithIndexAndDisplacement32Matcher match108( graph()->NewNode(a_op, d15, m4)); - CheckBaseWithIndexAndDisplacement(&match108, NULL, 0, m4, d15); + CheckBaseWithIndexAndDisplacement(&match108, nullptr, 0, m4, d15); // (M4 + D15) -> [NULL, 0, m4, d15] m4 = graph()->NewNode(m_op, p1, d4); ADD_NONE_ADDRESSING_OPERAND_USES(m4); BaseWithIndexAndDisplacement32Matcher match109( graph()->NewNode(a_op, m4, d15)); - CheckBaseWithIndexAndDisplacement(&match109, NULL, 0, m4, d15); + CheckBaseWithIndexAndDisplacement(&match109, nullptr, 0, m4, d15); // (B0 + S2) -> [b0, 0, s2, NULL] s2 = graph()->NewNode(s_op, p1, d2); ADD_NONE_ADDRESSING_OPERAND_USES(s2); BaseWithIndexAndDisplacement32Matcher match110( graph()->NewNode(a_op, b0, s2)); - CheckBaseWithIndexAndDisplacement(&match110, b0, 0, s2, NULL); + CheckBaseWithIndexAndDisplacement(&match110, b0, 0, s2, nullptr); // (S2 + B0) -> [b0, 0, s2, NULL] s2 = graph()->NewNode(s_op, p1, d2); ADD_NONE_ADDRESSING_OPERAND_USES(s2); BaseWithIndexAndDisplacement32Matcher match111( graph()->NewNode(a_op, s2, b0)); - CheckBaseWithIndexAndDisplacement(&match111, b0, 0, s2, NULL); + CheckBaseWithIndexAndDisplacement(&match111, b0, 0, s2, nullptr); // (D15 + S2) -> [NULL, 0, s2, d15] s2 = graph()->NewNode(s_op, p1, d2); ADD_NONE_ADDRESSING_OPERAND_USES(s2); BaseWithIndexAndDisplacement32Matcher match112( graph()->NewNode(a_op, d15, s2)); - CheckBaseWithIndexAndDisplacement(&match112, NULL, 0, s2, d15); + CheckBaseWithIndexAndDisplacement(&match112, nullptr, 0, s2, d15); // (S2 + D15) -> [NULL, 0, s2, d15] s2 = graph()->NewNode(s_op, p1, d2); ADD_NONE_ADDRESSING_OPERAND_USES(s2); BaseWithIndexAndDisplacement32Matcher match113( graph()->NewNode(a_op, s2, d15)); - CheckBaseWithIndexAndDisplacement(&match113, NULL, 0, s2, d15); + CheckBaseWithIndexAndDisplacement(&match113, nullptr, 0, s2, d15); // (B0 + M8) -> [b0, 0, m8, NULL] m8 = graph()->NewNode(m_op, p1, d8); ADD_NONE_ADDRESSING_OPERAND_USES(m8); BaseWithIndexAndDisplacement32Matcher match114( graph()->NewNode(a_op, b0, m8)); - CheckBaseWithIndexAndDisplacement(&match114, b0, 0, m8, NULL); + CheckBaseWithIndexAndDisplacement(&match114, b0, 0, m8, nullptr); // (M8 + B0) -> [b0, 0, m8, NULL] m8 = graph()->NewNode(m_op, p1, d8); ADD_NONE_ADDRESSING_OPERAND_USES(m8); BaseWithIndexAndDisplacement32Matcher match115( graph()->NewNode(a_op, m8, b0)); - CheckBaseWithIndexAndDisplacement(&match115, b0, 0, m8, NULL); + CheckBaseWithIndexAndDisplacement(&match115, b0, 0, m8, nullptr); // (D15 + M8) -> [NULL, 0, m8, d15] m8 = graph()->NewNode(m_op, p1, d8); ADD_NONE_ADDRESSING_OPERAND_USES(m8); BaseWithIndexAndDisplacement32Matcher match116( graph()->NewNode(a_op, d15, m8)); - CheckBaseWithIndexAndDisplacement(&match116, NULL, 0, m8, d15); + CheckBaseWithIndexAndDisplacement(&match116, nullptr, 0, m8, d15); // (M8 + D15) -> [NULL, 0, m8, d15] m8 = graph()->NewNode(m_op, p1, d8); ADD_NONE_ADDRESSING_OPERAND_USES(m8); BaseWithIndexAndDisplacement32Matcher match117( graph()->NewNode(a_op, m8, d15)); - CheckBaseWithIndexAndDisplacement(&match117, NULL, 0, m8, d15); + CheckBaseWithIndexAndDisplacement(&match117, nullptr, 0, m8, d15); // (B0 + S3) -> [b0, 0, s3, NULL] s3 = graph()->NewNode(s_op, p1, d3); ADD_NONE_ADDRESSING_OPERAND_USES(s3); BaseWithIndexAndDisplacement32Matcher match118( graph()->NewNode(a_op, b0, s3)); - CheckBaseWithIndexAndDisplacement(&match118, b0, 0, s3, NULL); + CheckBaseWithIndexAndDisplacement(&match118, b0, 0, s3, nullptr); // (S3 + B0) -> [b0, 0, s3, NULL] s3 = graph()->NewNode(s_op, p1, d3); ADD_NONE_ADDRESSING_OPERAND_USES(s3); BaseWithIndexAndDisplacement32Matcher match119( graph()->NewNode(a_op, s3, b0)); - CheckBaseWithIndexAndDisplacement(&match119, b0, 0, s3, NULL); + CheckBaseWithIndexAndDisplacement(&match119, b0, 0, s3, nullptr); // (D15 + S3) -> [NULL, 0, s3, d15] s3 = graph()->NewNode(s_op, p1, d3); ADD_NONE_ADDRESSING_OPERAND_USES(s3); BaseWithIndexAndDisplacement32Matcher match120( graph()->NewNode(a_op, d15, s3)); - CheckBaseWithIndexAndDisplacement(&match120, NULL, 0, s3, d15); + CheckBaseWithIndexAndDisplacement(&match120, nullptr, 0, s3, d15); // (S3 + D15) -> [NULL, 0, s3, d15] s3 = graph()->NewNode(s_op, p1, d3); ADD_NONE_ADDRESSING_OPERAND_USES(s3); BaseWithIndexAndDisplacement32Matcher match121( graph()->NewNode(a_op, s3, d15)); - CheckBaseWithIndexAndDisplacement(&match121, NULL, 0, s3, d15); + CheckBaseWithIndexAndDisplacement(&match121, nullptr, 0, s3, d15); // (D15 + S3) + B0 -> [b0, 0, (D15 + S3), NULL] s3 = graph()->NewNode(s_op, p1, d3); @@ -922,7 +922,7 @@ TEST_F(NodeMatcherTest, ScaledWithOffset32Matcher) { ADD_NONE_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement32Matcher match122( graph()->NewNode(a_op, temp, b0)); - CheckBaseWithIndexAndDisplacement(&match122, b0, 0, temp, NULL); + CheckBaseWithIndexAndDisplacement(&match122, b0, 0, temp, nullptr); // (B0 + D15) + S3 -> [p1, 3, (B0 + D15), NULL] s3 = graph()->NewNode(s_op, p1, d3); @@ -930,7 +930,7 @@ TEST_F(NodeMatcherTest, ScaledWithOffset32Matcher) { ADD_NONE_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement32Matcher match123( graph()->NewNode(a_op, temp, s3)); - CheckBaseWithIndexAndDisplacement(&match123, p1, 3, temp, NULL); + CheckBaseWithIndexAndDisplacement(&match123, p1, 3, temp, nullptr); // (S3 + B0) + D15 -> [NULL, 0, (S3 + B0), d15] s3 = graph()->NewNode(s_op, p1, d3); @@ -938,7 +938,7 @@ TEST_F(NodeMatcherTest, ScaledWithOffset32Matcher) { ADD_NONE_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement32Matcher match124( graph()->NewNode(a_op, temp, d15)); - CheckBaseWithIndexAndDisplacement(&match124, NULL, 0, temp, d15); + CheckBaseWithIndexAndDisplacement(&match124, nullptr, 0, temp, d15); // D15 + (S3 + B0) -> [NULL, 0, (S3 + B0), d15] s3 = graph()->NewNode(s_op, p1, d3); @@ -946,7 +946,7 @@ TEST_F(NodeMatcherTest, ScaledWithOffset32Matcher) { ADD_NONE_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement32Matcher match125( graph()->NewNode(a_op, d15, temp)); - CheckBaseWithIndexAndDisplacement(&match125, NULL, 0, temp, d15); + CheckBaseWithIndexAndDisplacement(&match125, nullptr, 0, temp, d15); // B0 + (D15 + S3) -> [b0, 0, (D15 + S3), NULL] s3 = graph()->NewNode(s_op, p1, d3); @@ -954,7 +954,7 @@ TEST_F(NodeMatcherTest, ScaledWithOffset32Matcher) { ADD_NONE_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement32Matcher match126( graph()->NewNode(a_op, b0, temp)); - CheckBaseWithIndexAndDisplacement(&match126, b0, 0, temp, NULL); + CheckBaseWithIndexAndDisplacement(&match126, b0, 0, temp, nullptr); // S3 + (B0 + D15) -> [p1, 3, (B0 + D15), NULL] s3 = graph()->NewNode(s_op, p1, d3); @@ -962,7 +962,7 @@ TEST_F(NodeMatcherTest, ScaledWithOffset32Matcher) { ADD_NONE_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement32Matcher match127( graph()->NewNode(a_op, s3, temp)); - CheckBaseWithIndexAndDisplacement(&match127, p1, 3, temp, NULL); + CheckBaseWithIndexAndDisplacement(&match127, p1, 3, temp, nullptr); // S3 + (B0 - D15) -> [p1, 3, (B0 - D15), NULL] s3 = graph()->NewNode(s_op, p1, d3); @@ -970,14 +970,14 @@ TEST_F(NodeMatcherTest, ScaledWithOffset32Matcher) { ADD_NONE_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement32Matcher match128( graph()->NewNode(a_op, s3, temp)); - CheckBaseWithIndexAndDisplacement(&match128, p1, 3, temp, NULL); + CheckBaseWithIndexAndDisplacement(&match128, p1, 3, temp, nullptr); // B0 + (B1 - D15) -> [b0, 0, (B1 - D15), NULL] temp = graph()->NewNode(sub_op, b1, d15); ADD_NONE_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement32Matcher match129( graph()->NewNode(a_op, b0, temp)); - CheckBaseWithIndexAndDisplacement(&match129, b0, 0, temp, NULL); + CheckBaseWithIndexAndDisplacement(&match129, b0, 0, temp, nullptr); // (B0 - D15) + S3 -> [p1, 3, temp, NULL] s3 = graph()->NewNode(s_op, p1, d3); @@ -985,21 +985,21 @@ TEST_F(NodeMatcherTest, ScaledWithOffset32Matcher) { ADD_NONE_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement32Matcher match130( graph()->NewNode(a_op, temp, s3)); - CheckBaseWithIndexAndDisplacement(&match130, p1, 3, temp, NULL); + CheckBaseWithIndexAndDisplacement(&match130, p1, 3, temp, nullptr); // (B0 + B1) + D15 -> [NULL, 0, (B0 + B1), d15] temp = graph()->NewNode(a_op, b0, b1); ADD_NONE_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement32Matcher match131( graph()->NewNode(a_op, temp, d15)); - CheckBaseWithIndexAndDisplacement(&match131, NULL, 0, temp, d15); + CheckBaseWithIndexAndDisplacement(&match131, nullptr, 0, temp, d15); // D15 + (B0 + B1) -> [NULL, 0, (B0 + B1), d15] temp = graph()->NewNode(a_op, b0, b1); ADD_NONE_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement32Matcher match132( graph()->NewNode(a_op, d15, temp)); - CheckBaseWithIndexAndDisplacement(&match132, NULL, 0, temp, d15); + CheckBaseWithIndexAndDisplacement(&match132, nullptr, 0, temp, d15); } @@ -1101,195 +1101,195 @@ TEST_F(NodeMatcherTest, ScaledWithOffset64Matcher) { // (B0 + B1) -> [B0, 0, B1, NULL] BaseWithIndexAndDisplacement64Matcher match1(graph()->NewNode(a_op, b0, b1)); - CheckBaseWithIndexAndDisplacement(&match1, b1, 0, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match1, b1, 0, b0, nullptr); // (B0 + D15) -> [NULL, 0, B0, D15] BaseWithIndexAndDisplacement64Matcher match2(graph()->NewNode(a_op, b0, d15)); - CheckBaseWithIndexAndDisplacement(&match2, NULL, 0, b0, d15); + CheckBaseWithIndexAndDisplacement(&match2, nullptr, 0, b0, d15); BaseWithIndexAndDisplacement64Matcher match2_32( graph()->NewNode(a_op, b0, d15_32)); - CheckBaseWithIndexAndDisplacement(&match2_32, NULL, 0, b0, d15_32); + CheckBaseWithIndexAndDisplacement(&match2_32, nullptr, 0, b0, d15_32); // (D15 + B0) -> [NULL, 0, B0, D15] BaseWithIndexAndDisplacement64Matcher match3(graph()->NewNode(a_op, d15, b0)); - CheckBaseWithIndexAndDisplacement(&match3, NULL, 0, b0, d15); + CheckBaseWithIndexAndDisplacement(&match3, nullptr, 0, b0, d15); // (B0 + M1) -> [p1, 0, B0, NULL] BaseWithIndexAndDisplacement64Matcher match4(graph()->NewNode(a_op, b0, m1)); - CheckBaseWithIndexAndDisplacement(&match4, p1, 0, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match4, p1, 0, b0, nullptr); // (M1 + B0) -> [p1, 0, B0, NULL] m1 = graph()->NewNode(m_op, p1, d1); BaseWithIndexAndDisplacement64Matcher match5(graph()->NewNode(a_op, m1, b0)); - CheckBaseWithIndexAndDisplacement(&match5, p1, 0, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match5, p1, 0, b0, nullptr); // (D15 + M1) -> [P1, 0, NULL, D15] m1 = graph()->NewNode(m_op, p1, d1); BaseWithIndexAndDisplacement64Matcher match6(graph()->NewNode(a_op, d15, m1)); - CheckBaseWithIndexAndDisplacement(&match6, p1, 0, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match6, p1, 0, nullptr, d15); // (M1 + D15) -> [P1, 0, NULL, D15] m1 = graph()->NewNode(m_op, p1, d1); BaseWithIndexAndDisplacement64Matcher match7(graph()->NewNode(a_op, m1, d15)); - CheckBaseWithIndexAndDisplacement(&match7, p1, 0, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match7, p1, 0, nullptr, d15); // (B0 + S0) -> [p1, 0, B0, NULL] BaseWithIndexAndDisplacement64Matcher match8(graph()->NewNode(a_op, b0, s0)); - CheckBaseWithIndexAndDisplacement(&match8, p1, 0, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match8, p1, 0, b0, nullptr); // (S0 + B0) -> [p1, 0, B0, NULL] s0 = graph()->NewNode(s_op, p1, d0); BaseWithIndexAndDisplacement64Matcher match9(graph()->NewNode(a_op, s0, b0)); - CheckBaseWithIndexAndDisplacement(&match9, p1, 0, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match9, p1, 0, b0, nullptr); // (D15 + S0) -> [P1, 0, NULL, D15] s0 = graph()->NewNode(s_op, p1, d0); BaseWithIndexAndDisplacement64Matcher match10( graph()->NewNode(a_op, d15, s0)); - CheckBaseWithIndexAndDisplacement(&match10, p1, 0, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match10, p1, 0, nullptr, d15); // (S0 + D15) -> [P1, 0, NULL, D15] s0 = graph()->NewNode(s_op, p1, d0); BaseWithIndexAndDisplacement64Matcher match11( graph()->NewNode(a_op, s0, d15)); - CheckBaseWithIndexAndDisplacement(&match11, p1, 0, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match11, p1, 0, nullptr, d15); // (B0 + M2) -> [p1, 1, B0, NULL] BaseWithIndexAndDisplacement64Matcher match12(graph()->NewNode(a_op, b0, m2)); - CheckBaseWithIndexAndDisplacement(&match12, p1, 1, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match12, p1, 1, b0, nullptr); // (M2 + B0) -> [p1, 1, B0, NULL] m2 = graph()->NewNode(m_op, p1, d2); BaseWithIndexAndDisplacement64Matcher match13(graph()->NewNode(a_op, m2, b0)); - CheckBaseWithIndexAndDisplacement(&match13, p1, 1, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match13, p1, 1, b0, nullptr); // (D15 + M2) -> [P1, 1, NULL, D15] m2 = graph()->NewNode(m_op, p1, d2); BaseWithIndexAndDisplacement64Matcher match14( graph()->NewNode(a_op, d15, m2)); - CheckBaseWithIndexAndDisplacement(&match14, p1, 1, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match14, p1, 1, nullptr, d15); // (M2 + D15) -> [P1, 1, NULL, D15] m2 = graph()->NewNode(m_op, p1, d2); BaseWithIndexAndDisplacement64Matcher match15( graph()->NewNode(a_op, m2, d15)); - CheckBaseWithIndexAndDisplacement(&match15, p1, 1, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match15, p1, 1, nullptr, d15); // (B0 + S1) -> [p1, 1, B0, NULL] BaseWithIndexAndDisplacement64Matcher match16(graph()->NewNode(a_op, b0, s1)); - CheckBaseWithIndexAndDisplacement(&match16, p1, 1, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match16, p1, 1, b0, nullptr); // (S1 + B0) -> [p1, 1, B0, NULL] s1 = graph()->NewNode(s_op, p1, d1); BaseWithIndexAndDisplacement64Matcher match17(graph()->NewNode(a_op, s1, b0)); - CheckBaseWithIndexAndDisplacement(&match17, p1, 1, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match17, p1, 1, b0, nullptr); // (D15 + S1) -> [P1, 1, NULL, D15] s1 = graph()->NewNode(s_op, p1, d1); BaseWithIndexAndDisplacement64Matcher match18( graph()->NewNode(a_op, d15, s1)); - CheckBaseWithIndexAndDisplacement(&match18, p1, 1, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match18, p1, 1, nullptr, d15); // (S1 + D15) -> [P1, 1, NULL, D15] s1 = graph()->NewNode(s_op, p1, d1); BaseWithIndexAndDisplacement64Matcher match19( graph()->NewNode(a_op, s1, d15)); - CheckBaseWithIndexAndDisplacement(&match19, p1, 1, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match19, p1, 1, nullptr, d15); // (B0 + M4) -> [p1, 2, B0, NULL] BaseWithIndexAndDisplacement64Matcher match20(graph()->NewNode(a_op, b0, m4)); - CheckBaseWithIndexAndDisplacement(&match20, p1, 2, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match20, p1, 2, b0, nullptr); // (M4 + B0) -> [p1, 2, B0, NULL] m4 = graph()->NewNode(m_op, p1, d4); BaseWithIndexAndDisplacement64Matcher match21(graph()->NewNode(a_op, m4, b0)); - CheckBaseWithIndexAndDisplacement(&match21, p1, 2, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match21, p1, 2, b0, nullptr); // (D15 + M4) -> [p1, 2, NULL, D15] m4 = graph()->NewNode(m_op, p1, d4); BaseWithIndexAndDisplacement64Matcher match22( graph()->NewNode(a_op, d15, m4)); - CheckBaseWithIndexAndDisplacement(&match22, p1, 2, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match22, p1, 2, nullptr, d15); // (M4 + D15) -> [p1, 2, NULL, D15] m4 = graph()->NewNode(m_op, p1, d4); BaseWithIndexAndDisplacement64Matcher match23( graph()->NewNode(a_op, m4, d15)); - CheckBaseWithIndexAndDisplacement(&match23, p1, 2, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match23, p1, 2, nullptr, d15); // (B0 + S2) -> [p1, 2, B0, NULL] BaseWithIndexAndDisplacement64Matcher match24(graph()->NewNode(a_op, b0, s2)); - CheckBaseWithIndexAndDisplacement(&match24, p1, 2, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match24, p1, 2, b0, nullptr); // (S2 + B0) -> [p1, 2, B0, NULL] s2 = graph()->NewNode(s_op, p1, d2); BaseWithIndexAndDisplacement64Matcher match25(graph()->NewNode(a_op, s2, b0)); - CheckBaseWithIndexAndDisplacement(&match25, p1, 2, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match25, p1, 2, b0, nullptr); // (D15 + S2) -> [p1, 2, NULL, D15] s2 = graph()->NewNode(s_op, p1, d2); BaseWithIndexAndDisplacement64Matcher match26( graph()->NewNode(a_op, d15, s2)); - CheckBaseWithIndexAndDisplacement(&match26, p1, 2, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match26, p1, 2, nullptr, d15); // (S2 + D15) -> [p1, 2, NULL, D15] s2 = graph()->NewNode(s_op, p1, d2); BaseWithIndexAndDisplacement64Matcher match27( graph()->NewNode(a_op, s2, d15)); - CheckBaseWithIndexAndDisplacement(&match27, p1, 2, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match27, p1, 2, nullptr, d15); // (B0 + M8) -> [p1, 2, B0, NULL] BaseWithIndexAndDisplacement64Matcher match28(graph()->NewNode(a_op, b0, m8)); - CheckBaseWithIndexAndDisplacement(&match28, p1, 3, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match28, p1, 3, b0, nullptr); // (M8 + B0) -> [p1, 2, B0, NULL] m8 = graph()->NewNode(m_op, p1, d8); BaseWithIndexAndDisplacement64Matcher match29(graph()->NewNode(a_op, m8, b0)); - CheckBaseWithIndexAndDisplacement(&match29, p1, 3, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match29, p1, 3, b0, nullptr); // (D15 + M8) -> [p1, 2, NULL, D15] m8 = graph()->NewNode(m_op, p1, d8); BaseWithIndexAndDisplacement64Matcher match30( graph()->NewNode(a_op, d15, m8)); - CheckBaseWithIndexAndDisplacement(&match30, p1, 3, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match30, p1, 3, nullptr, d15); // (M8 + D15) -> [p1, 2, NULL, D15] m8 = graph()->NewNode(m_op, p1, d8); BaseWithIndexAndDisplacement64Matcher match31( graph()->NewNode(a_op, m8, d15)); - CheckBaseWithIndexAndDisplacement(&match31, p1, 3, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match31, p1, 3, nullptr, d15); // (B0 + S3) -> [p1, 2, B0, NULL] BaseWithIndexAndDisplacement64Matcher match32(graph()->NewNode(a_op, b0, s3)); - CheckBaseWithIndexAndDisplacement(&match32, p1, 3, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match32, p1, 3, b0, nullptr); // (S3 + B0) -> [p1, 2, B0, NULL] s3 = graph()->NewNode(s_op, p1, d3); BaseWithIndexAndDisplacement64Matcher match33(graph()->NewNode(a_op, s3, b0)); - CheckBaseWithIndexAndDisplacement(&match33, p1, 3, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match33, p1, 3, b0, nullptr); // (D15 + S3) -> [p1, 2, NULL, D15] s3 = graph()->NewNode(s_op, p1, d3); BaseWithIndexAndDisplacement64Matcher match34( graph()->NewNode(a_op, d15, s3)); - CheckBaseWithIndexAndDisplacement(&match34, p1, 3, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match34, p1, 3, nullptr, d15); // (S3 + D15) -> [p1, 2, NULL, D15] s3 = graph()->NewNode(s_op, p1, d3); BaseWithIndexAndDisplacement64Matcher match35( graph()->NewNode(a_op, s3, d15)); - CheckBaseWithIndexAndDisplacement(&match35, p1, 3, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match35, p1, 3, nullptr, d15); // 2 INPUT - NEGATIVE CASES // (M3 + B1) -> [B0, 0, M3, NULL] BaseWithIndexAndDisplacement64Matcher match36(graph()->NewNode(a_op, b1, m3)); - CheckBaseWithIndexAndDisplacement(&match36, m3, 0, b1, NULL); + CheckBaseWithIndexAndDisplacement(&match36, m3, 0, b1, nullptr); // (S4 + B1) -> [B0, 0, S4, NULL] BaseWithIndexAndDisplacement64Matcher match37(graph()->NewNode(a_op, b1, s4)); - CheckBaseWithIndexAndDisplacement(&match37, s4, 0, b1, NULL); + CheckBaseWithIndexAndDisplacement(&match37, s4, 0, b1, nullptr); // 3 INPUT @@ -1405,209 +1405,209 @@ TEST_F(NodeMatcherTest, ScaledWithOffset64Matcher) { m1 = graph()->NewNode(m_op, p1, d1); ADD_ADDRESSING_OPERAND_USES(m1); BaseWithIndexAndDisplacement64Matcher match54(graph()->NewNode(a_op, b0, m1)); - CheckBaseWithIndexAndDisplacement(&match54, p1, 0, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match54, p1, 0, b0, nullptr); // (M1 + B0) -> [p1, 0, B0, NULL] m1 = graph()->NewNode(m_op, p1, d1); ADD_ADDRESSING_OPERAND_USES(m1); BaseWithIndexAndDisplacement64Matcher match55(graph()->NewNode(a_op, m1, b0)); - CheckBaseWithIndexAndDisplacement(&match55, p1, 0, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match55, p1, 0, b0, nullptr); // (D15 + M1) -> [P1, 0, NULL, D15] m1 = graph()->NewNode(m_op, p1, d1); ADD_ADDRESSING_OPERAND_USES(m1); BaseWithIndexAndDisplacement64Matcher match56( graph()->NewNode(a_op, d15, m1)); - CheckBaseWithIndexAndDisplacement(&match56, p1, 0, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match56, p1, 0, nullptr, d15); // (M1 + D15) -> [P1, 0, NULL, D15] m1 = graph()->NewNode(m_op, p1, d1); ADD_ADDRESSING_OPERAND_USES(m1); BaseWithIndexAndDisplacement64Matcher match57( graph()->NewNode(a_op, m1, d15)); - CheckBaseWithIndexAndDisplacement(&match57, p1, 0, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match57, p1, 0, nullptr, d15); // (B0 + S0) -> [p1, 0, B0, NULL] s0 = graph()->NewNode(s_op, p1, d0); ADD_ADDRESSING_OPERAND_USES(s0); BaseWithIndexAndDisplacement64Matcher match58(graph()->NewNode(a_op, b0, s0)); - CheckBaseWithIndexAndDisplacement(&match58, p1, 0, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match58, p1, 0, b0, nullptr); // (S0 + B0) -> [p1, 0, B0, NULL] s0 = graph()->NewNode(s_op, p1, d0); ADD_ADDRESSING_OPERAND_USES(s0); BaseWithIndexAndDisplacement64Matcher match59(graph()->NewNode(a_op, s0, b0)); - CheckBaseWithIndexAndDisplacement(&match59, p1, 0, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match59, p1, 0, b0, nullptr); // (D15 + S0) -> [P1, 0, NULL, D15] s0 = graph()->NewNode(s_op, p1, d0); ADD_ADDRESSING_OPERAND_USES(s0); BaseWithIndexAndDisplacement64Matcher match60( graph()->NewNode(a_op, d15, s0)); - CheckBaseWithIndexAndDisplacement(&match60, p1, 0, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match60, p1, 0, nullptr, d15); // (S0 + D15) -> [P1, 0, NULL, D15] s0 = graph()->NewNode(s_op, p1, d0); ADD_ADDRESSING_OPERAND_USES(s0); BaseWithIndexAndDisplacement64Matcher match61( graph()->NewNode(a_op, s0, d15)); - CheckBaseWithIndexAndDisplacement(&match61, p1, 0, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match61, p1, 0, nullptr, d15); // (B0 + M2) -> [p1, 1, B0, NULL] m2 = graph()->NewNode(m_op, p1, d2); ADD_ADDRESSING_OPERAND_USES(m2); BaseWithIndexAndDisplacement64Matcher match62(graph()->NewNode(a_op, b0, m2)); - CheckBaseWithIndexAndDisplacement(&match62, p1, 1, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match62, p1, 1, b0, nullptr); // (M2 + B0) -> [p1, 1, B0, NULL] m2 = graph()->NewNode(m_op, p1, d2); ADD_ADDRESSING_OPERAND_USES(m2); BaseWithIndexAndDisplacement64Matcher match63(graph()->NewNode(a_op, m2, b0)); - CheckBaseWithIndexAndDisplacement(&match63, p1, 1, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match63, p1, 1, b0, nullptr); // (D15 + M2) -> [P1, 1, NULL, D15] m2 = graph()->NewNode(m_op, p1, d2); ADD_ADDRESSING_OPERAND_USES(m2); BaseWithIndexAndDisplacement64Matcher match64( graph()->NewNode(a_op, d15, m2)); - CheckBaseWithIndexAndDisplacement(&match64, p1, 1, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match64, p1, 1, nullptr, d15); // (M2 + D15) -> [P1, 1, NULL, D15] m2 = graph()->NewNode(m_op, p1, d2); ADD_ADDRESSING_OPERAND_USES(m2); BaseWithIndexAndDisplacement64Matcher match65( graph()->NewNode(a_op, m2, d15)); - CheckBaseWithIndexAndDisplacement(&match65, p1, 1, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match65, p1, 1, nullptr, d15); // (B0 + S1) -> [p1, 1, B0, NULL] s1 = graph()->NewNode(s_op, p1, d1); ADD_ADDRESSING_OPERAND_USES(s1); BaseWithIndexAndDisplacement64Matcher match66(graph()->NewNode(a_op, b0, s1)); - CheckBaseWithIndexAndDisplacement(&match66, p1, 1, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match66, p1, 1, b0, nullptr); // (S1 + B0) -> [p1, 1, B0, NULL] s1 = graph()->NewNode(s_op, p1, d1); ADD_ADDRESSING_OPERAND_USES(s1); BaseWithIndexAndDisplacement64Matcher match67(graph()->NewNode(a_op, s1, b0)); - CheckBaseWithIndexAndDisplacement(&match67, p1, 1, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match67, p1, 1, b0, nullptr); // (D15 + S1) -> [P1, 1, NULL, D15] s1 = graph()->NewNode(s_op, p1, d1); ADD_ADDRESSING_OPERAND_USES(s1); BaseWithIndexAndDisplacement64Matcher match68( graph()->NewNode(a_op, d15, s1)); - CheckBaseWithIndexAndDisplacement(&match68, p1, 1, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match68, p1, 1, nullptr, d15); // (S1 + D15) -> [P1, 1, NULL, D15] s1 = graph()->NewNode(s_op, p1, d1); ADD_ADDRESSING_OPERAND_USES(s1); BaseWithIndexAndDisplacement64Matcher match69( graph()->NewNode(a_op, s1, d15)); - CheckBaseWithIndexAndDisplacement(&match69, p1, 1, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match69, p1, 1, nullptr, d15); // (B0 + M4) -> [p1, 2, B0, NULL] m4 = graph()->NewNode(m_op, p1, d4); ADD_ADDRESSING_OPERAND_USES(m4); BaseWithIndexAndDisplacement64Matcher match70(graph()->NewNode(a_op, b0, m4)); - CheckBaseWithIndexAndDisplacement(&match70, p1, 2, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match70, p1, 2, b0, nullptr); // (M4 + B0) -> [p1, 2, B0, NULL] m4 = graph()->NewNode(m_op, p1, d4); ADD_ADDRESSING_OPERAND_USES(m4); BaseWithIndexAndDisplacement64Matcher match71(graph()->NewNode(a_op, m4, b0)); - CheckBaseWithIndexAndDisplacement(&match71, p1, 2, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match71, p1, 2, b0, nullptr); // (D15 + M4) -> [p1, 2, NULL, D15] m4 = graph()->NewNode(m_op, p1, d4); ADD_ADDRESSING_OPERAND_USES(m4); BaseWithIndexAndDisplacement64Matcher match72( graph()->NewNode(a_op, d15, m4)); - CheckBaseWithIndexAndDisplacement(&match72, p1, 2, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match72, p1, 2, nullptr, d15); // (M4 + D15) -> [p1, 2, NULL, D15] m4 = graph()->NewNode(m_op, p1, d4); ADD_ADDRESSING_OPERAND_USES(m4); BaseWithIndexAndDisplacement64Matcher match73( graph()->NewNode(a_op, m4, d15)); - CheckBaseWithIndexAndDisplacement(&match73, p1, 2, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match73, p1, 2, nullptr, d15); // (B0 + S2) -> [p1, 2, B0, NULL] s2 = graph()->NewNode(s_op, p1, d2); ADD_ADDRESSING_OPERAND_USES(s2); BaseWithIndexAndDisplacement64Matcher match74(graph()->NewNode(a_op, b0, s2)); - CheckBaseWithIndexAndDisplacement(&match74, p1, 2, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match74, p1, 2, b0, nullptr); // (S2 + B0) -> [p1, 2, B0, NULL] s2 = graph()->NewNode(s_op, p1, d2); ADD_ADDRESSING_OPERAND_USES(s2); BaseWithIndexAndDisplacement64Matcher match75(graph()->NewNode(a_op, s2, b0)); - CheckBaseWithIndexAndDisplacement(&match75, p1, 2, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match75, p1, 2, b0, nullptr); // (D15 + S2) -> [p1, 2, NULL, D15] s2 = graph()->NewNode(s_op, p1, d2); ADD_ADDRESSING_OPERAND_USES(s2); BaseWithIndexAndDisplacement64Matcher match76( graph()->NewNode(a_op, d15, s2)); - CheckBaseWithIndexAndDisplacement(&match76, p1, 2, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match76, p1, 2, nullptr, d15); // (S2 + D15) -> [p1, 2, NULL, D15] s2 = graph()->NewNode(s_op, p1, d2); ADD_ADDRESSING_OPERAND_USES(s2); BaseWithIndexAndDisplacement64Matcher match77( graph()->NewNode(a_op, s2, d15)); - CheckBaseWithIndexAndDisplacement(&match77, p1, 2, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match77, p1, 2, nullptr, d15); // (B0 + M8) -> [p1, 2, B0, NULL] m8 = graph()->NewNode(m_op, p1, d8); ADD_ADDRESSING_OPERAND_USES(m8); BaseWithIndexAndDisplacement64Matcher match78(graph()->NewNode(a_op, b0, m8)); - CheckBaseWithIndexAndDisplacement(&match78, p1, 3, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match78, p1, 3, b0, nullptr); // (M8 + B0) -> [p1, 2, B0, NULL] m8 = graph()->NewNode(m_op, p1, d8); ADD_ADDRESSING_OPERAND_USES(m8); BaseWithIndexAndDisplacement64Matcher match79(graph()->NewNode(a_op, m8, b0)); - CheckBaseWithIndexAndDisplacement(&match79, p1, 3, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match79, p1, 3, b0, nullptr); // (D15 + M8) -> [p1, 2, NULL, D15] m8 = graph()->NewNode(m_op, p1, d8); ADD_ADDRESSING_OPERAND_USES(m8); BaseWithIndexAndDisplacement64Matcher match80( graph()->NewNode(a_op, d15, m8)); - CheckBaseWithIndexAndDisplacement(&match80, p1, 3, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match80, p1, 3, nullptr, d15); // (M8 + D15) -> [p1, 2, NULL, D15] m8 = graph()->NewNode(m_op, p1, d8); ADD_ADDRESSING_OPERAND_USES(m8); BaseWithIndexAndDisplacement64Matcher match81( graph()->NewNode(a_op, m8, d15)); - CheckBaseWithIndexAndDisplacement(&match81, p1, 3, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match81, p1, 3, nullptr, d15); // (B0 + S3) -> [p1, 2, B0, NULL] s3 = graph()->NewNode(s_op, p1, d3); ADD_ADDRESSING_OPERAND_USES(s3); BaseWithIndexAndDisplacement64Matcher match82(graph()->NewNode(a_op, b0, s3)); - CheckBaseWithIndexAndDisplacement(&match82, p1, 3, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match82, p1, 3, b0, nullptr); // (S3 + B0) -> [p1, 2, B0, NULL] s3 = graph()->NewNode(s_op, p1, d3); ADD_ADDRESSING_OPERAND_USES(s3); BaseWithIndexAndDisplacement64Matcher match83(graph()->NewNode(a_op, s3, b0)); - CheckBaseWithIndexAndDisplacement(&match83, p1, 3, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match83, p1, 3, b0, nullptr); // (D15 + S3) -> [p1, 2, NULL, D15] s3 = graph()->NewNode(s_op, p1, d3); ADD_ADDRESSING_OPERAND_USES(s3); BaseWithIndexAndDisplacement64Matcher match84( graph()->NewNode(a_op, d15, s3)); - CheckBaseWithIndexAndDisplacement(&match84, p1, 3, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match84, p1, 3, nullptr, d15); // (S3 + D15) -> [p1, 2, NULL, D15] s3 = graph()->NewNode(s_op, p1, d3); ADD_ADDRESSING_OPERAND_USES(s3); BaseWithIndexAndDisplacement64Matcher match85( graph()->NewNode(a_op, s3, d15)); - CheckBaseWithIndexAndDisplacement(&match85, p1, 3, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match85, p1, 3, nullptr, d15); // (D15 + S3) + B0 -> [p1, 2, b0, d15] s3 = graph()->NewNode(s_op, p1, d3); @@ -1632,7 +1632,7 @@ TEST_F(NodeMatcherTest, ScaledWithOffset64Matcher) { ADD_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement64Matcher match88( graph()->NewNode(a_op, temp, d15)); - CheckBaseWithIndexAndDisplacement(&match88, NULL, 0, temp, d15); + CheckBaseWithIndexAndDisplacement(&match88, nullptr, 0, temp, d15); // D15 + (S3 + B0) -> [NULL, 0, (s3 + b0), d15] // Avoid changing simple addressing to complex addressing @@ -1641,7 +1641,7 @@ TEST_F(NodeMatcherTest, ScaledWithOffset64Matcher) { ADD_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement64Matcher match89( graph()->NewNode(a_op, d15, temp)); - CheckBaseWithIndexAndDisplacement(&match89, NULL, 0, temp, d15); + CheckBaseWithIndexAndDisplacement(&match89, nullptr, 0, temp, d15); // B0 + (D15 + S3) -> [p1, 2, b0, d15] s3 = graph()->NewNode(s_op, p1, d3); @@ -1691,7 +1691,7 @@ TEST_F(NodeMatcherTest, ScaledWithOffset64Matcher) { ADD_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement64Matcher match95( graph()->NewNode(a_op, temp, d15)); - CheckBaseWithIndexAndDisplacement(&match95, NULL, 0, temp, d15); + CheckBaseWithIndexAndDisplacement(&match95, nullptr, 0, temp, d15); // D15 + (B0 + B1) -> [NULL, 0, (b0 + b1), d15] // Avoid changing simple addressing to complex addressing @@ -1699,7 +1699,7 @@ TEST_F(NodeMatcherTest, ScaledWithOffset64Matcher) { ADD_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement64Matcher match96( graph()->NewNode(a_op, d15, temp)); - CheckBaseWithIndexAndDisplacement(&match96, NULL, 0, temp, d15); + CheckBaseWithIndexAndDisplacement(&match96, nullptr, 0, temp, d15); // 5 INPUT - with none-addressing operand uses @@ -1707,223 +1707,223 @@ TEST_F(NodeMatcherTest, ScaledWithOffset64Matcher) { m1 = graph()->NewNode(m_op, p1, d1); ADD_NONE_ADDRESSING_OPERAND_USES(m1); BaseWithIndexAndDisplacement64Matcher match97(graph()->NewNode(a_op, b0, m1)); - CheckBaseWithIndexAndDisplacement(&match97, b0, 0, m1, NULL); + CheckBaseWithIndexAndDisplacement(&match97, b0, 0, m1, nullptr); // (M1 + B0) -> [b0, 0, m1, NULL] m1 = graph()->NewNode(m_op, p1, d1); ADD_NONE_ADDRESSING_OPERAND_USES(m1); BaseWithIndexAndDisplacement64Matcher match98(graph()->NewNode(a_op, m1, b0)); - CheckBaseWithIndexAndDisplacement(&match98, b0, 0, m1, NULL); + CheckBaseWithIndexAndDisplacement(&match98, b0, 0, m1, nullptr); // (D15 + M1) -> [NULL, 0, m1, d15] m1 = graph()->NewNode(m_op, p1, d1); ADD_NONE_ADDRESSING_OPERAND_USES(m1); BaseWithIndexAndDisplacement64Matcher match99( graph()->NewNode(a_op, d15, m1)); - CheckBaseWithIndexAndDisplacement(&match99, NULL, 0, m1, d15); + CheckBaseWithIndexAndDisplacement(&match99, nullptr, 0, m1, d15); // (M1 + D15) -> [NULL, 0, m1, d15] m1 = graph()->NewNode(m_op, p1, d1); ADD_NONE_ADDRESSING_OPERAND_USES(m1); BaseWithIndexAndDisplacement64Matcher match100( graph()->NewNode(a_op, m1, d15)); - CheckBaseWithIndexAndDisplacement(&match100, NULL, 0, m1, d15); + CheckBaseWithIndexAndDisplacement(&match100, nullptr, 0, m1, d15); // (B0 + S0) -> [b0, 0, s0, NULL] s0 = graph()->NewNode(s_op, p1, d0); ADD_NONE_ADDRESSING_OPERAND_USES(s0); BaseWithIndexAndDisplacement64Matcher match101( graph()->NewNode(a_op, b0, s0)); - CheckBaseWithIndexAndDisplacement(&match101, b0, 0, s0, NULL); + CheckBaseWithIndexAndDisplacement(&match101, b0, 0, s0, nullptr); // (S0 + B0) -> [b0, 0, s0, NULL] s0 = graph()->NewNode(s_op, p1, d0); ADD_NONE_ADDRESSING_OPERAND_USES(s0); BaseWithIndexAndDisplacement64Matcher match102( graph()->NewNode(a_op, s0, b0)); - CheckBaseWithIndexAndDisplacement(&match102, b0, 0, s0, NULL); + CheckBaseWithIndexAndDisplacement(&match102, b0, 0, s0, nullptr); // (D15 + S0) -> [NULL, 0, s0, d15] s0 = graph()->NewNode(s_op, p1, d0); ADD_NONE_ADDRESSING_OPERAND_USES(s0); BaseWithIndexAndDisplacement64Matcher match103( graph()->NewNode(a_op, d15, s0)); - CheckBaseWithIndexAndDisplacement(&match103, NULL, 0, s0, d15); + CheckBaseWithIndexAndDisplacement(&match103, nullptr, 0, s0, d15); // (S0 + D15) -> [NULL, 0, s0, d15] s0 = graph()->NewNode(s_op, p1, d0); ADD_NONE_ADDRESSING_OPERAND_USES(s0); BaseWithIndexAndDisplacement64Matcher match104( graph()->NewNode(a_op, s0, d15)); - CheckBaseWithIndexAndDisplacement(&match104, NULL, 0, s0, d15); + CheckBaseWithIndexAndDisplacement(&match104, nullptr, 0, s0, d15); // (B0 + M2) -> [b0, 0, m2, NULL] m2 = graph()->NewNode(m_op, p1, d2); ADD_NONE_ADDRESSING_OPERAND_USES(m2); BaseWithIndexAndDisplacement64Matcher match105( graph()->NewNode(a_op, b0, m2)); - CheckBaseWithIndexAndDisplacement(&match105, b0, 0, m2, NULL); + CheckBaseWithIndexAndDisplacement(&match105, b0, 0, m2, nullptr); // (M2 + B0) -> [b0, 0, m2, NULL] m2 = graph()->NewNode(m_op, p1, d2); ADD_NONE_ADDRESSING_OPERAND_USES(m2); BaseWithIndexAndDisplacement64Matcher match106( graph()->NewNode(a_op, m2, b0)); - CheckBaseWithIndexAndDisplacement(&match106, b0, 0, m2, NULL); + CheckBaseWithIndexAndDisplacement(&match106, b0, 0, m2, nullptr); // (D15 + M2) -> [NULL, 0, m2, d15] m2 = graph()->NewNode(m_op, p1, d2); ADD_NONE_ADDRESSING_OPERAND_USES(m2); BaseWithIndexAndDisplacement64Matcher match107( graph()->NewNode(a_op, d15, m2)); - CheckBaseWithIndexAndDisplacement(&match107, NULL, 0, m2, d15); + CheckBaseWithIndexAndDisplacement(&match107, nullptr, 0, m2, d15); // (M2 + D15) -> [NULL, 0, m2, d15] m2 = graph()->NewNode(m_op, p1, d2); ADD_NONE_ADDRESSING_OPERAND_USES(m2); BaseWithIndexAndDisplacement64Matcher match108( graph()->NewNode(a_op, m2, d15)); - CheckBaseWithIndexAndDisplacement(&match108, NULL, 0, m2, d15); + CheckBaseWithIndexAndDisplacement(&match108, nullptr, 0, m2, d15); // (B0 + S1) -> [b0, 0, s1, NULL] s1 = graph()->NewNode(s_op, p1, d1); ADD_NONE_ADDRESSING_OPERAND_USES(s1); BaseWithIndexAndDisplacement64Matcher match109( graph()->NewNode(a_op, b0, s1)); - CheckBaseWithIndexAndDisplacement(&match109, b0, 0, s1, NULL); + CheckBaseWithIndexAndDisplacement(&match109, b0, 0, s1, nullptr); // (S1 + B0) -> [b0, 0, s1, NULL] s1 = graph()->NewNode(s_op, p1, d1); ADD_NONE_ADDRESSING_OPERAND_USES(s1); BaseWithIndexAndDisplacement64Matcher match110( graph()->NewNode(a_op, s1, b0)); - CheckBaseWithIndexAndDisplacement(&match110, b0, 0, s1, NULL); + CheckBaseWithIndexAndDisplacement(&match110, b0, 0, s1, nullptr); // (D15 + S1) -> [NULL, 0, s1, d15] s1 = graph()->NewNode(s_op, p1, d1); ADD_NONE_ADDRESSING_OPERAND_USES(s1); BaseWithIndexAndDisplacement64Matcher match111( graph()->NewNode(a_op, d15, s1)); - CheckBaseWithIndexAndDisplacement(&match111, NULL, 0, s1, d15); + CheckBaseWithIndexAndDisplacement(&match111, nullptr, 0, s1, d15); // (S1 + D15) -> [NULL, 0, s1, d15] s1 = graph()->NewNode(s_op, p1, d1); ADD_NONE_ADDRESSING_OPERAND_USES(s1); BaseWithIndexAndDisplacement64Matcher match112( graph()->NewNode(a_op, s1, d15)); - CheckBaseWithIndexAndDisplacement(&match112, NULL, 0, s1, d15); + CheckBaseWithIndexAndDisplacement(&match112, nullptr, 0, s1, d15); // (B0 + M4) -> [b0, 0, m4, NULL] m4 = graph()->NewNode(m_op, p1, d4); ADD_NONE_ADDRESSING_OPERAND_USES(m4); BaseWithIndexAndDisplacement64Matcher match113( graph()->NewNode(a_op, b0, m4)); - CheckBaseWithIndexAndDisplacement(&match113, b0, 0, m4, NULL); + CheckBaseWithIndexAndDisplacement(&match113, b0, 0, m4, nullptr); // (M4 + B0) -> [b0, 0, m4, NULL] m4 = graph()->NewNode(m_op, p1, d4); ADD_NONE_ADDRESSING_OPERAND_USES(m4); BaseWithIndexAndDisplacement64Matcher match114( graph()->NewNode(a_op, m4, b0)); - CheckBaseWithIndexAndDisplacement(&match114, b0, 0, m4, NULL); + CheckBaseWithIndexAndDisplacement(&match114, b0, 0, m4, nullptr); // (D15 + M4) -> [NULL, 0, m4, d15] m4 = graph()->NewNode(m_op, p1, d4); ADD_NONE_ADDRESSING_OPERAND_USES(m4); BaseWithIndexAndDisplacement64Matcher match115( graph()->NewNode(a_op, d15, m4)); - CheckBaseWithIndexAndDisplacement(&match115, NULL, 0, m4, d15); + CheckBaseWithIndexAndDisplacement(&match115, nullptr, 0, m4, d15); // (M4 + D15) -> [NULL, 0, m4, d15] m4 = graph()->NewNode(m_op, p1, d4); ADD_NONE_ADDRESSING_OPERAND_USES(m4); BaseWithIndexAndDisplacement64Matcher match116( graph()->NewNode(a_op, m4, d15)); - CheckBaseWithIndexAndDisplacement(&match116, NULL, 0, m4, d15); + CheckBaseWithIndexAndDisplacement(&match116, nullptr, 0, m4, d15); // (B0 + S2) -> [b0, 0, s2, NULL] s2 = graph()->NewNode(s_op, p1, d2); ADD_NONE_ADDRESSING_OPERAND_USES(s2); BaseWithIndexAndDisplacement64Matcher match117( graph()->NewNode(a_op, b0, s2)); - CheckBaseWithIndexAndDisplacement(&match117, b0, 0, s2, NULL); + CheckBaseWithIndexAndDisplacement(&match117, b0, 0, s2, nullptr); // (S2 + B0) -> [b0, 0, s2, NULL] s2 = graph()->NewNode(s_op, p1, d2); ADD_NONE_ADDRESSING_OPERAND_USES(s2); BaseWithIndexAndDisplacement64Matcher match118( graph()->NewNode(a_op, s2, b0)); - CheckBaseWithIndexAndDisplacement(&match118, b0, 0, s2, NULL); + CheckBaseWithIndexAndDisplacement(&match118, b0, 0, s2, nullptr); // (D15 + S2) -> [NULL, 0, s2, d15] s2 = graph()->NewNode(s_op, p1, d2); ADD_NONE_ADDRESSING_OPERAND_USES(s2); BaseWithIndexAndDisplacement64Matcher match119( graph()->NewNode(a_op, d15, s2)); - CheckBaseWithIndexAndDisplacement(&match119, NULL, 0, s2, d15); + CheckBaseWithIndexAndDisplacement(&match119, nullptr, 0, s2, d15); // (S2 + D15) -> [NULL, 0, s2, d15] s2 = graph()->NewNode(s_op, p1, d2); ADD_NONE_ADDRESSING_OPERAND_USES(s2); BaseWithIndexAndDisplacement64Matcher match120( graph()->NewNode(a_op, s2, d15)); - CheckBaseWithIndexAndDisplacement(&match120, NULL, 0, s2, d15); + CheckBaseWithIndexAndDisplacement(&match120, nullptr, 0, s2, d15); // (B0 + M8) -> [b0, 0, m8, NULL] m8 = graph()->NewNode(m_op, p1, d8); ADD_NONE_ADDRESSING_OPERAND_USES(m8); BaseWithIndexAndDisplacement64Matcher match121( graph()->NewNode(a_op, b0, m8)); - CheckBaseWithIndexAndDisplacement(&match121, b0, 0, m8, NULL); + CheckBaseWithIndexAndDisplacement(&match121, b0, 0, m8, nullptr); // (M8 + B0) -> [b0, 0, m8, NULL] m8 = graph()->NewNode(m_op, p1, d8); ADD_NONE_ADDRESSING_OPERAND_USES(m8); BaseWithIndexAndDisplacement64Matcher match122( graph()->NewNode(a_op, m8, b0)); - CheckBaseWithIndexAndDisplacement(&match122, b0, 0, m8, NULL); + CheckBaseWithIndexAndDisplacement(&match122, b0, 0, m8, nullptr); // (D15 + M8) -> [NULL, 0, m8, d15] m8 = graph()->NewNode(m_op, p1, d8); ADD_NONE_ADDRESSING_OPERAND_USES(m8); BaseWithIndexAndDisplacement64Matcher match123( graph()->NewNode(a_op, d15, m8)); - CheckBaseWithIndexAndDisplacement(&match123, NULL, 0, m8, d15); + CheckBaseWithIndexAndDisplacement(&match123, nullptr, 0, m8, d15); // (M8 + D15) -> [NULL, 0, m8, d15] m8 = graph()->NewNode(m_op, p1, d8); ADD_NONE_ADDRESSING_OPERAND_USES(m8); BaseWithIndexAndDisplacement64Matcher match124( graph()->NewNode(a_op, m8, d15)); - CheckBaseWithIndexAndDisplacement(&match124, NULL, 0, m8, d15); + CheckBaseWithIndexAndDisplacement(&match124, nullptr, 0, m8, d15); // (B0 + S3) -> [b0, 0, s3, NULL] s3 = graph()->NewNode(s_op, p1, d3); ADD_NONE_ADDRESSING_OPERAND_USES(s3); BaseWithIndexAndDisplacement64Matcher match125( graph()->NewNode(a_op, b0, s3)); - CheckBaseWithIndexAndDisplacement(&match125, b0, 0, s3, NULL); + CheckBaseWithIndexAndDisplacement(&match125, b0, 0, s3, nullptr); // (S3 + B0) -> [b0, 0, s3, NULL] s3 = graph()->NewNode(s_op, p1, d3); ADD_NONE_ADDRESSING_OPERAND_USES(s3); BaseWithIndexAndDisplacement64Matcher match126( graph()->NewNode(a_op, s3, b0)); - CheckBaseWithIndexAndDisplacement(&match126, b0, 0, s3, NULL); + CheckBaseWithIndexAndDisplacement(&match126, b0, 0, s3, nullptr); // (D15 + S3) -> [NULL, 0, s3, d15] s3 = graph()->NewNode(s_op, p1, d3); ADD_NONE_ADDRESSING_OPERAND_USES(s3); BaseWithIndexAndDisplacement64Matcher match127( graph()->NewNode(a_op, d15, s3)); - CheckBaseWithIndexAndDisplacement(&match127, NULL, 0, s3, d15); + CheckBaseWithIndexAndDisplacement(&match127, nullptr, 0, s3, d15); // (S3 + D15) -> [NULL, 0, s3, d15] s3 = graph()->NewNode(s_op, p1, d3); ADD_NONE_ADDRESSING_OPERAND_USES(s3); BaseWithIndexAndDisplacement64Matcher match128( graph()->NewNode(a_op, s3, d15)); - CheckBaseWithIndexAndDisplacement(&match128, NULL, 0, s3, d15); + CheckBaseWithIndexAndDisplacement(&match128, nullptr, 0, s3, d15); // (D15 + S3) + B0 -> [b0, 0, (D15 + S3), NULL] s3 = graph()->NewNode(s_op, p1, d3); @@ -1931,7 +1931,7 @@ TEST_F(NodeMatcherTest, ScaledWithOffset64Matcher) { ADD_NONE_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement64Matcher match129( graph()->NewNode(a_op, temp, b0)); - CheckBaseWithIndexAndDisplacement(&match129, b0, 0, temp, NULL); + CheckBaseWithIndexAndDisplacement(&match129, b0, 0, temp, nullptr); // (B0 + D15) + S3 -> [p1, 3, (B0 + D15), NULL] s3 = graph()->NewNode(s_op, p1, d3); @@ -1939,7 +1939,7 @@ TEST_F(NodeMatcherTest, ScaledWithOffset64Matcher) { ADD_NONE_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement64Matcher match130( graph()->NewNode(a_op, temp, s3)); - CheckBaseWithIndexAndDisplacement(&match130, p1, 3, temp, NULL); + CheckBaseWithIndexAndDisplacement(&match130, p1, 3, temp, nullptr); // (S3 + B0) + D15 -> [NULL, 0, (S3 + B0), d15] s3 = graph()->NewNode(s_op, p1, d3); @@ -1947,7 +1947,7 @@ TEST_F(NodeMatcherTest, ScaledWithOffset64Matcher) { ADD_NONE_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement64Matcher match131( graph()->NewNode(a_op, temp, d15)); - CheckBaseWithIndexAndDisplacement(&match131, NULL, 0, temp, d15); + CheckBaseWithIndexAndDisplacement(&match131, nullptr, 0, temp, d15); // D15 + (S3 + B0) -> [NULL, 0, (S3 + B0), d15] s3 = graph()->NewNode(s_op, p1, d3); @@ -1955,7 +1955,7 @@ TEST_F(NodeMatcherTest, ScaledWithOffset64Matcher) { ADD_NONE_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement64Matcher match132( graph()->NewNode(a_op, d15, temp)); - CheckBaseWithIndexAndDisplacement(&match132, NULL, 0, temp, d15); + CheckBaseWithIndexAndDisplacement(&match132, nullptr, 0, temp, d15); // B0 + (D15 + S3) -> [b0, 0, (D15 + S3), NULL] s3 = graph()->NewNode(s_op, p1, d3); @@ -1963,7 +1963,7 @@ TEST_F(NodeMatcherTest, ScaledWithOffset64Matcher) { ADD_NONE_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement64Matcher match133( graph()->NewNode(a_op, b0, temp)); - CheckBaseWithIndexAndDisplacement(&match133, b0, 0, temp, NULL); + CheckBaseWithIndexAndDisplacement(&match133, b0, 0, temp, nullptr); // S3 + (B0 + D15) -> [p1, 3, (B0 + D15), NULL] s3 = graph()->NewNode(s_op, p1, d3); @@ -1971,7 +1971,7 @@ TEST_F(NodeMatcherTest, ScaledWithOffset64Matcher) { ADD_NONE_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement64Matcher match134( graph()->NewNode(a_op, s3, temp)); - CheckBaseWithIndexAndDisplacement(&match134, p1, 3, temp, NULL); + CheckBaseWithIndexAndDisplacement(&match134, p1, 3, temp, nullptr); // S3 + (B0 - D15) -> [p1, 3, (B0 - D15), NULL] s3 = graph()->NewNode(s_op, p1, d3); @@ -1979,14 +1979,14 @@ TEST_F(NodeMatcherTest, ScaledWithOffset64Matcher) { ADD_NONE_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement64Matcher match135( graph()->NewNode(a_op, s3, temp)); - CheckBaseWithIndexAndDisplacement(&match135, p1, 3, temp, NULL); + CheckBaseWithIndexAndDisplacement(&match135, p1, 3, temp, nullptr); // B0 + (B1 - D15) -> [b0, 0, (B1 - D15), NULL] temp = graph()->NewNode(sub_op, b1, d15); ADD_NONE_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement64Matcher match136( graph()->NewNode(a_op, b0, temp)); - CheckBaseWithIndexAndDisplacement(&match136, b0, 0, temp, NULL); + CheckBaseWithIndexAndDisplacement(&match136, b0, 0, temp, nullptr); // (B0 - D15) + S3 -> [p1, 3, temp, NULL] s3 = graph()->NewNode(s_op, p1, d3); @@ -1994,21 +1994,21 @@ TEST_F(NodeMatcherTest, ScaledWithOffset64Matcher) { ADD_NONE_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement64Matcher match137( graph()->NewNode(a_op, temp, s3)); - CheckBaseWithIndexAndDisplacement(&match137, p1, 3, temp, NULL); + CheckBaseWithIndexAndDisplacement(&match137, p1, 3, temp, nullptr); // (B0 + B1) + D15 -> [NULL, 0, (B0 + B1), d15] temp = graph()->NewNode(a_op, b0, b1); ADD_NONE_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement64Matcher match138( graph()->NewNode(a_op, temp, d15)); - CheckBaseWithIndexAndDisplacement(&match138, NULL, 0, temp, d15); + CheckBaseWithIndexAndDisplacement(&match138, nullptr, 0, temp, d15); // D15 + (B0 + B1) -> [NULL, 0, (B0 + B1), d15] temp = graph()->NewNode(a_op, b0, b1); ADD_NONE_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement64Matcher match139( graph()->NewNode(a_op, d15, temp)); - CheckBaseWithIndexAndDisplacement(&match139, NULL, 0, temp, d15); + CheckBaseWithIndexAndDisplacement(&match139, nullptr, 0, temp, d15); } TEST_F(NodeMatcherTest, BranchMatcher_match) { diff --git a/deps/v8/test/unittests/compiler/node-test-utils.cc b/deps/v8/test/unittests/compiler/node-test-utils.cc index 56f18931b4..0b3d8786f8 100644 --- a/deps/v8/test/unittests/compiler/node-test-utils.cc +++ b/deps/v8/test/unittests/compiler/node-test-utils.cc @@ -57,7 +57,7 @@ class TestNodeMatcher : public MatcherInterface<Node*> { bool MatchAndExplain(Node* node, MatchResultListener* listener) const override { - if (node == NULL) { + if (node == nullptr) { *listener << "which is NULL"; return false; } @@ -1401,6 +1401,43 @@ class IsBinopMatcher final : public TestNodeMatcher { const Matcher<Node*> rhs_matcher_; }; +class IsStringConcatMatcher final : public TestNodeMatcher { + public: + IsStringConcatMatcher(const Matcher<Node*>& length_matcher, + const Matcher<Node*>& lhs_matcher, + const Matcher<Node*>& rhs_matcher) + : TestNodeMatcher(IrOpcode::kStringConcat), + length_matcher_(length_matcher), + lhs_matcher_(lhs_matcher), + rhs_matcher_(rhs_matcher) {} + + void DescribeTo(std::ostream* os) const final { + TestNodeMatcher::DescribeTo(os); + *os << " whose length ("; + length_matcher_.DescribeTo(os); + *os << ") and lhs ("; + lhs_matcher_.DescribeTo(os); + *os << ") and rhs ("; + rhs_matcher_.DescribeTo(os); + *os << ")"; + } + + bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { + return (TestNodeMatcher::MatchAndExplain(node, listener) && + PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), + "length", length_matcher_, listener) && + PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), "lhs", + lhs_matcher_, listener) && + PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2), "rhs", + rhs_matcher_, listener)); + } + + private: + const Matcher<Node*> length_matcher_; + const Matcher<Node*> lhs_matcher_; + const Matcher<Node*> rhs_matcher_; +}; + class IsUnopMatcher final : public TestNodeMatcher { public: IsUnopMatcher(IrOpcode::Value opcode, const Matcher<Node*>& input_matcher) @@ -1910,9 +1947,19 @@ Matcher<Node*> IsTailCall( IrOpcode::k##opcode, hint_matcher, lhs_matcher, rhs_matcher, \ effect_matcher, control_matcher)); \ } -SPECULATIVE_BINOPS(DEFINE_SPECULATIVE_BINOP_MATCHER); +SIMPLIFIED_SPECULATIVE_NUMBER_BINOP_LIST(DEFINE_SPECULATIVE_BINOP_MATCHER); +DEFINE_SPECULATIVE_BINOP_MATCHER(SpeculativeNumberEqual) +DEFINE_SPECULATIVE_BINOP_MATCHER(SpeculativeNumberLessThan) +DEFINE_SPECULATIVE_BINOP_MATCHER(SpeculativeNumberLessThanOrEqual) #undef DEFINE_SPECULATIVE_BINOP_MATCHER +Matcher<Node*> IsStringConcat(const Matcher<Node*>& length_matcher, + const Matcher<Node*>& lhs_matcher, + const Matcher<Node*>& rhs_matcher) { + return MakeMatcher( + new IsStringConcatMatcher(length_matcher, lhs_matcher, rhs_matcher)); +} + Matcher<Node*> IsAllocate(const Matcher<Node*>& size_matcher, const Matcher<Node*>& effect_matcher, const Matcher<Node*>& control_matcher) { diff --git a/deps/v8/test/unittests/compiler/node-test-utils.h b/deps/v8/test/unittests/compiler/node-test-utils.h index 30ac330f7f..4e9c32e6d6 100644 --- a/deps/v8/test/unittests/compiler/node-test-utils.h +++ b/deps/v8/test/unittests/compiler/node-test-utils.h @@ -7,6 +7,7 @@ #include "src/compiler/common-operator.h" #include "src/compiler/machine-operator.h" +#include "src/compiler/opcodes.h" #include "src/compiler/simplified-operator.h" #include "src/machine-type.h" #include "testing/gmock/include/gmock/gmock.h" @@ -35,16 +36,6 @@ class Node; using ::testing::Matcher; -#define SPECULATIVE_BINOPS(V) \ - V(SpeculativeNumberAdd) \ - V(SpeculativeNumberSubtract) \ - V(SpeculativeNumberShiftLeft) \ - V(SpeculativeNumberShiftRight) \ - V(SpeculativeNumberShiftRightLogical) \ - V(SpeculativeNumberBitwiseAnd) \ - V(SpeculativeNumberBitwiseOr) \ - V(SpeculativeNumberBitwiseXor) - Matcher<Node*> IsDead(); Matcher<Node*> IsEnd(const Matcher<Node*>& control0_matcher); Matcher<Node*> IsEnd(const Matcher<Node*>& control0_matcher, @@ -221,7 +212,10 @@ Matcher<Node*> IsNumberAdd(const Matcher<Node*>& lhs_matcher, const Matcher<Node*>& rhs_matcher, \ const Matcher<Node*>& effect_matcher, \ const Matcher<Node*>& control_matcher); -SPECULATIVE_BINOPS(DECLARE_SPECULATIVE_BINOP_MATCHER); +SIMPLIFIED_SPECULATIVE_NUMBER_BINOP_LIST(DECLARE_SPECULATIVE_BINOP_MATCHER); +DECLARE_SPECULATIVE_BINOP_MATCHER(SpeculativeNumberEqual) +DECLARE_SPECULATIVE_BINOP_MATCHER(SpeculativeNumberLessThan) +DECLARE_SPECULATIVE_BINOP_MATCHER(SpeculativeNumberLessThanOrEqual) #undef DECLARE_SPECULATIVE_BINOP_MATCHER Matcher<Node*> IsNumberSubtract(const Matcher<Node*>& lhs_matcher, @@ -272,6 +266,9 @@ Matcher<Node*> IsNumberSqrt(const Matcher<Node*>& value_matcher); Matcher<Node*> IsNumberTan(const Matcher<Node*>& value_matcher); Matcher<Node*> IsNumberTanh(const Matcher<Node*>& value_matcher); Matcher<Node*> IsNumberTrunc(const Matcher<Node*>& value_matcher); +Matcher<Node*> IsStringConcat(const Matcher<Node*>& length_matcher, + const Matcher<Node*>& lhs_matcher, + const Matcher<Node*>& rhs_matcher); Matcher<Node*> IsStringFromSingleCharCode(const Matcher<Node*>& value_matcher); Matcher<Node*> IsStringLength(const Matcher<Node*>& value_matcher); Matcher<Node*> IsAllocate(const Matcher<Node*>& size_matcher, diff --git a/deps/v8/test/unittests/compiler/redundancy-elimination-unittest.cc b/deps/v8/test/unittests/compiler/redundancy-elimination-unittest.cc new file mode 100644 index 0000000000..f3ecd228a5 --- /dev/null +++ b/deps/v8/test/unittests/compiler/redundancy-elimination-unittest.cc @@ -0,0 +1,1170 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "src/compiler/redundancy-elimination.h" +#include "src/compiler/common-operator.h" +#include "test/unittests/compiler/graph-reducer-unittest.h" +#include "test/unittests/compiler/graph-unittest.h" +#include "test/unittests/compiler/node-test-utils.h" +#include "testing/gmock-support.h" + +using testing::_; +using testing::NiceMock; + +namespace v8 { +namespace internal { +namespace compiler { +namespace redundancy_elimination_unittest { + +class RedundancyEliminationTest : public GraphTest { + public: + explicit RedundancyEliminationTest(int num_parameters = 4) + : GraphTest(num_parameters), + reducer_(&editor_, zone()), + simplified_(zone()) { + // Initialize the {reducer_} state for the Start node. + reducer_.Reduce(graph()->start()); + + // Create a feedback vector with two CALL_IC slots. + FeedbackVectorSpec spec(zone()); + FeedbackSlot slot1 = spec.AddCallICSlot(); + FeedbackSlot slot2 = spec.AddCallICSlot(); + Handle<FeedbackMetadata> metadata = FeedbackMetadata::New(isolate(), &spec); + Handle<SharedFunctionInfo> shared = + isolate()->factory()->NewSharedFunctionInfoForBuiltin( + isolate()->factory()->empty_string(), Builtins::kIllegal); + shared->set_raw_outer_scope_info_or_feedback_metadata(*metadata); + Handle<FeedbackVector> feedback_vector = + FeedbackVector::New(isolate(), shared); + 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)); + } + ~RedundancyEliminationTest() override = default; + + protected: + Reduction Reduce(Node* node) { return reducer_.Reduce(node); } + + std::vector<VectorSlotPair> 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_; + RedundancyElimination reducer_; + SimplifiedOperatorBuilder simplified_; +}; + +namespace { + +const CheckForMinusZeroMode kCheckForMinusZeroModes[] = { + CheckForMinusZeroMode::kCheckForMinusZero, + CheckForMinusZeroMode::kDontCheckForMinusZero, +}; + +const CheckTaggedInputMode kCheckTaggedInputModes[] = { + CheckTaggedInputMode::kNumber, CheckTaggedInputMode::kNumberOrOddball}; + +const NumberOperationHint kNumberOperationHints[] = { + NumberOperationHint::kSignedSmall, + NumberOperationHint::kSignedSmallInputs, + NumberOperationHint::kSigned32, + NumberOperationHint::kNumber, + NumberOperationHint::kNumberOrOddball, +}; + +} // namespace + +// ----------------------------------------------------------------------------- +// CheckBounds + +TEST_F(RedundancyEliminationTest, CheckBounds) { + TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + Node* index = Parameter(0); + Node* length = Parameter(1); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = graph()->NewNode( + simplified()->CheckBounds(feedback1), index, length, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* check2 = effect = graph()->NewNode( + simplified()->CheckBounds(feedback2), index, length, effect, control); + Reduction r2 = Reduce(check2); + ASSERT_TRUE(r2.Changed()); + EXPECT_EQ(r2.replacement(), check1); + } + } +} + +// ----------------------------------------------------------------------------- +// CheckNumber + +TEST_F(RedundancyEliminationTest, CheckNumberSubsumedByCheckSmi) { + TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + Node* value = Parameter(0); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = graph()->NewNode( + simplified()->CheckSmi(feedback1), value, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* check2 = effect = graph()->NewNode( + simplified()->CheckNumber(feedback2), value, effect, control); + Reduction r2 = Reduce(check2); + ASSERT_TRUE(r2.Changed()); + EXPECT_EQ(r2.replacement(), check1); + } + } +} + +// ----------------------------------------------------------------------------- +// CheckString + +TEST_F(RedundancyEliminationTest, + CheckStringSubsumedByCheckInternalizedString) { + TRACED_FOREACH(VectorSlotPair, feedback, vector_slot_pairs()) { + Node* value = Parameter(0); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = graph()->NewNode( + simplified()->CheckInternalizedString(), value, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* check2 = effect = graph()->NewNode( + simplified()->CheckString(feedback), value, effect, control); + Reduction r2 = Reduce(check2); + ASSERT_TRUE(r2.Changed()); + EXPECT_EQ(r2.replacement(), check1); + } +} + +// ----------------------------------------------------------------------------- +// CheckSymbol + +TEST_F(RedundancyEliminationTest, CheckSymbol) { + Node* value = Parameter(0); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = + graph()->NewNode(simplified()->CheckSymbol(), value, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* check2 = effect = + graph()->NewNode(simplified()->CheckSymbol(), value, effect, control); + Reduction r2 = Reduce(check2); + ASSERT_TRUE(r2.Changed()); + EXPECT_EQ(r2.replacement(), check1); +} + +// ----------------------------------------------------------------------------- +// CheckedFloat64ToInt32 + +TEST_F(RedundancyEliminationTest, CheckedFloat64ToInt32) { + TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + TRACED_FOREACH(CheckForMinusZeroMode, mode, kCheckForMinusZeroModes) { + Node* value = Parameter(0); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = graph()->NewNode( + simplified()->CheckedFloat64ToInt32(mode, feedback1), value, effect, + control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* check2 = effect = graph()->NewNode( + simplified()->CheckedFloat64ToInt32(mode, feedback2), value, effect, + control); + Reduction r2 = Reduce(check2); + ASSERT_TRUE(r2.Changed()); + EXPECT_EQ(r2.replacement(), check1); + } + } + } +} + +// ----------------------------------------------------------------------------- +// CheckedInt32ToTaggedSigned + +TEST_F(RedundancyEliminationTest, CheckedInt32ToTaggedSigned) { + TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + Node* value = Parameter(0); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = + graph()->NewNode(simplified()->CheckedInt32ToTaggedSigned(feedback1), + value, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* check2 = effect = + graph()->NewNode(simplified()->CheckedInt32ToTaggedSigned(feedback2), + value, effect, control); + Reduction r2 = Reduce(check2); + ASSERT_TRUE(r2.Changed()); + EXPECT_EQ(r2.replacement(), check1); + } + } +} + +// ----------------------------------------------------------------------------- +// CheckedInt64ToInt32 + +TEST_F(RedundancyEliminationTest, CheckedInt64ToInt32) { + TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + Node* value = Parameter(0); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = graph()->NewNode( + simplified()->CheckedInt64ToInt32(feedback1), value, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* check2 = effect = graph()->NewNode( + simplified()->CheckedInt64ToInt32(feedback2), value, effect, control); + Reduction r2 = Reduce(check2); + ASSERT_TRUE(r2.Changed()); + EXPECT_EQ(r2.replacement(), check1); + } + } +} + +// ----------------------------------------------------------------------------- +// CheckedInt64ToTaggedSigned + +TEST_F(RedundancyEliminationTest, CheckedInt64ToTaggedSigned) { + TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + Node* value = Parameter(0); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = + graph()->NewNode(simplified()->CheckedInt64ToTaggedSigned(feedback1), + value, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* check2 = effect = + graph()->NewNode(simplified()->CheckedInt64ToTaggedSigned(feedback2), + value, effect, control); + Reduction r2 = Reduce(check2); + ASSERT_TRUE(r2.Changed()); + EXPECT_EQ(r2.replacement(), check1); + } + } +} + +// ----------------------------------------------------------------------------- +// CheckedTaggedSignedToInt32 + +TEST_F(RedundancyEliminationTest, CheckedTaggedSignedToInt32) { + TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + Node* value = Parameter(0); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = + graph()->NewNode(simplified()->CheckedTaggedSignedToInt32(feedback1), + value, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* check2 = effect = + graph()->NewNode(simplified()->CheckedTaggedSignedToInt32(feedback2), + value, effect, control); + Reduction r2 = Reduce(check2); + ASSERT_TRUE(r2.Changed()); + EXPECT_EQ(r2.replacement(), check1); + } + } +} + +// ----------------------------------------------------------------------------- +// CheckedTaggedToFloat64 + +TEST_F(RedundancyEliminationTest, CheckedTaggedToFloat64) { + TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + TRACED_FOREACH(CheckTaggedInputMode, mode, kCheckTaggedInputModes) { + Node* value = Parameter(0); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = graph()->NewNode( + simplified()->CheckedTaggedToFloat64(mode, feedback1), value, + effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* check2 = effect = graph()->NewNode( + simplified()->CheckedTaggedToFloat64(mode, feedback2), value, + effect, control); + Reduction r2 = Reduce(check2); + ASSERT_TRUE(r2.Changed()); + EXPECT_EQ(r2.replacement(), check1); + } + } + } +} + +TEST_F(RedundancyEliminationTest, + CheckedTaggedToFloat64SubsubmedByCheckedTaggedToFloat64) { + TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + Node* value = Parameter(0); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + // If the check passed for CheckTaggedInputMode::kNumber, it'll + // also pass later for CheckTaggedInputMode::kNumberOrOddball. + Node* check1 = effect = + graph()->NewNode(simplified()->CheckedTaggedToFloat64( + CheckTaggedInputMode::kNumber, feedback1), + value, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* check2 = effect = graph()->NewNode( + simplified()->CheckedTaggedToFloat64( + CheckTaggedInputMode::kNumberOrOddball, feedback2), + value, effect, control); + Reduction r2 = Reduce(check2); + ASSERT_TRUE(r2.Changed()); + EXPECT_EQ(r2.replacement(), check1); + } + } +} + +// ----------------------------------------------------------------------------- +// CheckedTaggedToInt32 + +TEST_F(RedundancyEliminationTest, CheckedTaggedToInt32) { + TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + TRACED_FOREACH(CheckForMinusZeroMode, mode, kCheckForMinusZeroModes) { + Node* value = Parameter(0); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = graph()->NewNode( + simplified()->CheckedTaggedToInt32(mode, feedback1), value, effect, + control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* check2 = effect = graph()->NewNode( + simplified()->CheckedTaggedToInt32(mode, feedback2), value, effect, + control); + Reduction r2 = Reduce(check2); + ASSERT_TRUE(r2.Changed()); + EXPECT_EQ(r2.replacement(), check1); + } + } + } +} + +TEST_F(RedundancyEliminationTest, + CheckedTaggedToInt32SubsumedByCheckedTaggedSignedToInt32) { + TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + TRACED_FOREACH(CheckForMinusZeroMode, mode, kCheckForMinusZeroModes) { + Node* value = Parameter(0); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = graph()->NewNode( + simplified()->CheckedTaggedSignedToInt32(feedback1), value, effect, + control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* check2 = effect = graph()->NewNode( + simplified()->CheckedTaggedToInt32(mode, feedback2), value, effect, + control); + Reduction r2 = Reduce(check2); + ASSERT_TRUE(r2.Changed()); + EXPECT_EQ(r2.replacement(), check1); + } + } + } +} + +// ----------------------------------------------------------------------------- +// CheckedTaggedToTaggedPointer + +TEST_F(RedundancyEliminationTest, CheckedTaggedToTaggedPointer) { + TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + Node* value = Parameter(0); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = graph()->NewNode( + simplified()->CheckedTaggedToTaggedPointer(feedback1), value, effect, + control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* check2 = effect = graph()->NewNode( + simplified()->CheckedTaggedToTaggedPointer(feedback2), value, effect, + control); + Reduction r2 = Reduce(check2); + ASSERT_TRUE(r2.Changed()); + EXPECT_EQ(r2.replacement(), check1); + } + } +} + +// ----------------------------------------------------------------------------- +// CheckedTaggedToTaggedSigned + +TEST_F(RedundancyEliminationTest, CheckedTaggedToTaggedSigned) { + TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + Node* value = Parameter(0); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = + graph()->NewNode(simplified()->CheckedTaggedToTaggedSigned(feedback1), + value, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* check2 = effect = + graph()->NewNode(simplified()->CheckedTaggedToTaggedSigned(feedback2), + value, effect, control); + Reduction r2 = Reduce(check2); + ASSERT_TRUE(r2.Changed()); + EXPECT_EQ(r2.replacement(), check1); + } + } +} + +// ----------------------------------------------------------------------------- +// CheckedTruncateTaggedToWord32 + +TEST_F(RedundancyEliminationTest, CheckedTruncateTaggedToWord32) { + TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + TRACED_FOREACH(CheckTaggedInputMode, mode, kCheckTaggedInputModes) { + Node* value = Parameter(0); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = graph()->NewNode( + simplified()->CheckedTruncateTaggedToWord32(mode, feedback1), value, + effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* check2 = effect = graph()->NewNode( + simplified()->CheckedTruncateTaggedToWord32(mode, feedback2), value, + effect, control); + Reduction r2 = Reduce(check2); + ASSERT_TRUE(r2.Changed()); + EXPECT_EQ(r2.replacement(), check1); + } + } + } +} + +TEST_F(RedundancyEliminationTest, + CheckedTruncateTaggedToWord32SubsumedByCheckedTruncateTaggedToWord32) { + TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + Node* value = Parameter(0); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + // If the check passed for CheckTaggedInputMode::kNumber, it'll + // also pass later for CheckTaggedInputMode::kNumberOrOddball. + Node* check1 = effect = + graph()->NewNode(simplified()->CheckedTruncateTaggedToWord32( + CheckTaggedInputMode::kNumber, feedback1), + value, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* check2 = effect = graph()->NewNode( + simplified()->CheckedTruncateTaggedToWord32( + CheckTaggedInputMode::kNumberOrOddball, feedback2), + value, effect, control); + Reduction r2 = Reduce(check2); + ASSERT_TRUE(r2.Changed()); + EXPECT_EQ(r2.replacement(), check1); + } + } +} + +// ----------------------------------------------------------------------------- +// CheckedUint32ToInt32 + +TEST_F(RedundancyEliminationTest, CheckedUint32ToInt32) { + TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + Node* value = Parameter(0); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = + graph()->NewNode(simplified()->CheckedUint32ToInt32(feedback1), value, + effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* check2 = effect = + graph()->NewNode(simplified()->CheckedUint32ToInt32(feedback2), value, + effect, control); + Reduction r2 = Reduce(check2); + ASSERT_TRUE(r2.Changed()); + EXPECT_EQ(r2.replacement(), check1); + } + } +} + +// ----------------------------------------------------------------------------- +// CheckedUint32ToTaggedSigned + +TEST_F(RedundancyEliminationTest, CheckedUint32ToTaggedSigned) { + TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + Node* value = Parameter(0); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = + graph()->NewNode(simplified()->CheckedUint32ToTaggedSigned(feedback1), + value, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* check2 = effect = + graph()->NewNode(simplified()->CheckedUint32ToTaggedSigned(feedback2), + value, effect, control); + Reduction r2 = Reduce(check2); + ASSERT_TRUE(r2.Changed()); + EXPECT_EQ(r2.replacement(), check1); + } + } +} + +// ----------------------------------------------------------------------------- +// CheckedUint64ToInt32 + +TEST_F(RedundancyEliminationTest, CheckedUint64ToInt32) { + TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + Node* value = Parameter(0); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = + graph()->NewNode(simplified()->CheckedUint64ToInt32(feedback1), value, + effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* check2 = effect = + graph()->NewNode(simplified()->CheckedUint64ToInt32(feedback2), value, + effect, control); + Reduction r2 = Reduce(check2); + ASSERT_TRUE(r2.Changed()); + EXPECT_EQ(r2.replacement(), check1); + } + } +} + +// ----------------------------------------------------------------------------- +// CheckedUint64ToTaggedSigned + +TEST_F(RedundancyEliminationTest, CheckedUint64ToTaggedSigned) { + TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + Node* value = Parameter(0); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = + graph()->NewNode(simplified()->CheckedUint64ToTaggedSigned(feedback1), + value, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* check2 = effect = + graph()->NewNode(simplified()->CheckedUint64ToTaggedSigned(feedback2), + value, effect, control); + Reduction r2 = Reduce(check2); + ASSERT_TRUE(r2.Changed()); + EXPECT_EQ(r2.replacement(), check1); + } + } +} + +// ----------------------------------------------------------------------------- +// SpeculativeNumberEqual + +TEST_F(RedundancyEliminationTest, + SpeculativeNumberEqualWithCheckBoundsBetterType) { + Typer typer(js_heap_broker(), Typer::kNoFlags, graph()); + TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + Node* lhs = Parameter(Type::Any(), 0); + Node* rhs = Parameter(Type::Any(), 1); + Node* length = Parameter(Type::Unsigned31(), 2); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = graph()->NewNode( + simplified()->CheckBounds(feedback1), lhs, length, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* check2 = effect = graph()->NewNode( + simplified()->CheckBounds(feedback2), rhs, length, effect, control); + Reduction r2 = Reduce(check2); + ASSERT_TRUE(r2.Changed()); + EXPECT_EQ(r2.replacement(), check2); + + Node* cmp3 = effect = + graph()->NewNode(simplified()->SpeculativeNumberEqual( + NumberOperationHint::kSignedSmall), + lhs, rhs, effect, control); + Reduction r3 = Reduce(cmp3); + ASSERT_TRUE(r3.Changed()); + EXPECT_THAT(r3.replacement(), + IsSpeculativeNumberEqual(NumberOperationHint::kSignedSmall, + check1, check2, _, _)); + } + } +} + +TEST_F(RedundancyEliminationTest, + SpeculativeNumberEqualWithCheckBoundsSameType) { + Typer typer(js_heap_broker(), Typer::kNoFlags, graph()); + TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + Node* lhs = Parameter(Type::UnsignedSmall(), 0); + Node* rhs = Parameter(Type::UnsignedSmall(), 1); + Node* length = Parameter(Type::Unsigned31(), 2); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = graph()->NewNode( + simplified()->CheckBounds(feedback1), lhs, length, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* check2 = effect = graph()->NewNode( + simplified()->CheckBounds(feedback2), rhs, length, effect, control); + Reduction r2 = Reduce(check2); + ASSERT_TRUE(r2.Changed()); + EXPECT_EQ(r2.replacement(), check2); + + Node* cmp3 = effect = + graph()->NewNode(simplified()->SpeculativeNumberEqual( + NumberOperationHint::kSignedSmall), + lhs, rhs, effect, control); + Reduction r3 = Reduce(cmp3); + ASSERT_TRUE(r3.Changed()); + EXPECT_THAT(r3.replacement(), + IsSpeculativeNumberEqual(NumberOperationHint::kSignedSmall, + lhs, rhs, _, _)); + } + } +} + +// ----------------------------------------------------------------------------- +// SpeculativeNumberLessThan + +TEST_F(RedundancyEliminationTest, + SpeculativeNumberLessThanWithCheckBoundsBetterType) { + Typer typer(js_heap_broker(), Typer::kNoFlags, graph()); + TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + Node* lhs = Parameter(Type::Any(), 0); + Node* rhs = Parameter(Type::Any(), 1); + Node* length = Parameter(Type::Unsigned31(), 2); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = graph()->NewNode( + simplified()->CheckBounds(feedback1), lhs, length, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* check2 = effect = graph()->NewNode( + simplified()->CheckBounds(feedback2), rhs, length, effect, control); + Reduction r2 = Reduce(check2); + ASSERT_TRUE(r2.Changed()); + EXPECT_EQ(r2.replacement(), check2); + + Node* cmp3 = effect = + graph()->NewNode(simplified()->SpeculativeNumberLessThan( + NumberOperationHint::kSignedSmall), + lhs, rhs, effect, control); + Reduction r3 = Reduce(cmp3); + ASSERT_TRUE(r3.Changed()); + EXPECT_THAT(r3.replacement(), + IsSpeculativeNumberLessThan(NumberOperationHint::kSignedSmall, + check1, check2, _, _)); + } + } +} + +TEST_F(RedundancyEliminationTest, + SpeculativeNumberLessThanWithCheckBoundsSameType) { + Typer typer(js_heap_broker(), Typer::kNoFlags, graph()); + TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + Node* lhs = Parameter(Type::UnsignedSmall(), 0); + Node* rhs = Parameter(Type::UnsignedSmall(), 1); + Node* length = Parameter(Type::Unsigned31(), 2); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = graph()->NewNode( + simplified()->CheckBounds(feedback1), lhs, length, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* check2 = effect = graph()->NewNode( + simplified()->CheckBounds(feedback2), rhs, length, effect, control); + Reduction r2 = Reduce(check2); + ASSERT_TRUE(r2.Changed()); + EXPECT_EQ(r2.replacement(), check2); + + Node* cmp3 = effect = + graph()->NewNode(simplified()->SpeculativeNumberLessThan( + NumberOperationHint::kSignedSmall), + lhs, rhs, effect, control); + Reduction r3 = Reduce(cmp3); + ASSERT_TRUE(r3.Changed()); + EXPECT_THAT(r3.replacement(), + IsSpeculativeNumberLessThan(NumberOperationHint::kSignedSmall, + lhs, rhs, _, _)); + } + } +} + +// ----------------------------------------------------------------------------- +// SpeculativeNumberLessThanOrEqual + +TEST_F(RedundancyEliminationTest, + SpeculativeNumberLessThanOrEqualWithCheckBoundsBetterType) { + Typer typer(js_heap_broker(), Typer::kNoFlags, graph()); + TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + Node* lhs = Parameter(Type::Any(), 0); + Node* rhs = Parameter(Type::Any(), 1); + Node* length = Parameter(Type::Unsigned31(), 2); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = graph()->NewNode( + simplified()->CheckBounds(feedback1), lhs, length, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* check2 = effect = graph()->NewNode( + simplified()->CheckBounds(feedback2), rhs, length, effect, control); + Reduction r2 = Reduce(check2); + ASSERT_TRUE(r2.Changed()); + EXPECT_EQ(r2.replacement(), check2); + + Node* cmp3 = effect = + graph()->NewNode(simplified()->SpeculativeNumberLessThanOrEqual( + NumberOperationHint::kSignedSmall), + lhs, rhs, effect, control); + Reduction r3 = Reduce(cmp3); + ASSERT_TRUE(r3.Changed()); + EXPECT_THAT(r3.replacement(), + IsSpeculativeNumberLessThanOrEqual( + NumberOperationHint::kSignedSmall, check1, check2, _, _)); + } + } +} + +TEST_F(RedundancyEliminationTest, + SpeculativeNumberLessThanOrEqualWithCheckBoundsSameType) { + Typer typer(js_heap_broker(), Typer::kNoFlags, graph()); + TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + Node* lhs = Parameter(Type::UnsignedSmall(), 0); + Node* rhs = Parameter(Type::UnsignedSmall(), 1); + Node* length = Parameter(Type::Unsigned31(), 2); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = graph()->NewNode( + simplified()->CheckBounds(feedback1), lhs, length, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* check2 = effect = graph()->NewNode( + simplified()->CheckBounds(feedback2), rhs, length, effect, control); + Reduction r2 = Reduce(check2); + ASSERT_TRUE(r2.Changed()); + EXPECT_EQ(r2.replacement(), check2); + + Node* cmp3 = effect = + graph()->NewNode(simplified()->SpeculativeNumberLessThanOrEqual( + NumberOperationHint::kSignedSmall), + lhs, rhs, effect, control); + Reduction r3 = Reduce(cmp3); + ASSERT_TRUE(r3.Changed()); + EXPECT_THAT(r3.replacement(), + IsSpeculativeNumberLessThanOrEqual( + NumberOperationHint::kSignedSmall, lhs, rhs, _, _)); + } + } +} + +// ----------------------------------------------------------------------------- +// SpeculativeNumberAdd + +TEST_F(RedundancyEliminationTest, + SpeculativeNumberAddWithCheckBoundsBetterType) { + Typer typer(js_heap_broker(), Typer::kNoFlags, graph()); + TRACED_FOREACH(VectorSlotPair, feedback, vector_slot_pairs()) { + TRACED_FOREACH(NumberOperationHint, hint, kNumberOperationHints) { + Node* lhs = Parameter(Type::Any(), 0); + Node* rhs = Parameter(Type::Any(), 1); + Node* length = Parameter(Type::Unsigned31(), 2); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = graph()->NewNode( + simplified()->CheckBounds(feedback), lhs, length, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* add2 = effect = graph()->NewNode( + simplified()->SpeculativeNumberAdd(hint), lhs, rhs, effect, control); + Reduction r2 = Reduce(add2); + ASSERT_TRUE(r2.Changed()); + EXPECT_THAT(r2.replacement(), + IsSpeculativeNumberAdd(hint, check1, rhs, _, _)); + } + } +} + +TEST_F(RedundancyEliminationTest, SpeculativeNumberAddWithCheckBoundsSameType) { + Typer typer(js_heap_broker(), Typer::kNoFlags, graph()); + TRACED_FOREACH(VectorSlotPair, 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); + Node* length = Parameter(Type::Unsigned31(), 1); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = graph()->NewNode( + simplified()->CheckBounds(feedback), lhs, length, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* add2 = effect = graph()->NewNode( + simplified()->SpeculativeNumberAdd(hint), lhs, rhs, effect, control); + Reduction r2 = Reduce(add2); + ASSERT_TRUE(r2.Changed()); + EXPECT_THAT(r2.replacement(), + IsSpeculativeNumberAdd(hint, lhs, rhs, _, _)); + } + } +} + +// ----------------------------------------------------------------------------- +// SpeculativeNumberSubtract + +TEST_F(RedundancyEliminationTest, + SpeculativeNumberSubtractWithCheckBoundsBetterType) { + Typer typer(js_heap_broker(), Typer::kNoFlags, graph()); + TRACED_FOREACH(VectorSlotPair, feedback, vector_slot_pairs()) { + TRACED_FOREACH(NumberOperationHint, hint, kNumberOperationHints) { + Node* lhs = Parameter(Type::Any(), 0); + Node* rhs = Parameter(Type::Any(), 1); + Node* length = Parameter(Type::Unsigned31(), 2); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = graph()->NewNode( + simplified()->CheckBounds(feedback), lhs, length, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* subtract2 = effect = + graph()->NewNode(simplified()->SpeculativeNumberSubtract(hint), lhs, + rhs, effect, control); + Reduction r2 = Reduce(subtract2); + ASSERT_TRUE(r2.Changed()); + EXPECT_THAT(r2.replacement(), + IsSpeculativeNumberSubtract(hint, check1, rhs, _, _)); + } + } +} + +TEST_F(RedundancyEliminationTest, + SpeculativeNumberSubtractWithCheckBoundsSameType) { + Typer typer(js_heap_broker(), Typer::kNoFlags, graph()); + TRACED_FOREACH(VectorSlotPair, 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); + Node* length = Parameter(Type::Unsigned31(), 1); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = graph()->NewNode( + simplified()->CheckBounds(feedback), lhs, length, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* subtract2 = effect = + graph()->NewNode(simplified()->SpeculativeNumberSubtract(hint), lhs, + rhs, effect, control); + Reduction r2 = Reduce(subtract2); + ASSERT_TRUE(r2.Changed()); + EXPECT_THAT(r2.replacement(), + IsSpeculativeNumberSubtract(hint, lhs, rhs, _, _)); + } + } +} + +// ----------------------------------------------------------------------------- +// SpeculativeSafeIntegerAdd + +TEST_F(RedundancyEliminationTest, + SpeculativeSafeIntegerAddWithCheckBoundsBetterType) { + Typer typer(js_heap_broker(), Typer::kNoFlags, graph()); + TRACED_FOREACH(VectorSlotPair, feedback, vector_slot_pairs()) { + TRACED_FOREACH(NumberOperationHint, hint, kNumberOperationHints) { + Node* lhs = Parameter(Type::Any(), 0); + Node* rhs = Parameter(Type::Any(), 1); + Node* length = Parameter(Type::Unsigned31(), 2); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = graph()->NewNode( + simplified()->CheckBounds(feedback), lhs, length, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* add2 = effect = + graph()->NewNode(simplified()->SpeculativeSafeIntegerAdd(hint), lhs, + rhs, effect, control); + Reduction r2 = Reduce(add2); + ASSERT_TRUE(r2.Changed()); + EXPECT_THAT(r2.replacement(), + IsSpeculativeSafeIntegerAdd(hint, check1, rhs, _, _)); + } + } +} + +TEST_F(RedundancyEliminationTest, + SpeculativeSafeIntegerAddWithCheckBoundsSameType) { + Typer typer(js_heap_broker(), Typer::kNoFlags, graph()); + TRACED_FOREACH(VectorSlotPair, 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); + Node* length = Parameter(Type::Unsigned31(), 1); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = graph()->NewNode( + simplified()->CheckBounds(feedback), lhs, length, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* add2 = effect = + graph()->NewNode(simplified()->SpeculativeSafeIntegerAdd(hint), lhs, + rhs, effect, control); + Reduction r2 = Reduce(add2); + ASSERT_TRUE(r2.Changed()); + EXPECT_THAT(r2.replacement(), + IsSpeculativeSafeIntegerAdd(hint, lhs, rhs, _, _)); + } + } +} + +// ----------------------------------------------------------------------------- +// SpeculativeSafeIntegerSubtract + +TEST_F(RedundancyEliminationTest, + SpeculativeSafeIntegerSubtractWithCheckBoundsBetterType) { + Typer typer(js_heap_broker(), Typer::kNoFlags, graph()); + TRACED_FOREACH(VectorSlotPair, feedback, vector_slot_pairs()) { + TRACED_FOREACH(NumberOperationHint, hint, kNumberOperationHints) { + Node* lhs = Parameter(Type::Any(), 0); + Node* rhs = Parameter(Type::Any(), 1); + Node* length = Parameter(Type::Unsigned31(), 2); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = graph()->NewNode( + simplified()->CheckBounds(feedback), lhs, length, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* subtract2 = effect = + graph()->NewNode(simplified()->SpeculativeSafeIntegerSubtract(hint), + lhs, rhs, effect, control); + Reduction r2 = Reduce(subtract2); + ASSERT_TRUE(r2.Changed()); + EXPECT_THAT(r2.replacement(), + IsSpeculativeSafeIntegerSubtract(hint, check1, rhs, _, _)); + } + } +} + +TEST_F(RedundancyEliminationTest, + SpeculativeSafeIntegerSubtractWithCheckBoundsSameType) { + Typer typer(js_heap_broker(), Typer::kNoFlags, graph()); + TRACED_FOREACH(VectorSlotPair, 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); + Node* length = Parameter(Type::Unsigned31(), 1); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = graph()->NewNode( + simplified()->CheckBounds(feedback), lhs, length, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* subtract2 = effect = + graph()->NewNode(simplified()->SpeculativeSafeIntegerSubtract(hint), + lhs, rhs, effect, control); + Reduction r2 = Reduce(subtract2); + ASSERT_TRUE(r2.Changed()); + EXPECT_THAT(r2.replacement(), + IsSpeculativeSafeIntegerSubtract(hint, lhs, rhs, _, _)); + } + } +} + +// ----------------------------------------------------------------------------- +// SpeculativeToNumber + +TEST_F(RedundancyEliminationTest, + SpeculativeToNumberWithCheckBoundsBetterType) { + Typer typer(js_heap_broker(), Typer::kNoFlags, graph()); + TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + TRACED_FOREACH(NumberOperationHint, hint, kNumberOperationHints) { + Node* index = Parameter(Type::Any(), 0); + Node* length = Parameter(Type::Unsigned31(), 1); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = + graph()->NewNode(simplified()->CheckBounds(feedback1), index, + length, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* to_number2 = effect = + graph()->NewNode(simplified()->SpeculativeToNumber(hint, feedback2), + index, effect, control); + Reduction r2 = Reduce(to_number2); + ASSERT_TRUE(r2.Changed()); + EXPECT_THAT(r2.replacement(), IsSpeculativeToNumber(check1)); + } + } + } +} + +TEST_F(RedundancyEliminationTest, SpeculativeToNumberWithCheckBoundsSameType) { + Typer typer(js_heap_broker(), Typer::kNoFlags, graph()); + TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(VectorSlotPair, 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); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = + graph()->NewNode(simplified()->CheckBounds(feedback1), index, + length, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* to_number2 = effect = + graph()->NewNode(simplified()->SpeculativeToNumber(hint, feedback2), + index, effect, control); + Reduction r2 = Reduce(to_number2); + ASSERT_TRUE(r2.Changed()); + EXPECT_THAT(r2.replacement(), IsSpeculativeToNumber(index)); + } + } + } +} + +} // namespace redundancy_elimination_unittest +} // namespace compiler +} // namespace internal +} // namespace v8 diff --git a/deps/v8/test/unittests/compiler/scheduler-rpo-unittest.cc b/deps/v8/test/unittests/compiler/scheduler-rpo-unittest.cc index 97cafdb6e6..68a7ffea4a 100644 --- a/deps/v8/test/unittests/compiler/scheduler-rpo-unittest.cc +++ b/deps/v8/test/unittests/compiler/scheduler-rpo-unittest.cc @@ -18,7 +18,7 @@ namespace compiler { class SchedulerRPOTest : public TestWithZone { public: - SchedulerRPOTest() {} + SchedulerRPOTest() = default; void CheckRPONumbers(BasicBlockVector* order, size_t expected, bool loops_allowed) { diff --git a/deps/v8/test/unittests/compiler/simplified-lowering-unittest.cc b/deps/v8/test/unittests/compiler/simplified-lowering-unittest.cc index 51e954f799..82bcda6e9f 100644 --- a/deps/v8/test/unittests/compiler/simplified-lowering-unittest.cc +++ b/deps/v8/test/unittests/compiler/simplified-lowering-unittest.cc @@ -25,7 +25,7 @@ class SimplifiedLoweringTest : public GraphTest { simplified_(zone()), jsgraph_(isolate(), graph(), common(), &javascript_, &simplified_, &machine_) {} - ~SimplifiedLoweringTest() override {} + ~SimplifiedLoweringTest() override = default; void LowerGraph(Node* node) { // Make sure we always start with an empty graph. @@ -42,7 +42,7 @@ class SimplifiedLoweringTest : public GraphTest { { // Simplified lowering needs to run w/o the typer decorator so make sure // the object is not live at the same time. - Typer typer(isolate(), js_heap_broker(), Typer::kNoFlags, graph()); + Typer typer(js_heap_broker(), Typer::kNoFlags, graph()); typer.Run(); } 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 7913d6398c..5e2f8f15cc 100644 --- a/deps/v8/test/unittests/compiler/simplified-operator-reducer-unittest.cc +++ b/deps/v8/test/unittests/compiler/simplified-operator-reducer-unittest.cc @@ -25,7 +25,7 @@ class SimplifiedOperatorReducerTest : public GraphTest { public: explicit SimplifiedOperatorReducerTest(int num_parameters = 1) : GraphTest(num_parameters), simplified_(zone()) {} - ~SimplifiedOperatorReducerTest() override {} + ~SimplifiedOperatorReducerTest() override = default; protected: Reduction Reduce(Node* node) { @@ -54,7 +54,7 @@ class SimplifiedOperatorReducerTestWithParam public: explicit SimplifiedOperatorReducerTestWithParam(int num_parameters = 1) : SimplifiedOperatorReducerTest(num_parameters) {} - ~SimplifiedOperatorReducerTestWithParam() override {} + ~SimplifiedOperatorReducerTestWithParam() override = default; }; diff --git a/deps/v8/test/unittests/compiler/typed-optimization-unittest.cc b/deps/v8/test/unittests/compiler/typed-optimization-unittest.cc index 86600aeffe..51426a5f85 100644 --- a/deps/v8/test/unittests/compiler/typed-optimization-unittest.cc +++ b/deps/v8/test/unittests/compiler/typed-optimization-unittest.cc @@ -28,7 +28,7 @@ class TypedOptimizationTest : public TypedGraphTest { public: TypedOptimizationTest() : TypedGraphTest(3), simplified_(zone()), deps_(isolate(), zone()) {} - ~TypedOptimizationTest() override {} + ~TypedOptimizationTest() override = default; protected: Reduction Reduce(Node* node) { diff --git a/deps/v8/test/unittests/compiler/typer-unittest.cc b/deps/v8/test/unittests/compiler/typer-unittest.cc index 53459c314a..b827088336 100644 --- a/deps/v8/test/unittests/compiler/typer-unittest.cc +++ b/deps/v8/test/unittests/compiler/typer-unittest.cc @@ -23,7 +23,7 @@ class TyperTest : public TypedGraphTest { TyperTest() : TypedGraphTest(3), js_heap_broker_(isolate(), zone()), - operation_typer_(isolate(), &js_heap_broker_, zone()), + operation_typer_(&js_heap_broker_, zone()), types_(zone(), isolate(), random_number_generator()), javascript_(zone()), simplified_(zone()) { @@ -434,7 +434,6 @@ TEST_F(TyperTest, TypeJSStrictEqual) { TEST_F(TyperTest, Monotonicity_##name) { \ TestUnaryMonotonicity(javascript_.name()); \ } -TEST_MONOTONICITY(ToInteger) TEST_MONOTONICITY(ToLength) TEST_MONOTONICITY(ToName) TEST_MONOTONICITY(ToNumber) |