Chromium Code Reviews| Index: src/compiler/js-graph.h |
| diff --git a/src/compiler/js-graph.h b/src/compiler/js-graph.h |
| index fe9b9f7b7ccdd0aa8e7e436128c64a3ea1d399f5..fcdd8f78a4d87a4138afb3ba1dfcf81c167fe4e3 100644 |
| --- a/src/compiler/js-graph.h |
| +++ b/src/compiler/js-graph.h |
| @@ -30,7 +30,9 @@ class JSGraph : public ZoneObject { |
| common_(common), |
| javascript_(javascript), |
| machine_(machine), |
| - cache_(zone()) {} |
| + cache_(zone()) { |
| + 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
|
| + } |
| // Canonicalized global constants. |
| Node* CEntryStubConstant(int result_size); |
| @@ -128,26 +130,28 @@ class JSGraph : public ZoneObject { |
| void GetCachedNodes(NodeVector* nodes); |
| private: |
| + enum CachedNode { |
| + kCEntryStubConstant, |
| + kUndefinedConstant, |
| + kTheHoleConstant, |
| + kTrueConstant, |
| + kFalseConstant, |
| + kNullConstant, |
| + kZeroConstant, |
| + kOneConstant, |
| + kNaNConstant, |
| + kEmptyFrameState, |
| + kDeadControl, |
| + kNumCachedNodes // Must remain last. |
| + }; |
| + |
| Isolate* isolate_; |
| Graph* graph_; |
| CommonOperatorBuilder* common_; |
| JSOperatorBuilder* javascript_; |
| MachineOperatorBuilder* machine_; |
| - |
| - // TODO(titzer): make this into a simple array. |
| - SetOncePointer<Node> c_entry_stub_constant_; |
| - SetOncePointer<Node> undefined_constant_; |
| - SetOncePointer<Node> the_hole_constant_; |
| - SetOncePointer<Node> true_constant_; |
| - SetOncePointer<Node> false_constant_; |
| - SetOncePointer<Node> null_constant_; |
| - SetOncePointer<Node> zero_constant_; |
| - SetOncePointer<Node> one_constant_; |
| - SetOncePointer<Node> nan_constant_; |
| - SetOncePointer<Node> empty_frame_state_; |
| - SetOncePointer<Node> dead_control_; |
| - |
| CommonNodeCache cache_; |
| + Node* cached_nodes_[kNumCachedNodes]; |
| Node* ImmovableHeapConstant(Handle<HeapObject> value); |
| Node* NumberConstant(double value); |