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

Unified Diff: src/isolate.h

Issue 2860009: [Isolates] Add a preprocessor flag to guard using TLS for the global isolate.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: fixes Created 10 years, 6 months 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 | « no previous file | src/isolate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/isolate.h
===================================================================
--- src/isolate.h (revision 4885)
+++ src/isolate.h (working copy)
@@ -28,6 +28,8 @@
#ifndef V8_ISOLATE_H_
#define V8_ISOLATE_H_
+// #define V8_USE_TLS_FOR_GLOBAL_ISOLATE
+
#include "apiutils.h"
#include "heap.h"
#include "execution.h"
@@ -152,10 +154,24 @@
// Returns the single global isolate.
static Isolate* Current() {
- ASSERT(global_isolate != NULL);
- return global_isolate;
+#ifdef V8_USE_TLS_FOR_GLOBAL_ISOLATE
+ Isolate* isolate = reinterpret_cast<Isolate*>(
+ Thread::GetThreadLocal(global_isolate_key_));
+ if (isolate == NULL) {
+ isolate = InitThreadForGlobalIsolate();
+ ASSERT(isolate != NULL);
+ }
+ return isolate;
+#else
+ ASSERT(global_isolate_ != NULL);
+ return global_isolate_;
+#endif
}
+#ifdef V8_USE_TLS_FOR_GLOBAL_ISOLATE
+ static Isolate* InitThreadForGlobalIsolate();
+#endif
+
// Creates a new isolate (perhaps using a deserializer). Returns null
// on failure.
static Isolate* Create(Deserializer* des);
@@ -216,7 +232,11 @@
private:
Isolate();
- static Isolate* global_isolate;
+#ifdef V8_USE_TLS_FOR_GLOBAL_ISOLATE
+ static Thread::LocalStorageKey global_isolate_key_;
+#endif
+ static Isolate* global_isolate_;
+
// TODO(isolates): Access to this global counter should be serialized.
static int number_of_isolates_;
« no previous file with comments | « no previous file | src/isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698