Commit 56f7c23f authored by Dan Elphick's avatar Dan Elphick Committed by Commit Bot

Update mkgrokdump so that it can see maps/objects in RO_SPACE

Also annotate maps with the space, now that this can be RO_SPACE as well
as MAP_SPACE.

Bug: v8:7464
Change-Id: Id597b2195c179b38f93b0e1c6b2ce9ef04e4f0e4
Reviewed-on: https://chromium-review.googlesource.com/980554
Commit-Queue: Dan Elphick <delphick@chromium.org>
Reviewed-by: 's avatarHannes Payer <hpayer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52251}
parent 6e02204d
......@@ -6352,6 +6352,10 @@ void Heap::RecordWritesIntoCode(Code* code) {
PagedSpace* PagedSpaces::next() {
switch (counter_++) {
case RO_SPACE:
// skip NEW_SPACE
counter_++;
return heap_->read_only_space();
case OLD_SPACE:
return heap_->old_space();
case CODE_SPACE:
......
......@@ -2796,11 +2796,17 @@ class VerifySmisVisitor : public RootVisitor {
};
// Space iterator for iterating over all the paged spaces of the heap: Map
// space, old space, code space and cell space. Returns
// each space in turn, and null when it is done.
// space, old space, code space and optionally read only space. Returns each
// space in turn, and null when it is done.
class V8_EXPORT_PRIVATE PagedSpaces BASE_EMBEDDED {
public:
explicit PagedSpaces(Heap* heap) : heap_(heap), counter_(OLD_SPACE) {}
enum class SpacesSpecifier { kSweepablePagedSpaces, kAllPagedSpaces };
explicit PagedSpaces(Heap* heap, SpacesSpecifier specifier =
SpacesSpecifier::kSweepablePagedSpaces)
: heap_(heap),
counter_(specifier == SpacesSpecifier::kAllPagedSpaces ? RO_SPACE
: OLD_SPACE) {}
PagedSpace* next();
private:
......
......@@ -40,6 +40,29 @@ class MockArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
void Free(void* p, size_t) override {}
};
#define ROOT_LIST_CASE(type, name, camel_name) \
if (n == NULL && o == space->heap()->name()) n = #camel_name;
#define STRUCT_LIST_CASE(upper_name, camel_name, name) \
if (n == NULL && o == space->heap()->name##_map()) n = #camel_name "Map";
static void DumpMaps(i::PagedSpace* space) {
i::HeapObjectIterator it(space);
for (i::Object* o = it.Next(); o != NULL; o = it.Next()) {
if (!o->IsMap()) continue;
i::Map* m = i::Map::cast(o);
const char* n = NULL;
intptr_t p = reinterpret_cast<intptr_t>(m) & 0x7FFFF;
int t = m->instance_type();
ROOT_LIST(ROOT_LIST_CASE)
STRUCT_LIST(STRUCT_LIST_CASE)
if (n == NULL) continue;
const char* sname = AllocationSpaceName(space->identity());
i::PrintF(" (\"%s\", 0x%05" V8PRIxPTR "): (%d, \"%s\"),\n", sname, p, t,
n);
}
}
#undef STRUCT_LIST_CASE
#undef ROOT_LIST_CASE
static int DumpHeapConstants(const char* argv0) {
// Start up V8.
std::unique_ptr<v8::Platform> platform = v8::platform::NewDefaultPlatform();
......@@ -62,25 +85,10 @@ static int DumpHeapConstants(const char* argv0) {
// Dump the KNOWN_MAP table to the console.
i::PrintF("\n# List of known V8 maps.\n");
#define ROOT_LIST_CASE(type, name, camel_name) \
if (n == NULL && o == heap->name()) n = #camel_name;
#define STRUCT_LIST_CASE(upper_name, camel_name, name) \
if (n == NULL && o == heap->name##_map()) n = #camel_name "Map";
i::HeapObjectIterator it(heap->map_space());
i::PrintF("KNOWN_MAPS = {\n");
for (i::Object* o = it.Next(); o != NULL; o = it.Next()) {
i::Map* m = i::Map::cast(o);
const char* n = NULL;
intptr_t p = reinterpret_cast<intptr_t>(m) & 0x7FFFF;
int t = m->instance_type();
ROOT_LIST(ROOT_LIST_CASE)
STRUCT_LIST(STRUCT_LIST_CASE)
if (n == NULL) continue;
i::PrintF(" 0x%05" V8PRIxPTR ": (%d, \"%s\"),\n", p, t, n);
}
DumpMaps(heap->read_only_space());
DumpMaps(heap->map_space());
i::PrintF("}\n");
#undef STRUCT_LIST_CASE
#undef ROOT_LIST_CASE
// Dump the KNOWN_OBJECTS table to the console.
i::PrintF("\n# List of known V8 objects.\n");
......@@ -89,7 +97,7 @@ static int DumpHeapConstants(const char* argv0) {
n = #camel_name; \
i = i::Heap::k##camel_name##RootIndex; \
}
i::PagedSpaces spit(heap);
i::PagedSpaces spit(heap, i::PagedSpaces::SpacesSpecifier::kAllPagedSpaces);
i::PrintF("KNOWN_OBJECTS = {\n");
for (i::PagedSpace* s = spit.next(); s != NULL; s = spit.next()) {
i::HeapObjectIterator it(s);
......@@ -98,6 +106,8 @@ static int DumpHeapConstants(const char* argv0) {
continue;
const char* sname = AllocationSpaceName(s->identity());
for (i::Object* o = it.Next(); o != NULL; o = it.Next()) {
// Skip maps in RO_SPACE since they will be reported elsewhere.
if (o->IsMap()) continue;
const char* n = NULL;
i::Heap::RootListIndex i = i::Heap::kStrongRootListLength;
intptr_t p = reinterpret_cast<intptr_t>(o) & 0x7FFFF;
......@@ -116,7 +126,7 @@ static int DumpHeapConstants(const char* argv0) {
i::PrintF("FRAME_MARKERS = (\n");
STACK_FRAME_TYPE_LIST(DUMP_MARKER)
i::PrintF(")\n");
#undef DUMP_TYPE
#undef DUMP_MARKER
}
i::PrintF("\n# This set of constants is generated from a %s build.\n",
......
......@@ -154,135 +154,135 @@ INSTANCE_TYPES = {
# List of known V8 maps.
KNOWN_MAPS = {
0x02201: (138, "FreeSpaceMap"),
0x02259: (132, "MetaMap"),
0x022b1: (131, "NullMap"),
0x02309: (184, "DescriptorArrayMap"),
0x02361: (182, "FixedArrayMap"),
0x023b9: (152, "OnePointerFillerMap"),
0x02411: (152, "TwoPointerFillerMap"),
0x02469: (131, "UninitializedMap"),
0x024c1: (8, "OneByteInternalizedStringMap"),
0x02519: (131, "UndefinedMap"),
0x02571: (129, "HeapNumberMap"),
0x025c9: (131, "TheHoleMap"),
0x02621: (131, "BooleanMap"),
0x02679: (136, "ByteArrayMap"),
0x026d1: (182, "FixedCOWArrayMap"),
0x02729: (185, "HashTableMap"),
0x02781: (128, "SymbolMap"),
0x027d9: (72, "OneByteStringMap"),
0x02831: (186, "ScopeInfoMap"),
0x02889: (204, "SharedFunctionInfoMap"),
0x028e1: (133, "CodeMap"),
0x02939: (192, "FunctionContextMap"),
0x02991: (197, "CellMap"),
0x029e9: (208, "WeakCellMap"),
0x02a41: (203, "GlobalPropertyCellMap"),
0x02a99: (135, "ForeignMap"),
0x02af1: (187, "TransitionArrayMap"),
0x02b49: (200, "FeedbackVectorMap"),
0x02ba1: (131, "ArgumentsMarkerMap"),
0x02bf9: (131, "ExceptionMap"),
0x02c51: (131, "TerminationExceptionMap"),
0x02ca9: (131, "OptimizedOutMap"),
0x02d01: (131, "StaleRegisterMap"),
0x02d59: (194, "NativeContextMap"),
0x02db1: (193, "ModuleContextMap"),
0x02e09: (191, "EvalContextMap"),
0x02e61: (195, "ScriptContextMap"),
0x02eb9: (188, "BlockContextMap"),
0x02f11: (189, "CatchContextMap"),
0x02f69: (196, "WithContextMap"),
0x02fc1: (190, "DebugEvaluateContextMap"),
0x03019: (182, "ScriptContextTableMap"),
0x03071: (151, "FeedbackMetadataArrayMap"),
0x030c9: (182, "ArrayListMap"),
0x03121: (130, "BigIntMap"),
0x03179: (183, "BoilerplateDescriptionMap"),
0x031d1: (137, "BytecodeArrayMap"),
0x03229: (198, "CodeDataContainerMap"),
0x03281: (1057, "ExternalMap"),
0x032d9: (150, "FixedDoubleArrayMap"),
0x03331: (185, "GlobalDictionaryMap"),
0x03389: (199, "ManyClosuresCellMap"),
0x033e1: (1072, "JSMessageObjectMap"),
0x03439: (182, "ModuleInfoMap"),
0x03491: (134, "MutableHeapNumberMap"),
0x034e9: (185, "NameDictionaryMap"),
0x03541: (199, "NoClosuresCellMap"),
0x03599: (185, "NumberDictionaryMap"),
0x035f1: (199, "OneClosureCellMap"),
0x03649: (185, "OrderedHashMapMap"),
0x036a1: (185, "OrderedHashSetMap"),
0x036f9: (202, "PropertyArrayMap"),
0x03751: (185, "SimpleNumberDictionaryMap"),
0x037a9: (182, "SloppyArgumentsElementsMap"),
0x03801: (205, "SmallOrderedHashMapMap"),
0x03859: (206, "SmallOrderedHashSetMap"),
0x038b1: (185, "StringTableMap"),
0x03909: (209, "WeakFixedArrayMap"),
0x03961: (106, "NativeSourceStringMap"),
0x039b9: (64, "StringMap"),
0x03a11: (73, "ConsOneByteStringMap"),
0x03a69: (65, "ConsStringMap"),
0x03ac1: (77, "ThinOneByteStringMap"),
0x03b19: (69, "ThinStringMap"),
0x03b71: (67, "SlicedStringMap"),
0x03bc9: (75, "SlicedOneByteStringMap"),
0x03c21: (66, "ExternalStringMap"),
0x03c79: (82, "ExternalStringWithOneByteDataMap"),
0x03cd1: (74, "ExternalOneByteStringMap"),
0x03d29: (98, "ShortExternalStringMap"),
0x03d81: (114, "ShortExternalStringWithOneByteDataMap"),
0x03dd9: (0, "InternalizedStringMap"),
0x03e31: (2, "ExternalInternalizedStringMap"),
0x03e89: (18, "ExternalInternalizedStringWithOneByteDataMap"),
0x03ee1: (10, "ExternalOneByteInternalizedStringMap"),
0x03f39: (34, "ShortExternalInternalizedStringMap"),
0x03f91: (50, "ShortExternalInternalizedStringWithOneByteDataMap"),
0x03fe9: (42, "ShortExternalOneByteInternalizedStringMap"),
0x04041: (106, "ShortExternalOneByteStringMap"),
0x04099: (140, "FixedUint8ArrayMap"),
0x040f1: (139, "FixedInt8ArrayMap"),
0x04149: (142, "FixedUint16ArrayMap"),
0x041a1: (141, "FixedInt16ArrayMap"),
0x041f9: (144, "FixedUint32ArrayMap"),
0x04251: (143, "FixedInt32ArrayMap"),
0x042a9: (145, "FixedFloat32ArrayMap"),
0x04301: (146, "FixedFloat64ArrayMap"),
0x04359: (147, "FixedUint8ClampedArrayMap"),
0x043b1: (149, "FixedBigUint64ArrayMap"),
0x04409: (148, "FixedBigInt64ArrayMap"),
0x04461: (172, "Tuple2Map"),
0x044b9: (170, "ScriptMap"),
0x04511: (163, "InterceptorInfoMap"),
0x04569: (154, "AccessorInfoMap"),
0x045c1: (153, "AccessCheckInfoMap"),
0x04619: (155, "AccessorPairMap"),
0x04671: (156, "AliasedArgumentsEntryMap"),
0x046c9: (157, "AllocationMementoMap"),
0x04721: (158, "AllocationSiteMap"),
0x04779: (159, "AsyncGeneratorRequestMap"),
0x047d1: (160, "ContextExtensionMap"),
0x04829: (161, "DebugInfoMap"),
0x04881: (162, "FunctionTemplateInfoMap"),
0x048d9: (164, "ModuleInfoEntryMap"),
0x04931: (165, "ModuleMap"),
0x04989: (166, "ObjectTemplateInfoMap"),
0x049e1: (167, "PromiseCapabilityMap"),
0x04a39: (168, "PromiseReactionMap"),
0x04a91: (169, "PrototypeInfoMap"),
0x04ae9: (171, "StackFrameInfoMap"),
0x04b41: (173, "Tuple3Map"),
0x04b99: (174, "WasmCompiledModuleMap"),
0x04bf1: (175, "WasmDebugInfoMap"),
0x04c49: (176, "WasmSharedModuleDataMap"),
0x04ca1: (177, "CallableTaskMap"),
0x04cf9: (178, "CallbackTaskMap"),
0x04d51: (179, "PromiseFulfillReactionJobTaskMap"),
0x04da9: (180, "PromiseRejectReactionJobTaskMap"),
0x04e01: (181, "PromiseResolveThenableJobTaskMap"),
("MAP_SPACE", 0x02201): (138, "FreeSpaceMap"),
("MAP_SPACE", 0x02259): (132, "MetaMap"),
("MAP_SPACE", 0x022b1): (131, "NullMap"),
("MAP_SPACE", 0x02309): (184, "DescriptorArrayMap"),
("MAP_SPACE", 0x02361): (182, "FixedArrayMap"),
("MAP_SPACE", 0x023b9): (152, "OnePointerFillerMap"),
("MAP_SPACE", 0x02411): (152, "TwoPointerFillerMap"),
("MAP_SPACE", 0x02469): (131, "UninitializedMap"),
("MAP_SPACE", 0x024c1): (8, "OneByteInternalizedStringMap"),
("MAP_SPACE", 0x02519): (131, "UndefinedMap"),
("MAP_SPACE", 0x02571): (129, "HeapNumberMap"),
("MAP_SPACE", 0x025c9): (131, "TheHoleMap"),
("MAP_SPACE", 0x02621): (131, "BooleanMap"),
("MAP_SPACE", 0x02679): (136, "ByteArrayMap"),
("MAP_SPACE", 0x026d1): (182, "FixedCOWArrayMap"),
("MAP_SPACE", 0x02729): (185, "HashTableMap"),
("MAP_SPACE", 0x02781): (128, "SymbolMap"),
("MAP_SPACE", 0x027d9): (72, "OneByteStringMap"),
("MAP_SPACE", 0x02831): (186, "ScopeInfoMap"),
("MAP_SPACE", 0x02889): (204, "SharedFunctionInfoMap"),
("MAP_SPACE", 0x028e1): (133, "CodeMap"),
("MAP_SPACE", 0x02939): (192, "FunctionContextMap"),
("MAP_SPACE", 0x02991): (197, "CellMap"),
("MAP_SPACE", 0x029e9): (208, "WeakCellMap"),
("MAP_SPACE", 0x02a41): (203, "GlobalPropertyCellMap"),
("MAP_SPACE", 0x02a99): (135, "ForeignMap"),
("MAP_SPACE", 0x02af1): (187, "TransitionArrayMap"),
("MAP_SPACE", 0x02b49): (200, "FeedbackVectorMap"),
("MAP_SPACE", 0x02ba1): (131, "ArgumentsMarkerMap"),
("MAP_SPACE", 0x02bf9): (131, "ExceptionMap"),
("MAP_SPACE", 0x02c51): (131, "TerminationExceptionMap"),
("MAP_SPACE", 0x02ca9): (131, "OptimizedOutMap"),
("MAP_SPACE", 0x02d01): (131, "StaleRegisterMap"),
("MAP_SPACE", 0x02d59): (194, "NativeContextMap"),
("MAP_SPACE", 0x02db1): (193, "ModuleContextMap"),
("MAP_SPACE", 0x02e09): (191, "EvalContextMap"),
("MAP_SPACE", 0x02e61): (195, "ScriptContextMap"),
("MAP_SPACE", 0x02eb9): (188, "BlockContextMap"),
("MAP_SPACE", 0x02f11): (189, "CatchContextMap"),
("MAP_SPACE", 0x02f69): (196, "WithContextMap"),
("MAP_SPACE", 0x02fc1): (190, "DebugEvaluateContextMap"),
("MAP_SPACE", 0x03019): (182, "ScriptContextTableMap"),
("MAP_SPACE", 0x03071): (151, "FeedbackMetadataArrayMap"),
("MAP_SPACE", 0x030c9): (182, "ArrayListMap"),
("MAP_SPACE", 0x03121): (130, "BigIntMap"),
("MAP_SPACE", 0x03179): (183, "BoilerplateDescriptionMap"),
("MAP_SPACE", 0x031d1): (137, "BytecodeArrayMap"),
("MAP_SPACE", 0x03229): (198, "CodeDataContainerMap"),
("MAP_SPACE", 0x03281): (1057, "ExternalMap"),
("MAP_SPACE", 0x032d9): (150, "FixedDoubleArrayMap"),
("MAP_SPACE", 0x03331): (185, "GlobalDictionaryMap"),
("MAP_SPACE", 0x03389): (199, "ManyClosuresCellMap"),
("MAP_SPACE", 0x033e1): (1072, "JSMessageObjectMap"),
("MAP_SPACE", 0x03439): (182, "ModuleInfoMap"),
("MAP_SPACE", 0x03491): (134, "MutableHeapNumberMap"),
("MAP_SPACE", 0x034e9): (185, "NameDictionaryMap"),
("MAP_SPACE", 0x03541): (199, "NoClosuresCellMap"),
("MAP_SPACE", 0x03599): (185, "NumberDictionaryMap"),
("MAP_SPACE", 0x035f1): (199, "OneClosureCellMap"),
("MAP_SPACE", 0x03649): (185, "OrderedHashMapMap"),
("MAP_SPACE", 0x036a1): (185, "OrderedHashSetMap"),
("MAP_SPACE", 0x036f9): (202, "PropertyArrayMap"),
("MAP_SPACE", 0x03751): (185, "SimpleNumberDictionaryMap"),
("MAP_SPACE", 0x037a9): (182, "SloppyArgumentsElementsMap"),
("MAP_SPACE", 0x03801): (205, "SmallOrderedHashMapMap"),
("MAP_SPACE", 0x03859): (206, "SmallOrderedHashSetMap"),
("MAP_SPACE", 0x038b1): (185, "StringTableMap"),
("MAP_SPACE", 0x03909): (209, "WeakFixedArrayMap"),
("MAP_SPACE", 0x03961): (106, "NativeSourceStringMap"),
("MAP_SPACE", 0x039b9): (64, "StringMap"),
("MAP_SPACE", 0x03a11): (73, "ConsOneByteStringMap"),
("MAP_SPACE", 0x03a69): (65, "ConsStringMap"),
("MAP_SPACE", 0x03ac1): (77, "ThinOneByteStringMap"),
("MAP_SPACE", 0x03b19): (69, "ThinStringMap"),
("MAP_SPACE", 0x03b71): (67, "SlicedStringMap"),
("MAP_SPACE", 0x03bc9): (75, "SlicedOneByteStringMap"),
("MAP_SPACE", 0x03c21): (66, "ExternalStringMap"),
("MAP_SPACE", 0x03c79): (82, "ExternalStringWithOneByteDataMap"),
("MAP_SPACE", 0x03cd1): (74, "ExternalOneByteStringMap"),
("MAP_SPACE", 0x03d29): (98, "ShortExternalStringMap"),
("MAP_SPACE", 0x03d81): (114, "ShortExternalStringWithOneByteDataMap"),
("MAP_SPACE", 0x03dd9): (0, "InternalizedStringMap"),
("MAP_SPACE", 0x03e31): (2, "ExternalInternalizedStringMap"),
("MAP_SPACE", 0x03e89): (18, "ExternalInternalizedStringWithOneByteDataMap"),
("MAP_SPACE", 0x03ee1): (10, "ExternalOneByteInternalizedStringMap"),
("MAP_SPACE", 0x03f39): (34, "ShortExternalInternalizedStringMap"),
("MAP_SPACE", 0x03f91): (50, "ShortExternalInternalizedStringWithOneByteDataMap"),
("MAP_SPACE", 0x03fe9): (42, "ShortExternalOneByteInternalizedStringMap"),
("MAP_SPACE", 0x04041): (106, "ShortExternalOneByteStringMap"),
("MAP_SPACE", 0x04099): (140, "FixedUint8ArrayMap"),
("MAP_SPACE", 0x040f1): (139, "FixedInt8ArrayMap"),
("MAP_SPACE", 0x04149): (142, "FixedUint16ArrayMap"),
("MAP_SPACE", 0x041a1): (141, "FixedInt16ArrayMap"),
("MAP_SPACE", 0x041f9): (144, "FixedUint32ArrayMap"),
("MAP_SPACE", 0x04251): (143, "FixedInt32ArrayMap"),
("MAP_SPACE", 0x042a9): (145, "FixedFloat32ArrayMap"),
("MAP_SPACE", 0x04301): (146, "FixedFloat64ArrayMap"),
("MAP_SPACE", 0x04359): (147, "FixedUint8ClampedArrayMap"),
("MAP_SPACE", 0x043b1): (149, "FixedBigUint64ArrayMap"),
("MAP_SPACE", 0x04409): (148, "FixedBigInt64ArrayMap"),
("MAP_SPACE", 0x04461): (172, "Tuple2Map"),
("MAP_SPACE", 0x044b9): (170, "ScriptMap"),
("MAP_SPACE", 0x04511): (163, "InterceptorInfoMap"),
("MAP_SPACE", 0x04569): (154, "AccessorInfoMap"),
("MAP_SPACE", 0x045c1): (153, "AccessCheckInfoMap"),
("MAP_SPACE", 0x04619): (155, "AccessorPairMap"),
("MAP_SPACE", 0x04671): (156, "AliasedArgumentsEntryMap"),
("MAP_SPACE", 0x046c9): (157, "AllocationMementoMap"),
("MAP_SPACE", 0x04721): (158, "AllocationSiteMap"),
("MAP_SPACE", 0x04779): (159, "AsyncGeneratorRequestMap"),
("MAP_SPACE", 0x047d1): (160, "ContextExtensionMap"),
("MAP_SPACE", 0x04829): (161, "DebugInfoMap"),
("MAP_SPACE", 0x04881): (162, "FunctionTemplateInfoMap"),
("MAP_SPACE", 0x048d9): (164, "ModuleInfoEntryMap"),
("MAP_SPACE", 0x04931): (165, "ModuleMap"),
("MAP_SPACE", 0x04989): (166, "ObjectTemplateInfoMap"),
("MAP_SPACE", 0x049e1): (167, "PromiseCapabilityMap"),
("MAP_SPACE", 0x04a39): (168, "PromiseReactionMap"),
("MAP_SPACE", 0x04a91): (169, "PrototypeInfoMap"),
("MAP_SPACE", 0x04ae9): (171, "StackFrameInfoMap"),
("MAP_SPACE", 0x04b41): (173, "Tuple3Map"),
("MAP_SPACE", 0x04b99): (174, "WasmCompiledModuleMap"),
("MAP_SPACE", 0x04bf1): (175, "WasmDebugInfoMap"),
("MAP_SPACE", 0x04c49): (176, "WasmSharedModuleDataMap"),
("MAP_SPACE", 0x04ca1): (177, "CallableTaskMap"),
("MAP_SPACE", 0x04cf9): (178, "CallbackTaskMap"),
("MAP_SPACE", 0x04d51): (179, "PromiseFulfillReactionJobTaskMap"),
("MAP_SPACE", 0x04da9): (180, "PromiseRejectReactionJobTaskMap"),
("MAP_SPACE", 0x04e01): (181, "PromiseResolveThenableJobTaskMap"),
}
# List of known V8 objects.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment