diff options
Diffstat (limited to 'deps/v8/test/cctest/compiler/test-graph-reducer.cc')
-rw-r--r-- | deps/v8/test/cctest/compiler/test-graph-reducer.cc | 50 |
1 files changed, 6 insertions, 44 deletions
diff --git a/deps/v8/test/cctest/compiler/test-graph-reducer.cc b/deps/v8/test/cctest/compiler/test-graph-reducer.cc index 189b3db18e..b94ca45855 100644 --- a/deps/v8/test/cctest/compiler/test-graph-reducer.cc +++ b/deps/v8/test/cctest/compiler/test-graph-reducer.cc @@ -102,10 +102,10 @@ class InPlaceBCReducer : public Reducer { // Wraps all "OPA0" nodes in "OPB1" operators by allocating new nodes. -class A0Wrapper V8_FINAL : public Reducer { +class A0Wrapper FINAL : public Reducer { public: explicit A0Wrapper(Graph* graph) : graph_(graph) {} - virtual Reduction Reduce(Node* node) V8_OVERRIDE { + virtual Reduction Reduce(Node* node) OVERRIDE { switch (node->op()->opcode()) { case OPCODE_A0: CHECK_EQ(0, node->InputCount()); @@ -118,10 +118,10 @@ class A0Wrapper V8_FINAL : public Reducer { // Wraps all "OPB0" nodes in two "OPC1" operators by allocating new nodes. -class B0Wrapper V8_FINAL : public Reducer { +class B0Wrapper FINAL : public Reducer { public: explicit B0Wrapper(Graph* graph) : graph_(graph) {} - virtual Reduction Reduce(Node* node) V8_OVERRIDE { + virtual Reduction Reduce(Node* node) OVERRIDE { switch (node->op()->opcode()) { case OPCODE_B0: CHECK_EQ(0, node->InputCount()); @@ -470,9 +470,9 @@ TEST(ReduceForward1) { reducer.ReduceGraph(); CHECK_EQ(before, graph.NodeCount()); CHECK_EQ(&OPB0, n1->op()); - CHECK_EQ(&OPB1, n2->op()); + CHECK(n2->IsDead()); CHECK_EQ(n1, end->InputAt(0)); - CHECK_EQ(&OPB1, n3->op()); + CHECK(n3->IsDead()); CHECK_EQ(n1, end->InputAt(0)); CHECK_EQ(&OPB2, end->op()); CHECK_EQ(0, n2->UseCount()); @@ -621,41 +621,3 @@ TEST(Order) { } } } - - -// Tests that a reducer is only applied once. -class OneTimeReducer : public Reducer { - public: - OneTimeReducer(Reducer* reducer, Zone* zone) - : reducer_(reducer), - nodes_(NodeSet::key_compare(), NodeSet::allocator_type(zone)) {} - virtual Reduction Reduce(Node* node) { - CHECK_EQ(0, static_cast<int>(nodes_.count(node))); - nodes_.insert(node); - return reducer_->Reduce(node); - } - Reducer* reducer_; - NodeSet nodes_; -}; - - -TEST(OneTimeReduce1) { - GraphTester graph; - - Node* n1 = graph.NewNode(&OPA0); - Node* end = graph.NewNode(&OPA1, n1); - graph.SetEnd(end); - - GraphReducer reducer(&graph); - InPlaceABReducer r; - OneTimeReducer once(&r, graph.zone()); - reducer.AddReducer(&once); - - // Tests A* => B* with in-place updates. Should only be applied once. - int before = graph.NodeCount(); - reducer.ReduceGraph(); - CHECK_EQ(before, graph.NodeCount()); - CHECK_EQ(&OPB0, n1->op()); - CHECK_EQ(&OPB1, end->op()); - CHECK_EQ(n1, end->InputAt(0)); -} |