Index: src/isolate.h |
diff --git a/src/isolate.h b/src/isolate.h |
index b44cbb5c2724559fdc68703a533294bb78e123da..96e044596d29a67bc71aa4c746a44b0c2180f1ac 100644 |
--- a/src/isolate.h |
+++ b/src/isolate.h |
@@ -486,6 +486,7 @@ class Isolate { |
// Returns the isolate inside which the current thread is running. |
INLINE(static Isolate* Current()) { |
+ DCHECK(base::NoBarrier_Load(&isolate_key_created_) == 1); |
Isolate* isolate = reinterpret_cast<Isolate*>( |
base::Thread::GetExistingThreadLocal(isolate_key_)); |
DCHECK(isolate != NULL); |
@@ -493,6 +494,7 @@ class Isolate { |
} |
INLINE(static Isolate* UncheckedCurrent()) { |
+ DCHECK(base::NoBarrier_Load(&isolate_key_created_) == 1); |
return reinterpret_cast<Isolate*>( |
base::Thread::GetThreadLocal(isolate_key_)); |
} |
@@ -1177,6 +1179,10 @@ class Isolate { |
// A global counter for all generated Isolates, might overflow. |
static base::Atomic32 isolate_counter_; |
+#if DEBUG |
+ static base::Atomic32 isolate_key_created_; |
+#endif |
+ |
void Deinit(); |
static void SetIsolateThreadLocals(Isolate* isolate, |