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/node-properties.h" | 13 #include "src/compiler/node-properties.h" |
13 | 14 |
14 namespace v8 { | 15 namespace v8 { |
15 namespace internal { | 16 namespace internal { |
16 namespace compiler { | 17 namespace compiler { |
17 | 18 |
18 class Typer; | 19 class Typer; |
19 | 20 |
20 // 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 |
21 // notions, including a builder for for JS* operators, canonicalized global | 22 // notions, including a builder for for JS* operators, canonicalized global |
22 // constants, and various helper methods. | 23 // constants, and various helper methods. |
23 class JSGraph : public ZoneObject { | 24 class JSGraph : public ZoneObject { |
24 public: | 25 public: |
25 JSGraph(Graph* graph, CommonOperatorBuilder* common, Typer* typer) | 26 JSGraph(Graph* graph, CommonOperatorBuilder* common, |
| 27 JSOperatorBuilder* javascript, Typer* typer, |
| 28 MachineOperatorBuilder* machine) |
26 : graph_(graph), | 29 : graph_(graph), |
27 common_(common), | 30 common_(common), |
28 javascript_(zone()), | 31 javascript_(javascript), |
29 typer_(typer), | 32 typer_(typer), |
| 33 machine_(machine), |
30 cache_(zone()) {} | 34 cache_(zone()) {} |
31 | 35 |
32 // Canonicalized global constants. | 36 // Canonicalized global constants. |
33 Node* CEntryStubConstant(); | 37 Node* CEntryStubConstant(); |
34 Node* UndefinedConstant(); | 38 Node* UndefinedConstant(); |
35 Node* TheHoleConstant(); | 39 Node* TheHoleConstant(); |
36 Node* TrueConstant(); | 40 Node* TrueConstant(); |
37 Node* FalseConstant(); | 41 Node* FalseConstant(); |
38 Node* NullConstant(); | 42 Node* NullConstant(); |
39 Node* ZeroConstant(); | 43 Node* ZeroConstant(); |
(...skipping 26 matching lines...) Expand all Loading... |
66 Node* Float64Constant(double value); | 70 Node* Float64Constant(double value); |
67 | 71 |
68 // Creates an ExternalConstant node, usually canonicalized. | 72 // Creates an ExternalConstant node, usually canonicalized. |
69 Node* ExternalConstant(ExternalReference ref); | 73 Node* ExternalConstant(ExternalReference ref); |
70 | 74 |
71 Node* SmiConstant(int32_t immediate) { | 75 Node* SmiConstant(int32_t immediate) { |
72 DCHECK(Smi::IsValid(immediate)); | 76 DCHECK(Smi::IsValid(immediate)); |
73 return Constant(immediate); | 77 return Constant(immediate); |
74 } | 78 } |
75 | 79 |
76 JSOperatorBuilder* javascript() { return &javascript_; } | 80 JSOperatorBuilder* javascript() { return javascript_; } |
77 CommonOperatorBuilder* common() { return common_; } | 81 CommonOperatorBuilder* common() { return common_; } |
| 82 MachineOperatorBuilder* machine() { return machine_; } |
78 Graph* graph() { return graph_; } | 83 Graph* graph() { return graph_; } |
79 Zone* zone() { return graph()->zone(); } | 84 Zone* zone() { return graph()->zone(); } |
80 Isolate* isolate() { return zone()->isolate(); } | 85 Isolate* isolate() { return zone()->isolate(); } |
81 | 86 |
82 private: | 87 private: |
83 Graph* graph_; | 88 Graph* graph_; |
84 CommonOperatorBuilder* common_; | 89 CommonOperatorBuilder* common_; |
85 JSOperatorBuilder javascript_; | 90 JSOperatorBuilder* javascript_; |
86 Typer* typer_; | 91 Typer* typer_; |
| 92 MachineOperatorBuilder* machine_; |
87 | 93 |
88 SetOncePointer<Node> c_entry_stub_constant_; | 94 SetOncePointer<Node> c_entry_stub_constant_; |
89 SetOncePointer<Node> undefined_constant_; | 95 SetOncePointer<Node> undefined_constant_; |
90 SetOncePointer<Node> the_hole_constant_; | 96 SetOncePointer<Node> the_hole_constant_; |
91 SetOncePointer<Node> true_constant_; | 97 SetOncePointer<Node> true_constant_; |
92 SetOncePointer<Node> false_constant_; | 98 SetOncePointer<Node> false_constant_; |
93 SetOncePointer<Node> null_constant_; | 99 SetOncePointer<Node> null_constant_; |
94 SetOncePointer<Node> zero_constant_; | 100 SetOncePointer<Node> zero_constant_; |
95 SetOncePointer<Node> one_constant_; | 101 SetOncePointer<Node> one_constant_; |
96 SetOncePointer<Node> nan_constant_; | 102 SetOncePointer<Node> nan_constant_; |
97 | 103 |
98 CommonNodeCache cache_; | 104 CommonNodeCache cache_; |
99 | 105 |
100 Node* ImmovableHeapConstant(Handle<Object> value); | 106 Node* ImmovableHeapConstant(Handle<Object> value); |
101 Node* NumberConstant(double value); | 107 Node* NumberConstant(double value); |
102 Node* NewNode(const Operator* op); | 108 Node* NewNode(const Operator* op); |
103 | 109 |
104 Factory* factory() { return isolate()->factory(); } | 110 Factory* factory() { return isolate()->factory(); } |
105 }; | 111 }; |
106 } // namespace compiler | 112 } // namespace compiler |
107 } // namespace internal | 113 } // namespace internal |
108 } // namespace v8 | 114 } // namespace v8 |
109 | 115 |
110 #endif | 116 #endif |
OLD | NEW |