| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 // | 4 // |
| 5 // Review notes: | 5 // Review notes: |
| 6 // | 6 // |
| 7 // - The use of macros in these inline functions may seem superfluous | 7 // - The use of macros in these inline functions may seem superfluous |
| 8 // but it is absolutely needed to make sure gcc generates optimal | 8 // but it is absolutely needed to make sure gcc generates optimal |
| 9 // code. gcc is not happy when attempting to inline too deep. | 9 // code. gcc is not happy when attempting to inline too deep. |
| 10 // | 10 // |
| (...skipping 2505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2516 int WeakFixedArray::last_used_index() const { | 2516 int WeakFixedArray::last_used_index() const { |
| 2517 return Smi::cast(FixedArray::cast(this)->get(kLastUsedIndexIndex))->value(); | 2517 return Smi::cast(FixedArray::cast(this)->get(kLastUsedIndexIndex))->value(); |
| 2518 } | 2518 } |
| 2519 | 2519 |
| 2520 | 2520 |
| 2521 void WeakFixedArray::set_last_used_index(int index) { | 2521 void WeakFixedArray::set_last_used_index(int index) { |
| 2522 FixedArray::cast(this)->set(kLastUsedIndexIndex, Smi::FromInt(index)); | 2522 FixedArray::cast(this)->set(kLastUsedIndexIndex, Smi::FromInt(index)); |
| 2523 } | 2523 } |
| 2524 | 2524 |
| 2525 | 2525 |
| 2526 template <class T> |
| 2527 T* WeakFixedArray::Iterator::Next() { |
| 2528 if (list_ != NULL) { |
| 2529 // Assert that list did not change during iteration. |
| 2530 DCHECK_EQ(last_used_index_, list_->last_used_index()); |
| 2531 while (index_ < list_->Length()) { |
| 2532 Object* item = list_->Get(index_++); |
| 2533 if (item != Empty()) return T::cast(item); |
| 2534 } |
| 2535 list_ = NULL; |
| 2536 } |
| 2537 return NULL; |
| 2538 } |
| 2539 |
| 2540 |
| 2526 int ArrayList::Length() { | 2541 int ArrayList::Length() { |
| 2527 if (FixedArray::cast(this)->length() == 0) return 0; | 2542 if (FixedArray::cast(this)->length() == 0) return 0; |
| 2528 return Smi::cast(FixedArray::cast(this)->get(kLengthIndex))->value(); | 2543 return Smi::cast(FixedArray::cast(this)->get(kLengthIndex))->value(); |
| 2529 } | 2544 } |
| 2530 | 2545 |
| 2531 | 2546 |
| 2532 void ArrayList::SetLength(int length) { | 2547 void ArrayList::SetLength(int length) { |
| 2533 return FixedArray::cast(this)->set(kLengthIndex, Smi::FromInt(length)); | 2548 return FixedArray::cast(this)->set(kLengthIndex, Smi::FromInt(length)); |
| 2534 } | 2549 } |
| 2535 | 2550 |
| (...skipping 5291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7827 #undef READ_INT64_FIELD | 7842 #undef READ_INT64_FIELD |
| 7828 #undef WRITE_INT64_FIELD | 7843 #undef WRITE_INT64_FIELD |
| 7829 #undef READ_BYTE_FIELD | 7844 #undef READ_BYTE_FIELD |
| 7830 #undef WRITE_BYTE_FIELD | 7845 #undef WRITE_BYTE_FIELD |
| 7831 #undef NOBARRIER_READ_BYTE_FIELD | 7846 #undef NOBARRIER_READ_BYTE_FIELD |
| 7832 #undef NOBARRIER_WRITE_BYTE_FIELD | 7847 #undef NOBARRIER_WRITE_BYTE_FIELD |
| 7833 | 7848 |
| 7834 } } // namespace v8::internal | 7849 } } // namespace v8::internal |
| 7835 | 7850 |
| 7836 #endif // V8_OBJECTS_INL_H_ | 7851 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |