| 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 void List<T, P>::Allocate(int length, P allocator) { | 140 void List<T, P>::Allocate(int length, P allocator) { |
| 141 DeleteData(data_); | 141 DeleteData(data_); |
| 142 Initialize(length, allocator); | 142 Initialize(length, allocator); |
| 143 length_ = length; | 143 length_ = length; |
| 144 } | 144 } |
| 145 | 145 |
| 146 | 146 |
| 147 template<typename T, class P> | 147 template<typename T, class P> |
| 148 void List<T, P>::Clear() { | 148 void List<T, P>::Clear() { |
| 149 DeleteData(data_); | 149 DeleteData(data_); |
| 150 Initialize(0); | 150 // We don't call Initialize(0) since that requires passing a Zone, |
| 151 // which we don't really need. |
| 152 data_ = NULL; |
| 153 capacity_ = 0; |
| 154 length_ = 0; |
| 151 } | 155 } |
| 152 | 156 |
| 153 | 157 |
| 154 template<typename T, class P> | 158 template<typename T, class P> |
| 155 void List<T, P>::Rewind(int pos) { | 159 void List<T, P>::Rewind(int pos) { |
| 156 length_ = pos; | 160 length_ = pos; |
| 157 } | 161 } |
| 158 | 162 |
| 159 | 163 |
| 160 template<typename T, class P> | 164 template<typename T, class P> |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 | 256 |
| 253 template <typename T> | 257 template <typename T> |
| 254 int SortedListBSearch(const List<T>& list, T elem) { | 258 int SortedListBSearch(const List<T>& list, T elem) { |
| 255 return SortedListBSearch<T, ElementCmp<T> > (list, ElementCmp<T>(elem)); | 259 return SortedListBSearch<T, ElementCmp<T> > (list, ElementCmp<T>(elem)); |
| 256 } | 260 } |
| 257 | 261 |
| 258 | 262 |
| 259 } } // namespace v8::internal | 263 } } // namespace v8::internal |
| 260 | 264 |
| 261 #endif // V8_LIST_INL_H_ | 265 #endif // V8_LIST_INL_H_ |
| OLD | NEW |