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

Side by Side Diff: src/list.h

Issue 1289553002: Make list constructor usable without list-inl.h header. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@local_cleanup-includes-inl-1
Patch Set: Created 5 years, 4 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
« no previous file with comments | « src/d8-posix.cc ('k') | src/list-inl.h » ('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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 template <typename CompareFunction> 159 template <typename CompareFunction>
160 void Sort(CompareFunction cmp); 160 void Sort(CompareFunction cmp);
161 void Sort(); 161 void Sort();
162 template <typename CompareFunction> 162 template <typename CompareFunction>
163 void StableSort(CompareFunction cmp, size_t start, size_t length); 163 void StableSort(CompareFunction cmp, size_t start, size_t length);
164 template <typename CompareFunction> 164 template <typename CompareFunction>
165 void StableSort(CompareFunction cmp); 165 void StableSort(CompareFunction cmp);
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);
171 data_ = (capacity > 0) ? NewData(capacity, allocator) : NULL;
172 capacity_ = capacity;
173 length_ = 0;
174 }
170 175
171 private: 176 private:
172 T* data_; 177 T* data_;
173 int capacity_; 178 int capacity_;
174 int length_; 179 int length_;
175 180
176 INLINE(T* NewData(int n, AllocationPolicy allocator)) { 181 INLINE(T* NewData(int n, AllocationPolicy allocator)) {
177 return static_cast<T*>(allocator.New(n * sizeof(T))); 182 return static_cast<T*>(allocator.New(n * sizeof(T)));
178 } 183 }
179 INLINE(void DeleteData(T* data)) { 184 INLINE(void DeleteData(T* data)) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 template <typename T, class P> 226 template <typename T, class P>
222 int SortedListBSearch(const List<T>& list, P cmp); 227 int SortedListBSearch(const List<T>& list, P cmp);
223 template <typename T> 228 template <typename T>
224 int SortedListBSearch(const List<T>& list, T elem); 229 int SortedListBSearch(const List<T>& list, T elem);
225 230
226 231
227 } } // namespace v8::internal 232 } } // namespace v8::internal
228 233
229 234
230 #endif // V8_LIST_H_ 235 #endif // V8_LIST_H_
OLDNEW
« no previous file with comments | « src/d8-posix.cc ('k') | src/list-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698