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

Side by Side Diff: test/cctest/compiler/simplified-graph-builder.h

Issue 539903002: Move StructuredMachineAssembler into cctest suite. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add a TODO. Created 6 years, 3 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
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 #ifndef V8_CCTEST_COMPILER_SIMPLIFIED_GRAPH_BUILDER_H_ 5 #ifndef V8_CCTEST_COMPILER_SIMPLIFIED_GRAPH_BUILDER_H_
6 #define V8_CCTEST_COMPILER_SIMPLIFIED_GRAPH_BUILDER_H_ 6 #define V8_CCTEST_COMPILER_SIMPLIFIED_GRAPH_BUILDER_H_
7 7
8 #include "src/compiler/common-operator.h" 8 #include "src/compiler/common-operator.h"
9 #include "src/compiler/graph-builder.h" 9 #include "src/compiler/graph-builder.h"
10 #include "src/compiler/machine-node-factory.h" 10 #include "src/compiler/machine-node-factory.h"
11 #include "src/compiler/machine-operator.h" 11 #include "src/compiler/machine-operator.h"
12 #include "src/compiler/simplified-node-factory.h"
13 #include "src/compiler/simplified-operator.h" 12 #include "src/compiler/simplified-operator.h"
14 #include "test/cctest/cctest.h" 13 #include "test/cctest/cctest.h"
15 #include "test/cctest/compiler/call-tester.h" 14 #include "test/cctest/compiler/call-tester.h"
16 15
17 namespace v8 { 16 namespace v8 {
18 namespace internal { 17 namespace internal {
19 namespace compiler { 18 namespace compiler {
20 19
21 class SimplifiedGraphBuilder 20 class SimplifiedGraphBuilder
22 : public StructuredGraphBuilder, 21 : public GraphBuilder,
23 public MachineNodeFactory<SimplifiedGraphBuilder>, 22 public MachineNodeFactory<SimplifiedGraphBuilder> {
24 public SimplifiedNodeFactory<SimplifiedGraphBuilder> {
25 public: 23 public:
26 SimplifiedGraphBuilder(Graph* graph, CommonOperatorBuilder* common, 24 SimplifiedGraphBuilder(Graph* graph, CommonOperatorBuilder* common,
27 MachineOperatorBuilder* machine, 25 MachineOperatorBuilder* machine,
28 SimplifiedOperatorBuilder* simplified); 26 SimplifiedOperatorBuilder* simplified);
29 virtual ~SimplifiedGraphBuilder() {} 27 virtual ~SimplifiedGraphBuilder() {}
30 28
31 class Environment : public StructuredGraphBuilder::Environment { 29 Zone* zone() const { return graph()->zone(); }
32 public:
33 Environment(SimplifiedGraphBuilder* builder, Node* control_dependency);
34
35 // TODO(dcarney): encode somehow and merge into StructuredGraphBuilder.
36 // SSA renaming operations.
37 Node* Top();
38 void Push(Node* node);
39 Node* Pop();
40 void Poke(size_t depth, Node* node);
41 Node* Peek(size_t depth);
42 };
43
44 Isolate* isolate() const { return zone()->isolate(); } 30 Isolate* isolate() const { return zone()->isolate(); }
45 Zone* zone() const { return StructuredGraphBuilder::zone(); } 31 CommonOperatorBuilder* common() const { return common_; }
46 CommonOperatorBuilder* common() const {
47 return StructuredGraphBuilder::common();
48 }
49 MachineOperatorBuilder* machine() const { return machine_; } 32 MachineOperatorBuilder* machine() const { return machine_; }
50 SimplifiedOperatorBuilder* simplified() const { return simplified_; } 33 SimplifiedOperatorBuilder* simplified() const { return simplified_; }
51 Environment* environment() {
52 return reinterpret_cast<Environment*>(
53 StructuredGraphBuilder::environment());
54 }
55 34
56 // Initialize graph and builder. 35 // Initialize graph and builder.
57 void Begin(int num_parameters); 36 void Begin(int num_parameters);
58 37
59 void Return(Node* value); 38 void Return(Node* value);
60 39
61 // Close the graph. 40 // Close the graph.
62 void End(); 41 void End();
63 42
43 Node* BooleanNot(Node* a) { return NewNode(simplified()->BooleanNot(), a); }
44
45 Node* NumberEqual(Node* a, Node* b) {
46 return NewNode(simplified()->NumberEqual(), a, b);
47 }
48 Node* NumberLessThan(Node* a, Node* b) {
49 return NewNode(simplified()->NumberLessThan(), a, b);
50 }
51 Node* NumberLessThanOrEqual(Node* a, Node* b) {
52 return NewNode(simplified()->NumberLessThanOrEqual(), a, b);
53 }
54 Node* NumberAdd(Node* a, Node* b) {
55 return NewNode(simplified()->NumberAdd(), a, b);
56 }
57 Node* NumberSubtract(Node* a, Node* b) {
58 return NewNode(simplified()->NumberSubtract(), a, b);
59 }
60 Node* NumberMultiply(Node* a, Node* b) {
61 return NewNode(simplified()->NumberMultiply(), a, b);
62 }
63 Node* NumberDivide(Node* a, Node* b) {
64 return NewNode(simplified()->NumberDivide(), a, b);
65 }
66 Node* NumberModulus(Node* a, Node* b) {
67 return NewNode(simplified()->NumberModulus(), a, b);
68 }
69 Node* NumberToInt32(Node* a) {
70 return NewNode(simplified()->NumberToInt32(), a);
71 }
72 Node* NumberToUint32(Node* a) {
73 return NewNode(simplified()->NumberToUint32(), a);
74 }
75
76 Node* StringEqual(Node* a, Node* b) {
77 return NewNode(simplified()->StringEqual(), a, b);
78 }
79 Node* StringLessThan(Node* a, Node* b) {
80 return NewNode(simplified()->StringLessThan(), a, b);
81 }
82 Node* StringLessThanOrEqual(Node* a, Node* b) {
83 return NewNode(simplified()->StringLessThanOrEqual(), a, b);
84 }
85 Node* StringAdd(Node* a, Node* b) {
86 return NewNode(simplified()->StringAdd(), a, b);
87 }
88
89 Node* ChangeTaggedToInt32(Node* a) {
90 return NewNode(simplified()->ChangeTaggedToInt32(), a);
91 }
92 Node* ChangeTaggedToUint32(Node* a) {
93 return NewNode(simplified()->ChangeTaggedToUint32(), a);
94 }
95 Node* ChangeTaggedToFloat64(Node* a) {
96 return NewNode(simplified()->ChangeTaggedToFloat64(), a);
97 }
98 Node* ChangeInt32ToTagged(Node* a) {
99 return NewNode(simplified()->ChangeInt32ToTagged(), a);
100 }
101 Node* ChangeUint32ToTagged(Node* a) {
102 return NewNode(simplified()->ChangeUint32ToTagged(), a);
103 }
104 Node* ChangeFloat64ToTagged(Node* a) {
105 return NewNode(simplified()->ChangeFloat64ToTagged(), a);
106 }
107 Node* ChangeBoolToBit(Node* a) {
108 return NewNode(simplified()->ChangeBoolToBit(), a);
109 }
110 Node* ChangeBitToBool(Node* a) {
111 return NewNode(simplified()->ChangeBitToBool(), a);
112 }
113
114 Node* LoadField(const FieldAccess& access, Node* object) {
115 return NewNode(simplified()->LoadField(access), object);
116 }
117 Node* StoreField(const FieldAccess& access, Node* object, Node* value) {
118 return NewNode(simplified()->StoreField(access), object, value);
119 }
120 Node* LoadElement(const ElementAccess& access, Node* object, Node* index) {
121 return NewNode(simplified()->LoadElement(access), object, index);
122 }
123 Node* StoreElement(const ElementAccess& access, Node* object, Node* index,
124 Node* value) {
125 return NewNode(simplified()->StoreElement(access), object, index, value);
126 }
127
128 protected:
129 virtual Node* MakeNode(Operator* op, int value_input_count,
130 Node** value_inputs);
131
64 private: 132 private:
133 Node* effect_;
134 Node* return_;
135 CommonOperatorBuilder* common_;
65 MachineOperatorBuilder* machine_; 136 MachineOperatorBuilder* machine_;
66 SimplifiedOperatorBuilder* simplified_; 137 SimplifiedOperatorBuilder* simplified_;
67 }; 138 };
68 139
69 } // namespace compiler 140 } // namespace compiler
70 } // namespace internal 141 } // namespace internal
71 } // namespace v8 142 } // namespace v8
72 143
73 #endif // V8_CCTEST_COMPILER_SIMPLIFIED_GRAPH_BUILDER_H_ 144 #endif // V8_CCTEST_COMPILER_SIMPLIFIED_GRAPH_BUILDER_H_
OLDNEW
« no previous file with comments | « test/cctest/compiler/graph-builder-tester.h ('k') | test/cctest/compiler/simplified-graph-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698