diff options
author | Myles Borins <mylesborins@google.com> | 2017-08-01 11:36:44 -0500 |
---|---|---|
committer | Myles Borins <mylesborins@google.com> | 2017-08-01 15:23:15 -0500 |
commit | 0a66b223e149a841669bfad5598e4254589730cb (patch) | |
tree | 5ec050f7f78aafbf5b1e0e50d639fb843141e162 /deps/v8/test/mkgrokdump | |
parent | 1782b3836ba58ef0da6b687f2bb970c0bd8199ad (diff) | |
download | node-new-0a66b223e149a841669bfad5598e4254589730cb.tar.gz |
deps: update V8 to 6.0.286.52
PR-URL: https://github.com/nodejs/node/pull/14004
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'deps/v8/test/mkgrokdump')
-rw-r--r-- | deps/v8/test/mkgrokdump/BUILD.gn | 27 | ||||
-rw-r--r-- | deps/v8/test/mkgrokdump/DEPS | 3 | ||||
-rw-r--r-- | deps/v8/test/mkgrokdump/README | 3 | ||||
-rw-r--r-- | deps/v8/test/mkgrokdump/mkgrokdump.cc | 133 | ||||
-rw-r--r-- | deps/v8/test/mkgrokdump/mkgrokdump.gyp | 46 | ||||
-rw-r--r-- | deps/v8/test/mkgrokdump/mkgrokdump.isolate | 17 | ||||
-rw-r--r-- | deps/v8/test/mkgrokdump/mkgrokdump.status | 10 | ||||
-rw-r--r-- | deps/v8/test/mkgrokdump/testcfg.py | 49 |
8 files changed, 288 insertions, 0 deletions
diff --git a/deps/v8/test/mkgrokdump/BUILD.gn b/deps/v8/test/mkgrokdump/BUILD.gn new file mode 100644 index 0000000000..5359f675d0 --- /dev/null +++ b/deps/v8/test/mkgrokdump/BUILD.gn @@ -0,0 +1,27 @@ +# Copyright 2017 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. + +import("../../gni/v8.gni") + +v8_executable("mkgrokdump") { + testonly = true + + # mkgrokdump is used to create tools/v8heapconst.py. + + sources = [ + "mkgrokdump.cc", + ] + + configs = [ "../..:internal_config_base" ] + + defines = [] + + deps = [ + "../..:v8", + "../..:v8_libbase", + "../..:v8_libplatform", + "//build/config:exe_and_shlib_deps", + "//build/win:default_exe_manifest", + ] +} diff --git a/deps/v8/test/mkgrokdump/DEPS b/deps/v8/test/mkgrokdump/DEPS new file mode 100644 index 0000000000..3e73aa244f --- /dev/null +++ b/deps/v8/test/mkgrokdump/DEPS @@ -0,0 +1,3 @@ +include_rules = [ + "+src", +] diff --git a/deps/v8/test/mkgrokdump/README b/deps/v8/test/mkgrokdump/README new file mode 100644 index 0000000000..2ee5ab099f --- /dev/null +++ b/deps/v8/test/mkgrokdump/README @@ -0,0 +1,3 @@ +If you change the heap layout, expect this test to fail (in CQ). You will then +need to build x64 release and run `<outdir>/mkgrokdump > tools/v8heapconst.py` +to rebaseline. diff --git a/deps/v8/test/mkgrokdump/mkgrokdump.cc b/deps/v8/test/mkgrokdump/mkgrokdump.cc new file mode 100644 index 0000000000..e5a41a13ba --- /dev/null +++ b/deps/v8/test/mkgrokdump/mkgrokdump.cc @@ -0,0 +1,133 @@ +// 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(); + i::PrintF("%s", kHeader); +#define DUMP_TYPE(T) i::PrintF(" %d: \"%s\",\n", i::T, #T); + i::PrintF("INSTANCE_TYPES = {\n"); + INSTANCE_TYPE_LIST(DUMP_TYPE) + i::PrintF("}\n"); +#undef DUMP_TYPE + + // 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); + } + 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"); +#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); + i::PrintF("KNOWN_OBJECTS = {\n"); + for (i::PagedSpace* s = spit.next(); s != NULL; s = spit.next()) { + i::HeapObjectIterator it(s); + // Code objects are generally platform-dependent. + if (s->identity() == i::CODE_SPACE) continue; + 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; + i::PrintF(" (\"%s\", 0x%05" V8PRIxPTR "): \"%s\",\n", sname, p, n); + } + } + i::PrintF("}\n"); +#undef ROOT_LIST_CASE + + // Dump frame markers + i::PrintF("\n# List of known V8 Frame Markers.\n"); +#define DUMP_MARKER(T, class) i::PrintF(" \"%s\",\n", #T); + i::PrintF("FRAME_MARKERS = (\n"); + STACK_FRAME_TYPE_LIST(DUMP_MARKER) + i::PrintF(")\n"); +#undef DUMP_TYPE + } + + i::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]); } diff --git a/deps/v8/test/mkgrokdump/mkgrokdump.gyp b/deps/v8/test/mkgrokdump/mkgrokdump.gyp new file mode 100644 index 0000000000..56f9ad14e0 --- /dev/null +++ b/deps/v8/test/mkgrokdump/mkgrokdump.gyp @@ -0,0 +1,46 @@ +# Copyright 2017 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. + +{ + 'variables': { + 'v8_code': 1, + }, + 'includes': ['../../gypfiles/toolchain.gypi', '../../gypfiles/features.gypi'], + 'targets': [ + { + 'target_name': 'mkgrokdump', + 'type': 'executable', + 'dependencies': [ + '../../src/v8.gyp:v8', + '../../src/v8.gyp:v8_libbase', + '../../src/v8.gyp:v8_libplatform', + ], + 'include_dirs': [ + '../..', + ], + 'sources': [ + 'mkgrokdump.cc', + ], + }, + ], + 'conditions': [ + ['test_isolation_mode != "noop"', { + 'targets': [ + { + 'target_name': 'mkgrokdump_run', + 'type': 'none', + 'dependencies': [ + 'mkgrokdump', + ], + 'includes': [ + '../../gypfiles/isolate.gypi', + ], + 'sources': [ + 'mkgrokdump.isolate', + ], + }, + ], + }], + ], +} diff --git a/deps/v8/test/mkgrokdump/mkgrokdump.isolate b/deps/v8/test/mkgrokdump/mkgrokdump.isolate new file mode 100644 index 0000000000..b2cbc32551 --- /dev/null +++ b/deps/v8/test/mkgrokdump/mkgrokdump.isolate @@ -0,0 +1,17 @@ +# Copyright 2017 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. +{ + 'variables': { + 'files': [ + './mkgrokdump.status', + './testcfg.py', + '../../tools/v8heapconst.py', + '<(PRODUCT_DIR)/mkgrokdump<(EXECUTABLE_SUFFIX)', + ], + }, + 'includes': [ + '../../src/base.isolate', + '../../tools/testrunner/testrunner.isolate', + ], +} diff --git a/deps/v8/test/mkgrokdump/mkgrokdump.status b/deps/v8/test/mkgrokdump/mkgrokdump.status new file mode 100644 index 0000000000..8fd6a0417a --- /dev/null +++ b/deps/v8/test/mkgrokdump/mkgrokdump.status @@ -0,0 +1,10 @@ +# Copyright 2017 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. + +[ +# Only test for default mode x64. +['variant != default or arch != x64', { + '*': [SKIP], +}], # variant != default or arch != x64 +] diff --git a/deps/v8/test/mkgrokdump/testcfg.py b/deps/v8/test/mkgrokdump/testcfg.py new file mode 100644 index 0000000000..c47b59de4a --- /dev/null +++ b/deps/v8/test/mkgrokdump/testcfg.py @@ -0,0 +1,49 @@ +# Copyright 2017 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. + +import os +import difflib + +from testrunner.local import testsuite +from testrunner.objects import testcase + + +class MkGrokdump(testsuite.TestSuite): + + def __init__(self, name, root): + super(MkGrokdump, self).__init__(name, root) + + def ListTests(self, context): + test = testcase.TestCase(self, self.shell()) + return [test] + + def GetFlagsForTestCase(self, testcase, context): + return [] + + def IsFailureOutput(self, testcase): + output = testcase.output + v8_path = os.path.dirname(os.path.dirname(os.path.abspath(self.root))) + expected_path = os.path.join(v8_path, "tools", "v8heapconst.py") + with open(expected_path) as f: + expected = f.read() + expected_lines = expected.splitlines() + actual_lines = output.stdout.splitlines() + diff = difflib.unified_diff(expected_lines, actual_lines, lineterm="", + fromfile="expected_path") + diffstring = '\n'.join(diff) + if diffstring is not "": + if "generated from a non-shipping build" in output.stdout: + return False + if not "generated from a shipping build" in output.stdout: + output.stdout = "Unexpected output:\n\n" + output.stdout + return True + output.stdout = diffstring + return True + return False + + def shell(self): + return "mkgrokdump" + +def GetSuite(name, root): + return MkGrokdump(name, root) |