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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 } | 97 } |
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 = hash_map_.LookupOrInsert(&key, hash); |
108 hash_map_.LookupOrInsert(&key, hash, ZoneAllocationPolicy(zone())); | |
109 DCHECK_NOT_NULL(lookup); | 108 DCHECK_NOT_NULL(lookup); |
110 Node* node; | 109 Node* node; |
111 if (lookup->value == nullptr) { | 110 if (lookup->value == nullptr) { |
112 int input_count = static_cast<int>(count); | 111 int input_count = static_cast<int>(count); |
113 node = graph()->NewNode(common()->StateValues(input_count), input_count, | 112 node = graph()->NewNode(common()->StateValues(input_count), input_count, |
114 nodes); | 113 nodes); |
115 NodeKey* new_key = new (zone()->New(sizeof(NodeKey))) NodeKey(node); | 114 NodeKey* new_key = new (zone()->New(sizeof(NodeKey))) NodeKey(node); |
116 lookup->key = new_key; | 115 lookup->key = new_key; |
117 lookup->value = node; | 116 lookup->value = node; |
118 } else { | 117 } else { |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 } else { | 307 } else { |
309 count++; | 308 count++; |
310 } | 309 } |
311 } | 310 } |
312 return count; | 311 return count; |
313 } | 312 } |
314 | 313 |
315 } // namespace compiler | 314 } // namespace compiler |
316 } // namespace internal | 315 } // namespace internal |
317 } // namespace v8 | 316 } // namespace v8 |
OLD | NEW |