OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 | 156 |
157 // Returns the length of the vector. | 157 // Returns the length of the vector. |
158 int length() const { return length_; } | 158 int length() const { return length_; } |
159 | 159 |
160 // Returns whether or not the vector is empty. | 160 // Returns whether or not the vector is empty. |
161 bool is_empty() const { return length_ == 0; } | 161 bool is_empty() const { return length_ == 0; } |
162 | 162 |
163 // Returns the pointer to the start of the data in the vector. | 163 // Returns the pointer to the start of the data in the vector. |
164 T* start() const { return start_; } | 164 T* start() const { return start_; } |
165 | 165 |
166 // Access individual vector elements. | 166 // Access individual vector elements - checks bounds in debug mode. |
167 T& operator[](int index) const { | 167 T& operator[](int index) const { |
168 RELEASE_ASSERT(0 <= index && index < length_); | 168 ASSERT(0 <= index && index < length_); |
169 return start_[index]; | 169 return start_[index]; |
170 } | 170 } |
171 | 171 |
172 T& first() { return start_[0]; } | 172 T& first() { return start_[0]; } |
173 | 173 |
174 T& last() { return start_[length_ - 1]; } | 174 T& last() { return start_[length_ - 1]; } |
175 | 175 |
176 private: | 176 private: |
177 T* start_; | 177 T* start_; |
178 int length_; | 178 int length_; |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 template <class Dest, class Source> | 300 template <class Dest, class Source> |
301 inline Dest BitCast(Source* source) { | 301 inline Dest BitCast(Source* source) { |
302 return BitCast<Dest>(reinterpret_cast<uintptr_t>(source)); | 302 return BitCast<Dest>(reinterpret_cast<uintptr_t>(source)); |
303 } | 303 } |
304 | 304 |
305 } // namespace double_conversion | 305 } // namespace double_conversion |
306 | 306 |
307 } // namespace WTF | 307 } // namespace WTF |
308 | 308 |
309 #endif // DOUBLE_CONVERSION_UTILS_H_ | 309 #endif // DOUBLE_CONVERSION_UTILS_H_ |
OLD | NEW |