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

Side by Side Diff: src/isolate.h

Issue 25697002: Revert "lazy instantiation of the default isolate" and "build fix for 17049". (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/api.cc ('k') | src/isolate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 // True if at least one thread Enter'ed this isolate. 484 // True if at least one thread Enter'ed this isolate.
485 bool IsInUse() { return entry_stack_ != NULL; } 485 bool IsInUse() { return entry_stack_ != NULL; }
486 486
487 // Destroys the non-default isolates. 487 // Destroys the non-default isolates.
488 // Sets default isolate into "has_been_disposed" state rather then destroying, 488 // Sets default isolate into "has_been_disposed" state rather then destroying,
489 // for legacy API reasons. 489 // for legacy API reasons.
490 void TearDown(); 490 void TearDown();
491 491
492 static void GlobalTearDown(); 492 static void GlobalTearDown();
493 493
494 bool IsDefaultIsolate() const { return is_default_isolate_; } 494 bool IsDefaultIsolate() const { return this == default_isolate_; }
495 495
496 static void SetCrashIfDefaultIsolateInitialized(); 496 static void SetCrashIfDefaultIsolateInitialized();
497 // Ensures that process-wide resources and the default isolate have been 497 // Ensures that process-wide resources and the default isolate have been
498 // allocated. It is only necessary to call this method in rare cases, for 498 // allocated. It is only necessary to call this method in rare cases, for
499 // example if you are using V8 from within the body of a static initializer. 499 // example if you are using V8 from within the body of a static initializer.
500 // Safe to call multiple times. 500 // Safe to call multiple times.
501 static Isolate* EnsureDefaultIsolate(bool must_be_null = false); 501 static void EnsureDefaultIsolate();
502
503 // Initialize all thread local variables
504 static void InitializeThreadLocalStorage();
505 502
506 // Find the PerThread for this particular (isolate, thread) combination 503 // Find the PerThread for this particular (isolate, thread) combination
507 // If one does not yet exist, return null. 504 // If one does not yet exist, return null.
508 PerIsolateThreadData* FindPerThreadDataForThisThread(); 505 PerIsolateThreadData* FindPerThreadDataForThisThread();
509 506
510 // Find the PerThread for given (isolate, thread) combination 507 // Find the PerThread for given (isolate, thread) combination
511 // If one does not yet exist, return null. 508 // If one does not yet exist, return null.
512 PerIsolateThreadData* FindPerThreadDataForThread(ThreadId thread_id); 509 PerIsolateThreadData* FindPerThreadDataForThread(ThreadId thread_id);
513 510
514 #ifdef ENABLE_DEBUGGER_SUPPORT 511 #ifdef ENABLE_DEBUGGER_SUPPORT
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
1133 function_entry_hook_ = function_entry_hook; 1130 function_entry_hook_ = function_entry_hook;
1134 } 1131 }
1135 1132
1136 void* stress_deopt_count_address() { return &stress_deopt_count_; } 1133 void* stress_deopt_count_address() { return &stress_deopt_count_; }
1137 1134
1138 inline RandomNumberGenerator* random_number_generator(); 1135 inline RandomNumberGenerator* random_number_generator();
1139 1136
1140 // Given an address occupied by a live code object, return that object. 1137 // Given an address occupied by a live code object, return that object.
1141 Object* FindCodeObject(Address a); 1138 Object* FindCodeObject(Address a);
1142 1139
1143 static Atomic32 GetLivingIsolates() {
1144 return Acquire_Load(&living_isolates_);
1145 }
1146
1147 private: 1140 private:
1148 explicit Isolate(bool is_default_isolate = false); 1141 Isolate();
1149 1142
1150 friend struct GlobalState; 1143 friend struct GlobalState;
1151 friend struct InitializeGlobalState; 1144 friend struct InitializeGlobalState;
1152 1145
1153 enum State { 1146 enum State {
1154 UNINITIALIZED, // Some components may not have been allocated. 1147 UNINITIALIZED, // Some components may not have been allocated.
1155 INITIALIZED // All components are fully initialized. 1148 INITIALIZED // All components are fully initialized.
1156 }; 1149 };
1157 1150
1158 // These fields are accessed through the API, offsets must be kept in sync 1151 // These fields are accessed through the API, offsets must be kept in sync
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1203 DISALLOW_COPY_AND_ASSIGN(EntryStackItem); 1196 DISALLOW_COPY_AND_ASSIGN(EntryStackItem);
1204 }; 1197 };
1205 1198
1206 // This mutex protects highest_thread_id_, thread_data_table_ and 1199 // This mutex protects highest_thread_id_, thread_data_table_ and
1207 // default_isolate_. 1200 // default_isolate_.
1208 static Mutex process_wide_mutex_; 1201 static Mutex process_wide_mutex_;
1209 1202
1210 static Thread::LocalStorageKey per_isolate_thread_data_key_; 1203 static Thread::LocalStorageKey per_isolate_thread_data_key_;
1211 static Thread::LocalStorageKey isolate_key_; 1204 static Thread::LocalStorageKey isolate_key_;
1212 static Thread::LocalStorageKey thread_id_key_; 1205 static Thread::LocalStorageKey thread_id_key_;
1206 static Isolate* default_isolate_;
1213 static ThreadDataTable* thread_data_table_; 1207 static ThreadDataTable* thread_data_table_;
1214 1208
1215 // A global counter for all generated Isolates, might overflow. 1209 // A global counter for all generated Isolates, might overflow.
1216 static Atomic32 isolate_counter_; 1210 static Atomic32 isolate_counter_;
1217 static Atomic32 living_isolates_;
1218 1211
1219 void Deinit(); 1212 void Deinit();
1220 1213
1221 static void SetIsolateThreadLocals(Isolate* isolate, 1214 static void SetIsolateThreadLocals(Isolate* isolate,
1222 PerIsolateThreadData* data); 1215 PerIsolateThreadData* data);
1223 1216
1224 // Find the PerThread for this particular (isolate, thread) combination. 1217 // Find the PerThread for this particular (isolate, thread) combination.
1225 // If one does not yet exist, allocate a new one. 1218 // If one does not yet exist, allocate a new one.
1226 PerIsolateThreadData* FindOrAllocatePerThreadDataForThisThread(); 1219 PerIsolateThreadData* FindOrAllocatePerThreadDataForThisThread();
1227 1220
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
1319 1312
1320 // True if fatal error has been signaled for this isolate. 1313 // True if fatal error has been signaled for this isolate.
1321 bool has_fatal_error_; 1314 bool has_fatal_error_;
1322 1315
1323 // True if we are using the Crankshaft optimizing compiler. 1316 // True if we are using the Crankshaft optimizing compiler.
1324 bool use_crankshaft_; 1317 bool use_crankshaft_;
1325 1318
1326 // True if this isolate was initialized from a snapshot. 1319 // True if this isolate was initialized from a snapshot.
1327 bool initialized_from_snapshot_; 1320 bool initialized_from_snapshot_;
1328 1321
1329 // True only for the default isolate.
1330 bool is_default_isolate_;
1331
1332 // Time stamp at initialization. 1322 // Time stamp at initialization.
1333 double time_millis_at_init_; 1323 double time_millis_at_init_;
1334 1324
1335 #if V8_TARGET_ARCH_ARM && !defined(__arm__) || \ 1325 #if V8_TARGET_ARCH_ARM && !defined(__arm__) || \
1336 V8_TARGET_ARCH_MIPS && !defined(__mips__) 1326 V8_TARGET_ARCH_MIPS && !defined(__mips__)
1337 bool simulator_initialized_; 1327 bool simulator_initialized_;
1338 HashMap* simulator_i_cache_; 1328 HashMap* simulator_i_cache_;
1339 Redirection* simulator_redirection_; 1329 Redirection* simulator_redirection_;
1340 #endif 1330 #endif
1341 1331
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
1512 1502
1513 // Mark the native context with out of memory. 1503 // Mark the native context with out of memory.
1514 inline void Context::mark_out_of_memory() { 1504 inline void Context::mark_out_of_memory() {
1515 native_context()->set_out_of_memory(GetIsolate()->heap()->true_value()); 1505 native_context()->set_out_of_memory(GetIsolate()->heap()->true_value());
1516 } 1506 }
1517 1507
1518 1508
1519 } } // namespace v8::internal 1509 } } // namespace v8::internal
1520 1510
1521 #endif // V8_ISOLATE_H_ 1511 #endif // V8_ISOLATE_H_
OLDNEW
« 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