Chromium Code Reviews| 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" |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 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(Isolate* isolate, Graph* graph, CommonOperatorBuilder* common, | 26 JSGraph(Isolate* isolate, Graph* graph, CommonOperatorBuilder* common, |
| 27 JSOperatorBuilder* javascript, MachineOperatorBuilder* machine) | 27 JSOperatorBuilder* javascript, MachineOperatorBuilder* machine) |
| 28 : isolate_(isolate), | 28 : isolate_(isolate), |
| 29 graph_(graph), | 29 graph_(graph), |
| 30 common_(common), | 30 common_(common), |
| 31 javascript_(javascript), | 31 javascript_(javascript), |
| 32 machine_(machine), | 32 machine_(machine), |
| 33 cache_(zone()) {} | 33 cache_(zone()) { |
| 34 for (size_t i = 0; i < kNumCachedNodes; i++) cached_nodes_[i] = nullptr; | |
|
Sven Panne
2015/04/14 06:14:41
Even shorter, more readable and having better chan
| |
| 35 } | |
| 34 | 36 |
| 35 // Canonicalized global constants. | 37 // Canonicalized global constants. |
| 36 Node* CEntryStubConstant(int result_size); | 38 Node* CEntryStubConstant(int result_size); |
| 37 Node* UndefinedConstant(); | 39 Node* UndefinedConstant(); |
| 38 Node* TheHoleConstant(); | 40 Node* TheHoleConstant(); |
| 39 Node* TrueConstant(); | 41 Node* TrueConstant(); |
| 40 Node* FalseConstant(); | 42 Node* FalseConstant(); |
| 41 Node* NullConstant(); | 43 Node* NullConstant(); |
| 42 Node* ZeroConstant(); | 44 Node* ZeroConstant(); |
| 43 Node* OneConstant(); | 45 Node* OneConstant(); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 121 CommonOperatorBuilder* common() const { return common_; } | 123 CommonOperatorBuilder* common() const { return common_; } |
| 122 MachineOperatorBuilder* machine() const { return machine_; } | 124 MachineOperatorBuilder* machine() const { return machine_; } |
| 123 Graph* graph() const { return graph_; } | 125 Graph* graph() const { return graph_; } |
| 124 Zone* zone() const { return graph()->zone(); } | 126 Zone* zone() const { return graph()->zone(); } |
| 125 Isolate* isolate() const { return isolate_; } | 127 Isolate* isolate() const { return isolate_; } |
| 126 Factory* factory() const { return isolate()->factory(); } | 128 Factory* factory() const { return isolate()->factory(); } |
| 127 | 129 |
| 128 void GetCachedNodes(NodeVector* nodes); | 130 void GetCachedNodes(NodeVector* nodes); |
| 129 | 131 |
| 130 private: | 132 private: |
| 133 enum CachedNode { | |
| 134 kCEntryStubConstant, | |
| 135 kUndefinedConstant, | |
| 136 kTheHoleConstant, | |
| 137 kTrueConstant, | |
| 138 kFalseConstant, | |
| 139 kNullConstant, | |
| 140 kZeroConstant, | |
| 141 kOneConstant, | |
| 142 kNaNConstant, | |
| 143 kEmptyFrameState, | |
| 144 kDeadControl, | |
| 145 kNumCachedNodes // Must remain last. | |
| 146 }; | |
| 147 | |
| 131 Isolate* isolate_; | 148 Isolate* isolate_; |
| 132 Graph* graph_; | 149 Graph* graph_; |
| 133 CommonOperatorBuilder* common_; | 150 CommonOperatorBuilder* common_; |
| 134 JSOperatorBuilder* javascript_; | 151 JSOperatorBuilder* javascript_; |
| 135 MachineOperatorBuilder* machine_; | 152 MachineOperatorBuilder* machine_; |
| 136 | |
| 137 // TODO(titzer): make this into a simple array. | |
| 138 SetOncePointer<Node> c_entry_stub_constant_; | |
| 139 SetOncePointer<Node> undefined_constant_; | |
| 140 SetOncePointer<Node> the_hole_constant_; | |
| 141 SetOncePointer<Node> true_constant_; | |
| 142 SetOncePointer<Node> false_constant_; | |
| 143 SetOncePointer<Node> null_constant_; | |
| 144 SetOncePointer<Node> zero_constant_; | |
| 145 SetOncePointer<Node> one_constant_; | |
| 146 SetOncePointer<Node> nan_constant_; | |
| 147 SetOncePointer<Node> empty_frame_state_; | |
| 148 SetOncePointer<Node> dead_control_; | |
| 149 | |
| 150 CommonNodeCache cache_; | 153 CommonNodeCache cache_; |
| 154 Node* cached_nodes_[kNumCachedNodes]; | |
| 151 | 155 |
| 152 Node* ImmovableHeapConstant(Handle<HeapObject> value); | 156 Node* ImmovableHeapConstant(Handle<HeapObject> value); |
| 153 Node* NumberConstant(double value); | 157 Node* NumberConstant(double value); |
| 154 | 158 |
| 155 DISALLOW_COPY_AND_ASSIGN(JSGraph); | 159 DISALLOW_COPY_AND_ASSIGN(JSGraph); |
| 156 }; | 160 }; |
| 157 | 161 |
| 158 } // namespace compiler | 162 } // namespace compiler |
| 159 } // namespace internal | 163 } // namespace internal |
| 160 } // namespace v8 | 164 } // namespace v8 |
| 161 | 165 |
| 162 #endif | 166 #endif |
| OLD | NEW |