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/node-properties.h" | 12 #include "src/compiler/node-properties.h" |
13 | 13 |
14 namespace v8 { | 14 namespace v8 { |
15 namespace internal { | 15 namespace internal { |
16 namespace compiler { | 16 namespace compiler { |
17 | 17 |
18 class Typer; | 18 class Typer; |
19 | 19 |
20 // Implements a facade on a Graph, enhancing the graph with JS-specific | 20 // Implements a facade on a Graph, enhancing the graph with JS-specific |
21 // notions, including a builder for for JS* operators, canonicalized global | 21 // notions, including a builder for for JS* operators, canonicalized global |
22 // constants, and various helper methods. | 22 // constants, and various helper methods. |
23 class JSGraph : public ZoneObject { | 23 class JSGraph : public ZoneObject { |
24 public: | 24 public: |
25 JSGraph(Graph* graph, CommonOperatorBuilder* common, Typer* typer) | 25 JSGraph(Graph* graph, CommonOperatorBuilder* common) |
26 : graph_(graph), | 26 : graph_(graph), |
27 common_(common), | 27 common_(common), |
28 javascript_(zone()), | 28 javascript_(zone()), |
29 typer_(typer), | |
30 cache_(zone()) {} | 29 cache_(zone()) {} |
31 | 30 |
32 // Canonicalized global constants. | 31 // Canonicalized global constants. |
33 Node* CEntryStubConstant(); | 32 Node* CEntryStubConstant(); |
34 Node* UndefinedConstant(); | 33 Node* UndefinedConstant(); |
35 Node* TheHoleConstant(); | 34 Node* TheHoleConstant(); |
36 Node* TrueConstant(); | 35 Node* TrueConstant(); |
37 Node* FalseConstant(); | 36 Node* FalseConstant(); |
38 Node* NullConstant(); | 37 Node* NullConstant(); |
39 Node* ZeroConstant(); | 38 Node* ZeroConstant(); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 JSOperatorBuilder* javascript() { return &javascript_; } | 75 JSOperatorBuilder* javascript() { return &javascript_; } |
77 CommonOperatorBuilder* common() { return common_; } | 76 CommonOperatorBuilder* common() { return common_; } |
78 Graph* graph() { return graph_; } | 77 Graph* graph() { return graph_; } |
79 Zone* zone() { return graph()->zone(); } | 78 Zone* zone() { return graph()->zone(); } |
80 Isolate* isolate() { return zone()->isolate(); } | 79 Isolate* isolate() { return zone()->isolate(); } |
81 | 80 |
82 private: | 81 private: |
83 Graph* graph_; | 82 Graph* graph_; |
84 CommonOperatorBuilder* common_; | 83 CommonOperatorBuilder* common_; |
85 JSOperatorBuilder javascript_; | 84 JSOperatorBuilder javascript_; |
86 Typer* typer_; | |
87 | 85 |
88 SetOncePointer<Node> c_entry_stub_constant_; | 86 SetOncePointer<Node> c_entry_stub_constant_; |
89 SetOncePointer<Node> undefined_constant_; | 87 SetOncePointer<Node> undefined_constant_; |
90 SetOncePointer<Node> the_hole_constant_; | 88 SetOncePointer<Node> the_hole_constant_; |
91 SetOncePointer<Node> true_constant_; | 89 SetOncePointer<Node> true_constant_; |
92 SetOncePointer<Node> false_constant_; | 90 SetOncePointer<Node> false_constant_; |
93 SetOncePointer<Node> null_constant_; | 91 SetOncePointer<Node> null_constant_; |
94 SetOncePointer<Node> zero_constant_; | 92 SetOncePointer<Node> zero_constant_; |
95 SetOncePointer<Node> one_constant_; | 93 SetOncePointer<Node> one_constant_; |
96 SetOncePointer<Node> nan_constant_; | 94 SetOncePointer<Node> nan_constant_; |
97 | 95 |
98 CommonNodeCache cache_; | 96 CommonNodeCache cache_; |
99 | 97 |
100 Node* ImmovableHeapConstant(Handle<Object> value); | 98 Node* ImmovableHeapConstant(Handle<Object> value); |
101 Node* NumberConstant(double value); | 99 Node* NumberConstant(double value); |
102 Node* NewNode(Operator* op); | 100 |
| 101 inline Node* CacheNode(SetOncePointer<Node>* cache, Node*); |
| 102 inline Node* CachedNode(SetOncePointer<Node>* cache); |
103 | 103 |
104 Factory* factory() { return isolate()->factory(); } | 104 Factory* factory() { return isolate()->factory(); } |
105 }; | 105 }; |
106 } // namespace compiler | 106 } // namespace compiler |
107 } // namespace internal | 107 } // namespace internal |
108 } // namespace v8 | 108 } // namespace v8 |
109 | 109 |
110 #endif | 110 #endif |
OLD | NEW |