Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(501)

Side by Side Diff: src/compiler/node-cache.cc

Issue 822923002: [turbofan] Cache float32 constants on the JSGraph level. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/node-cache.h ('k') | test/cctest/compiler/test-node-cache.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 11
12 namespace v8 { 12 namespace v8 {
13 namespace internal { 13 namespace internal {
14 namespace compiler { 14 namespace compiler {
15 15
16 namespace {
17
18 enum { kInitialSize = 16u, kLinearProbe = 5u };
19
20 } // namespace
21
22
16 template <typename Key, typename Hash, typename Pred> 23 template <typename Key, typename Hash, typename Pred>
17 struct NodeCache<Key, Hash, Pred>::Entry { 24 struct NodeCache<Key, Hash, Pred>::Entry {
18 Key key_; 25 Key key_;
19 Node* value_; 26 Node* value_;
20 }; 27 };
21 28
22 29
23 template <typename Key, typename Hash, typename Pred> 30 template <typename Key, typename Hash, typename Pred>
24 bool NodeCache<Key, Hash, Pred>::Resize(Zone* zone) { 31 bool NodeCache<Key, Hash, Pred>::Resize(Zone* zone) {
25 if (size_ >= max_) return false; // Don't grow past the maximum size. 32 if (size_ >= max_) return false; // Don't grow past the maximum size.
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 92
86 // If resized to maximum and still didn't find space, overwrite an entry. 93 // If resized to maximum and still didn't find space, overwrite an entry.
87 Entry* entry = &entries_[hash & (size_ - 1)]; 94 Entry* entry = &entries_[hash & (size_ - 1)];
88 entry->key_ = key; 95 entry->key_ = key;
89 entry->value_ = nullptr; 96 entry->value_ = nullptr;
90 return &entry->value_; 97 return &entry->value_;
91 } 98 }
92 99
93 100
94 template <typename Key, typename Hash, typename Pred> 101 template <typename Key, typename Hash, typename Pred>
95 void NodeCache<Key, Hash, Pred>::GetCachedNodes(NodeVector* nodes) { 102 void NodeCache<Key, Hash, Pred>::GetCachedNodes(ZoneVector<Node*>* nodes) {
96 if (entries_) { 103 if (entries_) {
97 for (size_t i = 0; i < size_ + kLinearProbe; i++) { 104 for (size_t i = 0; i < size_ + kLinearProbe; i++) {
98 if (entries_[i].value_ != NULL) nodes->push_back(entries_[i].value_); 105 if (entries_[i].value_) nodes->push_back(entries_[i].value_);
99 } 106 }
100 } 107 }
101 } 108 }
102 109
110
111 // -----------------------------------------------------------------------------
112 // Instantiations
113
114
115 template class NodeCache<int32_t>;
103 template class NodeCache<int64_t>; 116 template class NodeCache<int64_t>;
104 template class NodeCache<int32_t>;
105 template class NodeCache<void*>;
106 117
107 } // namespace compiler 118 } // namespace compiler
108 } // namespace internal 119 } // namespace internal
109 } // namespace v8 120 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/node-cache.h ('k') | test/cctest/compiler/test-node-cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698