From 03c549e0392f92c02536d3f86d5e1d8dfa3435ac Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 1 Sep 2021 11:08:40 +0200 Subject: BASELINE: Update Chromium to 91.0.4472.160 Change-Id: I0def1f08a2412aeed79a9ab95dd50eb5c3f65f31 Reviewed-by: Allan Sandfeld Jensen --- chromium/gin/BUILD.gn | 7 +++ chromium/gin/context_holder.cc | 4 +- chromium/gin/converter.cc | 8 +-- chromium/gin/converter.h | 7 +-- chromium/gin/converter_unittest.cc | 24 ++++---- chromium/gin/gin_features.cc | 15 ++++- chromium/gin/gin_features.h | 4 ++ chromium/gin/isolate_holder.cc | 12 ++-- chromium/gin/shell_runner.cc | 6 +- chromium/gin/v8_initializer.cc | 109 ++++++++++++++++++------------------- chromium/gin/v8_platform.cc | 1 + 11 files changed, 112 insertions(+), 85 deletions(-) (limited to 'chromium/gin') diff --git a/chromium/gin/BUILD.gn b/chromium/gin/BUILD.gn index dfc59c17382..86ce11a6c61 100644 --- a/chromium/gin/BUILD.gn +++ b/chromium/gin/BUILD.gn @@ -172,4 +172,11 @@ test("gin_unittests") { deps += [ "//v8:v8_external_startup_data_assets" ] } } + + if (is_fuchsia) { + additional_manifest_fragments = [ + # TODO(crbug.com/1185811): Figure out why jit_capabilities is needed. + "//build/config/fuchsia/test/jit_capabilities.test-cmx", + ] + } } diff --git a/chromium/gin/context_holder.cc b/chromium/gin/context_holder.cc index 114871778ae..23cbc326558 100644 --- a/chromium/gin/context_holder.cc +++ b/chromium/gin/context_holder.cc @@ -4,6 +4,8 @@ #include "gin/public/context_holder.h" +#include + #include "base/check.h" #include "gin/per_context_data.h" @@ -22,7 +24,7 @@ void ContextHolder::SetContext(v8::Local context) { DCHECK(context_.IsEmpty()); context_.Reset(isolate_, context); context_.AnnotateStrongRetainer("gin::ContextHolder::context_"); - data_.reset(new PerContextData(this, context)); + data_ = std::make_unique(this, context); } } // namespace gin diff --git a/chromium/gin/converter.cc b/chromium/gin/converter.cc index 3498080ea5b..dd7bf46f85d 100644 --- a/chromium/gin/converter.cc +++ b/chromium/gin/converter.cc @@ -152,17 +152,17 @@ bool Converter::FromV8(Isolate* isolate, return true; } -Local Converter::ToV8(Isolate* isolate, - const base::string16& val) { +Local Converter::ToV8(Isolate* isolate, + const std::u16string& val) { return String::NewFromTwoByte(isolate, reinterpret_cast(val.data()), v8::NewStringType::kNormal, val.size()) .ToLocalChecked(); } -bool Converter::FromV8(Isolate* isolate, +bool Converter::FromV8(Isolate* isolate, Local val, - base::string16* out) { + std::u16string* out) { if (!val->IsString()) return false; Local str = Local::Cast(val); diff --git a/chromium/gin/converter.h b/chromium/gin/converter.h index 9e9db93e347..18068d8da0d 100644 --- a/chromium/gin/converter.h +++ b/chromium/gin/converter.h @@ -14,7 +14,6 @@ #include "base/check.h" #include "base/notreached.h" -#include "base/strings/string16.h" #include "base/strings/string_piece.h" #include "gin/gin_export.h" #include "v8/include/v8.h" @@ -123,12 +122,12 @@ struct GIN_EXPORT Converter { }; template <> -struct GIN_EXPORT Converter { +struct GIN_EXPORT Converter { static v8::Local ToV8(v8::Isolate* isolate, - const base::string16& val); + const std::u16string& val); static bool FromV8(v8::Isolate* isolate, v8::Local val, - base::string16* out); + std::u16string* out); }; template <> diff --git a/chromium/gin/converter_unittest.cc b/chromium/gin/converter_unittest.cc index 162572385bd..f3f57bed24d 100644 --- a/chromium/gin/converter_unittest.cc +++ b/chromium/gin/converter_unittest.cc @@ -8,9 +8,10 @@ #include #include +#include + #include "base/compiler_specific.h" #include "base/stl_util.h" -#include "base/strings/string16.h" #include "base/strings/utf_string_conversions.h" #include "gin/function_template.h" #include "gin/handle.h" @@ -87,24 +88,23 @@ TEST_F(ConverterTest, String16) { HandleScope handle_scope(isolate); - EXPECT_TRUE(Converter::ToV8(isolate, base::ASCIIToUTF16("")) + EXPECT_TRUE(Converter::ToV8(isolate, u"") ->StrictEquals(StringToV8(isolate, ""))); - EXPECT_TRUE( - Converter::ToV8(isolate, base::ASCIIToUTF16("hello")) - ->StrictEquals(StringToV8(isolate, "hello"))); + EXPECT_TRUE(Converter::ToV8(isolate, u"hello") + ->StrictEquals(StringToV8(isolate, "hello"))); - base::string16 result; + std::u16string result; ASSERT_FALSE( - Converter::FromV8(isolate, v8::False(isolate), &result)); + Converter::FromV8(isolate, v8::False(isolate), &result)); ASSERT_FALSE( - Converter::FromV8(isolate, v8::True(isolate), &result)); - ASSERT_TRUE(Converter::FromV8( + Converter::FromV8(isolate, v8::True(isolate), &result)); + ASSERT_TRUE(Converter::FromV8( isolate, v8::String::Empty(isolate), &result)); - EXPECT_EQ(result, base::string16()); - ASSERT_TRUE(Converter::FromV8( + EXPECT_EQ(result, std::u16string()); + ASSERT_TRUE(Converter::FromV8( isolate, StringToV8(isolate, "hello"), &result)); - EXPECT_EQ(result, base::ASCIIToUTF16("hello")); + EXPECT_EQ(result, u"hello"); } TEST_F(ConverterTest, Int32) { diff --git a/chromium/gin/gin_features.cc b/chromium/gin/gin_features.cc index a2137abed41..39bcfed6c13 100644 --- a/chromium/gin/gin_features.cc +++ b/chromium/gin/gin_features.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #include "gin/gin_features.h" +#include "base/metrics/field_trial_params.h" namespace features { @@ -16,7 +17,7 @@ const base::Feature kV8FlushBytecode{"V8FlushBytecode", // Enables finalizing streaming JS compilations on a background thread. const base::Feature kV8OffThreadFinalization{"V8OffThreadFinalization", - base::FEATURE_DISABLED_BY_DEFAULT}; + base::FEATURE_ENABLED_BY_DEFAULT}; // Enables lazy feedback allocation in V8. const base::Feature kV8LazyFeedbackAllocation{"V8LazyFeedbackAllocation", @@ -62,8 +63,20 @@ const base::Feature kV8Turboprop{"V8Turboprop", const base::Feature kV8Sparkplug{"V8Sparkplug", base::FEATURE_DISABLED_BY_DEFAULT}; +// Enables short builtin calls feature. +const base::Feature kV8ShortBuiltinCalls{"V8ShortBuiltinCalls", + base::FEATURE_ENABLED_BY_DEFAULT}; + // Enables fast API calls in TurboFan. const base::Feature kV8TurboFastApiCalls{"V8TurboFastApiCalls", base::FEATURE_DISABLED_BY_DEFAULT}; +// Artificially delays script execution. +const base::Feature kV8ScriptAblation{"V8ScriptAblation", + base::FEATURE_DISABLED_BY_DEFAULT}; +const base::FeatureParam kV8ScriptRunDelayOnceMs{ + &kV8ScriptAblation, "V8ScriptRunDelayOnceMs", 0}; +const base::FeatureParam kV8ScriptRunDelayMs{&kV8ScriptAblation, + "V8ScriptRunDelayMs", 0}; + } // namespace features diff --git a/chromium/gin/gin_features.h b/chromium/gin/gin_features.h index f1158d05dbb..f2d269b2dbc 100644 --- a/chromium/gin/gin_features.h +++ b/chromium/gin/gin_features.h @@ -25,6 +25,10 @@ GIN_EXPORT extern const base::Feature kV8ExperimentalRegexpEngine; GIN_EXPORT extern const base::Feature kV8TurboFastApiCalls; GIN_EXPORT extern const base::Feature kV8Turboprop; GIN_EXPORT extern const base::Feature kV8Sparkplug; +GIN_EXPORT extern const base::Feature kV8ScriptAblation; +GIN_EXPORT extern const base::FeatureParam kV8ScriptRunDelayOnceMs; +GIN_EXPORT extern const base::FeatureParam kV8ScriptRunDelayMs; +GIN_EXPORT extern const base::Feature kV8ShortBuiltinCalls; } // namespace features diff --git a/chromium/gin/isolate_holder.cc b/chromium/gin/isolate_holder.cc index 73435b1c2c0..08815f12ad8 100644 --- a/chromium/gin/isolate_holder.cc +++ b/chromium/gin/isolate_holder.cc @@ -62,13 +62,13 @@ IsolateHolder::IsolateHolder( CHECK(allocator) << "You need to invoke gin::IsolateHolder::Initialize first"; isolate_ = v8::Isolate::Allocate(); - isolate_data_.reset( - new PerIsolateData(isolate_, allocator, access_mode_, task_runner)); + isolate_data_ = std::make_unique(isolate_, allocator, + access_mode_, task_runner); if (isolate_creation_mode == IsolateCreationMode::kCreateSnapshot) { // This branch is called when creating a V8 snapshot for Blink. // Note SnapshotCreator calls isolate->Enter() in its construction. - snapshot_creator_.reset( - new v8::SnapshotCreator(isolate_, g_reference_table)); + snapshot_creator_ = + std::make_unique(isolate_, g_reference_table); DCHECK_EQ(isolate_, snapshot_creator_->GetIsolate()); } else { v8::Isolate::CreateParams params; @@ -91,8 +91,8 @@ IsolateHolder::IsolateHolder( // IsolateHolder, but only the first registration will have any effect. gin::V8SharedMemoryDumpProvider::Register(); - isolate_memory_dump_provider_.reset( - new V8IsolateMemoryDumpProvider(this, task_runner)); + isolate_memory_dump_provider_ = + std::make_unique(this, task_runner); } IsolateHolder::~IsolateHolder() { diff --git a/chromium/gin/shell_runner.cc b/chromium/gin/shell_runner.cc index f0524289537..e4e84a62270 100644 --- a/chromium/gin/shell_runner.cc +++ b/chromium/gin/shell_runner.cc @@ -4,6 +4,8 @@ #include "gin/shell_runner.h" +#include + #include "gin/converter.h" #include "gin/per_context_data.h" #include "gin/public/context_holder.h" @@ -49,7 +51,7 @@ ShellRunner::ShellRunner(ShellRunnerDelegate* delegate, Isolate* isolate) v8::Local context = Context::New(isolate, NULL, delegate_->GetGlobalTemplate(this, isolate)); - context_holder_.reset(new ContextHolder(isolate)); + context_holder_ = std::make_unique(isolate); context_holder_->SetContext(context); PerContextData::From(context)->set_runner(this); @@ -63,7 +65,7 @@ void ShellRunner::Run(const std::string& source, const std::string& resource_name) { v8::Isolate* isolate = GetContextHolder()->isolate(); TryCatch try_catch(isolate); - v8::ScriptOrigin origin(StringToV8(isolate, resource_name)); + v8::ScriptOrigin origin(isolate, StringToV8(isolate, resource_name)); auto maybe_script = Script::Compile(GetContextHolder()->context(), StringToV8(isolate, source), &origin); v8::Local