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

Unified Diff: test/cctest/compiler/test-node-algorithm.cc

Issue 941963003: Revert of [turbofan] Finally get rid of the generic algorithm. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: test/cctest/compiler/test-node-algorithm.cc
diff --git a/test/cctest/compiler/test-node-algorithm.cc b/test/cctest/compiler/test-node-algorithm.cc
index 0cb77011aaefb6c63d0343aa2acbcc5169ce2c7e..842d18272e00b62584ad16d255909af544821193 100644
--- a/test/cctest/compiler/test-node-algorithm.cc
+++ b/test/cctest/compiler/test-node-algorithm.cc
@@ -9,6 +9,7 @@
#include "graph-tester.h"
#include "src/compiler/common-operator.h"
#include "src/compiler/graph.h"
+#include "src/compiler/graph-inl.h"
#include "src/compiler/graph-visualizer.h"
#include "src/compiler/node.h"
#include "src/compiler/operator.h"
@@ -18,6 +19,45 @@
static Operator dummy_operator(IrOpcode::kParameter, Operator::kNoWrite,
"dummy", 0, 0, 0, 1, 0, 0);
+
+class PreNodeVisitor : public NullNodeVisitor {
+ public:
+ void Pre(Node* node) {
+ printf("NODE ID: %d\n", node->id());
+ nodes_.push_back(node);
+ }
+ std::vector<Node*> nodes_;
+};
+
+
+class PostNodeVisitor : public NullNodeVisitor {
+ public:
+ void Post(Node* node) {
+ printf("NODE ID: %d\n", node->id());
+ nodes_.push_back(node);
+ }
+ std::vector<Node*> nodes_;
+};
+
+
+TEST(TestInputNodePreOrderVisitSimple) {
+ GraphWithStartNodeTester graph;
+ Node* n2 = graph.NewNode(&dummy_operator, graph.start());
+ Node* n3 = graph.NewNode(&dummy_operator, n2);
+ Node* n4 = graph.NewNode(&dummy_operator, n2, n3);
+ Node* n5 = graph.NewNode(&dummy_operator, n4, n2);
+ graph.SetEnd(n5);
+
+ PreNodeVisitor node_visitor;
+ graph.VisitNodeInputsFromEnd(&node_visitor);
+ CHECK_EQ(5, static_cast<int>(node_visitor.nodes_.size()));
+ CHECK(n5->id() == node_visitor.nodes_[0]->id());
+ CHECK(n4->id() == node_visitor.nodes_[1]->id());
+ CHECK(n2->id() == node_visitor.nodes_[2]->id());
+ CHECK(graph.start()->id() == node_visitor.nodes_[3]->id());
+ CHECK(n3->id() == node_visitor.nodes_[4]->id());
+}
+
TEST(TestPrintNodeGraphToNodeGraphviz) {
GraphWithStartNodeTester graph;
« no previous file with comments | « test/cctest/compiler/test-machine-operator-reducer.cc ('k') | test/unittests/compiler/instruction-selector-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698