Index: src/compiler/js-graph.h |
diff --git a/src/compiler/js-graph.h b/src/compiler/js-graph.h |
index fe9b9f7b7ccdd0aa8e7e436128c64a3ea1d399f5..13dc367d4dd6cab8440fcd0074e6947d430a0644 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 (int i = 0; i < kNumCachedNodes; i++) cached_nodes_[i] = nullptr; |
+ } |
// 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); |