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

Unified Diff: test/cctest/compiler/compiler/simplified-graph-builder.cc

Issue 426233002: Land the Fan (disabled) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review feedback, rebase and "git cl format" Created 6 years, 5 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/compiler/simplified-graph-builder.cc
diff --git a/test/cctest/compiler/compiler/simplified-graph-builder.cc b/test/cctest/compiler/compiler/simplified-graph-builder.cc
new file mode 100644
index 0000000000000000000000000000000000000000..038c61a5a693fb4093b3cd92dcdb2f0eff349906
--- /dev/null
+++ b/test/cctest/compiler/compiler/simplified-graph-builder.cc
@@ -0,0 +1,78 @@
+// 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/cctest/compiler/simplified-graph-builder.h"
+
+namespace v8 {
+namespace internal {
+namespace compiler {
+
+SimplifiedGraphBuilder::SimplifiedGraphBuilder(
+ Graph* graph, CommonOperatorBuilder* common,
+ MachineOperatorBuilder* machine, SimplifiedOperatorBuilder* simplified)
+ : StructuredGraphBuilder(graph, common),
+ machine_(machine),
+ simplified_(simplified) {}
+
+
+void SimplifiedGraphBuilder::Begin() {
+ ASSERT(graph()->start() == NULL);
+ Node* start = graph()->NewNode(common()->Start());
+ graph()->SetStart(start);
+ set_environment(new (zone()) Environment(this, start));
+}
+
+
+void SimplifiedGraphBuilder::Return(Node* value) {
+ Node* control = NewNode(common()->Return(), value);
+ UpdateControlDependencyToLeaveFunction(control);
+}
+
+
+void SimplifiedGraphBuilder::End() {
+ environment()->UpdateControlDependency(exit_control());
+ graph()->SetEnd(NewNode(common()->End()));
+}
+
+
+SimplifiedGraphBuilder::Environment::Environment(
+ SimplifiedGraphBuilder* builder, Node* control_dependency)
+ : StructuredGraphBuilder::Environment(builder, control_dependency) {}
+
+
+Node* SimplifiedGraphBuilder::Environment::Top() {
+ ASSERT(!values()->empty());
+ return values()->back();
+}
+
+
+void SimplifiedGraphBuilder::Environment::Push(Node* node) {
+ values()->push_back(node);
+}
+
+
+Node* SimplifiedGraphBuilder::Environment::Pop() {
+ ASSERT(!values()->empty());
+ Node* back = values()->back();
+ values()->pop_back();
+ return back;
+}
+
+
+void SimplifiedGraphBuilder::Environment::Poke(size_t depth, Node* node) {
+ ASSERT(depth < values()->size());
+ size_t index = values()->size() - depth - 1;
+ values()->at(index) = node;
+}
+
+
+Node* SimplifiedGraphBuilder::Environment::Peek(size_t depth) {
+ ASSERT(depth < values()->size());
+ size_t index = values()->size() - depth - 1;
+ return values()->at(index);
+}
+
+} // namespace compiler
+} // namespace internal
+} // namespace v8
« no previous file with comments | « test/cctest/compiler/compiler/simplified-graph-builder.h ('k') | test/cctest/compiler/compiler/test-branch-combine.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698