Index: src/heap/objects-visiting.cc |
diff --git a/src/heap/objects-visiting.cc b/src/heap/objects-visiting.cc |
index a65f53469455a67444df558a9a69b12bde9d09c3..ff5b8591cec4d1e8c1aa849c9051806ce2c6d8a9 100644 |
--- a/src/heap/objects-visiting.cc |
+++ b/src/heap/objects-visiting.cc |
@@ -6,6 +6,7 @@ |
#include "src/heap/mark-compact-inl.h" |
#include "src/heap/objects-visiting.h" |
+#include "src/heap/objects-visiting-inl.h" |
namespace v8 { |
namespace internal { |
@@ -173,6 +174,135 @@ StaticVisitorBase::VisitorId StaticVisitorBase::GetVisitorId( |
} |
+void HeapObject::IterateBody(InstanceType type, int object_size, |
+ ObjectVisitor* v) { |
+ // Avoiding <Type>::cast(this) because it accesses the map pointer field. |
+ // During GC, the map pointer field is encoded. |
+ if (type < FIRST_NONSTRING_TYPE) { |
+ switch (type & kStringRepresentationMask) { |
+ case kSeqStringTag: |
+ break; |
+ case kConsStringTag: |
+ ConsString::BodyDescriptor::IterateBody(this, v); |
+ break; |
+ case kSlicedStringTag: |
+ SlicedString::BodyDescriptor::IterateBody(this, v); |
+ break; |
+ case kExternalStringTag: |
+ if ((type & kStringEncodingMask) == kOneByteStringTag) { |
+ reinterpret_cast<ExternalOneByteString*>(this) |
+ ->ExternalOneByteStringIterateBody(v); |
+ } else { |
+ reinterpret_cast<ExternalTwoByteString*>(this) |
+ ->ExternalTwoByteStringIterateBody(v); |
+ } |
+ break; |
+ } |
+ return; |
+ } |
+ |
+ switch (type) { |
+ case FIXED_ARRAY_TYPE: |
+ FixedArray::BodyDescriptor::IterateBody(this, object_size, v); |
+ break; |
+ case FIXED_DOUBLE_ARRAY_TYPE: |
+ break; |
+ case JS_OBJECT_TYPE: |
+ case JS_CONTEXT_EXTENSION_OBJECT_TYPE: |
+ case JS_GENERATOR_OBJECT_TYPE: |
+ case JS_MODULE_TYPE: |
+ case JS_VALUE_TYPE: |
+ case JS_DATE_TYPE: |
+ case JS_ARRAY_TYPE: |
+ case JS_ARRAY_BUFFER_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_WEAK_MAP_TYPE: |
+ case JS_WEAK_SET_TYPE: |
+ case JS_REGEXP_TYPE: |
+ case JS_GLOBAL_PROXY_TYPE: |
+ case JS_GLOBAL_OBJECT_TYPE: |
+ case JS_BUILTINS_OBJECT_TYPE: |
+ case JS_MESSAGE_OBJECT_TYPE: |
+ JSObject::BodyDescriptor::IterateBody(this, object_size, v); |
+ break; |
+ case JS_FUNCTION_TYPE: |
+ reinterpret_cast<JSFunction*>(this) |
+ ->JSFunctionIterateBody(object_size, v); |
+ break; |
+ case ODDBALL_TYPE: |
+ Oddball::BodyDescriptor::IterateBody(this, v); |
+ break; |
+ case JS_PROXY_TYPE: |
+ JSProxy::BodyDescriptor::IterateBody(this, v); |
+ break; |
+ case JS_FUNCTION_PROXY_TYPE: |
+ JSFunctionProxy::BodyDescriptor::IterateBody(this, v); |
+ break; |
+ case FOREIGN_TYPE: |
+ reinterpret_cast<Foreign*>(this)->ForeignIterateBody(v); |
+ break; |
+ case MAP_TYPE: |
+ Map::BodyDescriptor::IterateBody(this, v); |
+ break; |
+ case CODE_TYPE: |
+ reinterpret_cast<Code*>(this)->CodeIterateBody(v); |
+ break; |
+ case CELL_TYPE: |
+ Cell::BodyDescriptor::IterateBody(this, v); |
+ break; |
+ case PROPERTY_CELL_TYPE: |
+ PropertyCell::BodyDescriptor::IterateBody(this, v); |
+ break; |
+ case WEAK_CELL_TYPE: |
+ WeakCell::BodyDescriptor::IterateBody(this, v); |
+ break; |
+ case SYMBOL_TYPE: |
+ Symbol::BodyDescriptor::IterateBody(this, v); |
+ break; |
+ |
+ case HEAP_NUMBER_TYPE: |
+ case MUTABLE_HEAP_NUMBER_TYPE: |
+ case SIMD128_VALUE_TYPE: |
+ case FILLER_TYPE: |
+ case BYTE_ARRAY_TYPE: |
+ case BYTECODE_ARRAY_TYPE: |
+ case FREE_SPACE_TYPE: |
+ break; |
+ |
+#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \ |
+ case FIXED_##TYPE##_ARRAY_TYPE: \ |
+ reinterpret_cast<FixedTypedArrayBase*>(this) \ |
+ ->FixedTypedArrayBaseIterateBody(v); \ |
+ break; |
+ TYPED_ARRAYS(TYPED_ARRAY_CASE) |
+#undef TYPED_ARRAY_CASE |
+ |
+ case SHARED_FUNCTION_INFO_TYPE: { |
+ SharedFunctionInfo::BodyDescriptor::IterateBody(this, v); |
+ break; |
+ } |
+ |
+#define MAKE_STRUCT_CASE(NAME, Name, name) case NAME##_TYPE: |
+ STRUCT_LIST(MAKE_STRUCT_CASE) |
+#undef MAKE_STRUCT_CASE |
+ if (type == ALLOCATION_SITE_TYPE) { |
+ AllocationSite::BodyDescriptor::IterateBody(this, v); |
+ } else { |
+ StructBodyDescriptor::IterateBody(this, object_size, v); |
+ } |
+ break; |
+ default: |
+ PrintF("Unknown type: %d\n", type); |
+ UNREACHABLE(); |
+ } |
+} |
+ |
+ |
// We don't record weak slots during marking or scavenges. Instead we do it |
// once when we complete mark-compact cycle. Note that write barrier has no |
// effect if we are already in the middle of compacting mark-sweep cycle and we |