Chromium Code Reviews

Side by Side Diff: src/objects-inl.h

Issue 2270783002: Add new FrameArray type (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
OLDNEW
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...)
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...)
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 = get(1 + frame_ix * kElementsPerFrame + k##name##Offset); \
2618 return type::cast(obj); \
2619 } \
2620 \
2621 void FrameArray::Set##name(int frame_ix, type* value) { \
2622 set(1 + frame_ix * kElementsPerFrame + k##name##Offset, value); \
2623 }
2624 FRAME_ARRAY_FIELD_LIST(DEFINE_FRAME_ARRAY_ACCESSORS)
2625 #undef DEFINE_FRAME_ARRAY_ACCESSORS
2626
2627 bool FrameArray::IsWasmFrame(int frame_ix) const {
2628 Object* obj =
2629 get(1 + frame_ix * kElementsPerFrame + kWasmFunctionIndexOffset);
2630 return obj->IsSmi();
2631 }
2632
2633 int FrameArray::FrameCount() const {
2634 DCHECK_EQ(1, length() % kElementsPerFrame);
2635 return (length() - 1) / kElementsPerFrame;
2636 }
2613 2637
2614 bool DescriptorArray::IsEmpty() { 2638 bool DescriptorArray::IsEmpty() {
2615 DCHECK(length() >= kFirstIndex || 2639 DCHECK(length() >= kFirstIndex ||
2616 this == GetHeap()->empty_descriptor_array()); 2640 this == GetHeap()->empty_descriptor_array());
2617 return length() < kFirstIndex; 2641 return length() < kFirstIndex;
2618 } 2642 }
2619 2643
2620 2644
2621 int DescriptorArray::number_of_descriptors() { 2645 int DescriptorArray::number_of_descriptors() {
2622 DCHECK(length() >= kFirstIndex || IsEmpty()); 2646 DCHECK(length() >= kFirstIndex || IsEmpty());
(...skipping 593 matching lines...)
3216 CAST_ACCESSOR(DescriptorArray) 3240 CAST_ACCESSOR(DescriptorArray)
3217 CAST_ACCESSOR(ExternalOneByteString) 3241 CAST_ACCESSOR(ExternalOneByteString)
3218 CAST_ACCESSOR(ExternalString) 3242 CAST_ACCESSOR(ExternalString)
3219 CAST_ACCESSOR(ExternalTwoByteString) 3243 CAST_ACCESSOR(ExternalTwoByteString)
3220 CAST_ACCESSOR(FixedArray) 3244 CAST_ACCESSOR(FixedArray)
3221 CAST_ACCESSOR(FixedArrayBase) 3245 CAST_ACCESSOR(FixedArrayBase)
3222 CAST_ACCESSOR(FixedDoubleArray) 3246 CAST_ACCESSOR(FixedDoubleArray)
3223 CAST_ACCESSOR(FixedTypedArrayBase) 3247 CAST_ACCESSOR(FixedTypedArrayBase)
3224 CAST_ACCESSOR(Float32x4) 3248 CAST_ACCESSOR(Float32x4)
3225 CAST_ACCESSOR(Foreign) 3249 CAST_ACCESSOR(Foreign)
3250 CAST_ACCESSOR(FrameArray)
3226 CAST_ACCESSOR(GlobalDictionary) 3251 CAST_ACCESSOR(GlobalDictionary)
3227 CAST_ACCESSOR(HandlerTable) 3252 CAST_ACCESSOR(HandlerTable)
3228 CAST_ACCESSOR(HeapObject) 3253 CAST_ACCESSOR(HeapObject)
3229 CAST_ACCESSOR(Int16x8) 3254 CAST_ACCESSOR(Int16x8)
3230 CAST_ACCESSOR(Int32x4) 3255 CAST_ACCESSOR(Int32x4)
3231 CAST_ACCESSOR(Int8x16) 3256 CAST_ACCESSOR(Int8x16)
3232 CAST_ACCESSOR(JSArray) 3257 CAST_ACCESSOR(JSArray)
3233 CAST_ACCESSOR(JSArrayBuffer) 3258 CAST_ACCESSOR(JSArrayBuffer)
3234 CAST_ACCESSOR(JSArrayBufferView) 3259 CAST_ACCESSOR(JSArrayBufferView)
3235 CAST_ACCESSOR(JSBoundFunction) 3260 CAST_ACCESSOR(JSBoundFunction)
(...skipping 4983 matching lines...)
8219 #undef WRITE_INT64_FIELD 8244 #undef WRITE_INT64_FIELD
8220 #undef READ_BYTE_FIELD 8245 #undef READ_BYTE_FIELD
8221 #undef WRITE_BYTE_FIELD 8246 #undef WRITE_BYTE_FIELD
8222 #undef NOBARRIER_READ_BYTE_FIELD 8247 #undef NOBARRIER_READ_BYTE_FIELD
8223 #undef NOBARRIER_WRITE_BYTE_FIELD 8248 #undef NOBARRIER_WRITE_BYTE_FIELD
8224 8249
8225 } // namespace internal 8250 } // namespace internal
8226 } // namespace v8 8251 } // namespace v8
8227 8252
8228 #endif // V8_OBJECTS_INL_H_ 8253 #endif // V8_OBJECTS_INL_H_
OLDNEW
« src/objects.cc ('K') | « src/objects.cc ('k') | src/runtime/runtime-internal.cc » ('j') | no next file with comments »

Powered by Google App Engine