| 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 #include "src/compiler/node-cache.h" | 5 #include "src/compiler/node-cache.h" |
| 6 | 6 |
| 7 #include <cstring> | 7 #include <cstring> |
| 8 | 8 |
| 9 #include "src/zone.h" | 9 #include "src/zone.h" |
| 10 #include "src/zone-containers.h" | 10 #include "src/zone-containers.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 Entry* entry = &entries_[hash & (size_ - 1)]; | 87 Entry* entry = &entries_[hash & (size_ - 1)]; |
| 88 entry->key_ = key; | 88 entry->key_ = key; |
| 89 entry->value_ = nullptr; | 89 entry->value_ = nullptr; |
| 90 return &entry->value_; | 90 return &entry->value_; |
| 91 } | 91 } |
| 92 | 92 |
| 93 | 93 |
| 94 template <typename Key, typename Hash, typename Pred> | 94 template <typename Key, typename Hash, typename Pred> |
| 95 void NodeCache<Key, Hash, Pred>::GetCachedNodes(NodeVector* nodes) { | 95 void NodeCache<Key, Hash, Pred>::GetCachedNodes(NodeVector* nodes) { |
| 96 if (entries_) { | 96 if (entries_) { |
| 97 for (size_t i = 0; i < size_; i++) { | 97 for (size_t i = 0; i < size_ + kLinearProbe; i++) { |
| 98 if (entries_[i].value_ != NULL) nodes->push_back(entries_[i].value_); | 98 if (entries_[i].value_ != NULL) nodes->push_back(entries_[i].value_); |
| 99 } | 99 } |
| 100 } | 100 } |
| 101 } | 101 } |
| 102 | 102 |
| 103 template class NodeCache<int64_t>; | 103 template class NodeCache<int64_t>; |
| 104 template class NodeCache<int32_t>; | 104 template class NodeCache<int32_t>; |
| 105 template class NodeCache<void*>; | 105 template class NodeCache<void*>; |
| 106 | 106 |
| 107 } // namespace compiler | 107 } // namespace compiler |
| 108 } // namespace internal | 108 } // namespace internal |
| 109 } // namespace v8 | 109 } // namespace v8 |
| OLD | NEW |