diff options
author | Michaël Zasso <targos@protonmail.com> | 2020-11-13 12:51:53 +0100 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2020-11-15 16:46:54 +0100 |
commit | 48db20f6f53060e38b2272566b014741eb4f519f (patch) | |
tree | e2f9b4c7f69d2e4597b73b4c3c09f4371d5cc963 /deps/v8/test/cctest/test-heap-profiler.cc | |
parent | 79916428a48df937aa5b2b69c061d2d42181a76b (diff) | |
download | node-new-48db20f6f53060e38b2272566b014741eb4f519f.tar.gz |
deps: update V8 to 8.7.220
PR-URL: https://github.com/nodejs/node/pull/35700
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
Diffstat (limited to 'deps/v8/test/cctest/test-heap-profiler.cc')
-rw-r--r-- | deps/v8/test/cctest/test-heap-profiler.cc | 62 |
1 files changed, 9 insertions, 53 deletions
diff --git a/deps/v8/test/cctest/test-heap-profiler.cc b/deps/v8/test/cctest/test-heap-profiler.cc index 76b8e8eddf..9eff4cbfc1 100644 --- a/deps/v8/test/cctest/test-heap-profiler.cc +++ b/deps/v8/test/cctest/test-heap-profiler.cc @@ -55,6 +55,7 @@ using i::ArrayVector; using i::SourceLocation; using i::Vector; using v8::base::Optional; +using v8::internal::heap::GrowNewSpaceToMaximumCapacity; namespace { @@ -1263,6 +1264,9 @@ static TestStatsStream GetHeapStatsUpdate( TEST(HeapSnapshotObjectsStats) { + // Concurrent allocation might break results + v8::internal::FLAG_stress_concurrent_allocation = false; + LocalContext env; v8::HandleScope scope(env->GetIsolate()); v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler(); @@ -2442,27 +2446,18 @@ bool HasWeakGlobalHandle() { } -static void PersistentHandleCallback( - const v8::WeakCallbackInfo<v8::Persistent<v8::Object> >& data) { - data.GetParameter()->Reset(); -} - - TEST(WeakGlobalHandle) { LocalContext env; v8::HandleScope scope(env->GetIsolate()); CHECK(!HasWeakGlobalHandle()); - v8::Persistent<v8::Object> handle; + v8::Global<v8::Object> handle; handle.Reset(env->GetIsolate(), v8::Object::New(env->GetIsolate())); - handle.SetWeak(&handle, PersistentHandleCallback, - v8::WeakCallbackType::kParameter); + handle.SetWeak(); CHECK(HasWeakGlobalHandle()); - CcTest::CollectAllGarbage(); - EmptyMessageQueues(env->GetIsolate()); } @@ -3893,7 +3888,8 @@ TEST(SamplingHeapProfilerPretenuredInlineAllocations) { CcTest::InitializeVM(); if (!CcTest::i_isolate()->use_optimizer() || i::FLAG_always_opt) return; if (i::FLAG_gc_global || i::FLAG_stress_compaction || - i::FLAG_stress_incremental_marking) { + i::FLAG_stress_incremental_marking || + i::FLAG_stress_concurrent_allocation) { return; } @@ -3904,10 +3900,7 @@ TEST(SamplingHeapProfilerPretenuredInlineAllocations) { // Suppress randomness to avoid flakiness in tests. v8::internal::FLAG_sampling_heap_profiler_suppress_randomness = true; - // Grow new space until maximum capacity reached. - while (!CcTest::heap()->new_space()->IsAtMaximumCapacity()) { - CcTest::heap()->new_space()->Grow(); - } + GrowNewSpaceToMaximumCapacity(CcTest::heap()); i::ScopedVector<char> source(1024); i::SNPrintF(source, @@ -4126,40 +4119,3 @@ TEST(Bug8373_2) { heap_profiler->StopTrackingHeapObjects(); } - -TEST(HeapSnapshotDeleteDuringTakeSnapshot) { - // Check that a heap snapshot can be deleted during GC while another one - // is being taken. - - LocalContext env; - v8::HandleScope scope(env->GetIsolate()); - v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler(); - int gc_calls = 0; - v8::Global<v8::Object> handle; - - { - struct WeakData { - const v8::HeapSnapshot* snapshot; - int* gc_calls; - v8::Global<v8::Object>* handle; - }; - WeakData* data = - new WeakData{heap_profiler->TakeHeapSnapshot(), &gc_calls, &handle}; - - v8::HandleScope scope(env->GetIsolate()); - handle.Reset(env->GetIsolate(), v8::Object::New(env->GetIsolate())); - handle.SetWeak( - data, - [](const v8::WeakCallbackInfo<WeakData>& data) { - std::unique_ptr<WeakData> weakdata{data.GetParameter()}; - const_cast<v8::HeapSnapshot*>(weakdata->snapshot)->Delete(); - ++*weakdata->gc_calls; - weakdata->handle->Reset(); - }, - v8::WeakCallbackType::kParameter); - } - CHECK_EQ(gc_calls, 0); - - CHECK(ValidateSnapshot(heap_profiler->TakeHeapSnapshot())); - CHECK_EQ(gc_calls, 1); -} |