Index: src/heap/objects-visiting-inl.h |
diff --git a/src/heap/objects-visiting-inl.h b/src/heap/objects-visiting-inl.h |
index bc4491d4bf778b16ae87f96804b68ebc9461f68d..34ba9a86d42d64618cb02339a25639759411d54a 100644 |
--- a/src/heap/objects-visiting-inl.h |
+++ b/src/heap/objects-visiting-inl.h |
@@ -15,6 +15,204 @@ |
namespace v8 { |
namespace internal { |
+VisitorId StaticVisitorBase::GetVisitorId(Map* map) { |
+ return GetVisitorId(map->instance_type(), map->instance_size(), |
+ FLAG_unbox_double_fields && !map->HasFastPointerLayout()); |
+} |
+ |
+VisitorId StaticVisitorBase::GetVisitorId(int instance_type, int instance_size, |
+ bool has_unboxed_fields) { |
+ if (instance_type < FIRST_NONSTRING_TYPE) { |
+ switch (instance_type & kStringRepresentationMask) { |
+ case kSeqStringTag: |
+ if ((instance_type & kStringEncodingMask) == kOneByteStringTag) { |
+ return kVisitSeqOneByteString; |
+ } else { |
+ return kVisitSeqTwoByteString; |
+ } |
+ |
+ case kConsStringTag: |
+ if (IsShortcutCandidate(instance_type)) { |
+ return kVisitShortcutCandidate; |
+ } else { |
+ return kVisitConsString; |
+ } |
+ |
+ case kSlicedStringTag: |
+ return kVisitSlicedString; |
+ |
+ case kExternalStringTag: |
+ return kVisitDataObject; |
+ |
+ case kThinStringTag: |
+ return kVisitThinString; |
+ } |
+ UNREACHABLE(); |
+ } |
+ |
+ switch (instance_type) { |
+ case BYTE_ARRAY_TYPE: |
+ return kVisitByteArray; |
+ |
+ case BYTECODE_ARRAY_TYPE: |
+ return kVisitBytecodeArray; |
+ |
+ case FREE_SPACE_TYPE: |
+ return kVisitFreeSpace; |
+ |
+ case FIXED_ARRAY_TYPE: |
+ return kVisitFixedArray; |
+ |
+ case FIXED_DOUBLE_ARRAY_TYPE: |
+ return kVisitFixedDoubleArray; |
+ |
+ case ODDBALL_TYPE: |
+ return kVisitOddball; |
+ |
+ case MAP_TYPE: |
+ return kVisitMap; |
+ |
+ case CODE_TYPE: |
+ return kVisitCode; |
+ |
+ case CELL_TYPE: |
+ return kVisitCell; |
+ |
+ case PROPERTY_CELL_TYPE: |
+ return kVisitPropertyCell; |
+ |
+ case WEAK_CELL_TYPE: |
+ return kVisitWeakCell; |
+ |
+ case TRANSITION_ARRAY_TYPE: |
+ return kVisitTransitionArray; |
+ |
+ case JS_WEAK_MAP_TYPE: |
+ case JS_WEAK_SET_TYPE: |
+ return kVisitJSWeakCollection; |
+ |
+ case JS_REGEXP_TYPE: |
+ return kVisitJSRegExp; |
+ |
+ case SHARED_FUNCTION_INFO_TYPE: |
+ return kVisitSharedFunctionInfo; |
+ |
+ case JS_PROXY_TYPE: |
+ return kVisitStruct; |
+ |
+ case SYMBOL_TYPE: |
+ return kVisitSymbol; |
+ |
+ case JS_ARRAY_BUFFER_TYPE: |
+ return kVisitJSArrayBuffer; |
+ |
+ case SMALL_ORDERED_HASH_MAP_TYPE: |
+ return kVisitSmallOrderedHashMap; |
+ |
+ case SMALL_ORDERED_HASH_SET_TYPE: |
+ return kVisitSmallOrderedHashSet; |
+ |
+ case JS_OBJECT_TYPE: |
+ case JS_ERROR_TYPE: |
+ case JS_ARGUMENTS_TYPE: |
+ case JS_ASYNC_FROM_SYNC_ITERATOR_TYPE: |
+ case JS_CONTEXT_EXTENSION_OBJECT_TYPE: |
+ case JS_GENERATOR_OBJECT_TYPE: |
+ case JS_ASYNC_GENERATOR_OBJECT_TYPE: |
+ case JS_MODULE_NAMESPACE_TYPE: |
+ case JS_VALUE_TYPE: |
+ case JS_DATE_TYPE: |
+ case JS_ARRAY_TYPE: |
+ case JS_GLOBAL_PROXY_TYPE: |
+ case JS_GLOBAL_OBJECT_TYPE: |
+ case JS_MESSAGE_OBJECT_TYPE: |
+ case JS_TYPED_ARRAY_TYPE: |
+ case JS_DATA_VIEW_TYPE: |
+ case JS_SET_TYPE: |
+ case JS_MAP_TYPE: |
+ case JS_SET_ITERATOR_TYPE: |
+ case JS_MAP_ITERATOR_TYPE: |
+ case JS_STRING_ITERATOR_TYPE: |
+ |
+ case JS_TYPED_ARRAY_KEY_ITERATOR_TYPE: |
+ case JS_FAST_ARRAY_KEY_ITERATOR_TYPE: |
+ case JS_GENERIC_ARRAY_KEY_ITERATOR_TYPE: |
+ case JS_UINT8_ARRAY_KEY_VALUE_ITERATOR_TYPE: |
+ case JS_INT8_ARRAY_KEY_VALUE_ITERATOR_TYPE: |
+ case JS_UINT16_ARRAY_KEY_VALUE_ITERATOR_TYPE: |
+ case JS_INT16_ARRAY_KEY_VALUE_ITERATOR_TYPE: |
+ case JS_UINT32_ARRAY_KEY_VALUE_ITERATOR_TYPE: |
+ case JS_INT32_ARRAY_KEY_VALUE_ITERATOR_TYPE: |
+ case JS_FLOAT32_ARRAY_KEY_VALUE_ITERATOR_TYPE: |
+ case JS_FLOAT64_ARRAY_KEY_VALUE_ITERATOR_TYPE: |
+ case JS_UINT8_CLAMPED_ARRAY_KEY_VALUE_ITERATOR_TYPE: |
+ case JS_FAST_SMI_ARRAY_KEY_VALUE_ITERATOR_TYPE: |
+ case JS_FAST_HOLEY_SMI_ARRAY_KEY_VALUE_ITERATOR_TYPE: |
+ case JS_FAST_ARRAY_KEY_VALUE_ITERATOR_TYPE: |
+ case JS_FAST_HOLEY_ARRAY_KEY_VALUE_ITERATOR_TYPE: |
+ case JS_FAST_DOUBLE_ARRAY_KEY_VALUE_ITERATOR_TYPE: |
+ case JS_FAST_HOLEY_DOUBLE_ARRAY_KEY_VALUE_ITERATOR_TYPE: |
+ case JS_GENERIC_ARRAY_KEY_VALUE_ITERATOR_TYPE: |
+ case JS_UINT8_ARRAY_VALUE_ITERATOR_TYPE: |
+ case JS_INT8_ARRAY_VALUE_ITERATOR_TYPE: |
+ case JS_UINT16_ARRAY_VALUE_ITERATOR_TYPE: |
+ case JS_INT16_ARRAY_VALUE_ITERATOR_TYPE: |
+ case JS_UINT32_ARRAY_VALUE_ITERATOR_TYPE: |
+ case JS_INT32_ARRAY_VALUE_ITERATOR_TYPE: |
+ case JS_FLOAT32_ARRAY_VALUE_ITERATOR_TYPE: |
+ case JS_FLOAT64_ARRAY_VALUE_ITERATOR_TYPE: |
+ case JS_UINT8_CLAMPED_ARRAY_VALUE_ITERATOR_TYPE: |
+ case JS_FAST_SMI_ARRAY_VALUE_ITERATOR_TYPE: |
+ case JS_FAST_HOLEY_SMI_ARRAY_VALUE_ITERATOR_TYPE: |
+ case JS_FAST_ARRAY_VALUE_ITERATOR_TYPE: |
+ case JS_FAST_HOLEY_ARRAY_VALUE_ITERATOR_TYPE: |
+ case JS_FAST_DOUBLE_ARRAY_VALUE_ITERATOR_TYPE: |
+ case JS_FAST_HOLEY_DOUBLE_ARRAY_VALUE_ITERATOR_TYPE: |
+ case JS_GENERIC_ARRAY_VALUE_ITERATOR_TYPE: |
+ |
+ case JS_PROMISE_CAPABILITY_TYPE: |
+ case JS_PROMISE_TYPE: |
+ case JS_BOUND_FUNCTION_TYPE: |
+ return has_unboxed_fields ? kVisitJSObject : kVisitJSObjectFast; |
+ case JS_API_OBJECT_TYPE: |
+ case JS_SPECIAL_API_OBJECT_TYPE: |
+ return kVisitJSApiObject; |
+ |
+ case JS_FUNCTION_TYPE: |
+ return kVisitJSFunction; |
+ |
+ case FILLER_TYPE: |
+ case FOREIGN_TYPE: |
+ case HEAP_NUMBER_TYPE: |
+ case MUTABLE_HEAP_NUMBER_TYPE: |
+ return kVisitDataObject; |
+ |
+ case FIXED_UINT8_ARRAY_TYPE: |
+ case FIXED_INT8_ARRAY_TYPE: |
+ case FIXED_UINT16_ARRAY_TYPE: |
+ case FIXED_INT16_ARRAY_TYPE: |
+ case FIXED_UINT32_ARRAY_TYPE: |
+ case FIXED_INT32_ARRAY_TYPE: |
+ case FIXED_FLOAT32_ARRAY_TYPE: |
+ case FIXED_UINT8_CLAMPED_ARRAY_TYPE: |
+ return kVisitFixedTypedArrayBase; |
+ |
+ case FIXED_FLOAT64_ARRAY_TYPE: |
+ return kVisitFixedFloat64Array; |
+ |
+#define MAKE_STRUCT_CASE(NAME, Name, name) case NAME##_TYPE: |
+ STRUCT_LIST(MAKE_STRUCT_CASE) |
+#undef MAKE_STRUCT_CASE |
+ if (instance_type == ALLOCATION_SITE_TYPE) { |
+ return kVisitAllocationSite; |
+ } |
+ |
+ return kVisitStruct; |
+ |
+ default: |
+ UNREACHABLE(); |
+ } |
+} |
template <typename Callback> |
Callback VisitorDispatchTable<Callback>::GetVisitor(Map* map) { |