diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-11-18 16:35:47 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-11-18 15:45:54 +0000 |
commit | 32f5a1c56531e4210bc4cf8d8c7825d66e081888 (patch) | |
tree | eeeec6822f4d738d8454525233fd0e2e3a659e6d /chromium/gin | |
parent | 99677208ff3b216fdfec551fbe548da5520cd6fb (diff) | |
download | qtwebengine-chromium-32f5a1c56531e4210bc4cf8d8c7825d66e081888.tar.gz |
BASELINE: Update Chromium to 87.0.4280.67
Change-Id: Ib157360be8c2ffb2c73125751a89f60e049c1d54
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/gin')
-rw-r--r-- | chromium/gin/BUILD.gn | 6 | ||||
-rw-r--r-- | chromium/gin/gin_features.cc | 8 | ||||
-rw-r--r-- | chromium/gin/gin_features.h | 2 | ||||
-rw-r--r-- | chromium/gin/isolate_holder.cc | 2 | ||||
-rw-r--r-- | chromium/gin/v8_initializer.cc | 27 | ||||
-rw-r--r-- | chromium/gin/v8_isolate_memory_dump_provider.cc | 15 | ||||
-rw-r--r-- | chromium/gin/v8_platform.cc | 5 | ||||
-rw-r--r-- | chromium/gin/v8_platform_unittest.cc | 5 |
8 files changed, 58 insertions, 12 deletions
diff --git a/chromium/gin/BUILD.gn b/chromium/gin/BUILD.gn index d0489cdfad7..dfc59c17382 100644 --- a/chromium/gin/BUILD.gn +++ b/chromium/gin/BUILD.gn @@ -2,7 +2,6 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import("//build/config/allocator.gni") import("//testing/test.gni") import("//tools/v8_context_snapshot/v8_context_snapshot.gni") import("//v8/gni/v8.gni") @@ -86,7 +85,10 @@ component("gin") { frameworks = [ "CoreFoundation.framework" ] } - configs += [ "//v8:external_startup_data" ] + configs += [ + "//tools/v8_context_snapshot:use_v8_context_snapshot", + "//v8:external_startup_data", + ] } executable("gin_shell") { diff --git a/chromium/gin/gin_features.cc b/chromium/gin/gin_features.cc index a5bb3251e3c..b200a04e342 100644 --- a/chromium/gin/gin_features.cc +++ b/chromium/gin/gin_features.cc @@ -42,4 +42,12 @@ const base::Feature kV8ReduceConcurrentMarkingTasks{ const base::Feature kV8NoReclaimUnmodifiedWrappers{ "V8NoReclaimUnmodifiedWrappers", base::FEATURE_DISABLED_BY_DEFAULT}; +// Enables concurrent heap access and allocation. +const base::Feature kV8LocalHeaps{"V8LocalHeaps", + base::FEATURE_ENABLED_BY_DEFAULT}; + +// Enables TurboFan's direct heap access. +const base::Feature kV8TurboDirectHeapAccess{"V8TurboDirectHeapAccess", + base::FEATURE_ENABLED_BY_DEFAULT}; + } // namespace features diff --git a/chromium/gin/gin_features.h b/chromium/gin/gin_features.h index 1279aa3b247..0e2b51c83f3 100644 --- a/chromium/gin/gin_features.h +++ b/chromium/gin/gin_features.h @@ -19,6 +19,8 @@ GIN_EXPORT extern const base::Feature kV8PerContextMarkingWorklist; GIN_EXPORT extern const base::Feature kV8FlushEmbeddedBlobICache; GIN_EXPORT extern const base::Feature kV8ReduceConcurrentMarkingTasks; GIN_EXPORT extern const base::Feature kV8NoReclaimUnmodifiedWrappers; +GIN_EXPORT extern const base::Feature kV8LocalHeaps; +GIN_EXPORT extern const base::Feature kV8TurboDirectHeapAccess; } // namespace features diff --git a/chromium/gin/isolate_holder.cc b/chromium/gin/isolate_holder.cc index 13f6369429c..73435b1c2c0 100644 --- a/chromium/gin/isolate_holder.cc +++ b/chromium/gin/isolate_holder.cc @@ -81,6 +81,8 @@ IsolateHolder::IsolateHolder( atomics_wait_mode == AllowAtomicsWaitMode::kAllowAtomicsWait; params.external_references = g_reference_table; params.only_terminate_in_safe_scope = true; + params.embedder_wrapper_type_index = kWrapperInfoIndex; + params.embedder_wrapper_object_index = kEncodedValueIndex; v8::Isolate::Initialize(isolate_, params); } diff --git a/chromium/gin/v8_initializer.cc b/chromium/gin/v8_initializer.cc index 3484c3f307f..4174fd98f3a 100644 --- a/chromium/gin/v8_initializer.cc +++ b/chromium/gin/v8_initializer.cc @@ -76,7 +76,9 @@ const char kSnapshotFileName32[] = "snapshot_blob_32.bin"; #endif #else // defined(OS_ANDROID) -const char kV8ContextSnapshotFileName[] = "v8_context_snapshot.bin"; +#if defined(USE_V8_CONTEXT_SNAPSHOT) +const char kV8ContextSnapshotFileName[] = V8_CONTEXT_SNAPSHOT_FILENAME; +#endif const char kSnapshotFileName[] = "snapshot_blob.bin"; #endif // defined(OS_ANDROID) @@ -86,7 +88,12 @@ const char* GetSnapshotFileName( case V8Initializer::V8SnapshotFileType::kDefault: return kSnapshotFileName; case V8Initializer::V8SnapshotFileType::kWithAdditionalContext: +#if defined(USE_V8_CONTEXT_SNAPSHOT) return kV8ContextSnapshotFileName; +#else + NOTREACHED(); + return nullptr; +#endif } NOTREACHED(); return nullptr; @@ -263,6 +270,24 @@ void V8Initializer::Initialize(IsolateHolder::ScriptMode mode) { sizeof(no_reclaim_unmodified_wrappers) - 1); } + if (!base::FeatureList::IsEnabled(features::kV8LocalHeaps)) { + // The --local-heaps flag is enabled by default, so we need to explicitly + // disable it if kV8LocalHeaps is disabled. + static constexpr char no_local_heaps[] = "--no-local-heaps"; + v8::V8::SetFlagsFromString(no_local_heaps, sizeof(no_local_heaps) - 1); + + // Also disable TurboFan's direct access if local heaps are not enabled. + static constexpr char no_direct_access[] = "--no-turbo-direct-heap-access"; + v8::V8::SetFlagsFromString(no_direct_access, sizeof(no_direct_access) - 1); + } + + if (!base::FeatureList::IsEnabled(features::kV8TurboDirectHeapAccess)) { + // The --turbo-direct-heap-access flag is enabled by default, so we need to + // explicitly disable it if kV8TurboDirectHeapAccess is disabled. + static constexpr char no_direct_access[] = "--no-turbo-direct-heap-access"; + v8::V8::SetFlagsFromString(no_direct_access, sizeof(no_direct_access) - 1); + } + if (IsolateHolder::kStrictMode == mode) { static const char use_strict[] = "--use_strict"; v8::V8::SetFlagsFromString(use_strict, sizeof(use_strict) - 1); diff --git a/chromium/gin/v8_isolate_memory_dump_provider.cc b/chromium/gin/v8_isolate_memory_dump_provider.cc index e80b8d4173b..8df3b0f5e86 100644 --- a/chromium/gin/v8_isolate_memory_dump_provider.cc +++ b/chromium/gin/v8_isolate_memory_dump_provider.cc @@ -167,6 +167,8 @@ void V8IsolateMemoryDumpProvider::DumpHeapStatistics( // Dump statistics of the heap's spaces. v8::HeapStatistics heap_statistics; + // The total heap sizes should be sampled before the individual space sizes + // because of concurrent allocation. DCHECKs below rely on this order. isolate_holder_->isolate()->GetHeapStatistics(&heap_statistics); IsolateHolder::IsolateType isolate_type = isolate_holder_->isolate_type(); @@ -210,10 +212,12 @@ void V8IsolateMemoryDumpProvider::DumpHeapStatistics( space_used_size); } - // Sanity checks. - DCHECK_EQ(heap_statistics.total_physical_size(), known_spaces_physical_size); - DCHECK_EQ(heap_statistics.used_heap_size(), known_spaces_used_size); - DCHECK_EQ(heap_statistics.total_heap_size(), known_spaces_size); + // Sanity checks that all spaces are accounted for in GetHeapSpaceStatistics. + // Background threads may be running and allocating concurrently, so the sum + // of space sizes may be exceed the total heap size that was sampled earlier. + DCHECK_LE(heap_statistics.total_physical_size(), known_spaces_physical_size); + DCHECK_LE(heap_statistics.used_heap_size(), known_spaces_used_size); + DCHECK_LE(heap_statistics.total_heap_size(), known_spaces_size); // If V8 zaps garbage, all the memory mapped regions become resident, // so we add an extra dump to avoid mismatches w.r.t. the total @@ -223,8 +227,7 @@ void V8IsolateMemoryDumpProvider::DumpHeapStatistics( dump_base_name + "/zapped_for_debug" + dump_name_suffix); zap_dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, base::trace_event::MemoryAllocatorDump::kUnitsBytes, - heap_statistics.total_heap_size() - - heap_statistics.total_physical_size()); + known_spaces_size - known_spaces_physical_size); } // Dump statistics about malloced memory. diff --git a/chromium/gin/v8_platform.cc b/chromium/gin/v8_platform.cc index 1d5158d2adc..319dca5afc2 100644 --- a/chromium/gin/v8_platform.cc +++ b/chromium/gin/v8_platform.cc @@ -202,10 +202,10 @@ class PageAllocator : public v8::PageAllocator { ~PageAllocator() override = default; size_t AllocatePageSize() override { - return base::kPageAllocationGranularity; + return base::PageAllocationGranularity(); } - size_t CommitPageSize() override { return base::kSystemPageSize; } + size_t CommitPageSize() override { return base::SystemPageSize(); } void SetRandomMmapSeed(int64_t seed) override { base::SetMmapSeedForTesting(seed); @@ -284,6 +284,7 @@ class JobDelegateImpl : public v8::JobDelegate { delegate_->NotifyConcurrencyIncrease(); } uint8_t GetTaskId() override { return delegate_->GetTaskId(); } + bool IsJoiningThread() const override { return delegate_->IsJoiningThread(); } private: base::JobDelegate* delegate_; diff --git a/chromium/gin/v8_platform_unittest.cc b/chromium/gin/v8_platform_unittest.cc index d2ea2b7768c..8dbfbd4342e 100644 --- a/chromium/gin/v8_platform_unittest.cc +++ b/chromium/gin/v8_platform_unittest.cc @@ -74,7 +74,10 @@ TEST(V8PlatformTest, PostJobSimple) { explicit Task(std::atomic_size_t* num_tasks_to_run) : num_tasks_to_run(num_tasks_to_run) {} void Run(v8::JobDelegate* delegate) override { --(*num_tasks_to_run); } - size_t GetMaxConcurrency() const override { return *num_tasks_to_run; } + + size_t GetMaxConcurrency(size_t /* worker_count*/) const override { + return *num_tasks_to_run; + } std::atomic_size_t* num_tasks_to_run; }; |