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

Unified Diff: src/isolate.h

Issue 24999002: lazy instantiation of the default isolate (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: nit Created 7 years, 3 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 | « src/api.cc ('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 8babed46f4eef960e09898f7181a6fc26e762a6f..1f477b330b27759399773fc5a34ed6ba226e86f5 100644
--- a/src/isolate.h
+++ b/src/isolate.h
@@ -491,14 +491,17 @@ class Isolate {
static void GlobalTearDown();
- bool IsDefaultIsolate() const { return this == default_isolate_; }
+ bool IsDefaultIsolate() const { return is_default_isolate_; }
static void SetCrashIfDefaultIsolateInitialized();
// Ensures that process-wide resources and the default isolate have been
// 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 void EnsureDefaultIsolate();
+ static Isolate* EnsureDefaultIsolate();
+
+ // Initialize all thread local variables
+ static void InitializeThreadLocalStorage();
// Find the PerThread for this particular (isolate, thread) combination
// If one does not yet exist, return null.
@@ -1124,8 +1127,12 @@ class Isolate {
// Given an address occupied by a live code object, return that object.
Object* FindCodeObject(Address a);
+ static Atomic32 GetLivingIsolates() {
+ return Acquire_Load(&living_isolates_);
+ }
+
private:
- Isolate();
+ explicit Isolate(bool is_default_isolate = false);
friend struct GlobalState;
friend struct InitializeGlobalState;
@@ -1190,11 +1197,11 @@ class Isolate {
static Thread::LocalStorageKey per_isolate_thread_data_key_;
static Thread::LocalStorageKey isolate_key_;
static Thread::LocalStorageKey thread_id_key_;
- static Isolate* default_isolate_;
static ThreadDataTable* thread_data_table_;
// A global counter for all generated Isolates, might overflow.
static Atomic32 isolate_counter_;
+ static Atomic32 living_isolates_;
void Deinit();
@@ -1306,6 +1313,9 @@ class Isolate {
// True if this isolate was initialized from a snapshot.
bool initialized_from_snapshot_;
+ // True only for the default isolate.
+ bool is_default_isolate_;
+
// Time stamp at initialization.
double time_millis_at_init_;
« no previous file with comments | « src/api.cc ('k') | src/isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698