Index: test/mkgrokdump/mkgrokdump.cc |
diff --git a/test/mkgrokdump/mkgrokdump.cc b/test/mkgrokdump/mkgrokdump.cc |
deleted file mode 100644 |
index 71da277d6e0cb67ea370f642c9061b575afaec41..0000000000000000000000000000000000000000 |
--- a/test/mkgrokdump/mkgrokdump.cc |
+++ /dev/null |
@@ -1,130 +0,0 @@ |
-// Copyright 2012 the V8 project authors. All rights reserved. |
-// Use of this source code is governed by a BSD-style license that can be |
-// found in the LICENSE file. |
- |
-#include <stdio.h> |
- |
-#include "include/libplatform/libplatform.h" |
-#include "include/v8.h" |
- |
-#include "src/frames.h" |
-#include "src/heap/heap.h" |
-#include "src/heap/spaces.h" |
-#include "src/isolate.h" |
-#include "src/objects-inl.h" |
- |
-namespace v8 { |
- |
-static const char* kHeader = |
- "# Copyright 2017 the V8 project authors. All rights reserved.\n" |
- "# Use of this source code is governed by a BSD-style license that can\n" |
- "# be found in the LICENSE file.\n" |
- "\n" |
- "# This file is automatically generated by mkgrokdump and should not\n" |
- "# be modified manually.\n" |
- "\n" |
- "# List of known V8 instance types.\n"; |
- |
-// Non-snapshot builds allocate objects to different places. |
-// Debug builds emit debug code, affecting code object sizes. |
-#if defined(V8_USE_SNAPSHOT) && !defined(DEBUG) |
-static const char* kBuild = "shipping"; |
-#else |
-static const char* kBuild = "non-shipping"; |
-#endif |
- |
-class MockArrayBufferAllocator : public v8::ArrayBuffer::Allocator { |
- public: |
- void* Allocate(size_t length) override { return nullptr; } |
- void* AllocateUninitialized(size_t length) override { return nullptr; } |
- void Free(void* p, size_t) override {} |
-}; |
- |
-static int DumpHeapConstants(const char* argv0) { |
- // Start up V8. |
- v8::Platform* platform = v8::platform::CreateDefaultPlatform(); |
- v8::V8::InitializePlatform(platform); |
- v8::V8::Initialize(); |
- v8::V8::InitializeExternalStartupData(argv0); |
- Isolate::CreateParams create_params; |
- MockArrayBufferAllocator mock_arraybuffer_allocator; |
- create_params.array_buffer_allocator = &mock_arraybuffer_allocator; |
- Isolate* isolate = Isolate::New(create_params); |
- { |
- Isolate::Scope scope(isolate); |
- i::Heap* heap = reinterpret_cast<i::Isolate*>(isolate)->heap(); |
- printf("%s", kHeader); |
-#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 (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()); |
- 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; |
- printf(" 0x%05" V8PRIxPTR ": (%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 (n == NULL && o == heap->name()) { \ |
- n = #camel_name; \ |
- i = i::Heap::k##camel_name##RootIndex; \ |
- } |
- 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; |
- i::Heap::RootListIndex i = i::Heap::kStrongRootListLength; |
- intptr_t p = reinterpret_cast<intptr_t>(o) & 0x7ffff; |
- ROOT_LIST(ROOT_LIST_CASE) |
- if (n == NULL) continue; |
- if (!i::Heap::RootIsImmortalImmovable(i)) continue; |
- printf(" (\"%s\", 0x%05" V8PRIxPTR "): \"%s\",\n", sname, p, n); |
- } |
- } |
- printf("}\n"); |
-#undef ROOT_LIST_CASE |
- |
- // Dump frame markers |
- printf("\n# List of known V8 Frame Markers.\n"); |
-#define DUMP_MARKER(T, class) printf(" \"%s\",\n", #T); |
- printf("FRAME_MARKERS = (\n"); |
- STACK_FRAME_TYPE_LIST(DUMP_MARKER) |
- printf(")\n"); |
-#undef DUMP_TYPE |
- } |
- |
- printf("\n# This set of constants is generated from a %s build.\n", kBuild); |
- |
- // Teardown. |
- isolate->Dispose(); |
- v8::V8::ShutdownPlatform(); |
- delete platform; |
- return 0; |
-} |
- |
-} // namespace v8 |
- |
-int main(int argc, char* argv[]) { return v8::DumpHeapConstants(argv[0]); } |