Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(577)

Side by Side Diff: test/cctest/compiler/test-graph-reducer.cc

Issue 602193005: [turbofan] Drop obsolete test after r24236. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "graph-tester.h" 7 #include "graph-tester.h"
8 #include "src/compiler/generic-node-inl.h" 8 #include "src/compiler/generic-node-inl.h"
9 #include "src/compiler/graph-reducer.h" 9 #include "src/compiler/graph-reducer.h"
10 10
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 for (int i = 0; i < 3; i++) { 614 for (int i = 0; i < 3; i++) {
615 int before = graph.NodeCount(); 615 int before = graph.NodeCount();
616 reducer.ReduceGraph(); 616 reducer.ReduceGraph();
617 CHECK_EQ(before, graph.NodeCount()); 617 CHECK_EQ(before, graph.NodeCount());
618 CHECK_EQ(&OPC0, n1->op()); 618 CHECK_EQ(&OPC0, n1->op());
619 CHECK_EQ(&OPC1, end->op()); 619 CHECK_EQ(&OPC1, end->op());
620 CHECK_EQ(n1, end->InputAt(0)); 620 CHECK_EQ(n1, end->InputAt(0));
621 } 621 }
622 } 622 }
623 } 623 }
624
625
626 // Tests that a reducer is only applied once.
627 class OneTimeReducer : public Reducer {
628 public:
629 OneTimeReducer(Reducer* reducer, Zone* zone)
630 : reducer_(reducer),
631 nodes_(NodeSet::key_compare(), NodeSet::allocator_type(zone)) {}
632 virtual Reduction Reduce(Node* node) {
633 CHECK_EQ(0, static_cast<int>(nodes_.count(node)));
634 nodes_.insert(node);
635 return reducer_->Reduce(node);
636 }
637 Reducer* reducer_;
638 NodeSet nodes_;
639 };
640
641
642 TEST(OneTimeReduce1) {
643 GraphTester graph;
644
645 Node* n1 = graph.NewNode(&OPA0);
646 Node* end = graph.NewNode(&OPA1, n1);
647 graph.SetEnd(end);
648
649 GraphReducer reducer(&graph);
650 InPlaceABReducer r;
651 OneTimeReducer once(&r, graph.zone());
652 reducer.AddReducer(&once);
653
654 // Tests A* => B* with in-place updates. Should only be applied once.
655 int before = graph.NodeCount();
656 reducer.ReduceGraph();
657 CHECK_EQ(before, graph.NodeCount());
658 CHECK_EQ(&OPB0, n1->op());
659 CHECK_EQ(&OPB1, end->op());
660 CHECK_EQ(n1, end->InputAt(0));
661 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698