OLD | NEW |
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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 class CpuFeatures; | 61 class CpuFeatures; |
62 class CpuProfiler; | 62 class CpuProfiler; |
63 class DeoptimizerData; | 63 class DeoptimizerData; |
64 class Deserializer; | 64 class Deserializer; |
65 class EmptyStatement; | 65 class EmptyStatement; |
66 class ExternalReferenceTable; | 66 class ExternalReferenceTable; |
67 class Factory; | 67 class Factory; |
68 class FunctionInfoListener; | 68 class FunctionInfoListener; |
69 class HandleScopeImplementer; | 69 class HandleScopeImplementer; |
70 class HeapProfiler; | 70 class HeapProfiler; |
| 71 class HTracer; |
71 class InlineRuntimeFunctionsTable; | 72 class InlineRuntimeFunctionsTable; |
72 class NoAllocationStringAllocator; | 73 class NoAllocationStringAllocator; |
73 class InnerPointerToCodeCache; | 74 class InnerPointerToCodeCache; |
74 class MarkingThread; | 75 class MarkingThread; |
75 class PreallocatedMemoryThread; | 76 class PreallocatedMemoryThread; |
76 class RegExpStack; | 77 class RegExpStack; |
77 class SaveContext; | 78 class SaveContext; |
78 class UnicodeCache; | 79 class UnicodeCache; |
79 class ConsStringIteratorOp; | 80 class ConsStringIteratorOp; |
80 class StringTracker; | 81 class StringTracker; |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 /* Serializer state. */ \ | 365 /* Serializer state. */ \ |
365 V(ExternalReferenceTable*, external_reference_table, NULL) \ | 366 V(ExternalReferenceTable*, external_reference_table, NULL) \ |
366 /* AstNode state. */ \ | 367 /* AstNode state. */ \ |
367 V(int, ast_node_id, 0) \ | 368 V(int, ast_node_id, 0) \ |
368 V(unsigned, ast_node_count, 0) \ | 369 V(unsigned, ast_node_count, 0) \ |
369 /* SafeStackFrameIterator activations count. */ \ | 370 /* SafeStackFrameIterator activations count. */ \ |
370 V(int, safe_stack_iterator_counter, 0) \ | 371 V(int, safe_stack_iterator_counter, 0) \ |
371 V(CpuProfiler*, cpu_profiler, NULL) \ | 372 V(CpuProfiler*, cpu_profiler, NULL) \ |
372 V(HeapProfiler*, heap_profiler, NULL) \ | 373 V(HeapProfiler*, heap_profiler, NULL) \ |
373 V(bool, observer_delivery_pending, false) \ | 374 V(bool, observer_delivery_pending, false) \ |
| 375 V(HTracer*, htracer, NULL) \ |
374 ISOLATE_DEBUGGER_INIT_LIST(V) | 376 ISOLATE_DEBUGGER_INIT_LIST(V) |
375 | 377 |
376 class Isolate { | 378 class Isolate { |
377 // These forward declarations are required to make the friend declarations in | 379 // These forward declarations are required to make the friend declarations in |
378 // PerIsolateThreadData work on some older versions of gcc. | 380 // PerIsolateThreadData work on some older versions of gcc. |
379 class ThreadDataTable; | 381 class ThreadDataTable; |
380 class EntryStackItem; | 382 class EntryStackItem; |
381 public: | 383 public: |
382 ~Isolate(); | 384 ~Isolate(); |
383 | 385 |
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1092 static v8::Isolate* GetDefaultIsolateForLocking(); | 1094 static v8::Isolate* GetDefaultIsolateForLocking(); |
1093 | 1095 |
1094 MarkingThread** marking_threads() { | 1096 MarkingThread** marking_threads() { |
1095 return marking_thread_; | 1097 return marking_thread_; |
1096 } | 1098 } |
1097 | 1099 |
1098 SweeperThread** sweeper_threads() { | 1100 SweeperThread** sweeper_threads() { |
1099 return sweeper_thread_; | 1101 return sweeper_thread_; |
1100 } | 1102 } |
1101 | 1103 |
| 1104 HTracer* GetHTracer(); |
| 1105 |
1102 private: | 1106 private: |
1103 Isolate(); | 1107 Isolate(); |
1104 | 1108 |
| 1109 int id() const { return static_cast<int>(id_); } |
| 1110 |
1105 friend struct GlobalState; | 1111 friend struct GlobalState; |
1106 friend struct InitializeGlobalState; | 1112 friend struct InitializeGlobalState; |
1107 | 1113 |
1108 enum State { | 1114 enum State { |
1109 UNINITIALIZED, // Some components may not have been allocated. | 1115 UNINITIALIZED, // Some components may not have been allocated. |
1110 INITIALIZED // All components are fully initialized. | 1116 INITIALIZED // All components are fully initialized. |
1111 }; | 1117 }; |
1112 | 1118 |
1113 // These fields are accessed through the API, offsets must be kept in sync | 1119 // These fields are accessed through the API, offsets must be kept in sync |
1114 // with v8::internal::Internals (in include/v8.h) constants. This is also | 1120 // with v8::internal::Internals (in include/v8.h) constants. This is also |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1162 // This mutex protects highest_thread_id_, thread_data_table_ and | 1168 // This mutex protects highest_thread_id_, thread_data_table_ and |
1163 // default_isolate_. | 1169 // default_isolate_. |
1164 static Mutex* process_wide_mutex_; | 1170 static Mutex* process_wide_mutex_; |
1165 | 1171 |
1166 static Thread::LocalStorageKey per_isolate_thread_data_key_; | 1172 static Thread::LocalStorageKey per_isolate_thread_data_key_; |
1167 static Thread::LocalStorageKey isolate_key_; | 1173 static Thread::LocalStorageKey isolate_key_; |
1168 static Thread::LocalStorageKey thread_id_key_; | 1174 static Thread::LocalStorageKey thread_id_key_; |
1169 static Isolate* default_isolate_; | 1175 static Isolate* default_isolate_; |
1170 static ThreadDataTable* thread_data_table_; | 1176 static ThreadDataTable* thread_data_table_; |
1171 | 1177 |
| 1178 // A global counter for all generated Isolates, might overflow. |
| 1179 static Atomic32 isolate_counter_; |
| 1180 |
1172 void Deinit(); | 1181 void Deinit(); |
1173 | 1182 |
1174 static void SetIsolateThreadLocals(Isolate* isolate, | 1183 static void SetIsolateThreadLocals(Isolate* isolate, |
1175 PerIsolateThreadData* data); | 1184 PerIsolateThreadData* data); |
1176 | 1185 |
1177 // Allocate and insert PerIsolateThreadData into the ThreadDataTable | 1186 // Allocate and insert PerIsolateThreadData into the ThreadDataTable |
1178 // (regardless of whether such data already exists). | 1187 // (regardless of whether such data already exists). |
1179 PerIsolateThreadData* AllocatePerIsolateThreadData(ThreadId thread_id); | 1188 PerIsolateThreadData* AllocatePerIsolateThreadData(ThreadId thread_id); |
1180 | 1189 |
1181 // Find the PerThread for this particular (isolate, thread) combination. | 1190 // Find the PerThread for this particular (isolate, thread) combination. |
(...skipping 24 matching lines...) Expand all Loading... |
1206 void FillCache(); | 1215 void FillCache(); |
1207 | 1216 |
1208 void PropagatePendingExceptionToExternalTryCatch(); | 1217 void PropagatePendingExceptionToExternalTryCatch(); |
1209 | 1218 |
1210 void InitializeDebugger(); | 1219 void InitializeDebugger(); |
1211 | 1220 |
1212 // Traverse prototype chain to find out whether the object is derived from | 1221 // Traverse prototype chain to find out whether the object is derived from |
1213 // the Error object. | 1222 // the Error object. |
1214 bool IsErrorObject(Handle<Object> obj); | 1223 bool IsErrorObject(Handle<Object> obj); |
1215 | 1224 |
| 1225 Atomic32 id_; |
1216 EntryStackItem* entry_stack_; | 1226 EntryStackItem* entry_stack_; |
1217 int stack_trace_nesting_level_; | 1227 int stack_trace_nesting_level_; |
1218 StringStream* incomplete_message_; | 1228 StringStream* incomplete_message_; |
1219 // The preallocated memory thread singleton. | 1229 // The preallocated memory thread singleton. |
1220 PreallocatedMemoryThread* preallocated_memory_thread_; | 1230 PreallocatedMemoryThread* preallocated_memory_thread_; |
1221 Address isolate_addresses_[kIsolateAddressCount + 1]; // NOLINT | 1231 Address isolate_addresses_[kIsolateAddressCount + 1]; // NOLINT |
1222 NoAllocationStringAllocator* preallocated_message_space_; | 1232 NoAllocationStringAllocator* preallocated_message_space_; |
1223 Bootstrapper* bootstrapper_; | 1233 Bootstrapper* bootstrapper_; |
1224 RuntimeProfiler* runtime_profiler_; | 1234 RuntimeProfiler* runtime_profiler_; |
1225 CompilationCache* compilation_cache_; | 1235 CompilationCache* compilation_cache_; |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1475 | 1485 |
1476 // Mark the native context with out of memory. | 1486 // Mark the native context with out of memory. |
1477 inline void Context::mark_out_of_memory() { | 1487 inline void Context::mark_out_of_memory() { |
1478 native_context()->set_out_of_memory(HEAP->true_value()); | 1488 native_context()->set_out_of_memory(HEAP->true_value()); |
1479 } | 1489 } |
1480 | 1490 |
1481 | 1491 |
1482 } } // namespace v8::internal | 1492 } } // namespace v8::internal |
1483 | 1493 |
1484 #endif // V8_ISOLATE_H_ | 1494 #endif // V8_ISOLATE_H_ |
OLD | NEW |