Chromium Code Reviews

Side by Side Diff: src/list.h

Issue 2299753002: Made zone segments aligned in memory and included a pointer to the zone in the header. Larger objec…
Patch Set: Added a zone segment pool for small segments to avoid frequent sys calls Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
« no previous file with comments | « src/base/platform/platform-win32.cc ('k') | src/runtime/runtime-regexp.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 #ifndef V8_LIST_H_ 5 #ifndef V8_LIST_H_
6 #define V8_LIST_H_ 6 #define V8_LIST_H_
7 7
8 #include <algorithm> 8 #include <algorithm>
9 9
10 #include "src/checks.h" 10 #include "src/checks.h"
(...skipping 155 matching lines...)
166 void StableSort(); 166 void StableSort();
167 167
168 INLINE(void Initialize(int capacity, 168 INLINE(void Initialize(int capacity,
169 AllocationPolicy allocator = AllocationPolicy())) { 169 AllocationPolicy allocator = AllocationPolicy())) {
170 DCHECK(capacity >= 0); 170 DCHECK(capacity >= 0);
171 data_ = (capacity > 0) ? NewData(capacity, allocator) : NULL; 171 data_ = (capacity > 0) ? NewData(capacity, allocator) : NULL;
172 capacity_ = capacity; 172 capacity_ = capacity;
173 length_ = 0; 173 length_ = 0;
174 } 174 }
175 175
176 protected:
177 T* data() const { return data_; }
178
176 private: 179 private:
177 T* data_; 180 T* data_;
178 int capacity_; 181 int capacity_;
179 int length_; 182 int length_;
180 183
181 INLINE(T* NewData(int n, AllocationPolicy allocator)) { 184 INLINE(T* NewData(int n, AllocationPolicy allocator)) {
182 return static_cast<T*>(allocator.New(n * sizeof(T))); 185 return static_cast<T*>(allocator.New(n * sizeof(T)));
183 } 186 }
184 INLINE(void DeleteData(T* data)) { 187 INLINE(void DeleteData(T* data)) {
185 AllocationPolicy::Delete(data); 188 AllocationPolicy::Delete(data);
(...skipping 39 matching lines...)
225 int SortedListBSearch(const List<T>& list, P cmp); 228 int SortedListBSearch(const List<T>& list, P cmp);
226 template <typename T> 229 template <typename T>
227 int SortedListBSearch(const List<T>& list, T elem); 230 int SortedListBSearch(const List<T>& list, T elem);
228 231
229 232
230 } // namespace internal 233 } // namespace internal
231 } // namespace v8 234 } // namespace v8
232 235
233 236
234 #endif // V8_LIST_H_ 237 #endif // V8_LIST_H_
OLDNEW
« no previous file with comments | « src/base/platform/platform-win32.cc ('k') | src/runtime/runtime-regexp.cc » ('j') | no next file with comments »

Powered by Google App Engine