| OLD | NEW |
| 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 bool List<T, P>::RemoveElement(const T& elm) { | 118 bool List<T, P>::RemoveElement(const T& elm) { |
| 119 for (int i = 0; i < length_; i++) { | 119 for (int i = 0; i < length_; i++) { |
| 120 if (data_[i] == elm) { | 120 if (data_[i] == elm) { |
| 121 Remove(i); | 121 Remove(i); |
| 122 return true; | 122 return true; |
| 123 } | 123 } |
| 124 } | 124 } |
| 125 return false; | 125 return false; |
| 126 } | 126 } |
| 127 | 127 |
| 128 template <typename T, class P> |
| 129 void List<T, P>::Swap(List<T, P>* list) { |
| 130 std::swap(data_, list->data_); |
| 131 std::swap(length_, list->length_); |
| 132 std::swap(capacity_, list->capacity_); |
| 133 } |
| 128 | 134 |
| 129 template<typename T, class P> | 135 template<typename T, class P> |
| 130 void List<T, P>::Allocate(int length, P allocator) { | 136 void List<T, P>::Allocate(int length, P allocator) { |
| 131 DeleteData(data_); | 137 DeleteData(data_); |
| 132 Initialize(length, allocator); | 138 Initialize(length, allocator); |
| 133 length_ = length; | 139 length_ = length; |
| 134 } | 140 } |
| 135 | 141 |
| 136 | 142 |
| 137 template<typename T, class P> | 143 template<typename T, class P> |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 | 291 |
| 286 template <typename T> | 292 template <typename T> |
| 287 int SortedListBSearch(const List<T>& list, T elem) { | 293 int SortedListBSearch(const List<T>& list, T elem) { |
| 288 return SortedListBSearch<T, ElementCmp<T> > (list, ElementCmp<T>(elem)); | 294 return SortedListBSearch<T, ElementCmp<T> > (list, ElementCmp<T>(elem)); |
| 289 } | 295 } |
| 290 | 296 |
| 291 | 297 |
| 292 } } // namespace v8::internal | 298 } } // namespace v8::internal |
| 293 | 299 |
| 294 #endif // V8_LIST_INL_H_ | 300 #endif // V8_LIST_INL_H_ |
| OLD | NEW |