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 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 if (data_[i] == elm) { | 130 if (data_[i] == elm) { |
131 Remove(i); | 131 Remove(i); |
132 return true; | 132 return true; |
133 } | 133 } |
134 } | 134 } |
135 return false; | 135 return false; |
136 } | 136 } |
137 | 137 |
138 | 138 |
139 template<typename T, class P> | 139 template<typename T, class P> |
| 140 void List<T, P>::Allocate(int length) { |
| 141 DeleteData(data_); |
| 142 Initialize(length); |
| 143 length_ = length; |
| 144 } |
| 145 |
| 146 |
| 147 template<typename T, class P> |
140 void List<T, P>::Clear() { | 148 void List<T, P>::Clear() { |
141 DeleteData(data_); | 149 DeleteData(data_); |
142 Initialize(0); | 150 Initialize(0); |
143 } | 151 } |
144 | 152 |
145 | 153 |
146 template<typename T, class P> | 154 template<typename T, class P> |
147 void List<T, P>::Rewind(int pos) { | 155 void List<T, P>::Rewind(int pos) { |
148 length_ = pos; | 156 length_ = pos; |
149 } | 157 } |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 | 252 |
245 template <typename T> | 253 template <typename T> |
246 int SortedListBSearch(const List<T>& list, T elem) { | 254 int SortedListBSearch(const List<T>& list, T elem) { |
247 return SortedListBSearch<T, ElementCmp<T> > (list, ElementCmp<T>(elem)); | 255 return SortedListBSearch<T, ElementCmp<T> > (list, ElementCmp<T>(elem)); |
248 } | 256 } |
249 | 257 |
250 | 258 |
251 } } // namespace v8::internal | 259 } } // namespace v8::internal |
252 | 260 |
253 #endif // V8_LIST_INL_H_ | 261 #endif // V8_LIST_INL_H_ |
OLD | NEW |