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 class Typer; | 19 class Typer; |
20 | 20 |
21 // 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 |
22 // notions, including a builder for for JS* operators, canonicalized global | 22 // notions, including a builder for for JS* operators, canonicalized global |
23 // constants, and various helper methods. | 23 // constants, and various helper methods. |
24 class JSGraph : public ZoneObject { | 24 class JSGraph : public ZoneObject { |
25 public: | 25 public: |
26 JSGraph(Graph* graph, CommonOperatorBuilder* common, | 26 JSGraph(Isolate* isolate, Graph* graph, CommonOperatorBuilder* common, |
27 JSOperatorBuilder* javascript, MachineOperatorBuilder* machine) | 27 JSOperatorBuilder* javascript, MachineOperatorBuilder* machine) |
28 : graph_(graph), | 28 : isolate_(isolate), |
| 29 graph_(graph), |
29 common_(common), | 30 common_(common), |
30 javascript_(javascript), | 31 javascript_(javascript), |
31 machine_(machine), | 32 machine_(machine), |
32 cache_(zone()) {} | 33 cache_(zone()) {} |
33 | 34 |
34 // Canonicalized global constants. | 35 // Canonicalized global constants. |
35 Node* CEntryStubConstant(int result_size); | 36 Node* CEntryStubConstant(int result_size); |
36 Node* UndefinedConstant(); | 37 Node* UndefinedConstant(); |
37 Node* TheHoleConstant(); | 38 Node* TheHoleConstant(); |
38 Node* TrueConstant(); | 39 Node* TrueConstant(); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 } | 107 } |
107 | 108 |
108 // Creates a dummy Constant node, used to satisfy calling conventions of | 109 // Creates a dummy Constant node, used to satisfy calling conventions of |
109 // stubs and runtime functions that do not require a context. | 110 // stubs and runtime functions that do not require a context. |
110 Node* NoContextConstant() { return ZeroConstant(); } | 111 Node* NoContextConstant() { return ZeroConstant(); } |
111 | 112 |
112 // Creates an empty frame states for cases where we know that a function | 113 // Creates an empty frame states for cases where we know that a function |
113 // cannot deopt. | 114 // cannot deopt. |
114 Node* EmptyFrameState(); | 115 Node* EmptyFrameState(); |
115 | 116 |
116 JSOperatorBuilder* javascript() { return javascript_; } | 117 JSOperatorBuilder* javascript() const { return javascript_; } |
117 CommonOperatorBuilder* common() { return common_; } | 118 CommonOperatorBuilder* common() const { return common_; } |
118 MachineOperatorBuilder* machine() { return machine_; } | 119 MachineOperatorBuilder* machine() const { return machine_; } |
119 Graph* graph() { return graph_; } | 120 Graph* graph() const { return graph_; } |
120 Zone* zone() { return graph()->zone(); } | 121 Zone* zone() const { return graph()->zone(); } |
121 Isolate* isolate() { return zone()->isolate(); } | 122 Isolate* isolate() const { return isolate_; } |
122 Factory* factory() { return isolate()->factory(); } | 123 Factory* factory() const { return isolate()->factory(); } |
123 | 124 |
124 void GetCachedNodes(NodeVector* nodes); | 125 void GetCachedNodes(NodeVector* nodes); |
125 | 126 |
126 private: | 127 private: |
| 128 Isolate* isolate_; |
127 Graph* graph_; | 129 Graph* graph_; |
128 CommonOperatorBuilder* common_; | 130 CommonOperatorBuilder* common_; |
129 JSOperatorBuilder* javascript_; | 131 JSOperatorBuilder* javascript_; |
130 MachineOperatorBuilder* machine_; | 132 MachineOperatorBuilder* machine_; |
131 | 133 |
132 // TODO(titzer): make this into a simple array. | 134 // TODO(titzer): make this into a simple array. |
133 SetOncePointer<Node> c_entry_stub_constant_; | 135 SetOncePointer<Node> c_entry_stub_constant_; |
134 SetOncePointer<Node> undefined_constant_; | 136 SetOncePointer<Node> undefined_constant_; |
135 SetOncePointer<Node> the_hole_constant_; | 137 SetOncePointer<Node> the_hole_constant_; |
136 SetOncePointer<Node> true_constant_; | 138 SetOncePointer<Node> true_constant_; |
(...skipping 10 matching lines...) Expand all Loading... |
147 Node* NumberConstant(double value); | 149 Node* NumberConstant(double value); |
148 | 150 |
149 DISALLOW_COPY_AND_ASSIGN(JSGraph); | 151 DISALLOW_COPY_AND_ASSIGN(JSGraph); |
150 }; | 152 }; |
151 | 153 |
152 } // namespace compiler | 154 } // namespace compiler |
153 } // namespace internal | 155 } // namespace internal |
154 } // namespace v8 | 156 } // namespace v8 |
155 | 157 |
156 #endif | 158 #endif |
OLD | NEW |