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

Side by Side Diff: test/cctest/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, 4 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "test/cctest/compiler/simplified-graph-builder.h"
6
7 namespace v8 {
8 namespace internal {
9 namespace compiler {
10
11 SimplifiedGraphBuilder::SimplifiedGraphBuilder(
12 Graph* graph, CommonOperatorBuilder* common,
13 MachineOperatorBuilder* machine, SimplifiedOperatorBuilder* simplified)
14 : StructuredGraphBuilder(graph, common),
15 machine_(machine),
16 simplified_(simplified) {}
17
18
19 void SimplifiedGraphBuilder::Begin() {
20 ASSERT(graph()->start() == NULL);
21 Node* start = graph()->NewNode(common()->Start());
22 graph()->SetStart(start);
23 set_environment(new (zone()) Environment(this, start));
24 }
25
26
27 void SimplifiedGraphBuilder::Return(Node* value) {
28 Node* control = NewNode(common()->Return(), value);
29 UpdateControlDependencyToLeaveFunction(control);
30 }
31
32
33 void SimplifiedGraphBuilder::End() {
34 environment()->UpdateControlDependency(exit_control());
35 graph()->SetEnd(NewNode(common()->End()));
36 }
37
38
39 SimplifiedGraphBuilder::Environment::Environment(
40 SimplifiedGraphBuilder* builder, Node* control_dependency)
41 : StructuredGraphBuilder::Environment(builder, control_dependency) {}
42
43
44 Node* SimplifiedGraphBuilder::Environment::Top() {
45 ASSERT(!values()->empty());
46 return values()->back();
47 }
48
49
50 void SimplifiedGraphBuilder::Environment::Push(Node* node) {
51 values()->push_back(node);
52 }
53
54
55 Node* SimplifiedGraphBuilder::Environment::Pop() {
56 ASSERT(!values()->empty());
57 Node* back = values()->back();
58 values()->pop_back();
59 return back;
60 }
61
62
63 void SimplifiedGraphBuilder::Environment::Poke(size_t depth, Node* node) {
64 ASSERT(depth < values()->size());
65 size_t index = values()->size() - depth - 1;
66 values()->at(index) = node;
67 }
68
69
70 Node* SimplifiedGraphBuilder::Environment::Peek(size_t depth) {
71 ASSERT(depth < values()->size());
72 size_t index = values()->size() - depth - 1;
73 return values()->at(index);
74 }
75
76 } // namespace compiler
77 } // namespace internal
78 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/compiler/simplified-graph-builder.h ('k') | test/cctest/compiler/test-branch-combine.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698