OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 #include "src/compiler/state-values-utils.h" | 5 #include "src/compiler/state-values-utils.h" |
6 | 6 |
7 namespace v8 { | 7 namespace v8 { |
8 namespace internal { | 8 namespace internal { |
9 namespace compiler { | 9 namespace compiler { |
10 | 10 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 return static_cast<int>(hash & 0x7fffffff); | 98 return static_cast<int>(hash & 0x7fffffff); |
99 } | 99 } |
100 | 100 |
101 } // namespace | 101 } // namespace |
102 | 102 |
103 | 103 |
104 Node* StateValuesCache::GetValuesNodeFromCache(Node** nodes, size_t count) { | 104 Node* StateValuesCache::GetValuesNodeFromCache(Node** nodes, size_t count) { |
105 StateValuesKey key(count, nodes); | 105 StateValuesKey key(count, nodes); |
106 int hash = StateValuesHashKey(nodes, count); | 106 int hash = StateValuesHashKey(nodes, count); |
107 ZoneHashMap::Entry* lookup = | 107 ZoneHashMap::Entry* lookup = |
108 hash_map_.Lookup(&key, hash, true, ZoneAllocationPolicy(zone())); | 108 hash_map_.LookupOrInsert(&key, hash, ZoneAllocationPolicy(zone())); |
109 DCHECK_NOT_NULL(lookup); | 109 DCHECK_NOT_NULL(lookup); |
110 Node* node; | 110 Node* node; |
111 if (lookup->value == nullptr) { | 111 if (lookup->value == nullptr) { |
112 int input_count = static_cast<int>(count); | 112 int input_count = static_cast<int>(count); |
113 node = graph()->NewNode(common()->StateValues(input_count), input_count, | 113 node = graph()->NewNode(common()->StateValues(input_count), input_count, |
114 nodes); | 114 nodes); |
115 NodeKey* new_key = new (zone()->New(sizeof(NodeKey))) NodeKey(node); | 115 NodeKey* new_key = new (zone()->New(sizeof(NodeKey))) NodeKey(node); |
116 lookup->key = new_key; | 116 lookup->key = new_key; |
117 lookup->value = node; | 117 lookup->value = node; |
118 } else { | 118 } else { |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 } else { | 308 } else { |
309 count++; | 309 count++; |
310 } | 310 } |
311 } | 311 } |
312 return count; | 312 return count; |
313 } | 313 } |
314 | 314 |
315 } // namespace compiler | 315 } // namespace compiler |
316 } // namespace internal | 316 } // namespace internal |
317 } // namespace v8 | 317 } // namespace v8 |
OLD | NEW |