Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(634)

Unified Diff: src/isolate.h

Issue 758043002: Document that Isolate::GetCurrent() must not be called before initialization (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/v8.h ('k') | src/isolate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
« no previous file with comments | « include/v8.h ('k') | src/isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698