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 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 TYPE_CHECKER(TransitionArray, TRANSITION_ARRAY_TYPE) | 702 TYPE_CHECKER(TransitionArray, TRANSITION_ARRAY_TYPE) |
703 | 703 |
704 bool HeapObject::IsJSWeakCollection() const { | 704 bool HeapObject::IsJSWeakCollection() const { |
705 return IsJSWeakMap() || IsJSWeakSet(); | 705 return IsJSWeakMap() || IsJSWeakSet(); |
706 } | 706 } |
707 | 707 |
708 bool HeapObject::IsJSCollection() const { return IsJSMap() || IsJSSet(); } | 708 bool HeapObject::IsJSCollection() const { return IsJSMap() || IsJSSet(); } |
709 | 709 |
710 bool HeapObject::IsDescriptorArray() const { return IsFixedArray(); } | 710 bool HeapObject::IsDescriptorArray() const { return IsFixedArray(); } |
711 | 711 |
| 712 bool HeapObject::IsFrameArray() const { return IsFixedArray(); } |
| 713 |
712 bool HeapObject::IsArrayList() const { return IsFixedArray(); } | 714 bool HeapObject::IsArrayList() const { return IsFixedArray(); } |
713 | 715 |
714 bool Object::IsLayoutDescriptor() const { | 716 bool Object::IsLayoutDescriptor() const { |
715 return IsSmi() || IsFixedTypedArrayBase(); | 717 return IsSmi() || IsFixedTypedArrayBase(); |
716 } | 718 } |
717 | 719 |
718 bool HeapObject::IsTypeFeedbackVector() const { return IsFixedArray(); } | 720 bool HeapObject::IsTypeFeedbackVector() const { return IsFixedArray(); } |
719 | 721 |
720 bool HeapObject::IsTypeFeedbackMetadata() const { return IsFixedArray(); } | 722 bool HeapObject::IsTypeFeedbackMetadata() const { return IsFixedArray(); } |
721 | 723 |
(...skipping 1881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2603 | 2605 |
2604 Object** FixedArray::data_start() { | 2606 Object** FixedArray::data_start() { |
2605 return HeapObject::RawField(this, kHeaderSize); | 2607 return HeapObject::RawField(this, kHeaderSize); |
2606 } | 2608 } |
2607 | 2609 |
2608 | 2610 |
2609 Object** FixedArray::RawFieldOfElementAt(int index) { | 2611 Object** FixedArray::RawFieldOfElementAt(int index) { |
2610 return HeapObject::RawField(this, OffsetOfElementAt(index)); | 2612 return HeapObject::RawField(this, OffsetOfElementAt(index)); |
2611 } | 2613 } |
2612 | 2614 |
| 2615 #define DEFINE_FRAME_ARRAY_ACCESSORS(name, type) \ |
| 2616 type* FrameArray::name(int frame_ix) const { \ |
| 2617 Object* obj = \ |
| 2618 get(kFirstIndex + frame_ix * kElementsPerFrame + k##name##Offset); \ |
| 2619 return type::cast(obj); \ |
| 2620 } \ |
| 2621 \ |
| 2622 void FrameArray::Set##name(int frame_ix, type* value) { \ |
| 2623 set(kFirstIndex + frame_ix * kElementsPerFrame + k##name##Offset, value); \ |
| 2624 } |
| 2625 FRAME_ARRAY_FIELD_LIST(DEFINE_FRAME_ARRAY_ACCESSORS) |
| 2626 #undef DEFINE_FRAME_ARRAY_ACCESSORS |
| 2627 |
| 2628 int FrameArray::SloppyFrameCount() const { |
| 2629 return Smi::cast(get(kSloppyFramesIndex))->value(); |
| 2630 } |
| 2631 |
| 2632 void FrameArray::SetSloppyFrameCount(int count) { |
| 2633 return set(kSloppyFramesIndex, Smi::FromInt(count)); |
| 2634 } |
| 2635 |
| 2636 bool FrameArray::IsWasmFrame(int frame_ix) const { |
| 2637 Object* obj = get(kFirstIndex + frame_ix * kElementsPerFrame + |
| 2638 kWasmFunctionIndexOffset); |
| 2639 return obj->IsSmi(); |
| 2640 } |
| 2641 |
| 2642 int FrameArray::FrameCount() const { |
| 2643 const int frame_count = Smi::cast(get(kFrameCountIndex))->value(); |
| 2644 DCHECK_LE(0, frame_count); |
| 2645 return frame_count; |
| 2646 } |
2613 | 2647 |
2614 bool DescriptorArray::IsEmpty() { | 2648 bool DescriptorArray::IsEmpty() { |
2615 DCHECK(length() >= kFirstIndex || | 2649 DCHECK(length() >= kFirstIndex || |
2616 this == GetHeap()->empty_descriptor_array()); | 2650 this == GetHeap()->empty_descriptor_array()); |
2617 return length() < kFirstIndex; | 2651 return length() < kFirstIndex; |
2618 } | 2652 } |
2619 | 2653 |
2620 | 2654 |
2621 int DescriptorArray::number_of_descriptors() { | 2655 int DescriptorArray::number_of_descriptors() { |
2622 DCHECK(length() >= kFirstIndex || IsEmpty()); | 2656 DCHECK(length() >= kFirstIndex || IsEmpty()); |
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3216 CAST_ACCESSOR(DescriptorArray) | 3250 CAST_ACCESSOR(DescriptorArray) |
3217 CAST_ACCESSOR(ExternalOneByteString) | 3251 CAST_ACCESSOR(ExternalOneByteString) |
3218 CAST_ACCESSOR(ExternalString) | 3252 CAST_ACCESSOR(ExternalString) |
3219 CAST_ACCESSOR(ExternalTwoByteString) | 3253 CAST_ACCESSOR(ExternalTwoByteString) |
3220 CAST_ACCESSOR(FixedArray) | 3254 CAST_ACCESSOR(FixedArray) |
3221 CAST_ACCESSOR(FixedArrayBase) | 3255 CAST_ACCESSOR(FixedArrayBase) |
3222 CAST_ACCESSOR(FixedDoubleArray) | 3256 CAST_ACCESSOR(FixedDoubleArray) |
3223 CAST_ACCESSOR(FixedTypedArrayBase) | 3257 CAST_ACCESSOR(FixedTypedArrayBase) |
3224 CAST_ACCESSOR(Float32x4) | 3258 CAST_ACCESSOR(Float32x4) |
3225 CAST_ACCESSOR(Foreign) | 3259 CAST_ACCESSOR(Foreign) |
| 3260 CAST_ACCESSOR(FrameArray) |
3226 CAST_ACCESSOR(GlobalDictionary) | 3261 CAST_ACCESSOR(GlobalDictionary) |
3227 CAST_ACCESSOR(HandlerTable) | 3262 CAST_ACCESSOR(HandlerTable) |
3228 CAST_ACCESSOR(HeapObject) | 3263 CAST_ACCESSOR(HeapObject) |
3229 CAST_ACCESSOR(Int16x8) | 3264 CAST_ACCESSOR(Int16x8) |
3230 CAST_ACCESSOR(Int32x4) | 3265 CAST_ACCESSOR(Int32x4) |
3231 CAST_ACCESSOR(Int8x16) | 3266 CAST_ACCESSOR(Int8x16) |
3232 CAST_ACCESSOR(JSArray) | 3267 CAST_ACCESSOR(JSArray) |
3233 CAST_ACCESSOR(JSArrayBuffer) | 3268 CAST_ACCESSOR(JSArrayBuffer) |
3234 CAST_ACCESSOR(JSArrayBufferView) | 3269 CAST_ACCESSOR(JSArrayBufferView) |
3235 CAST_ACCESSOR(JSBoundFunction) | 3270 CAST_ACCESSOR(JSBoundFunction) |
(...skipping 4983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8219 #undef WRITE_INT64_FIELD | 8254 #undef WRITE_INT64_FIELD |
8220 #undef READ_BYTE_FIELD | 8255 #undef READ_BYTE_FIELD |
8221 #undef WRITE_BYTE_FIELD | 8256 #undef WRITE_BYTE_FIELD |
8222 #undef NOBARRIER_READ_BYTE_FIELD | 8257 #undef NOBARRIER_READ_BYTE_FIELD |
8223 #undef NOBARRIER_WRITE_BYTE_FIELD | 8258 #undef NOBARRIER_WRITE_BYTE_FIELD |
8224 | 8259 |
8225 } // namespace internal | 8260 } // namespace internal |
8226 } // namespace v8 | 8261 } // namespace v8 |
8227 | 8262 |
8228 #endif // V8_OBJECTS_INL_H_ | 8263 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |