Commit 60db8fd1 authored by dcarney@chromium.org's avatar dcarney@chromium.org

build fix for 17049

instantiate default isolate on v8::Isolate::GetCurrent()

TBR=mstarzinger@chromium.org
BUG=

Review URL: https://codereview.chromium.org/25611003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17060 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 80b0ec57
......@@ -6487,6 +6487,10 @@ void V8::CancelTerminateExecution(Isolate* isolate) {
Isolate* Isolate::GetCurrent() {
i::Isolate* isolate = i::Isolate::UncheckedCurrent();
if (isolate == NULL) {
isolate = i::Isolate::EnsureDefaultIsolate(true);
ASSERT(isolate == i::Isolate::UncheckedCurrent());
}
return reinterpret_cast<Isolate*>(isolate);
}
......
......@@ -390,10 +390,13 @@ void Isolate::SetCrashIfDefaultIsolateInitialized() {
}
Isolate* Isolate::EnsureDefaultIsolate() {
Isolate* Isolate::EnsureDefaultIsolate(bool must_be_null) {
static Isolate* default_isolate_ = NULL;
LockGuard<Mutex> lock_guard(&process_wide_mutex_);
CHECK(default_isolate_status_ != kDefaultIsolateCrashIfInitialized);
if (must_be_null) {
CHECK(default_isolate_ == NULL);
}
if (default_isolate_ == NULL) {
default_isolate_ = new Isolate(true);
}
......
......@@ -498,7 +498,7 @@ class Isolate {
// allocated. It is only necessary to call this method in rare cases, for
// example if you are using V8 from within the body of a static initializer.
// Safe to call multiple times.
static Isolate* EnsureDefaultIsolate();
static Isolate* EnsureDefaultIsolate(bool must_be_null = false);
// Initialize all thread local variables
static void InitializeThreadLocalStorage();
......
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