OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_ISOLATE_H_ | 5 #ifndef V8_ISOLATE_H_ |
6 #define V8_ISOLATE_H_ | 6 #define V8_ISOLATE_H_ |
7 | 7 |
8 #include "../include/v8-debug.h" | 8 #include "../include/v8-debug.h" |
9 #include "allocation.h" | 9 #include "allocation.h" |
10 #include "assert-scope.h" | 10 #include "assert-scope.h" |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 // True if at least one thread Enter'ed this isolate. | 471 // True if at least one thread Enter'ed this isolate. |
472 bool IsInUse() { return entry_stack_ != NULL; } | 472 bool IsInUse() { return entry_stack_ != NULL; } |
473 | 473 |
474 // Destroys the non-default isolates. | 474 // Destroys the non-default isolates. |
475 // Sets default isolate into "has_been_disposed" state rather then destroying, | 475 // Sets default isolate into "has_been_disposed" state rather then destroying, |
476 // for legacy API reasons. | 476 // for legacy API reasons. |
477 void TearDown(); | 477 void TearDown(); |
478 | 478 |
479 static void GlobalTearDown(); | 479 static void GlobalTearDown(); |
480 | 480 |
481 bool IsDefaultIsolate() const { return this == default_isolate_; } | |
482 | |
483 static void SetCrashIfDefaultIsolateInitialized(); | 481 static void SetCrashIfDefaultIsolateInitialized(); |
484 // Ensures that process-wide resources and the default isolate have been | 482 // Ensures that process-wide resources and the default isolate have been |
485 // allocated. It is only necessary to call this method in rare cases, for | 483 // allocated. It is only necessary to call this method in rare cases, for |
486 // example if you are using V8 from within the body of a static initializer. | 484 // example if you are using V8 from within the body of a static initializer. |
487 // Safe to call multiple times. | 485 // Safe to call multiple times. |
488 static void EnsureDefaultIsolate(); | 486 static void EnsureDefaultIsolate(); |
489 | 487 |
490 // Find the PerThread for this particular (isolate, thread) combination | 488 // Find the PerThread for this particular (isolate, thread) combination |
491 // If one does not yet exist, return null. | 489 // If one does not yet exist, return null. |
492 PerIsolateThreadData* FindPerThreadDataForThisThread(); | 490 PerIsolateThreadData* FindPerThreadDataForThisThread(); |
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1127 | 1125 |
1128 int entry_count; | 1126 int entry_count; |
1129 PerIsolateThreadData* previous_thread_data; | 1127 PerIsolateThreadData* previous_thread_data; |
1130 Isolate* previous_isolate; | 1128 Isolate* previous_isolate; |
1131 EntryStackItem* previous_item; | 1129 EntryStackItem* previous_item; |
1132 | 1130 |
1133 private: | 1131 private: |
1134 DISALLOW_COPY_AND_ASSIGN(EntryStackItem); | 1132 DISALLOW_COPY_AND_ASSIGN(EntryStackItem); |
1135 }; | 1133 }; |
1136 | 1134 |
1137 // This mutex protects highest_thread_id_, thread_data_table_ and | 1135 // This mutex protects highest_thread_id_ and thread_data_table_. |
1138 // default_isolate_. | |
1139 static Mutex process_wide_mutex_; | 1136 static Mutex process_wide_mutex_; |
1140 | 1137 |
1141 static Thread::LocalStorageKey per_isolate_thread_data_key_; | 1138 static Thread::LocalStorageKey per_isolate_thread_data_key_; |
1142 static Thread::LocalStorageKey isolate_key_; | 1139 static Thread::LocalStorageKey isolate_key_; |
1143 static Thread::LocalStorageKey thread_id_key_; | 1140 static Thread::LocalStorageKey thread_id_key_; |
1144 static Isolate* default_isolate_; | |
1145 static ThreadDataTable* thread_data_table_; | 1141 static ThreadDataTable* thread_data_table_; |
1146 | 1142 |
1147 // A global counter for all generated Isolates, might overflow. | 1143 // A global counter for all generated Isolates, might overflow. |
1148 static Atomic32 isolate_counter_; | 1144 static Atomic32 isolate_counter_; |
1149 | 1145 |
1150 void Deinit(); | 1146 void Deinit(); |
1151 | 1147 |
1152 static void SetIsolateThreadLocals(Isolate* isolate, | 1148 static void SetIsolateThreadLocals(Isolate* isolate, |
1153 PerIsolateThreadData* data); | 1149 PerIsolateThreadData* data); |
1154 | 1150 |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1488 } | 1484 } |
1489 | 1485 |
1490 EmbeddedVector<char, 128> filename_; | 1486 EmbeddedVector<char, 128> filename_; |
1491 FILE* file_; | 1487 FILE* file_; |
1492 int scope_depth_; | 1488 int scope_depth_; |
1493 }; | 1489 }; |
1494 | 1490 |
1495 } } // namespace v8::internal | 1491 } } // namespace v8::internal |
1496 | 1492 |
1497 #endif // V8_ISOLATE_H_ | 1493 #endif // V8_ISOLATE_H_ |
OLD | NEW |