Reviewers: Michael Starzinger,

Message:
Committed patchset #1 manually as r17060.

Description:
build fix for 17049

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

[email protected]
BUG=

Committed: https://code.google.com/p/v8/source/detail?r=17060

Please review this at https://codereview.chromium.org/25611003/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+9, -2 lines):
  M src/api.cc
  M src/isolate.h
  M src/isolate.cc


Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 4d221bf365bf3820697b829d064014b4c8a9ac86..734a7e9db88f94933a61712cff0d73c5884937d4 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*>(isolate);
 }

Index: src/isolate.cc
diff --git a/src/isolate.cc b/src/isolate.cc
index 7e0c36aca3c27f1885a34517114f86046f3131e2..f86d5dc143b4e898eeee294733c79f66ab5f02b4 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<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);
   }
Index: src/isolate.h
diff --git a/src/isolate.h b/src/isolate.h
index 54d313fb5d3fb27f208a9cbe4246f2285698bf3f..bc38fbf59f81bcfdd289fa011c3dba7c2ac96221 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();


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to