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

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

Issue 1248743003: [turbofan] Get rid of overly abstract SimplifiedGraphBuilder. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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 unified diff | Download patch
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 #ifndef V8_CCTEST_COMPILER_SIMPLIFIED_GRAPH_BUILDER_H_
6 #define V8_CCTEST_COMPILER_SIMPLIFIED_GRAPH_BUILDER_H_
7
8 #include "src/compiler/common-operator.h"
9 #include "src/compiler/graph-builder.h"
10 #include "src/compiler/machine-operator.h"
11 #include "src/compiler/simplified-operator.h"
12 #include "test/cctest/cctest.h"
13 #include "test/cctest/compiler/call-tester.h"
14
15 namespace v8 {
16 namespace internal {
17 namespace compiler {
18
19 class SimplifiedGraphBuilder : public GraphBuilder {
20 public:
21 SimplifiedGraphBuilder(Isolate* isolate, Graph* graph,
22 CommonOperatorBuilder* common,
23 MachineOperatorBuilder* machine,
24 SimplifiedOperatorBuilder* simplified);
25 virtual ~SimplifiedGraphBuilder() {}
26
27 Zone* zone() const { return graph()->zone(); }
28 CommonOperatorBuilder* common() const { return common_; }
29 MachineOperatorBuilder* machine() const { return machine_; }
30 SimplifiedOperatorBuilder* simplified() const { return simplified_; }
31
32 // Initialize graph and builder.
33 void Begin(int num_parameters);
34
35 void Return(Node* value);
36
37 // Close the graph.
38 void End();
39
40 Node* PointerConstant(void* value) {
41 intptr_t intptr_value = reinterpret_cast<intptr_t>(value);
42 return kPointerSize == 8 ? NewNode(common()->Int64Constant(intptr_value))
43 : Int32Constant(static_cast<int>(intptr_value));
44 }
45 Node* Int32Constant(int32_t value) {
46 return NewNode(common()->Int32Constant(value));
47 }
48 Node* HeapConstant(Handle<HeapObject> object) {
49 Unique<HeapObject> val = Unique<HeapObject>::CreateUninitialized(object);
50 return NewNode(common()->HeapConstant(val));
51 }
52
53 Node* BooleanNot(Node* a) { return NewNode(simplified()->BooleanNot(), a); }
54
55 Node* NumberEqual(Node* a, Node* b) {
56 return NewNode(simplified()->NumberEqual(), a, b);
57 }
58 Node* NumberLessThan(Node* a, Node* b) {
59 return NewNode(simplified()->NumberLessThan(), a, b);
60 }
61 Node* NumberLessThanOrEqual(Node* a, Node* b) {
62 return NewNode(simplified()->NumberLessThanOrEqual(), a, b);
63 }
64 Node* NumberAdd(Node* a, Node* b) {
65 return NewNode(simplified()->NumberAdd(), a, b);
66 }
67 Node* NumberSubtract(Node* a, Node* b) {
68 return NewNode(simplified()->NumberSubtract(), a, b);
69 }
70 Node* NumberMultiply(Node* a, Node* b) {
71 return NewNode(simplified()->NumberMultiply(), a, b);
72 }
73 Node* NumberDivide(Node* a, Node* b) {
74 return NewNode(simplified()->NumberDivide(), a, b);
75 }
76 Node* NumberModulus(Node* a, Node* b) {
77 return NewNode(simplified()->NumberModulus(), a, b);
78 }
79 Node* NumberToInt32(Node* a) {
80 return NewNode(simplified()->NumberToInt32(), a);
81 }
82 Node* NumberToUint32(Node* a) {
83 return NewNode(simplified()->NumberToUint32(), a);
84 }
85
86 Node* StringEqual(Node* a, Node* b) {
87 return NewNode(simplified()->StringEqual(), a, b);
88 }
89 Node* StringLessThan(Node* a, Node* b) {
90 return NewNode(simplified()->StringLessThan(), a, b);
91 }
92 Node* StringLessThanOrEqual(Node* a, Node* b) {
93 return NewNode(simplified()->StringLessThanOrEqual(), a, b);
94 }
95
96 Node* ChangeTaggedToInt32(Node* a) {
97 return NewNode(simplified()->ChangeTaggedToInt32(), a);
98 }
99 Node* ChangeTaggedToUint32(Node* a) {
100 return NewNode(simplified()->ChangeTaggedToUint32(), a);
101 }
102 Node* ChangeTaggedToFloat64(Node* a) {
103 return NewNode(simplified()->ChangeTaggedToFloat64(), a);
104 }
105 Node* ChangeInt32ToTagged(Node* a) {
106 return NewNode(simplified()->ChangeInt32ToTagged(), a);
107 }
108 Node* ChangeUint32ToTagged(Node* a) {
109 return NewNode(simplified()->ChangeUint32ToTagged(), a);
110 }
111 Node* ChangeFloat64ToTagged(Node* a) {
112 return NewNode(simplified()->ChangeFloat64ToTagged(), a);
113 }
114 Node* ChangeBoolToBit(Node* a) {
115 return NewNode(simplified()->ChangeBoolToBit(), a);
116 }
117 Node* ChangeBitToBool(Node* a) {
118 return NewNode(simplified()->ChangeBitToBool(), a);
119 }
120
121 Node* LoadField(const FieldAccess& access, Node* object) {
122 return NewNode(simplified()->LoadField(access), object);
123 }
124 Node* StoreField(const FieldAccess& access, Node* object, Node* value) {
125 return NewNode(simplified()->StoreField(access), object, value);
126 }
127 Node* LoadElement(const ElementAccess& access, Node* object, Node* index) {
128 return NewNode(simplified()->LoadElement(access), object, index);
129 }
130 Node* StoreElement(const ElementAccess& access, Node* object, Node* index,
131 Node* value) {
132 return NewNode(simplified()->StoreElement(access), object, index, value);
133 }
134
135 protected:
136 virtual Node* MakeNode(const Operator* op, int value_input_count,
137 Node** value_inputs, bool incomplete) final;
138
139 private:
140 Node* effect_;
141 Node* return_;
142 CommonOperatorBuilder* common_;
143 MachineOperatorBuilder* machine_;
144 SimplifiedOperatorBuilder* simplified_;
145 };
146
147 } // namespace compiler
148 } // namespace internal
149 } // namespace v8
150
151 #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