Revision: 17060
Author:   [email protected]
Date:     Wed Oct  2 07:55:52 2013 UTC
Log:      build fix for 17049

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

[email protected]
BUG=

Review URL: https://codereview.chromium.org/25611003
http://code.google.com/p/v8/source/detail?r=17060

Modified:
 /branches/bleeding_edge/src/api.cc
 /branches/bleeding_edge/src/isolate.cc
 /branches/bleeding_edge/src/isolate.h

=======================================
--- /branches/bleeding_edge/src/api.cc  Tue Oct  1 14:26:53 2013 UTC
+++ /branches/bleeding_edge/src/api.cc  Wed Oct  2 07:55:52 2013 UTC
@@ -6487,6 +6487,10 @@

 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);
 }

=======================================
--- /branches/bleeding_edge/src/isolate.cc      Tue Oct  1 18:00:02 2013 UTC
+++ /branches/bleeding_edge/src/isolate.cc      Wed Oct  2 07:55:52 2013 UTC
@@ -390,10 +390,13 @@
 }


-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);
   }
=======================================
--- /branches/bleeding_edge/src/isolate.h       Tue Oct  1 14:53:45 2013 UTC
+++ /branches/bleeding_edge/src/isolate.h       Wed Oct  2 07:55:52 2013 UTC
@@ -498,7 +498,7 @@
   // 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