From: dcarney@chromium.org Date: Wed, 2 Oct 2013 07:55:52 +0000 (+0000) Subject: build fix for 17049 X-Git-Tag: upstream/4.7.83~12207 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=60db8fd14dcb010ff6eaf2bf539ddfbb54c40ab8;p=platform%2Fupstream%2Fv8.git 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 --- diff --git a/src/api.cc b/src/api.cc index 4d221bf36..734a7e9db 100644 --- a/src/api.cc +++ b/src/api.cc @@ -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); } diff --git a/src/isolate.cc b/src/isolate.cc index 7e0c36aca..f86d5dc14 100644 --- a/src/isolate.cc +++ b/src/isolate.cc @@ -390,10 +390,13 @@ void Isolate::SetCrashIfDefaultIsolateInitialized() { } -Isolate* Isolate::EnsureDefaultIsolate() { +Isolate* Isolate::EnsureDefaultIsolate(bool must_be_null) { static Isolate* default_isolate_ = NULL; LockGuard 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); } diff --git a/src/isolate.h b/src/isolate.h index 54d313fb5..bc38fbf59 100644 --- a/src/isolate.h +++ b/src/isolate.h @@ -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();