diff options
Diffstat (limited to 'deps/v8/src/objects/objects-body-descriptors-inl.h')
-rw-r--r-- | deps/v8/src/objects/objects-body-descriptors-inl.h | 80 |
1 files changed, 50 insertions, 30 deletions
diff --git a/deps/v8/src/objects/objects-body-descriptors-inl.h b/deps/v8/src/objects/objects-body-descriptors-inl.h index 874330e5eb..e4167229ca 100644 --- a/deps/v8/src/objects/objects-body-descriptors-inl.h +++ b/deps/v8/src/objects/objects-body-descriptors-inl.h @@ -19,6 +19,7 @@ #include "src/objects/oddball.h" #include "src/objects/ordered-hash-table-inl.h" #include "src/objects/source-text-module.h" +#include "src/objects/swiss-name-dictionary-inl.h" #include "src/objects/synthetic-module.h" #include "src/objects/torque-defined-classes-inl.h" #include "src/objects/transitions.h" @@ -59,16 +60,7 @@ bool BodyDescriptorBase::IsValidJSObjectSlotImpl(Map map, HeapObject obj, // embedder field area as tagged slots. STATIC_ASSERT(kEmbedderDataSlotSize == kTaggedSize); #endif - if (!FLAG_unbox_double_fields || map.HasFastPointerLayout()) { - return true; - } else { - DCHECK(FLAG_unbox_double_fields); - DCHECK(IsAligned(offset, kSystemPointerSize)); - - LayoutDescriptorHelper helper(map); - DCHECK(!helper.all_fields_tagged()); - return helper.IsTagged(offset); - } + return true; } template <typename ObjectVisitor> @@ -100,23 +92,7 @@ void BodyDescriptorBase::IterateJSObjectBodyImpl(Map map, HeapObject obj, // embedder field area as tagged slots. STATIC_ASSERT(kEmbedderDataSlotSize == kTaggedSize); #endif - if (!FLAG_unbox_double_fields || map.HasFastPointerLayout()) { - IteratePointers(obj, start_offset, end_offset, v); - } else { - DCHECK(FLAG_unbox_double_fields); - DCHECK(IsAligned(start_offset, kSystemPointerSize) && - IsAligned(end_offset, kSystemPointerSize)); - - LayoutDescriptorHelper helper(map); - DCHECK(!helper.all_fields_tagged()); - for (int offset = start_offset; offset < end_offset;) { - int end_of_region_offset; - if (helper.IsTagged(offset, end_offset, &end_of_region_offset)) { - IteratePointers(obj, offset, end_of_region_offset, v); - } - offset = end_of_region_offset; - } - } + IteratePointers(obj, start_offset, end_offset, v); } template <typename ObjectVisitor> @@ -403,6 +379,38 @@ class V8_EXPORT_PRIVATE SmallOrderedHashTable<Derived>::BodyDescriptor final } }; +class V8_EXPORT_PRIVATE SwissNameDictionary::BodyDescriptor final + : public BodyDescriptorBase { + public: + static bool IsValidSlot(Map map, HeapObject obj, int offset) { + // Using |unchecked_cast| here and elsewhere in this class because the + // Scavenger may be calling us while the map word contains the forwarding + // address (a Smi) rather than a map. + + SwissNameDictionary table = SwissNameDictionary::unchecked_cast(obj); + STATIC_ASSERT(MetaTablePointerOffset() + kTaggedSize == + DataTableStartOffset()); + return offset >= MetaTablePointerOffset() && + (offset < table.DataTableEndOffset(table.Capacity())); + } + + template <typename ObjectVisitor> + static inline void IterateBody(Map map, HeapObject obj, int object_size, + ObjectVisitor* v) { + SwissNameDictionary table = SwissNameDictionary::unchecked_cast(obj); + STATIC_ASSERT(MetaTablePointerOffset() + kTaggedSize == + DataTableStartOffset()); + int start_offset = MetaTablePointerOffset(); + int end_offset = table.DataTableEndOffset(table.Capacity()); + IteratePointers(obj, start_offset, end_offset, v); + } + + static inline int SizeOf(Map map, HeapObject obj) { + SwissNameDictionary table = SwissNameDictionary::unchecked_cast(obj); + return SwissNameDictionary::SizeFor(table.Capacity()); + } +}; + class ByteArray::BodyDescriptor final : public BodyDescriptorBase { public: static bool IsValidSlot(Map map, HeapObject obj, int offset) { return false; } @@ -563,7 +571,6 @@ class WasmTypeInfo::BodyDescriptor final : public BodyDescriptorBase { ObjectVisitor* v) { Foreign::BodyDescriptor::IterateBody<ObjectVisitor>(map, obj, object_size, v); - IteratePointer(obj, kParentOffset, v); IteratePointer(obj, kSupertypesOffset, v); IteratePointer(obj, kSubtypesOffset, v); } @@ -898,7 +905,6 @@ ReturnType BodyDescriptorApply(InstanceType type, T1 p1, T2 p2, T3 p3, T4 p4) { case GLOBAL_DICTIONARY_TYPE: case NUMBER_DICTIONARY_TYPE: case SIMPLE_NUMBER_DICTIONARY_TYPE: - case SCOPE_INFO_TYPE: case SCRIPT_CONTEXT_TABLE_TYPE: return Op::template apply<FixedArray::BodyDescriptor>(p1, p2, p3, p4); case EPHEMERON_HASH_TABLE_TYPE: @@ -996,6 +1002,7 @@ ReturnType BodyDescriptorApply(InstanceType type, T1 p1, T2 p2, T3 p3, T4 p4) { case WASM_MEMORY_OBJECT_TYPE: case WASM_MODULE_OBJECT_TYPE: case WASM_TABLE_OBJECT_TYPE: + case WASM_VALUE_OBJECT_TYPE: return Op::template apply<JSObject::BodyDescriptor>(p1, p2, p3, p4); case WASM_INSTANCE_OBJECT_TYPE: return Op::template apply<WasmInstanceObject::BodyDescriptor>(p1, p2, p3, @@ -1011,6 +1018,13 @@ ReturnType BodyDescriptorApply(InstanceType type, T1 p1, T2 p2, T3 p3, T4 p4) { case JS_TYPED_ARRAY_TYPE: return Op::template apply<JSTypedArray::BodyDescriptor>(p1, p2, p3, p4); case JS_FUNCTION_TYPE: + case JS_PROMISE_CONSTRUCTOR_TYPE: + case JS_REG_EXP_CONSTRUCTOR_TYPE: + case JS_ARRAY_CONSTRUCTOR_TYPE: +#define TYPED_ARRAY_CONSTRUCTORS_SWITCH(Type, type, TYPE, Ctype) \ + case TYPE##_TYPED_ARRAY_CONSTRUCTOR_TYPE: + TYPED_ARRAYS(TYPED_ARRAY_CONSTRUCTORS_SWITCH) +#undef TYPED_ARRAY_CONSTRUCTORS_SWITCH return Op::template apply<JSFunction::BodyDescriptor>(p1, p2, p3, p4); case WEAK_CELL_TYPE: return Op::template apply<WeakCell::BodyDescriptor>(p1, p2, p3, p4); @@ -1044,6 +1058,11 @@ ReturnType BodyDescriptorApply(InstanceType type, T1 p1, T2 p2, T3 p3, T4 p4) { return Op::template apply< SmallOrderedHashTable<SmallOrderedNameDictionary>::BodyDescriptor>( p1, p2, p3, p4); + + case SWISS_NAME_DICTIONARY_TYPE: + return Op::template apply<SwissNameDictionary::BodyDescriptor>(p1, p2, p3, + p4); + case CODE_DATA_CONTAINER_TYPE: return Op::template apply<CodeDataContainer::BodyDescriptor>(p1, p2, p3, p4); @@ -1084,7 +1103,8 @@ ReturnType BodyDescriptorApply(InstanceType type, T1 p1, T2 p2, T3 p3, T4 p4) { case SYNTHETIC_MODULE_TYPE: return Op::template apply<SyntheticModule::BodyDescriptor>(p1, p2, p3, p4); -// TODO(tebbi): Avoid duplicated cases when the body descriptors are identical. +// TODO(turbofan): Avoid duplicated cases when the body descriptors are +// identical. #define MAKE_TORQUE_BODY_DESCRIPTOR_APPLY(TYPE, TypeName) \ case TYPE: \ return Op::template apply<TypeName::BodyDescriptor>(p1, p2, p3, p4); |