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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 int length() const { return length_; } | 153 int length() const { return length_; } |
154 | 154 |
155 // Returns whether or not the vector is empty. | 155 // Returns whether or not the vector is empty. |
156 bool is_empty() const { return length_ == 0; } | 156 bool is_empty() const { return length_ == 0; } |
157 | 157 |
158 // Returns the pointer to the start of the data in the vector. | 158 // Returns the pointer to the start of the data in the vector. |
159 T* Start() const { return start_; } | 159 T* Start() const { return start_; } |
160 | 160 |
161 // Access individual vector elements. | 161 // Access individual vector elements. |
162 T& operator[](int index) const { | 162 T& operator[](int index) const { |
163 RELEASE_ASSERT(0 <= index && index < length_); | 163 CHECK_LE(0, index); |
| 164 CHECK_LT(index, length_); |
164 return start_[index]; | 165 return start_[index]; |
165 } | 166 } |
166 | 167 |
167 T& First() { return start_[0]; } | 168 T& First() { return start_[0]; } |
168 | 169 |
169 T& Last() { return start_[length_ - 1]; } | 170 T& Last() { return start_[length_ - 1]; } |
170 | 171 |
171 private: | 172 private: |
172 T* start_; | 173 T* start_; |
173 int length_; | 174 int length_; |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 template <class Dest, class Source> | 296 template <class Dest, class Source> |
296 inline Dest BitCast(Source* source) { | 297 inline Dest BitCast(Source* source) { |
297 return BitCast<Dest>(reinterpret_cast<uintptr_t>(source)); | 298 return BitCast<Dest>(reinterpret_cast<uintptr_t>(source)); |
298 } | 299 } |
299 | 300 |
300 } // namespace double_conversion | 301 } // namespace double_conversion |
301 | 302 |
302 } // namespace WTF | 303 } // namespace WTF |
303 | 304 |
304 #endif // DOUBLE_CONVERSION_UTILS_H_ | 305 #endif // DOUBLE_CONVERSION_UTILS_H_ |
OLD | NEW |