From b60eb45c82bb314df6340ae295d2578e647b72ae Mon Sep 17 00:00:00 2001 From: Clemens Hammacher Date: Wed, 23 Jan 2019 14:35:03 +0100 Subject: [PATCH] [cctest] Reenable V8 disposal This was disabled in 2014 (https://crrev.com/267383002), together with a comment about a broken serializer. The conditional v8 initialization was since then moved back to be unconditional, but the TearDown was never restored. Now we need it for wasm, since during tear down the wasm engine synchronizes on all background compile jobs. Omitting this leads to uses of the disposed platform (see https://crrev.com/c/1429861). R=mstarzinger@chromium.org Bug: v8:8689, v8:7921, v8:8725 Change-Id: Ia24f746094f38fc6ce349532587b622384379125 Reviewed-on: https://chromium-review.googlesource.com/c/1430059 Commit-Queue: Clemens Hammacher Reviewed-by: Michael Starzinger Cr-Commit-Position: refs/heads/master@{#59032} --- src/api.cc | 8 ++++++++ test/cctest/cctest.cc | 3 +-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/api.cc b/src/api.cc index 23b496706a..31e1f16eef 100644 --- a/src/api.cc +++ b/src/api.cc @@ -905,9 +905,17 @@ void RegisteredExtension::Register(RegisteredExtension* that) { void RegisteredExtension::UnregisterAll() { + // Keep a list of all leaked Extension objects, to suppress ASan leak reports. + // We cannot suppress via lsan suppressions, since the objects are allocated + // at different call sites. + // TODO(clemensh): Fix this (https://crbug.com/v8/8725). + static std::vector* leaked_extensions = + new std::vector; + RegisteredExtension* re = first_extension_; while (re != nullptr) { RegisteredExtension* next = re->next(); + leaked_extensions->push_back(re->extension_); delete re; re = next; } diff --git a/test/cctest/cctest.cc b/test/cctest/cctest.cc index ee03a66ea3..b4683222df 100644 --- a/test/cctest/cctest.cc +++ b/test/cctest/cctest.cc @@ -337,8 +337,7 @@ int main(int argc, char* argv[]) { if (print_run_count && tests_run != 1) printf("Ran %i tests.\n", tests_run); CcTest::TearDown(); - // TODO(svenpanne) See comment above. - // if (!disable_automatic_dispose_) v8::V8::Dispose(); + if (!disable_automatic_dispose_) v8::V8::Dispose(); v8::V8::ShutdownPlatform(); return 0; }