Commit 9473d2a0 authored by Andreas Haas's avatar Andreas Haas Committed by Commit Bot

[v8] Use the new isolate initialization api

At the moment, the isolate is allocated and initialized in a single
step. This has the downside that the platform cannot register the
isolate before the isolate gets initialized, and therefore the platform
is not available for the isolate during initialization. With this CL we
register the uninitialized isolate on the platform and initialize the
isolate after that.

This change is needed to allow the creation of task runners already
during the initialization of the isolate.

The related V8 CL: https://crrev.com/c/1014044

R=yangguo@chromium.org

Change-Id: I7a18d1e91f53d728b40a68152e3a3dcb84cf34bb
Reviewed-on: https://chromium-review.googlesource.com/1015020Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarJeremy Roman <jbroman@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#555418}
parent 3402ee5a
......@@ -55,11 +55,15 @@ IsolateHolder::IsolateHolder(
v8::ArrayBuffer::Allocator* allocator = g_array_buffer_allocator;
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));
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(g_reference_table));
isolate_ = snapshot_creator_->GetIsolate();
snapshot_creator_.reset(
new v8::SnapshotCreator(isolate_, g_reference_table));
DCHECK_EQ(isolate_, snapshot_creator_->GetIsolate());
} else {
v8::Isolate::CreateParams params;
params.entry_hook = DebugImpl::GetFunctionEntryHook();
......@@ -73,11 +77,9 @@ IsolateHolder::IsolateHolder(
params.external_references = g_reference_table;
params.only_terminate_in_safe_scope = true;
isolate_ = v8::Isolate::New(params);
v8::Isolate::Initialize(isolate_, params);
}
isolate_data_.reset(
new PerIsolateData(isolate_, allocator, access_mode_, task_runner));
isolate_memory_dump_provider_.reset(
new V8IsolateMemoryDumpProvider(this, task_runner));
#if defined(OS_WIN)
......
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