From 12c8d363312fdf62d6c9bfb9e6ccc05dd548dabc Mon Sep 17 00:00:00 2001 From: "mstarzinger@chromium.org" Date: Fri, 2 Aug 2013 09:02:02 +0000 Subject: [PATCH] Generate grokdump constants with 'make grokdump' now. R=svenpanne@chromium.org Review URL: https://codereview.chromium.org/21771002 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16022 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- Makefile | 9 +- src/d8.cc | 72 +++++++++++ src/d8.h | 2 + tools/grokdump.py | 262 +------------------------------------- tools/v8heapconst.py | 252 ++++++++++++++++++++++++++++++++++++ tools/v8heapconst.py.tmpl | 30 +++++ 6 files changed, 370 insertions(+), 257 deletions(-) create mode 100644 tools/v8heapconst.py create mode 100644 tools/v8heapconst.py.tmpl diff --git a/Makefile b/Makefile index 499f6cb08e..288c257396 100644 --- a/Makefile +++ b/Makefile @@ -192,6 +192,7 @@ endif # ----------------- available targets: -------------------- # - "dependencies": pulls in external dependencies (currently: GYP) +# - "grokdump": rebuilds heap constants lists used by grokdump # - any arch listed in ARCHES (see below) # - any mode listed in MODES # - every combination ., e.g. "ia32.release" @@ -392,7 +393,7 @@ endif # Replaces the old with the new environment file if they're different, which # will trigger GYP to regenerate Makefiles. $(ENVFILE): $(ENVFILE).new - @if test -r $(ENVFILE) && cmp $(ENVFILE).new $(ENVFILE) >/dev/null; \ + @if test -r $(ENVFILE) && cmp $(ENVFILE).new $(ENVFILE) > /dev/null; \ then rm $(ENVFILE).new; \ else mv $(ENVFILE).new $(ENVFILE); fi @@ -401,6 +402,12 @@ $(ENVFILE).new: @mkdir -p $(OUTDIR); echo "GYPFLAGS=$(GYPFLAGS)" > $(ENVFILE).new; \ echo "CXX=$(CXX)" >> $(ENVFILE).new +# Heap constants for grokdump. +DUMP_FILE = tools/v8heapconst.py +grokdump: ia32.release + @cat $(DUMP_FILE).tmpl > $(DUMP_FILE) + @$(OUTDIR)/ia32.release/d8 --dump-heap-constants >> $(DUMP_FILE) + # Dependencies. # Remember to keep these in sync with the DEPS file. dependencies: diff --git a/src/d8.cc b/src/d8.cc index cde8404dcc..d6ecdc9f75 100644 --- a/src/d8.cc +++ b/src/d8.cc @@ -1406,6 +1406,14 @@ bool Shell::SetOptions(int argc, char* argv[]) { #else options.num_parallel_files++; #endif // V8_SHARED + } else if (strcmp(argv[i], "--dump-heap-constants") == 0) { +#ifdef V8_SHARED + printf("D8 with shared library does not support constant dumping\n"); + return false; +#else + options.dump_heap_constants = true; + argv[i] = NULL; +#endif } #ifdef V8_SHARED else if (strcmp(argv[i], "--dump-counters") == 0) { @@ -1560,6 +1568,63 @@ static void SetStandaloneFlagsViaCommandLine() { #endif +#ifndef V8_SHARED +static void DumpHeapConstants(i::Isolate* isolate) { + i::Heap* heap = isolate->heap(); + + // Dump the INSTANCE_TYPES table to the console. + printf("# List of known V8 instance types.\n"); +#define DUMP_TYPE(T) printf(" %d: \"%s\",\n", i::T, #T); + printf("INSTANCE_TYPES = {\n"); + INSTANCE_TYPE_LIST(DUMP_TYPE) + printf("}\n"); +#undef DUMP_TYPE + + // Dump the KNOWN_MAP table to the console. + printf("\n# List of known V8 maps.\n"); +#define ROOT_LIST_CASE(type, name, camel_name) \ + if (o == heap->name()) n = #camel_name; +#define STRUCT_LIST_CASE(upper_name, camel_name, name) \ + if (o == heap->name##_map()) n = #camel_name "Map"; + i::HeapObjectIterator it(heap->map_space()); + 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(m) & 0xfffff; + int t = m->instance_type(); + ROOT_LIST(ROOT_LIST_CASE) + STRUCT_LIST(STRUCT_LIST_CASE) + if (n == NULL) continue; + printf(" 0x%05" V8_PTR_PREFIX "x: (%d, \"%s\"),\n", p, t, n); + } + printf("}\n"); +#undef STRUCT_LIST_CASE +#undef ROOT_LIST_CASE + + // Dump the KNOWN_OBJECTS table to the console. + printf("\n# List of known V8 objects.\n"); +#define ROOT_LIST_CASE(type, name, camel_name) \ + if (o == heap->name()) n = #camel_name; + i::OldSpaces spit(heap); + printf("KNOWN_OBJECTS = {\n"); + for (i::PagedSpace* s = spit.next(); s != NULL; s = spit.next()) { + i::HeapObjectIterator it(s); + const char* sname = AllocationSpaceName(s->identity()); + for (i::Object* o = it.Next(); o != NULL; o = it.Next()) { + const char* n = NULL; + intptr_t p = reinterpret_cast(o) & 0xfffff; + ROOT_LIST(ROOT_LIST_CASE) + if (n == NULL) continue; + printf(" (\"%s\", 0x%05" V8_PTR_PREFIX "x): \"%s\",\n", sname, p, n); + } + } + printf("}\n"); +#undef ROOT_LIST_CASE +} +#endif // V8_SHARED + + class ShellArrayBufferAllocator : public v8::ArrayBuffer::Allocator { public: virtual void* Allocate(size_t length) { @@ -1597,6 +1662,13 @@ int Shell::Main(int argc, char* argv[]) { PerIsolateData data(isolate); InitializeDebugger(isolate); +#ifndef V8_SHARED + if (options.dump_heap_constants) { + DumpHeapConstants(reinterpret_cast(isolate)); + return 0; + } +#endif + if (options.stress_opt || options.stress_deopt) { Testing::SetStressRunType(options.stress_opt ? Testing::kStressTypeOpt diff --git a/src/d8.h b/src/d8.h index 4f04342cf4..3b06985ca2 100644 --- a/src/d8.h +++ b/src/d8.h @@ -231,6 +231,7 @@ class ShellOptions { stress_deopt(false), interactive_shell(false), test_shell(false), + dump_heap_constants(false), num_isolates(1), isolate_sources(NULL) { } @@ -254,6 +255,7 @@ class ShellOptions { bool stress_deopt; bool interactive_shell; bool test_shell; + bool dump_heap_constants; int num_isolates; SourceGroup* isolate_sources; }; diff --git a/tools/grokdump.py b/tools/grokdump.py index 9719376d7f..fadbe762c4 100755 --- a/tools/grokdump.py +++ b/tools/grokdump.py @@ -40,6 +40,7 @@ import re import struct import sys import types +import v8heapconst USAGE="""usage: %prog [OPTIONS] [DUMP-FILE] @@ -163,6 +164,11 @@ def FullDump(reader, heap): reader.ForEachMemoryRegion(dump_region) +# Heap constants generated by 'make grokdump' in v8heapconst module. +INSTANCE_TYPES = v8heapconst.INSTANCE_TYPES +KNOWN_MAPS = v8heapconst.KNOWN_MAPS +KNOWN_OBJECTS = v8heapconst.KNOWN_OBJECTS + # Set of structures and constants that describe the layout of minidump # files. Based on MSDN and Google Breakpad. @@ -834,262 +840,6 @@ class MinidumpReader(object): return "%s+0x%x" % (symbol.name, diff) - -# List of V8 instance types. Obtained by adding the code below to any .cc file. -# -# #define DUMP_TYPE(T) printf(" %d: \"%s\",\n", T, #T); -# struct P { -# P() { -# printf("INSTANCE_TYPES = {\n"); -# INSTANCE_TYPE_LIST(DUMP_TYPE) -# printf("}\n"); -# } -# }; -# static P p; -INSTANCE_TYPES = { - 0: "STRING_TYPE", - 4: "ASCII_STRING_TYPE", - 1: "CONS_STRING_TYPE", - 5: "CONS_ASCII_STRING_TYPE", - 3: "SLICED_STRING_TYPE", - 2: "EXTERNAL_STRING_TYPE", - 6: "EXTERNAL_ASCII_STRING_TYPE", - 10: "EXTERNAL_STRING_WITH_ASCII_DATA_TYPE", - 18: "SHORT_EXTERNAL_STRING_TYPE", - 22: "SHORT_EXTERNAL_ASCII_STRING_TYPE", - 26: "SHORT_EXTERNAL_STRING_WITH_ASCII_DATA_TYPE", - 64: "INTERNALIZED_STRING_TYPE", - 68: "ASCII_INTERNALIZED_STRING_TYPE", - 65: "CONS_INTERNALIZED_STRING_TYPE", - 69: "CONS_ASCII_INTERNALIZED_STRING_TYPE", - 66: "EXTERNAL_INTERNALIZED_STRING_TYPE", - 70: "EXTERNAL_ASCII_INTERNALIZED_STRING_TYPE", - 74: "EXTERNAL_INTERNALIZED_STRING_WITH_ASCII_DATA_TYPE", - 82: "SHORT_EXTERNAL_INTERNALIZED_STRING_TYPE", - 86: "SHORT_EXTERNAL_ASCII_INTERNALIZED_STRING_TYPE", - 90: "SHORT_EXTERNAL_INTERNALIZED_STRING_WITH_ASCII_DATA_TYPE", - 128: "SYMBOL_TYPE", - 129: "MAP_TYPE", - 130: "CODE_TYPE", - 131: "ODDBALL_TYPE", - 132: "JS_GLOBAL_PROPERTY_CELL_TYPE", - 133: "HEAP_NUMBER_TYPE", - 134: "FOREIGN_TYPE", - 135: "BYTE_ARRAY_TYPE", - 136: "FREE_SPACE_TYPE", - 137: "EXTERNAL_BYTE_ARRAY_TYPE", - 138: "EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE", - 139: "EXTERNAL_SHORT_ARRAY_TYPE", - 140: "EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE", - 141: "EXTERNAL_INT_ARRAY_TYPE", - 142: "EXTERNAL_UNSIGNED_INT_ARRAY_TYPE", - 143: "EXTERNAL_FLOAT_ARRAY_TYPE", - 145: "EXTERNAL_PIXEL_ARRAY_TYPE", - 147: "FILLER_TYPE", - 148: "DECLARED_ACCESSOR_DESCRIPTOR_TYPE", - 149: "DECLARED_ACCESSOR_INFO_TYPE", - 150: "EXECUTABLE_ACCESSOR_INFO_TYPE", - 151: "ACCESSOR_PAIR_TYPE", - 152: "ACCESS_CHECK_INFO_TYPE", - 153: "INTERCEPTOR_INFO_TYPE", - 154: "CALL_HANDLER_INFO_TYPE", - 155: "FUNCTION_TEMPLATE_INFO_TYPE", - 156: "OBJECT_TEMPLATE_INFO_TYPE", - 157: "SIGNATURE_INFO_TYPE", - 158: "TYPE_SWITCH_INFO_TYPE", - 159: "ALLOCATION_SITE_INFO_TYPE", - 160: "SCRIPT_TYPE", - 161: "CODE_CACHE_TYPE", - 162: "POLYMORPHIC_CODE_CACHE_TYPE", - 163: "TYPE_FEEDBACK_INFO_TYPE", - 164: "ALIASED_ARGUMENTS_ENTRY_TYPE", - 167: "FIXED_ARRAY_TYPE", - 146: "FIXED_DOUBLE_ARRAY_TYPE", - 168: "SHARED_FUNCTION_INFO_TYPE", - 169: "JS_MESSAGE_OBJECT_TYPE", - 172: "JS_VALUE_TYPE", - 173: "JS_DATE_TYPE", - 174: "JS_OBJECT_TYPE", - 175: "JS_CONTEXT_EXTENSION_OBJECT_TYPE", - 176: "JS_MODULE_TYPE", - 177: "JS_GLOBAL_OBJECT_TYPE", - 178: "JS_BUILTINS_OBJECT_TYPE", - 179: "JS_GLOBAL_PROXY_TYPE", - 180: "JS_ARRAY_TYPE", - 171: "JS_PROXY_TYPE", - 183: "JS_WEAK_MAP_TYPE", - 184: "JS_WEAK_SET_TYPE", - 185: "JS_REGEXP_TYPE", - 186: "JS_FUNCTION_TYPE", - 170: "JS_FUNCTION_PROXY_TYPE", - 165: "DEBUG_INFO_TYPE", - 166: "BREAK_POINT_INFO_TYPE", -} - - -# List of known V8 maps. Used to determine the instance type and name -# for maps that are part of the root-set and hence on the first page of -# the map-space. Obtained by adding the code below to an IA32 release -# build with enabled snapshots to the end of the Isolate::Init method. -# -# #define ROOT_LIST_CASE(type, name, camel_name) \ -# if (o == heap_.name()) n = #camel_name; -# #define STRUCT_LIST_CASE(upper_name, camel_name, name) \ -# if (o == heap_.name##_map()) n = #camel_name "Map"; -# HeapObjectIterator it(heap_.map_space()); -# printf("KNOWN_MAPS = {\n"); -# for (Object* o = it.Next(); o != NULL; o = it.Next()) { -# Map* m = Map::cast(o); -# const char* n = ""; -# intptr_t p = reinterpret_cast(m) & 0xfffff; -# int t = m->instance_type(); -# ROOT_LIST(ROOT_LIST_CASE) -# STRUCT_LIST(STRUCT_LIST_CASE) -# printf(" 0x%05x: (%d, \"%s\"),\n", p, t, n); -# } -# printf("}\n"); -KNOWN_MAPS = { - 0x08081: (135, "ByteArrayMap"), - 0x080a9: (129, "MetaMap"), - 0x080d1: (131, "OddballMap"), - 0x080f9: (68, "AsciiInternalizedStringMap"), - 0x08121: (167, "FixedArrayMap"), - 0x08149: (133, "HeapNumberMap"), - 0x08171: (136, "FreeSpaceMap"), - 0x08199: (147, "OnePointerFillerMap"), - 0x081c1: (147, "TwoPointerFillerMap"), - 0x081e9: (132, "GlobalPropertyCellMap"), - 0x08211: (168, "SharedFunctionInfoMap"), - 0x08239: (167, "NativeContextMap"), - 0x08261: (130, "CodeMap"), - 0x08289: (167, "ScopeInfoMap"), - 0x082b1: (167, "FixedCOWArrayMap"), - 0x082d9: (146, "FixedDoubleArrayMap"), - 0x08301: (167, "HashTableMap"), - 0x08329: (128, "SymbolMap"), - 0x08351: (0, "StringMap"), - 0x08379: (4, "AsciiStringMap"), - 0x083a1: (1, "ConsStringMap"), - 0x083c9: (5, "ConsAsciiStringMap"), - 0x083f1: (3, "SlicedStringMap"), - 0x08419: (7, "SlicedAsciiStringMap"), - 0x08441: (2, "ExternalStringMap"), - 0x08469: (10, "ExternalStringWithAsciiDataMap"), - 0x08491: (6, "ExternalAsciiStringMap"), - 0x084b9: (18, "ShortExternalStringMap"), - 0x084e1: (26, "ShortExternalStringWithAsciiDataMap"), - 0x08509: (64, "InternalizedStringMap"), - 0x08531: (65, "ConsInternalizedStringMap"), - 0x08559: (69, "ConsAsciiInternalizedStringMap"), - 0x08581: (66, "ExternalInternalizedStringMap"), - 0x085a9: (74, "ExternalInternalizedStringWithAsciiDataMap"), - 0x085d1: (70, "ExternalAsciiInternalizedStringMap"), - 0x085f9: (82, "ShortExternalInternalizedStringMap"), - 0x08621: (90, "ShortExternalInternalizedStringWithAsciiDataMap"), - 0x08649: (86, "ShortExternalAsciiInternalizedStringMap"), - 0x08671: (22, "ShortExternalAsciiStringMap"), - 0x08699: (0, "UndetectableStringMap"), - 0x086c1: (4, "UndetectableAsciiStringMap"), - 0x086e9: (145, "ExternalPixelArrayMap"), - 0x08711: (137, "ExternalByteArrayMap"), - 0x08739: (138, "ExternalUnsignedByteArrayMap"), - 0x08761: (139, "ExternalShortArrayMap"), - 0x08789: (140, "ExternalUnsignedShortArrayMap"), - 0x087b1: (141, "ExternalIntArrayMap"), - 0x087d9: (142, "ExternalUnsignedIntArrayMap"), - 0x08801: (143, "ExternalFloatArrayMap"), - 0x08829: (144, "ExternalDoubleArrayMap"), - 0x08851: (167, "NonStrictArgumentsElementsMap"), - 0x08879: (167, "FunctionContextMap"), - 0x088a1: (167, "CatchContextMap"), - 0x088c9: (167, "WithContextMap"), - 0x088f1: (167, "BlockContextMap"), - 0x08919: (167, "ModuleContextMap"), - 0x08941: (167, "GlobalContextMap"), - 0x08969: (169, "JSMessageObjectMap"), - 0x08991: (134, "ForeignMap"), - 0x089b9: (174, "NeanderMap"), - 0x089e1: (159, "AllocationSiteInfoMap"), - 0x08a09: (162, "PolymorphicCodeCacheMap"), - 0x08a31: (160, "ScriptMap"), - 0x08a59: (174, ""), - 0x08a81: (174, "ExternalMap"), - 0x08aa9: (148, "DeclaredAccessorDescriptorMap"), - 0x08ad1: (149, "DeclaredAccessorInfoMap"), - 0x08af9: (150, "ExecutableAccessorInfoMap"), - 0x08b21: (151, "AccessorPairMap"), - 0x08b49: (152, "AccessCheckInfoMap"), - 0x08b71: (153, "InterceptorInfoMap"), - 0x08b99: (154, "CallHandlerInfoMap"), - 0x08bc1: (155, "FunctionTemplateInfoMap"), - 0x08be9: (156, "ObjectTemplateInfoMap"), - 0x08c11: (157, "SignatureInfoMap"), - 0x08c39: (158, "TypeSwitchInfoMap"), - 0x08c61: (161, "CodeCacheMap"), - 0x08c89: (163, "TypeFeedbackInfoMap"), - 0x08cb1: (164, "AliasedArgumentsEntryMap"), - 0x08cd9: (165, "DebugInfoMap"), - 0x08d01: (166, "BreakPointInfoMap"), -} - - -# List of known V8 objects. Used to determine name for objects that are -# part of the root-set and hence on the first page of various old-space -# paged. Obtained by adding the code below to an IA32 release build with -# enabled snapshots to the end of the Isolate::Init method. -# -# #define ROOT_LIST_CASE(type, name, camel_name) \ -# if (o == heap_.name()) n = #camel_name; -# OldSpaces spit(heap()); -# printf("KNOWN_OBJECTS = {\n"); -# for (PagedSpace* s = spit.next(); s != NULL; s = spit.next()) { -# HeapObjectIterator it(s); -# const char* sname = AllocationSpaceName(s->identity()); -# for (Object* o = it.Next(); o != NULL; o = it.Next()) { -# const char* n = NULL; -# intptr_t p = reinterpret_cast(o) & 0xfffff; -# ROOT_LIST(ROOT_LIST_CASE) -# if (n != NULL) { -# printf(" (\"%s\", 0x%05x): \"%s\",\n", sname, p, n); -# } -# } -# } -# printf("}\n"); -KNOWN_OBJECTS = { - ("OLD_POINTER_SPACE", 0x08081): "NullValue", - ("OLD_POINTER_SPACE", 0x08091): "UndefinedValue", - ("OLD_POINTER_SPACE", 0x080a1): "InstanceofCacheMap", - ("OLD_POINTER_SPACE", 0x080b1): "TrueValue", - ("OLD_POINTER_SPACE", 0x080c1): "FalseValue", - ("OLD_POINTER_SPACE", 0x080d1): "NoInterceptorResultSentinel", - ("OLD_POINTER_SPACE", 0x080e1): "ArgumentsMarker", - ("OLD_POINTER_SPACE", 0x080f1): "NumberStringCache", - ("OLD_POINTER_SPACE", 0x088f9): "SingleCharacterStringCache", - ("OLD_POINTER_SPACE", 0x08b01): "StringSplitCache", - ("OLD_POINTER_SPACE", 0x08f09): "RegExpMultipleCache", - ("OLD_POINTER_SPACE", 0x09311): "TerminationException", - ("OLD_POINTER_SPACE", 0x09321): "MessageListeners", - ("OLD_POINTER_SPACE", 0x0933d): "CodeStubs", - ("OLD_POINTER_SPACE", 0x09fa5): "NonMonomorphicCache", - ("OLD_POINTER_SPACE", 0x0a5b9): "PolymorphicCodeCache", - ("OLD_POINTER_SPACE", 0x0a5c1): "NativesSourceCache", - ("OLD_POINTER_SPACE", 0x0a601): "EmptyScript", - ("OLD_POINTER_SPACE", 0x0a63d): "IntrinsicFunctionNames", - ("OLD_POINTER_SPACE", 0x0d659): "ObservationState", - ("OLD_POINTER_SPACE", 0x27415): "SymbolTable", - ("OLD_DATA_SPACE", 0x08099): "EmptyDescriptorArray", - ("OLD_DATA_SPACE", 0x080a1): "EmptyFixedArray", - ("OLD_DATA_SPACE", 0x080a9): "NanValue", - ("OLD_DATA_SPACE", 0x08125): "EmptyByteArray", - ("OLD_DATA_SPACE", 0x0812d): "EmptyString", - ("OLD_DATA_SPACE", 0x08259): "InfinityValue", - ("OLD_DATA_SPACE", 0x08265): "MinusZeroValue", - ("OLD_DATA_SPACE", 0x08271): "PrototypeAccessors", - ("CODE_SPACE", 0x0aea1): "JsEntryCode", - ("CODE_SPACE", 0x0b5c1): "JsConstructEntryCode", -} - - class Printer(object): """Printer with indentation support.""" diff --git a/tools/v8heapconst.py b/tools/v8heapconst.py new file mode 100644 index 0000000000..a8c0c7b523 --- /dev/null +++ b/tools/v8heapconst.py @@ -0,0 +1,252 @@ +# Copyright 2013 the V8 project authors. All rights reserved. +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# This file is automatically generated from the V8 source and should not +# be modified manually, run 'make grokdump' instead to update this file. + +# List of known V8 instance types. +INSTANCE_TYPES = { + 64: "STRING_TYPE", + 68: "ASCII_STRING_TYPE", + 65: "CONS_STRING_TYPE", + 69: "CONS_ASCII_STRING_TYPE", + 67: "SLICED_STRING_TYPE", + 66: "EXTERNAL_STRING_TYPE", + 70: "EXTERNAL_ASCII_STRING_TYPE", + 74: "EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE", + 82: "SHORT_EXTERNAL_STRING_TYPE", + 86: "SHORT_EXTERNAL_ASCII_STRING_TYPE", + 90: "SHORT_EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE", + 0: "INTERNALIZED_STRING_TYPE", + 4: "ASCII_INTERNALIZED_STRING_TYPE", + 1: "CONS_INTERNALIZED_STRING_TYPE", + 5: "CONS_ASCII_INTERNALIZED_STRING_TYPE", + 2: "EXTERNAL_INTERNALIZED_STRING_TYPE", + 6: "EXTERNAL_ASCII_INTERNALIZED_STRING_TYPE", + 10: "EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE", + 18: "SHORT_EXTERNAL_INTERNALIZED_STRING_TYPE", + 22: "SHORT_EXTERNAL_ASCII_INTERNALIZED_STRING_TYPE", + 26: "SHORT_EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE", + 128: "SYMBOL_TYPE", + 129: "MAP_TYPE", + 130: "CODE_TYPE", + 131: "ODDBALL_TYPE", + 132: "CELL_TYPE", + 133: "PROPERTY_CELL_TYPE", + 134: "HEAP_NUMBER_TYPE", + 135: "FOREIGN_TYPE", + 136: "BYTE_ARRAY_TYPE", + 137: "FREE_SPACE_TYPE", + 138: "EXTERNAL_BYTE_ARRAY_TYPE", + 139: "EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE", + 140: "EXTERNAL_SHORT_ARRAY_TYPE", + 141: "EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE", + 142: "EXTERNAL_INT_ARRAY_TYPE", + 143: "EXTERNAL_UNSIGNED_INT_ARRAY_TYPE", + 144: "EXTERNAL_FLOAT_ARRAY_TYPE", + 145: "EXTERNAL_DOUBLE_ARRAY_TYPE", + 146: "EXTERNAL_PIXEL_ARRAY_TYPE", + 148: "FILLER_TYPE", + 149: "DECLARED_ACCESSOR_DESCRIPTOR_TYPE", + 150: "DECLARED_ACCESSOR_INFO_TYPE", + 151: "EXECUTABLE_ACCESSOR_INFO_TYPE", + 152: "ACCESSOR_PAIR_TYPE", + 153: "ACCESS_CHECK_INFO_TYPE", + 154: "INTERCEPTOR_INFO_TYPE", + 155: "CALL_HANDLER_INFO_TYPE", + 156: "FUNCTION_TEMPLATE_INFO_TYPE", + 157: "OBJECT_TEMPLATE_INFO_TYPE", + 158: "SIGNATURE_INFO_TYPE", + 159: "TYPE_SWITCH_INFO_TYPE", + 161: "ALLOCATION_MEMENTO_TYPE", + 160: "ALLOCATION_SITE_TYPE", + 162: "SCRIPT_TYPE", + 163: "CODE_CACHE_TYPE", + 164: "POLYMORPHIC_CODE_CACHE_TYPE", + 165: "TYPE_FEEDBACK_INFO_TYPE", + 166: "ALIASED_ARGUMENTS_ENTRY_TYPE", + 167: "BOX_TYPE", + 170: "FIXED_ARRAY_TYPE", + 147: "FIXED_DOUBLE_ARRAY_TYPE", + 171: "SHARED_FUNCTION_INFO_TYPE", + 172: "JS_MESSAGE_OBJECT_TYPE", + 175: "JS_VALUE_TYPE", + 176: "JS_DATE_TYPE", + 177: "JS_OBJECT_TYPE", + 178: "JS_CONTEXT_EXTENSION_OBJECT_TYPE", + 179: "JS_GENERATOR_OBJECT_TYPE", + 180: "JS_MODULE_TYPE", + 181: "JS_GLOBAL_OBJECT_TYPE", + 182: "JS_BUILTINS_OBJECT_TYPE", + 183: "JS_GLOBAL_PROXY_TYPE", + 184: "JS_ARRAY_TYPE", + 185: "JS_ARRAY_BUFFER_TYPE", + 186: "JS_TYPED_ARRAY_TYPE", + 187: "JS_DATA_VIEW_TYPE", + 174: "JS_PROXY_TYPE", + 190: "JS_WEAK_MAP_TYPE", + 191: "JS_WEAK_SET_TYPE", + 192: "JS_REGEXP_TYPE", + 193: "JS_FUNCTION_TYPE", + 173: "JS_FUNCTION_PROXY_TYPE", + 168: "DEBUG_INFO_TYPE", + 169: "BREAK_POINT_INFO_TYPE", +} + +# List of known V8 maps. +KNOWN_MAPS = { + 0x08081: (136, "ByteArrayMap"), + 0x080a9: (129, "MetaMap"), + 0x080d1: (131, "OddballMap"), + 0x080f9: (4, "AsciiInternalizedStringMap"), + 0x08121: (170, "FixedArrayMap"), + 0x08149: (134, "HeapNumberMap"), + 0x08171: (137, "FreeSpaceMap"), + 0x08199: (148, "OnePointerFillerMap"), + 0x081c1: (148, "TwoPointerFillerMap"), + 0x081e9: (132, "CellMap"), + 0x08211: (133, "GlobalPropertyCellMap"), + 0x08239: (171, "SharedFunctionInfoMap"), + 0x08261: (170, "NativeContextMap"), + 0x08289: (130, "CodeMap"), + 0x082b1: (170, "ScopeInfoMap"), + 0x082d9: (170, "FixedCOWArrayMap"), + 0x08301: (147, "FixedDoubleArrayMap"), + 0x08329: (170, "HashTableMap"), + 0x08351: (128, "SymbolMap"), + 0x08379: (64, "StringMap"), + 0x083a1: (68, "AsciiStringMap"), + 0x083c9: (65, "ConsStringMap"), + 0x083f1: (69, "ConsAsciiStringMap"), + 0x08419: (67, "SlicedStringMap"), + 0x08441: (71, "SlicedAsciiStringMap"), + 0x08469: (66, "ExternalStringMap"), + 0x08491: (74, "ExternalStringWithOneByteDataMap"), + 0x084b9: (70, "ExternalAsciiStringMap"), + 0x084e1: (82, "ShortExternalStringMap"), + 0x08509: (90, "ShortExternalStringWithOneByteDataMap"), + 0x08531: (0, "InternalizedStringMap"), + 0x08559: (1, "ConsInternalizedStringMap"), + 0x08581: (5, "ConsAsciiInternalizedStringMap"), + 0x085a9: (2, "ExternalInternalizedStringMap"), + 0x085d1: (10, "ExternalInternalizedStringWithOneByteDataMap"), + 0x085f9: (6, "ExternalAsciiInternalizedStringMap"), + 0x08621: (18, "ShortExternalInternalizedStringMap"), + 0x08649: (26, "ShortExternalInternalizedStringWithOneByteDataMap"), + 0x08671: (22, "ShortExternalAsciiInternalizedStringMap"), + 0x08699: (86, "ShortExternalAsciiStringMap"), + 0x086c1: (64, "UndetectableStringMap"), + 0x086e9: (68, "UndetectableAsciiStringMap"), + 0x08711: (138, "ExternalByteArrayMap"), + 0x08739: (139, "ExternalUnsignedByteArrayMap"), + 0x08761: (140, "ExternalShortArrayMap"), + 0x08789: (141, "ExternalUnsignedShortArrayMap"), + 0x087b1: (142, "ExternalIntArrayMap"), + 0x087d9: (143, "ExternalUnsignedIntArrayMap"), + 0x08801: (144, "ExternalFloatArrayMap"), + 0x08829: (145, "ExternalDoubleArrayMap"), + 0x08851: (146, "ExternalPixelArrayMap"), + 0x08879: (170, "NonStrictArgumentsElementsMap"), + 0x088a1: (170, "FunctionContextMap"), + 0x088c9: (170, "CatchContextMap"), + 0x088f1: (170, "WithContextMap"), + 0x08919: (170, "BlockContextMap"), + 0x08941: (170, "ModuleContextMap"), + 0x08969: (170, "GlobalContextMap"), + 0x08991: (172, "JSMessageObjectMap"), + 0x089b9: (135, "ForeignMap"), + 0x089e1: (177, "NeanderMap"), + 0x08a09: (161, "AllocationMementoMap"), + 0x08a31: (160, "AllocationSiteMap"), + 0x08a59: (164, "PolymorphicCodeCacheMap"), + 0x08a81: (162, "ScriptMap"), + 0x08ad1: (177, "ExternalMap"), + 0x08af9: (167, "BoxMap"), + 0x08b21: (149, "DeclaredAccessorDescriptorMap"), + 0x08b49: (150, "DeclaredAccessorInfoMap"), + 0x08b71: (151, "ExecutableAccessorInfoMap"), + 0x08b99: (152, "AccessorPairMap"), + 0x08bc1: (153, "AccessCheckInfoMap"), + 0x08be9: (154, "InterceptorInfoMap"), + 0x08c11: (155, "CallHandlerInfoMap"), + 0x08c39: (156, "FunctionTemplateInfoMap"), + 0x08c61: (157, "ObjectTemplateInfoMap"), + 0x08c89: (158, "SignatureInfoMap"), + 0x08cb1: (159, "TypeSwitchInfoMap"), + 0x08cd9: (163, "CodeCacheMap"), + 0x08d01: (165, "TypeFeedbackInfoMap"), + 0x08d29: (166, "AliasedArgumentsEntryMap"), + 0x08d51: (168, "DebugInfoMap"), + 0x08d79: (169, "BreakPointInfoMap"), +} + +# List of known V8 objects. +KNOWN_OBJECTS = { + ("OLD_POINTER_SPACE", 0x08081): "NullValue", + ("OLD_POINTER_SPACE", 0x08091): "UndefinedValue", + ("OLD_POINTER_SPACE", 0x080a1): "I18nTemplateTwo", + ("OLD_POINTER_SPACE", 0x080b1): "TrueValue", + ("OLD_POINTER_SPACE", 0x080c1): "FalseValue", + ("OLD_POINTER_SPACE", 0x080d1): "UninitializedValue", + ("OLD_POINTER_SPACE", 0x080e1): "NoInterceptorResultSentinel", + ("OLD_POINTER_SPACE", 0x080f1): "ArgumentsMarker", + ("OLD_POINTER_SPACE", 0x08101): "NumberStringCache", + ("OLD_POINTER_SPACE", 0x08909): "SingleCharacterStringCache", + ("OLD_POINTER_SPACE", 0x08d11): "StringSplitCache", + ("OLD_POINTER_SPACE", 0x09119): "RegExpMultipleCache", + ("OLD_POINTER_SPACE", 0x09521): "TerminationException", + ("OLD_POINTER_SPACE", 0x09531): "MessageListeners", + ("OLD_POINTER_SPACE", 0x0954d): "CodeStubs", + ("OLD_POINTER_SPACE", 0x0a9d9): "NonMonomorphicCache", + ("OLD_POINTER_SPACE", 0x0afed): "PolymorphicCodeCache", + ("OLD_POINTER_SPACE", 0x0aff5): "NativesSourceCache", + ("OLD_POINTER_SPACE", 0x0b035): "EmptyScript", + ("OLD_POINTER_SPACE", 0x0b06d): "IntrinsicFunctionNames", + ("OLD_POINTER_SPACE", 0x0e089): "ObservationState", + ("OLD_POINTER_SPACE", 0x0e095): "FrozenSymbol", + ("OLD_POINTER_SPACE", 0x0e0a1): "ElementsTransitionSymbol", + ("OLD_POINTER_SPACE", 0x0e0ad): "EmptySlowElementDictionary", + ("OLD_POINTER_SPACE", 0x0e249): "ObservedSymbol", + ("OLD_POINTER_SPACE", 0x27631): "StringTable", + ("OLD_DATA_SPACE", 0x08099): "EmptyDescriptorArray", + ("OLD_DATA_SPACE", 0x080a1): "EmptyFixedArray", + ("OLD_DATA_SPACE", 0x080a9): "NanValue", + ("OLD_DATA_SPACE", 0x08141): "EmptyByteArray", + ("OLD_DATA_SPACE", 0x08269): "EmptyExternalByteArray", + ("OLD_DATA_SPACE", 0x08275): "EmptyExternalUnsignedByteArray", + ("OLD_DATA_SPACE", 0x08281): "EmptyExternalShortArray", + ("OLD_DATA_SPACE", 0x0828d): "EmptyExternalUnsignedShortArray", + ("OLD_DATA_SPACE", 0x08299): "EmptyExternalIntArray", + ("OLD_DATA_SPACE", 0x082a5): "EmptyExternalUnsignedIntArray", + ("OLD_DATA_SPACE", 0x082b1): "EmptyExternalFloatArray", + ("OLD_DATA_SPACE", 0x082bd): "EmptyExternalDoubleArray", + ("OLD_DATA_SPACE", 0x082c9): "EmptyExternalPixelArray", + ("OLD_DATA_SPACE", 0x082d5): "InfinityValue", + ("OLD_DATA_SPACE", 0x082e1): "MinusZeroValue", + ("CODE_SPACE", 0x0eb41): "JsConstructEntryCode", + ("CODE_SPACE", 0x177a1): "JsEntryCode", +} diff --git a/tools/v8heapconst.py.tmpl b/tools/v8heapconst.py.tmpl new file mode 100644 index 0000000000..a773f47c8b --- /dev/null +++ b/tools/v8heapconst.py.tmpl @@ -0,0 +1,30 @@ +# Copyright 2013 the V8 project authors. All rights reserved. +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# This file is automatically generated from the V8 source and should not +# be modified manually, run 'make grokdump' instead to update this file. +