OLD | NEW |
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_COMPILER_JS_GRAPH_H_ | 5 #ifndef V8_COMPILER_JS_GRAPH_H_ |
6 #define V8_COMPILER_JS_GRAPH_H_ | 6 #define V8_COMPILER_JS_GRAPH_H_ |
7 | 7 |
8 #include "src/compiler/common-node-cache.h" | 8 #include "src/compiler/common-node-cache.h" |
9 #include "src/compiler/common-operator.h" | 9 #include "src/compiler/common-operator.h" |
10 #include "src/compiler/graph.h" | 10 #include "src/compiler/graph.h" |
11 #include "src/compiler/js-operator.h" | 11 #include "src/compiler/js-operator.h" |
12 #include "src/compiler/machine-operator.h" | 12 #include "src/compiler/machine-operator.h" |
13 #include "src/compiler/node-properties.h" | 13 #include "src/compiler/node-properties.h" |
14 | 14 |
15 namespace v8 { | 15 namespace v8 { |
16 namespace internal { | 16 namespace internal { |
17 namespace compiler { | 17 namespace compiler { |
18 | 18 |
19 // Forward declarations. | |
20 class Typer; | 19 class Typer; |
21 | 20 |
22 // Implements a facade on a Graph, enhancing the graph with JS-specific | 21 // Implements a facade on a Graph, enhancing the graph with JS-specific |
23 // notions, including a builder for for JS* operators, canonicalized global | 22 // notions, including a builder for for JS* operators, canonicalized global |
24 // constants, and various helper methods. | 23 // constants, and various helper methods. |
25 class JSGraph : public ZoneObject { | 24 class JSGraph : public ZoneObject { |
26 public: | 25 public: |
27 JSGraph(Graph* graph, CommonOperatorBuilder* common, | 26 JSGraph(Graph* graph, CommonOperatorBuilder* common, |
28 JSOperatorBuilder* javascript, MachineOperatorBuilder* machine) | 27 JSOperatorBuilder* javascript, MachineOperatorBuilder* machine) |
29 : graph_(graph), | 28 : graph_(graph), |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 102 |
104 Node* SmiConstant(int32_t immediate) { | 103 Node* SmiConstant(int32_t immediate) { |
105 DCHECK(Smi::IsValid(immediate)); | 104 DCHECK(Smi::IsValid(immediate)); |
106 return Constant(immediate); | 105 return Constant(immediate); |
107 } | 106 } |
108 | 107 |
109 // Creates a dummy Constant node, used to satisfy calling conventions of | 108 // Creates a dummy Constant node, used to satisfy calling conventions of |
110 // stubs and runtime functions that do not require a context. | 109 // stubs and runtime functions that do not require a context. |
111 Node* NoContextConstant() { return ZeroConstant(); } | 110 Node* NoContextConstant() { return ZeroConstant(); } |
112 | 111 |
113 // Cached common types. | |
114 Type* ZeroOneRangeType(); | |
115 | |
116 JSOperatorBuilder* javascript() { return javascript_; } | 112 JSOperatorBuilder* javascript() { return javascript_; } |
117 CommonOperatorBuilder* common() { return common_; } | 113 CommonOperatorBuilder* common() { return common_; } |
118 MachineOperatorBuilder* machine() { return machine_; } | 114 MachineOperatorBuilder* machine() { return machine_; } |
119 Graph* graph() { return graph_; } | 115 Graph* graph() { return graph_; } |
120 Zone* zone() { return graph()->zone(); } | 116 Zone* zone() { return graph()->zone(); } |
121 Isolate* isolate() { return zone()->isolate(); } | 117 Isolate* isolate() { return zone()->isolate(); } |
122 Factory* factory() { return isolate()->factory(); } | 118 Factory* factory() { return isolate()->factory(); } |
123 | 119 |
124 void GetCachedNodes(NodeVector* nodes); | 120 void GetCachedNodes(NodeVector* nodes); |
125 | 121 |
126 private: | 122 private: |
127 Graph* graph_; | 123 Graph* graph_; |
128 CommonOperatorBuilder* common_; | 124 CommonOperatorBuilder* common_; |
129 JSOperatorBuilder* javascript_; | 125 JSOperatorBuilder* javascript_; |
130 MachineOperatorBuilder* machine_; | 126 MachineOperatorBuilder* machine_; |
131 | 127 |
132 // TODO(titzer): make this into a simple array. | 128 // TODO(titzer): make this into a simple array. |
133 SetOncePointer<Node> c_entry_stub_constant_; | 129 SetOncePointer<Node> c_entry_stub_constant_; |
134 SetOncePointer<Node> undefined_constant_; | 130 SetOncePointer<Node> undefined_constant_; |
135 SetOncePointer<Node> the_hole_constant_; | 131 SetOncePointer<Node> the_hole_constant_; |
136 SetOncePointer<Node> true_constant_; | 132 SetOncePointer<Node> true_constant_; |
137 SetOncePointer<Node> false_constant_; | 133 SetOncePointer<Node> false_constant_; |
138 SetOncePointer<Node> null_constant_; | 134 SetOncePointer<Node> null_constant_; |
139 SetOncePointer<Node> zero_constant_; | 135 SetOncePointer<Node> zero_constant_; |
140 SetOncePointer<Node> one_constant_; | 136 SetOncePointer<Node> one_constant_; |
141 SetOncePointer<Node> nan_constant_; | 137 SetOncePointer<Node> nan_constant_; |
142 | 138 |
143 SetOncePointer<Type> zero_one_range_type_; | |
144 | |
145 CommonNodeCache cache_; | 139 CommonNodeCache cache_; |
146 | 140 |
147 Node* ImmovableHeapConstant(Handle<HeapObject> value); | 141 Node* ImmovableHeapConstant(Handle<HeapObject> value); |
148 Node* NumberConstant(double value); | 142 Node* NumberConstant(double value); |
149 | 143 |
150 DISALLOW_COPY_AND_ASSIGN(JSGraph); | 144 DISALLOW_COPY_AND_ASSIGN(JSGraph); |
151 }; | 145 }; |
152 | 146 |
153 } // namespace compiler | 147 } // namespace compiler |
154 } // namespace internal | 148 } // namespace internal |
155 } // namespace v8 | 149 } // namespace v8 |
156 | 150 |
157 #endif | 151 #endif |
OLD | NEW |