OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 inline void set_try_catch_handler_address(Address address) { | 217 inline void set_try_catch_handler_address(Address address) { |
218 try_catch_handler_address_ = address; | 218 try_catch_handler_address_ = address; |
219 } | 219 } |
220 | 220 |
221 void Free() { | 221 void Free() { |
222 ASSERT(!has_pending_message_); | 222 ASSERT(!has_pending_message_); |
223 ASSERT(!external_caught_exception_); | 223 ASSERT(!external_caught_exception_); |
224 ASSERT(try_catch_handler_address_ == NULL); | 224 ASSERT(try_catch_handler_address_ == NULL); |
225 } | 225 } |
226 | 226 |
227 Isolate* isolate_; | |
228 // The context where the current execution method is created and for variable | 227 // The context where the current execution method is created and for variable |
229 // lookups. | 228 // lookups. |
230 Context* context_; | 229 Context* context_; |
231 ThreadId thread_id_; | 230 ThreadId thread_id_; |
232 MaybeObject* pending_exception_; | 231 MaybeObject* pending_exception_; |
233 bool has_pending_message_; | 232 bool has_pending_message_; |
234 Object* pending_message_obj_; | 233 Object* pending_message_obj_; |
235 Script* pending_message_script_; | 234 Script* pending_message_script_; |
236 int pending_message_start_pos_; | 235 int pending_message_start_pos_; |
237 int pending_message_end_pos_; | 236 int pending_message_end_pos_; |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 void TearDown(); | 479 void TearDown(); |
481 | 480 |
482 bool IsDefaultIsolate() const { return this == default_isolate_; } | 481 bool IsDefaultIsolate() const { return this == default_isolate_; } |
483 | 482 |
484 // Ensures that process-wide resources and the default isolate have been | 483 // Ensures that process-wide resources and the default isolate have been |
485 // allocated. It is only necessary to call this method in rare casses, for | 484 // allocated. It is only necessary to call this method in rare casses, for |
486 // example if you are using V8 from within the body of a static initializer. | 485 // example if you are using V8 from within the body of a static initializer. |
487 // Safe to call multiple times. | 486 // Safe to call multiple times. |
488 static void EnsureDefaultIsolate(); | 487 static void EnsureDefaultIsolate(); |
489 | 488 |
490 // Find the PerThread for this particular (isolate, thread) combination | |
491 // If one does not yet exist, return null. | |
492 PerIsolateThreadData* FindPerThreadDataForThisThread(); | |
493 | |
494 #ifdef ENABLE_DEBUGGER_SUPPORT | 489 #ifdef ENABLE_DEBUGGER_SUPPORT |
495 // Get the debugger from the default isolate. Preinitializes the | 490 // Get the debugger from the default isolate. Preinitializes the |
496 // default isolate if needed. | 491 // default isolate if needed. |
497 static Debugger* GetDefaultIsolateDebugger(); | 492 static Debugger* GetDefaultIsolateDebugger(); |
498 #endif | 493 #endif |
499 | 494 |
500 // Get the stack guard from the default isolate. Preinitializes the | 495 // Get the stack guard from the default isolate. Preinitializes the |
501 // default isolate if needed. | 496 // default isolate if needed. |
502 static StackGuard* GetDefaultIsolateStackGuard(); | 497 static StackGuard* GetDefaultIsolateStackGuard(); |
503 | 498 |
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1063 EntryStackItem* entry_stack_; | 1058 EntryStackItem* entry_stack_; |
1064 | 1059 |
1065 // Allocate and insert PerIsolateThreadData into the ThreadDataTable | 1060 // Allocate and insert PerIsolateThreadData into the ThreadDataTable |
1066 // (regardless of whether such data already exists). | 1061 // (regardless of whether such data already exists). |
1067 PerIsolateThreadData* AllocatePerIsolateThreadData(ThreadId thread_id); | 1062 PerIsolateThreadData* AllocatePerIsolateThreadData(ThreadId thread_id); |
1068 | 1063 |
1069 // Find the PerThread for this particular (isolate, thread) combination. | 1064 // Find the PerThread for this particular (isolate, thread) combination. |
1070 // If one does not yet exist, allocate a new one. | 1065 // If one does not yet exist, allocate a new one. |
1071 PerIsolateThreadData* FindOrAllocatePerThreadDataForThisThread(); | 1066 PerIsolateThreadData* FindOrAllocatePerThreadDataForThisThread(); |
1072 | 1067 |
1073 // PreInits and returns a default isolate. Needed when a new thread tries | 1068 // PreInits and returns a default isolate. Needed when a new thread tries |
1074 // to create a Locker for the first time (the lock itself is in the isolate). | 1069 // to create a Locker for the first time (the lock itself is in the isolate). |
1075 static Isolate* GetDefaultIsolateForLocking(); | 1070 static Isolate* GetDefaultIsolateForLocking(); |
1076 | 1071 |
1077 // Initializes the current thread to run this Isolate. | 1072 // Initializes the current thread to run this Isolate. |
1078 // Not thread-safe. Multiple threads should not Enter/Exit the same isolate | 1073 // Not thread-safe. Multiple threads should not Enter/Exit the same isolate |
1079 // at the same time, this should be prevented using external locking. | 1074 // at the same time, this should be prevented using external locking. |
1080 void Enter(); | 1075 void Enter(); |
1081 | 1076 |
1082 // Exits the current thread. The previosuly entered Isolate is restored | 1077 // Exits the current thread. The previosuly entered Isolate is restored |
1083 // for the thread. | 1078 // for the thread. |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1195 // between compilation units. | 1190 // between compilation units. |
1196 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ | 1191 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ |
1197 static const intptr_t name##_debug_offset_; | 1192 static const intptr_t name##_debug_offset_; |
1198 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) | 1193 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) |
1199 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) | 1194 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) |
1200 #undef ISOLATE_FIELD_OFFSET | 1195 #undef ISOLATE_FIELD_OFFSET |
1201 #endif | 1196 #endif |
1202 | 1197 |
1203 friend class ExecutionAccess; | 1198 friend class ExecutionAccess; |
1204 friend class IsolateInitializer; | 1199 friend class IsolateInitializer; |
1205 friend class ThreadManager; | |
1206 friend class StackGuard; | |
1207 friend class ThreadId; | 1200 friend class ThreadId; |
1208 friend class v8::Isolate; | 1201 friend class v8::Isolate; |
1209 friend class v8::Locker; | 1202 friend class v8::Locker; |
1210 friend class v8::Unlocker; | |
1211 | 1203 |
1212 DISALLOW_COPY_AND_ASSIGN(Isolate); | 1204 DISALLOW_COPY_AND_ASSIGN(Isolate); |
1213 }; | 1205 }; |
1214 | 1206 |
1215 | 1207 |
1216 // If the GCC version is 4.1.x or 4.2.x an additional field is added to the | 1208 // If the GCC version is 4.1.x or 4.2.x an additional field is added to the |
1217 // class as a work around for a bug in the generated code found with these | 1209 // class as a work around for a bug in the generated code found with these |
1218 // versions of GCC. See V8 issue 122 for details. | 1210 // versions of GCC. See V8 issue 122 for details. |
1219 class SaveContext BASE_EMBEDDED { | 1211 class SaveContext BASE_EMBEDDED { |
1220 public: | 1212 public: |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1381 | 1373 |
1382 } } // namespace v8::internal | 1374 } } // namespace v8::internal |
1383 | 1375 |
1384 // TODO(isolates): Get rid of these -inl.h includes and place them only where | 1376 // TODO(isolates): Get rid of these -inl.h includes and place them only where |
1385 // they're needed. | 1377 // they're needed. |
1386 #include "allocation-inl.h" | 1378 #include "allocation-inl.h" |
1387 #include "zone-inl.h" | 1379 #include "zone-inl.h" |
1388 #include "frames-inl.h" | 1380 #include "frames-inl.h" |
1389 | 1381 |
1390 #endif // V8_ISOLATE_H_ | 1382 #endif // V8_ISOLATE_H_ |
OLD | NEW |