diff options
author | Michaƫl Zasso <targos@protonmail.com> | 2018-01-24 20:16:06 +0100 |
---|---|---|
committer | Myles Borins <mylesborins@google.com> | 2018-01-24 15:02:20 -0800 |
commit | 4c4af643e5042d615a60c6bbc05aee9d81b903e5 (patch) | |
tree | 3fb0a97988fe4439ae3ae06f26915d1dcf8cab92 /deps/v8/test/cctest/cctest.cc | |
parent | fa9f31a4fda5a3782c652e56e394465805ebb50f (diff) | |
download | android-node-v8-4c4af643e5042d615a60c6bbc05aee9d81b903e5.tar.gz android-node-v8-4c4af643e5042d615a60c6bbc05aee9d81b903e5.tar.bz2 android-node-v8-4c4af643e5042d615a60c6bbc05aee9d81b903e5.zip |
deps: update V8 to 6.4.388.40
PR-URL: https://github.com/nodejs/node/pull/17489
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
Diffstat (limited to 'deps/v8/test/cctest/cctest.cc')
-rw-r--r-- | deps/v8/test/cctest/cctest.cc | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/deps/v8/test/cctest/cctest.cc b/deps/v8/test/cctest/cctest.cc index 45015a2b90..8d33884b5b 100644 --- a/deps/v8/test/cctest/cctest.cc +++ b/deps/v8/test/cctest/cctest.cc @@ -47,11 +47,11 @@ enum InitializationState { kUnset, kUninitialized, kInitialized }; static InitializationState initialization_state_ = kUnset; static bool disable_automatic_dispose_ = false; -CcTest* CcTest::last_ = NULL; +CcTest* CcTest::last_ = nullptr; bool CcTest::initialize_called_ = false; v8::base::Atomic32 CcTest::isolate_used_ = 0; -v8::ArrayBuffer::Allocator* CcTest::allocator_ = NULL; -v8::Isolate* CcTest::isolate_ = NULL; +v8::ArrayBuffer::Allocator* CcTest::allocator_ = nullptr; +v8::Isolate* CcTest::isolate_ = nullptr; CcTest::CcTest(TestFunction* callback, const char* file, const char* name, bool enabled, bool initialize) @@ -82,20 +82,30 @@ CcTest::CcTest(TestFunction* callback, const char* file, const char* name, void CcTest::Run() { if (!initialize_) { - CHECK(initialization_state_ != kInitialized); + CHECK_NE(initialization_state_, kInitialized); initialization_state_ = kUninitialized; - CHECK(CcTest::isolate_ == NULL); + CHECK_NULL(CcTest::isolate_); } else { - CHECK(initialization_state_ != kUninitialized); + CHECK_NE(initialization_state_, kUninitialized); initialization_state_ = kInitialized; - if (isolate_ == NULL) { + if (isolate_ == nullptr) { v8::Isolate::CreateParams create_params; create_params.array_buffer_allocator = allocator_; isolate_ = v8::Isolate::New(create_params); } isolate_->Enter(); } +#ifdef DEBUG + const size_t active_isolates = i::Isolate::non_disposed_isolates(); +#endif // DEBUG callback_(); +#ifdef DEBUG + // This DCHECK ensures that all Isolates are properly disposed after finishing + // the test. Stray Isolates lead to stray tasks in the platform which can + // interact weirdly when swapping in new platforms (for testing) or during + // shutdown. + DCHECK_EQ(active_isolates, i::Isolate::non_disposed_isolates()); +#endif // DEBUG if (initialize_) { if (v8::Locker::IsActive()) { v8::Locker locker(isolate_); @@ -142,7 +152,7 @@ void CcTest::InitializeVM() { } void CcTest::TearDown() { - if (isolate_ != NULL) isolate_->Dispose(); + if (isolate_ != nullptr) isolate_->Dispose(); } v8::Local<v8::Context> CcTest::NewContext(CcTestExtensionFlags extensions, @@ -208,7 +218,7 @@ HandleAndZoneScope::HandleAndZoneScope() HandleAndZoneScope::~HandleAndZoneScope() {} static void PrintTestList(CcTest* current) { - if (current == NULL) return; + if (current == nullptr) return; PrintTestList(current->prev()); printf("%s/%s\n", current->file(), current->name()); } @@ -253,8 +263,8 @@ int main(int argc, char* argv[]) { } v8::V8::InitializeICUDefaultLocation(argv[0]); - v8::Platform* platform = v8::platform::CreateDefaultPlatform(); - v8::V8::InitializePlatform(platform); + std::unique_ptr<v8::Platform> platform(v8::platform::NewDefaultPlatform()); + v8::V8::InitializePlatform(platform.get()); v8::internal::FlagList::SetFlagsFromCommandLine(&argc, argv, true); v8::V8::Initialize(); v8::V8::InitializeExternalStartupData(argv[0]); @@ -291,7 +301,7 @@ int main(int argc, char* argv[]) { char* file = arg_copy; char* name = testname + 1; CcTest* test = CcTest::last(); - while (test != NULL) { + while (test != nullptr) { if (test->enabled() && strcmp(test->file(), file) == 0 && strcmp(test->name(), name) == 0) { @@ -305,7 +315,7 @@ int main(int argc, char* argv[]) { // Run all tests with the specified file or test name. char* file_or_name = arg_copy; CcTest* test = CcTest::last(); - while (test != NULL) { + while (test != nullptr) { if (test->enabled() && (strcmp(test->file(), file_or_name) == 0 || strcmp(test->name(), file_or_name) == 0)) { @@ -324,9 +334,8 @@ int main(int argc, char* argv[]) { // TODO(svenpanne) See comment above. // if (!disable_automatic_dispose_) v8::V8::Dispose(); v8::V8::ShutdownPlatform(); - delete platform; return 0; } -RegisterThreadedTest *RegisterThreadedTest::first_ = NULL; +RegisterThreadedTest* RegisterThreadedTest::first_ = nullptr; int RegisterThreadedTest::count_ = 0; |