| 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 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 // Whether out of memory exceptions should be ignored. | 294 // Whether out of memory exceptions should be ignored. |
| 295 bool ignore_out_of_memory_; | 295 bool ignore_out_of_memory_; |
| 296 | 296 |
| 297 private: | 297 private: |
| 298 void InitializeInternal(); | 298 void InitializeInternal(); |
| 299 | 299 |
| 300 Address try_catch_handler_address_; | 300 Address try_catch_handler_address_; |
| 301 }; | 301 }; |
| 302 | 302 |
| 303 | 303 |
| 304 class SystemThreadManager { | |
| 305 public: | |
| 306 enum ParallelSystemComponent { | |
| 307 PARALLEL_SWEEPING, | |
| 308 CONCURRENT_SWEEPING, | |
| 309 CONCURRENT_RECOMPILATION | |
| 310 }; | |
| 311 | |
| 312 static int NumberOfParallelSystemThreads(ParallelSystemComponent type); | |
| 313 | |
| 314 static const int kMaxThreads = 4; | |
| 315 }; | |
| 316 | |
| 317 | |
| 318 #ifdef ENABLE_DEBUGGER_SUPPORT | 304 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 319 | 305 |
| 320 #define ISOLATE_DEBUGGER_INIT_LIST(V) \ | 306 #define ISOLATE_DEBUGGER_INIT_LIST(V) \ |
| 321 V(DebuggerAgent*, debugger_agent_instance, NULL) | 307 V(DebuggerAgent*, debugger_agent_instance, NULL) |
| 322 #else | 308 #else |
| 323 | 309 |
| 324 #define ISOLATE_DEBUGGER_INIT_LIST(V) | 310 #define ISOLATE_DEBUGGER_INIT_LIST(V) |
| 325 | 311 |
| 326 #endif | 312 #endif |
| 327 | 313 |
| (...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1104 code_stub_interface_descriptor(int index); | 1090 code_stub_interface_descriptor(int index); |
| 1105 | 1091 |
| 1106 void IterateDeferredHandles(ObjectVisitor* visitor); | 1092 void IterateDeferredHandles(ObjectVisitor* visitor); |
| 1107 void LinkDeferredHandles(DeferredHandles* deferred_handles); | 1093 void LinkDeferredHandles(DeferredHandles* deferred_handles); |
| 1108 void UnlinkDeferredHandles(DeferredHandles* deferred_handles); | 1094 void UnlinkDeferredHandles(DeferredHandles* deferred_handles); |
| 1109 | 1095 |
| 1110 #ifdef DEBUG | 1096 #ifdef DEBUG |
| 1111 bool IsDeferredHandle(Object** location); | 1097 bool IsDeferredHandle(Object** location); |
| 1112 #endif // DEBUG | 1098 #endif // DEBUG |
| 1113 | 1099 |
| 1100 void set_max_available_threads(int value) { |
| 1101 max_available_threads_ = value; |
| 1102 } |
| 1103 |
| 1104 bool concurrent_recompilation_enabled() { |
| 1105 // Thread is only available with flag enabled. |
| 1106 ASSERT(optimizing_compiler_thread_ == NULL || |
| 1107 FLAG_concurrent_recompilation); |
| 1108 return optimizing_compiler_thread_ != NULL; |
| 1109 } |
| 1110 |
| 1111 bool concurrent_osr_enabled() { |
| 1112 // Thread is only available with flag enabled. |
| 1113 ASSERT(optimizing_compiler_thread_ == NULL || |
| 1114 FLAG_concurrent_recompilation); |
| 1115 return optimizing_compiler_thread_ != NULL && FLAG_concurrent_osr; |
| 1116 } |
| 1117 |
| 1114 OptimizingCompilerThread* optimizing_compiler_thread() { | 1118 OptimizingCompilerThread* optimizing_compiler_thread() { |
| 1115 return optimizing_compiler_thread_; | 1119 return optimizing_compiler_thread_; |
| 1116 } | 1120 } |
| 1117 | 1121 |
| 1122 bool num_sweeper_threads() { |
| 1123 return num_sweeper_threads_; |
| 1124 } |
| 1125 |
| 1126 SweeperThread** sweeper_threads() { |
| 1127 return sweeper_thread_; |
| 1128 } |
| 1129 |
| 1118 // PreInits and returns a default isolate. Needed when a new thread tries | 1130 // PreInits and returns a default isolate. Needed when a new thread tries |
| 1119 // to create a Locker for the first time (the lock itself is in the isolate). | 1131 // to create a Locker for the first time (the lock itself is in the isolate). |
| 1120 // TODO(svenpanne) This method is on death row... | 1132 // TODO(svenpanne) This method is on death row... |
| 1121 static v8::Isolate* GetDefaultIsolateForLocking(); | 1133 static v8::Isolate* GetDefaultIsolateForLocking(); |
| 1122 | 1134 |
| 1123 SweeperThread** sweeper_threads() { | |
| 1124 return sweeper_thread_; | |
| 1125 } | |
| 1126 | |
| 1127 int id() const { return static_cast<int>(id_); } | 1135 int id() const { return static_cast<int>(id_); } |
| 1128 | 1136 |
| 1129 HStatistics* GetHStatistics(); | 1137 HStatistics* GetHStatistics(); |
| 1130 HTracer* GetHTracer(); | 1138 HTracer* GetHTracer(); |
| 1131 CodeTracer* GetCodeTracer(); | 1139 CodeTracer* GetCodeTracer(); |
| 1132 | 1140 |
| 1133 FunctionEntryHook function_entry_hook() { return function_entry_hook_; } | 1141 FunctionEntryHook function_entry_hook() { return function_entry_hook_; } |
| 1134 void set_function_entry_hook(FunctionEntryHook function_entry_hook) { | 1142 void set_function_entry_hook(FunctionEntryHook function_entry_hook) { |
| 1135 function_entry_hook_ = function_entry_hook; | 1143 function_entry_hook_ = function_entry_hook; |
| 1136 } | 1144 } |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1366 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ | 1374 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ |
| 1367 static const intptr_t name##_debug_offset_; | 1375 static const intptr_t name##_debug_offset_; |
| 1368 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) | 1376 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) |
| 1369 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) | 1377 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) |
| 1370 #undef ISOLATE_FIELD_OFFSET | 1378 #undef ISOLATE_FIELD_OFFSET |
| 1371 #endif | 1379 #endif |
| 1372 | 1380 |
| 1373 DeferredHandles* deferred_handles_head_; | 1381 DeferredHandles* deferred_handles_head_; |
| 1374 OptimizingCompilerThread* optimizing_compiler_thread_; | 1382 OptimizingCompilerThread* optimizing_compiler_thread_; |
| 1375 SweeperThread** sweeper_thread_; | 1383 SweeperThread** sweeper_thread_; |
| 1384 int num_sweeper_threads_; |
| 1385 |
| 1386 // TODO(yangguo): This will become obsolete once ResourceConstraints |
| 1387 // becomes an argument to Isolate constructor. |
| 1388 int max_available_threads_; |
| 1376 | 1389 |
| 1377 // Counts deopt points if deopt_every_n_times is enabled. | 1390 // Counts deopt points if deopt_every_n_times is enabled. |
| 1378 unsigned int stress_deopt_count_; | 1391 unsigned int stress_deopt_count_; |
| 1379 | 1392 |
| 1380 friend class ExecutionAccess; | 1393 friend class ExecutionAccess; |
| 1381 friend class HandleScopeImplementer; | 1394 friend class HandleScopeImplementer; |
| 1382 friend class IsolateInitializer; | 1395 friend class IsolateInitializer; |
| 1383 friend class OptimizingCompilerThread; | 1396 friend class OptimizingCompilerThread; |
| 1384 friend class SweeperThread; | 1397 friend class SweeperThread; |
| 1385 friend class ThreadManager; | 1398 friend class ThreadManager; |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1574 } | 1587 } |
| 1575 | 1588 |
| 1576 EmbeddedVector<char, 128> filename_; | 1589 EmbeddedVector<char, 128> filename_; |
| 1577 FILE* file_; | 1590 FILE* file_; |
| 1578 int scope_depth_; | 1591 int scope_depth_; |
| 1579 }; | 1592 }; |
| 1580 | 1593 |
| 1581 } } // namespace v8::internal | 1594 } } // namespace v8::internal |
| 1582 | 1595 |
| 1583 #endif // V8_ISOLATE_H_ | 1596 #endif // V8_ISOLATE_H_ |
| OLD | NEW |