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

Side by Side Diff: src/list-inl.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/list.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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_INL_H_ 5 #ifndef V8_LIST_INL_H_
6 #define V8_LIST_INL_H_ 6 #define V8_LIST_INL_H_
7 7
8 #include "src/list.h" 8 #include "src/list.h"
9 9
10 #include "src/base/macros.h" 10 #include "src/base/macros.h"
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 #endif 238 #endif
239 } 239 }
240 240
241 241
242 template <typename T, class P> 242 template <typename T, class P>
243 void List<T, P>::StableSort() { 243 void List<T, P>::StableSort() {
244 ToVector().StableSort(); 244 ToVector().StableSort();
245 } 245 }
246 246
247 247
248 template <typename T, class P>
249 void List<T, P>::Initialize(int capacity, P allocator) {
250 DCHECK(capacity >= 0);
251 data_ = (capacity > 0) ? NewData(capacity, allocator) : NULL;
252 capacity_ = capacity;
253 length_ = 0;
254 }
255
256
257 template <typename T, typename P> 248 template <typename T, typename P>
258 int SortedListBSearch(const List<T>& list, P cmp) { 249 int SortedListBSearch(const List<T>& list, P cmp) {
259 int low = 0; 250 int low = 0;
260 int high = list.length() - 1; 251 int high = list.length() - 1;
261 while (low <= high) { 252 while (low <= high) {
262 int mid = (low + high) / 2; 253 int mid = (low + high) / 2;
263 T mid_elem = list[mid]; 254 T mid_elem = list[mid];
264 255
265 if (cmp(&mid_elem) > 0) { 256 if (cmp(&mid_elem) > 0) {
266 high = mid - 1; 257 high = mid - 1;
(...skipping 24 matching lines...) Expand all
291 282
292 template <typename T> 283 template <typename T>
293 int SortedListBSearch(const List<T>& list, T elem) { 284 int SortedListBSearch(const List<T>& list, T elem) {
294 return SortedListBSearch<T, ElementCmp<T> > (list, ElementCmp<T>(elem)); 285 return SortedListBSearch<T, ElementCmp<T> > (list, ElementCmp<T>(elem));
295 } 286 }
296 287
297 288
298 } } // namespace v8::internal 289 } } // namespace v8::internal
299 290
300 #endif // V8_LIST_INL_H_ 291 #endif // V8_LIST_INL_H_
OLDNEW
« no previous file with comments | « src/list.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698