Commit 1e7eb050 authored by Robert Liao's avatar Robert Liao Committed by Commit Bot

Revert "gin: Set V8 context snapshot as a default snapshot"

This reverts commit 231de835.

Reason for revert: This change seems to break per-build bisects on Windows.

Command run:
python bisect_builds.py -o -a win64 -g 64.0.3282.24 -b 65.0.3294.0 -p S:\src\bisect\profile --use-local-cache

Result:
You are probably looking for a change made after 522661 (known good), but no later than 522662 (first known bad).
CHANGELOG URL:
The script might not always return single CL as suspect as some perf builds might get missing due to failure.
  https://chromium.googlesource.com/chromium/src/+log/bf8135d0bce64496b872062a07b427ddff825ec5..231de835ae50977881282c8c7fbbc2a93388d4b6

Original change's description:
> gin: Set V8 context snapshot as a default snapshot
> 
> Thanks to the change in V8 to make external reference table optional,
> we can always use v8_context_snapshot.bin on platforms where it is
> avaiable.
> 
> This CL sets the file as the default snapshot blob, and removes
> setting snapshot in Isolate::CreateParam.
> 
> 
> Bug: 764576, 789964
> Change-Id: I16654eef810efcd0103e9a29659f4616c61f790b
> Reviewed-on: https://chromium-review.googlesource.com/802654
> Commit-Queue: Hitoshi Yoshida <peria@chromium.org>
> Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
> Reviewed-by: Kentaro Hara <haraken@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#522662}

TBR=peria@chromium.org,rmcilroy@chromium.org,haraken@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 764576, 789964
Change-Id: Ibe8ddd99b86fd00c2c2586645350401896c49084
Reviewed-on: https://chromium-review.googlesource.com/827705
Commit-Queue: Robert Liao <robliao@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarRobert Liao <robliao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#524261}
parent 9dc63392
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
import("//testing/test.gni") import("//testing/test.gni")
import("//v8/gni/v8.gni") import("//v8/gni/v8.gni")
import("//tools/v8_context_snapshot/v8_context_snapshot.gni")
component("gin") { component("gin") {
sources = [ sources = [
...@@ -74,9 +73,6 @@ component("gin") { ...@@ -74,9 +73,6 @@ component("gin") {
"$root_out_dir/natives_blob.bin", "$root_out_dir/natives_blob.bin",
"$root_out_dir/snapshot_blob.bin", "$root_out_dir/snapshot_blob.bin",
] ]
if (use_v8_context_snapshot) {
data += [ "$root_out_dir/v8_context_snapshot.bin" ]
}
} }
defines = [ "GIN_IMPLEMENTATION" ] defines = [ "GIN_IMPLEMENTATION" ]
...@@ -93,10 +89,7 @@ component("gin") { ...@@ -93,10 +89,7 @@ component("gin") {
libs = [ "CoreFoundation.framework" ] libs = [ "CoreFoundation.framework" ]
} }
configs += [ configs += [ "//v8:external_startup_data" ]
"//tools/v8_context_snapshot:use_v8_context_snapshot",
"//v8:external_startup_data",
]
} }
executable("gin_shell") { executable("gin_shell") {
...@@ -113,10 +106,7 @@ executable("gin_shell") { ...@@ -113,10 +106,7 @@ executable("gin_shell") {
"//v8", "//v8",
] ]
configs += [ configs += [ "//v8:external_startup_data" ]
"//tools/v8_context_snapshot:use_v8_context_snapshot",
"//v8:external_startup_data",
]
} }
source_set("gin_test") { source_set("gin_test") {
...@@ -132,14 +122,10 @@ source_set("gin_test") { ...@@ -132,14 +122,10 @@ source_set("gin_test") {
] ]
deps = [ deps = [
"//base/test:test_support", "//base/test:test_support",
"//tools/v8_context_snapshot",
"//v8", "//v8",
] ]
configs += [ configs += [ "//v8:external_startup_data" ]
"//tools/v8_context_snapshot:use_v8_context_snapshot",
"//v8:external_startup_data",
]
} }
test("gin_unittests") { test("gin_unittests") {
......
...@@ -38,12 +38,16 @@ IsolateHolder::IsolateHolder( ...@@ -38,12 +38,16 @@ IsolateHolder::IsolateHolder(
IsolateHolder::IsolateHolder( IsolateHolder::IsolateHolder(
scoped_refptr<base::SingleThreadTaskRunner> task_runner, scoped_refptr<base::SingleThreadTaskRunner> task_runner,
AccessMode access_mode) AccessMode access_mode)
: IsolateHolder(std::move(task_runner), access_mode, kAllowAtomicsWait) {} : IsolateHolder(std::move(task_runner),
access_mode,
kAllowAtomicsWait,
nullptr) {}
IsolateHolder::IsolateHolder( IsolateHolder::IsolateHolder(
scoped_refptr<base::SingleThreadTaskRunner> task_runner, scoped_refptr<base::SingleThreadTaskRunner> task_runner,
AccessMode access_mode, AccessMode access_mode,
AllowAtomicsWaitMode atomics_wait_mode) AllowAtomicsWaitMode atomics_wait_mode,
v8::StartupData* startup_data)
: access_mode_(access_mode) { : access_mode_(access_mode) {
v8::ArrayBuffer::Allocator* allocator = g_array_buffer_allocator; v8::ArrayBuffer::Allocator* allocator = g_array_buffer_allocator;
CHECK(allocator) << "You need to invoke gin::IsolateHolder::Initialize first"; CHECK(allocator) << "You need to invoke gin::IsolateHolder::Initialize first";
...@@ -56,6 +60,14 @@ IsolateHolder::IsolateHolder( ...@@ -56,6 +60,14 @@ IsolateHolder::IsolateHolder(
params.array_buffer_allocator = allocator; params.array_buffer_allocator = allocator;
params.allow_atomics_wait = atomics_wait_mode == kAllowAtomicsWait; params.allow_atomics_wait = atomics_wait_mode == kAllowAtomicsWait;
params.external_references = g_reference_table; params.external_references = g_reference_table;
if (startup_data) {
CHECK(g_reference_table);
V8Initializer::GetV8ContextSnapshotData(startup_data);
if (startup_data->data) {
params.snapshot_blob = startup_data;
}
}
isolate_ = v8::Isolate::New(params); isolate_ = v8::Isolate::New(params);
// TODO(ssid): Make sure the task runner is never null here, crbug.com/762723. // TODO(ssid): Make sure the task runner is never null here, crbug.com/762723.
......
...@@ -59,7 +59,8 @@ class GIN_EXPORT IsolateHolder { ...@@ -59,7 +59,8 @@ class GIN_EXPORT IsolateHolder {
AccessMode access_mode); AccessMode access_mode);
IsolateHolder(scoped_refptr<base::SingleThreadTaskRunner> task_runner, IsolateHolder(scoped_refptr<base::SingleThreadTaskRunner> task_runner,
AccessMode access_mode, AccessMode access_mode,
AllowAtomicsWaitMode atomics_wait_mode); AllowAtomicsWaitMode atomics_wait_mode,
v8::StartupData* startup_data);
// This constructor is to create V8 snapshot for Blink. // This constructor is to create V8 snapshot for Blink.
// Note this constructor calls isolate->Enter() internally. // Note this constructor calls isolate->Enter() internally.
......
...@@ -72,10 +72,7 @@ int main(int argc, char** argv) { ...@@ -72,10 +72,7 @@ int main(int argc, char** argv) {
#ifdef V8_USE_EXTERNAL_STARTUP_DATA #ifdef V8_USE_EXTERNAL_STARTUP_DATA
gin::V8Initializer::LoadV8Snapshot(); gin::V8Initializer::LoadV8Snapshot();
gin::V8Initializer::LoadV8Natives(); gin::V8Initializer::LoadV8Natives();
#ifdef USE_V8_CONTEXT_SNAPSHOT #endif
gin::V8Initializer::LoadV8ContextSnapshot();
#endif // USE_V8_CONTEXT_SNAPSHOT
#endif // V8_USE_EXTERNAL_STARTUP_DATA
base::MessageLoop message_loop; base::MessageLoop message_loop;
base::TaskScheduler::CreateAndStartWithDefaultParams("gin"); base::TaskScheduler::CreateAndStartWithDefaultParams("gin");
......
...@@ -32,9 +32,6 @@ TEST(RunnerTest, Run) { ...@@ -32,9 +32,6 @@ TEST(RunnerTest, Run) {
gin::V8Initializer::LoadV8Snapshot(); gin::V8Initializer::LoadV8Snapshot();
gin::V8Initializer::LoadV8Natives(); gin::V8Initializer::LoadV8Natives();
#endif #endif
#ifdef USE_V8_CONTEXT_SNAPSHOT
gin::V8Initializer::LoadV8ContextSnapshot();
#endif
gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode, gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode,
gin::IsolateHolder::kStableV8Extras, gin::IsolateHolder::kStableV8Extras,
......
...@@ -24,10 +24,6 @@ void V8Test::SetUp() { ...@@ -24,10 +24,6 @@ void V8Test::SetUp() {
gin::V8Initializer::LoadV8Snapshot(); gin::V8Initializer::LoadV8Snapshot();
gin::V8Initializer::LoadV8Natives(); gin::V8Initializer::LoadV8Natives();
#endif #endif
#ifdef USE_V8_CONTEXT_SNAPSHOT
gin::V8Initializer::LoadV8ContextSnapshot();
#endif
gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode, gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode,
gin::IsolateHolder::kStableV8Extras, gin::IsolateHolder::kStableV8Extras,
gin::ArrayBufferAllocator::SharedInstance()); gin::ArrayBufferAllocator::SharedInstance());
......
...@@ -242,22 +242,16 @@ void V8Initializer::Initialize(IsolateHolder::ScriptMode mode, ...@@ -242,22 +242,16 @@ void V8Initializer::Initialize(IsolateHolder::ScriptMode mode,
#if defined(V8_USE_EXTERNAL_STARTUP_DATA) #if defined(V8_USE_EXTERNAL_STARTUP_DATA)
v8::StartupData natives; v8::StartupData natives;
GetMappedFileData(g_mapped_natives, &natives); natives.data = reinterpret_cast<const char*>(g_mapped_natives->data());
natives.raw_size = static_cast<int>(g_mapped_natives->length());
v8::V8::SetNativesDataBlob(&natives); v8::V8::SetNativesDataBlob(&natives);
#if defined(USE_V8_CONTEXT_SNAPSHOT)
if (g_mapped_v8_context_snapshot) {
v8::StartupData snapshot{};
GetMappedFileData(g_mapped_v8_context_snapshot, &snapshot);
v8::V8::SetSnapshotDataBlob(&snapshot);
}
#else
if (g_mapped_snapshot) { if (g_mapped_snapshot) {
v8::StartupData snapshot{}; v8::StartupData snapshot;
GetMappedFileData(g_mapped_snapshot, &snapshot); snapshot.data = reinterpret_cast<const char*>(g_mapped_snapshot->data());
snapshot.raw_size = static_cast<int>(g_mapped_snapshot->length());
v8::V8::SetSnapshotDataBlob(&snapshot); v8::V8::SetSnapshotDataBlob(&snapshot);
} }
#endif // USE_V8_CONTEXT_SNAPSHOT
#endif // V8_USE_EXTERNAL_STARTUP_DATA #endif // V8_USE_EXTERNAL_STARTUP_DATA
v8::V8::SetEntropySource(&GenerateEntropy); v8::V8::SetEntropySource(&GenerateEntropy);
......
...@@ -62,10 +62,14 @@ V8PerIsolateData::V8PerIsolateData( ...@@ -62,10 +62,14 @@ V8PerIsolateData::V8PerIsolateData(
WebTaskRunner* task_runner, WebTaskRunner* task_runner,
V8ContextSnapshotMode v8_context_snapshot_mode) V8ContextSnapshotMode v8_context_snapshot_mode)
: v8_context_snapshot_mode_(v8_context_snapshot_mode), : v8_context_snapshot_mode_(v8_context_snapshot_mode),
isolate_holder_(task_runner, isolate_holder_(
gin::IsolateHolder::kSingleThread, task_runner,
IsMainThread() ? gin::IsolateHolder::kDisallowAtomicsWait gin::IsolateHolder::kSingleThread,
: gin::IsolateHolder::kAllowAtomicsWait), IsMainThread() ? gin::IsolateHolder::kDisallowAtomicsWait
: gin::IsolateHolder::kAllowAtomicsWait,
v8_context_snapshot_mode_ == V8ContextSnapshotMode::kUseSnapshot
? &startup_data_
: nullptr),
interface_template_map_for_v8_context_snapshot_(GetIsolate()), interface_template_map_for_v8_context_snapshot_(GetIsolate()),
string_cache_(WTF::WrapUnique(new StringCache(GetIsolate()))), string_cache_(WTF::WrapUnique(new StringCache(GetIsolate()))),
private_property_(V8PrivateProperty::Create()), private_property_(V8PrivateProperty::Create()),
...@@ -74,6 +78,13 @@ V8PerIsolateData::V8PerIsolateData( ...@@ -74,6 +78,13 @@ V8PerIsolateData::V8PerIsolateData(
is_handling_recursion_level_error_(false), is_handling_recursion_level_error_(false),
is_reporting_exception_(false), is_reporting_exception_(false),
runtime_call_stats_(base::DefaultTickClock::GetInstance()) { runtime_call_stats_(base::DefaultTickClock::GetInstance()) {
// If it fails to load the snapshot file, falls back to kDontUseSnapshot mode.
// TODO(peria): Remove this fallback routine.
if (v8_context_snapshot_mode_ == V8ContextSnapshotMode::kUseSnapshot &&
!startup_data_.data) {
v8_context_snapshot_mode_ = V8ContextSnapshotMode::kDontUseSnapshot;
}
// FIXME: Remove once all v8::Isolate::GetCurrent() calls are gone. // FIXME: Remove once all v8::Isolate::GetCurrent() calls are gone.
GetIsolate()->Enter(); GetIsolate()->Enter();
GetIsolate()->AddBeforeCallEnteredCallback(&BeforeCallEnteredCallback); GetIsolate()->AddBeforeCallEnteredCallback(&BeforeCallEnteredCallback);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment