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

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

Issue 656103002: Add JSGraph::GetCachedNodes and NodeCache::GetCachedNodes. These routines are necessary in the dead… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 2 months 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 | Annotate | Revision Log
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 11
11 namespace v8 { 12 namespace v8 {
12 namespace internal { 13 namespace internal {
13 namespace compiler { 14 namespace compiler {
14 15
15 template <typename Key, typename Hash, typename Pred> 16 template <typename Key, typename Hash, typename Pred>
16 struct NodeCache<Key, Hash, Pred>::Entry { 17 struct NodeCache<Key, Hash, Pred>::Entry {
17 Key key_; 18 Key key_;
18 Node* value_; 19 Node* value_;
19 }; 20 };
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 } 84 }
84 85
85 // If resized to maximum and still didn't find space, overwrite an entry. 86 // If resized to maximum and still didn't find space, overwrite an entry.
86 Entry* entry = &entries_[hash & (size_ - 1)]; 87 Entry* entry = &entries_[hash & (size_ - 1)];
87 entry->key_ = key; 88 entry->key_ = key;
88 entry->value_ = nullptr; 89 entry->value_ = nullptr;
89 return &entry->value_; 90 return &entry->value_;
90 } 91 }
91 92
92 93
94 template <typename Key, typename Hash, typename Pred>
95 void NodeCache<Key, Hash, Pred>::GetCachedNodes(NodeVector* nodes) {
96 if (entries_) {
97 for (size_t i = 0; i < size_; i++) {
98 if (entries_[i].value_ != NULL) nodes->push_back(entries_[i].value_);
99 }
100 }
101 }
102
93 template class NodeCache<int64_t>; 103 template class NodeCache<int64_t>;
94 template class NodeCache<int32_t>; 104 template class NodeCache<int32_t>;
95 template class NodeCache<void*>; 105 template class NodeCache<void*>;
96 106
97 } // namespace compiler 107 } // namespace compiler
98 } // namespace internal 108 } // namespace internal
99 } // namespace v8 109 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698