| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 | 319 |
| 320 // Returns the pointer to the start of the data in the vector. | 320 // Returns the pointer to the start of the data in the vector. |
| 321 T* start() const { return start_; } | 321 T* start() const { return start_; } |
| 322 | 322 |
| 323 // Access individual vector elements - checks bounds in debug mode. | 323 // Access individual vector elements - checks bounds in debug mode. |
| 324 T& operator[](int index) const { | 324 T& operator[](int index) const { |
| 325 ASSERT(0 <= index && index < length_); | 325 ASSERT(0 <= index && index < length_); |
| 326 return start_[index]; | 326 return start_[index]; |
| 327 } | 327 } |
| 328 | 328 |
| 329 T& at(int i) const { return operator[](i); } |
| 330 |
| 329 T& first() { return start_[0]; } | 331 T& first() { return start_[0]; } |
| 330 | 332 |
| 331 T& last() { return start_[length_ - 1]; } | 333 T& last() { return start_[length_ - 1]; } |
| 332 | 334 |
| 333 // Returns a clone of this vector with a new backing store. | 335 // Returns a clone of this vector with a new backing store. |
| 334 Vector<T> Clone() const { | 336 Vector<T> Clone() const { |
| 335 T* result = NewArray<T>(length_); | 337 T* result = NewArray<T>(length_); |
| 336 for (int i = 0; i < length_; i++) result[i] = start_[i]; | 338 for (int i = 0; i < length_; i++) result[i] = start_[i]; |
| 337 return Vector<T>(result, length_); | 339 return Vector<T>(result, length_); |
| 338 } | 340 } |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 } | 720 } |
| 719 | 721 |
| 720 template <class Dest, class Source> | 722 template <class Dest, class Source> |
| 721 inline Dest BitCast(Source* source) { | 723 inline Dest BitCast(Source* source) { |
| 722 return BitCast<Dest>(reinterpret_cast<uintptr_t>(source)); | 724 return BitCast<Dest>(reinterpret_cast<uintptr_t>(source)); |
| 723 } | 725 } |
| 724 | 726 |
| 725 } } // namespace v8::internal | 727 } } // namespace v8::internal |
| 726 | 728 |
| 727 #endif // V8_UTILS_H_ | 729 #endif // V8_UTILS_H_ |
| OLD | NEW |