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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 #ifdef ENABLE_DEBUGGER_SUPPORT | 302 #ifdef ENABLE_DEBUGGER_SUPPORT |
303 | 303 |
304 #define ISOLATE_DEBUGGER_INIT_LIST(V) \ | 304 #define ISOLATE_DEBUGGER_INIT_LIST(V) \ |
305 V(DebuggerAgent*, debugger_agent_instance, NULL) | 305 V(DebuggerAgent*, debugger_agent_instance, NULL) |
306 #else | 306 #else |
307 | 307 |
308 #define ISOLATE_DEBUGGER_INIT_LIST(V) | 308 #define ISOLATE_DEBUGGER_INIT_LIST(V) |
309 | 309 |
310 #endif | 310 #endif |
311 | 311 |
| 312 |
| 313 #if V8_TARGET_ARCH_ARM && !defined(__arm__) || \ |
| 314 V8_TARGET_ARCH_A64 && !defined(__aarch64__) || \ |
| 315 V8_TARGET_ARCH_MIPS && !defined(__mips__) |
| 316 |
| 317 #define ISOLATE_INIT_SIMULATOR_LIST(V) \ |
| 318 V(bool, simulator_initialized, false) \ |
| 319 V(HashMap*, simulator_i_cache, NULL) \ |
| 320 V(Redirection*, simulator_redirection, NULL) |
| 321 #else |
| 322 |
| 323 #define ISOLATE_INIT_SIMULATOR_LIST(V) |
| 324 |
| 325 #endif |
| 326 |
| 327 |
312 #ifdef DEBUG | 328 #ifdef DEBUG |
313 | 329 |
314 #define ISOLATE_INIT_DEBUG_ARRAY_LIST(V) \ | 330 #define ISOLATE_INIT_DEBUG_ARRAY_LIST(V) \ |
315 V(CommentStatistic, paged_space_comments_statistics, \ | 331 V(CommentStatistic, paged_space_comments_statistics, \ |
316 CommentStatistic::kMaxComments + 1) | 332 CommentStatistic::kMaxComments + 1) \ |
| 333 V(int, code_kind_statistics, Code::NUMBER_OF_KINDS) |
317 #else | 334 #else |
318 | 335 |
319 #define ISOLATE_INIT_DEBUG_ARRAY_LIST(V) | 336 #define ISOLATE_INIT_DEBUG_ARRAY_LIST(V) |
320 | 337 |
321 #endif | 338 #endif |
322 | 339 |
323 #define ISOLATE_INIT_ARRAY_LIST(V) \ | 340 #define ISOLATE_INIT_ARRAY_LIST(V) \ |
324 /* SerializerDeserializer state. */ \ | 341 /* SerializerDeserializer state. */ \ |
325 V(int32_t, jsregexp_static_offsets_vector, kJSRegexpStaticOffsetsVectorSize) \ | 342 V(int32_t, jsregexp_static_offsets_vector, kJSRegexpStaticOffsetsVectorSize) \ |
326 V(int, bad_char_shift_table, kUC16AlphabetSize) \ | 343 V(int, bad_char_shift_table, kUC16AlphabetSize) \ |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 /* Serializer state. */ \ | 375 /* Serializer state. */ \ |
359 V(ExternalReferenceTable*, external_reference_table, NULL) \ | 376 V(ExternalReferenceTable*, external_reference_table, NULL) \ |
360 /* AstNode state. */ \ | 377 /* AstNode state. */ \ |
361 V(int, ast_node_id, 0) \ | 378 V(int, ast_node_id, 0) \ |
362 V(unsigned, ast_node_count, 0) \ | 379 V(unsigned, ast_node_count, 0) \ |
363 V(bool, microtask_pending, false) \ | 380 V(bool, microtask_pending, false) \ |
364 V(bool, autorun_microtasks, true) \ | 381 V(bool, autorun_microtasks, true) \ |
365 V(HStatistics*, hstatistics, NULL) \ | 382 V(HStatistics*, hstatistics, NULL) \ |
366 V(HTracer*, htracer, NULL) \ | 383 V(HTracer*, htracer, NULL) \ |
367 V(CodeTracer*, code_tracer, NULL) \ | 384 V(CodeTracer*, code_tracer, NULL) \ |
| 385 V(bool, fp_stubs_generated, false) \ |
| 386 V(int, max_available_threads, 0) \ |
| 387 ISOLATE_INIT_SIMULATOR_LIST(V) \ |
368 ISOLATE_DEBUGGER_INIT_LIST(V) | 388 ISOLATE_DEBUGGER_INIT_LIST(V) |
369 | 389 |
370 #define THREAD_LOCAL_TOP_ACCESSOR(type, name) \ | 390 #define THREAD_LOCAL_TOP_ACCESSOR(type, name) \ |
371 inline void set_##name(type v) { thread_local_top_.name##_ = v; } \ | 391 inline void set_##name(type v) { thread_local_top_.name##_ = v; } \ |
372 inline type name() const { return thread_local_top_.name##_; } | 392 inline type name() const { return thread_local_top_.name##_; } |
373 | 393 |
374 | 394 |
375 class Isolate { | 395 class Isolate { |
376 // These forward declarations are required to make the friend declarations in | 396 // These forward declarations are required to make the friend declarations in |
377 // PerIsolateThreadData work on some older versions of gcc. | 397 // PerIsolateThreadData work on some older versions of gcc. |
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
930 ConsStringIteratorOp* objects_string_compare_iterator_b() { | 950 ConsStringIteratorOp* objects_string_compare_iterator_b() { |
931 return &objects_string_compare_iterator_b_; | 951 return &objects_string_compare_iterator_b_; |
932 } | 952 } |
933 | 953 |
934 StaticResource<ConsStringIteratorOp>* objects_string_iterator() { | 954 StaticResource<ConsStringIteratorOp>* objects_string_iterator() { |
935 return &objects_string_iterator_; | 955 return &objects_string_iterator_; |
936 } | 956 } |
937 | 957 |
938 RuntimeState* runtime_state() { return &runtime_state_; } | 958 RuntimeState* runtime_state() { return &runtime_state_; } |
939 | 959 |
940 FIELD_ACCESSOR(bool, fp_stubs_generated); | |
941 | |
942 Builtins* builtins() { return &builtins_; } | 960 Builtins* builtins() { return &builtins_; } |
943 | 961 |
944 void NotifyExtensionInstalled() { | 962 void NotifyExtensionInstalled() { |
945 has_installed_extensions_ = true; | 963 has_installed_extensions_ = true; |
946 } | 964 } |
947 | 965 |
948 bool has_installed_extensions() { return has_installed_extensions_; } | 966 bool has_installed_extensions() { return has_installed_extensions_; } |
949 | 967 |
950 unibrow::Mapping<unibrow::Ecma262Canonicalize>* | 968 unibrow::Mapping<unibrow::Ecma262Canonicalize>* |
951 regexp_macro_assembler_canonicalize() { | 969 regexp_macro_assembler_canonicalize() { |
(...skipping 25 matching lines...) Expand all Loading... |
977 | 995 |
978 CpuProfiler* cpu_profiler() const { return cpu_profiler_; } | 996 CpuProfiler* cpu_profiler() const { return cpu_profiler_; } |
979 HeapProfiler* heap_profiler() const { return heap_profiler_; } | 997 HeapProfiler* heap_profiler() const { return heap_profiler_; } |
980 | 998 |
981 #ifdef DEBUG | 999 #ifdef DEBUG |
982 HistogramInfo* heap_histograms() { return heap_histograms_; } | 1000 HistogramInfo* heap_histograms() { return heap_histograms_; } |
983 | 1001 |
984 JSObject::SpillInformation* js_spill_information() { | 1002 JSObject::SpillInformation* js_spill_information() { |
985 return &js_spill_information_; | 1003 return &js_spill_information_; |
986 } | 1004 } |
987 | |
988 int* code_kind_statistics() { return code_kind_statistics_; } | |
989 #endif | |
990 | |
991 #if V8_TARGET_ARCH_ARM && !defined(__arm__) || \ | |
992 V8_TARGET_ARCH_A64 && !defined(__aarch64__) || \ | |
993 V8_TARGET_ARCH_MIPS && !defined(__mips__) | |
994 FIELD_ACCESSOR(bool, simulator_initialized) | |
995 FIELD_ACCESSOR(HashMap*, simulator_i_cache) | |
996 FIELD_ACCESSOR(Redirection*, simulator_redirection) | |
997 #endif | 1005 #endif |
998 | 1006 |
999 Factory* factory() { return reinterpret_cast<Factory*>(this); } | 1007 Factory* factory() { return reinterpret_cast<Factory*>(this); } |
1000 | 1008 |
1001 static const int kJSRegexpStaticOffsetsVectorSize = 128; | 1009 static const int kJSRegexpStaticOffsetsVectorSize = 128; |
1002 | 1010 |
1003 THREAD_LOCAL_TOP_ACCESSOR(ExternalCallbackScope*, external_callback_scope) | 1011 THREAD_LOCAL_TOP_ACCESSOR(ExternalCallbackScope*, external_callback_scope) |
1004 | 1012 |
1005 THREAD_LOCAL_TOP_ACCESSOR(StateTag, current_vm_state) | 1013 THREAD_LOCAL_TOP_ACCESSOR(StateTag, current_vm_state) |
1006 | 1014 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1056 CallInterfaceDescriptor* call_descriptor(CallDescriptorKey index); | 1064 CallInterfaceDescriptor* call_descriptor(CallDescriptorKey index); |
1057 | 1065 |
1058 void IterateDeferredHandles(ObjectVisitor* visitor); | 1066 void IterateDeferredHandles(ObjectVisitor* visitor); |
1059 void LinkDeferredHandles(DeferredHandles* deferred_handles); | 1067 void LinkDeferredHandles(DeferredHandles* deferred_handles); |
1060 void UnlinkDeferredHandles(DeferredHandles* deferred_handles); | 1068 void UnlinkDeferredHandles(DeferredHandles* deferred_handles); |
1061 | 1069 |
1062 #ifdef DEBUG | 1070 #ifdef DEBUG |
1063 bool IsDeferredHandle(Object** location); | 1071 bool IsDeferredHandle(Object** location); |
1064 #endif // DEBUG | 1072 #endif // DEBUG |
1065 | 1073 |
1066 FIELD_ACCESSOR(int, max_available_threads); | |
1067 | |
1068 bool concurrent_recompilation_enabled() { | 1074 bool concurrent_recompilation_enabled() { |
1069 // Thread is only available with flag enabled. | 1075 // Thread is only available with flag enabled. |
1070 ASSERT(optimizing_compiler_thread_ == NULL || | 1076 ASSERT(optimizing_compiler_thread_ == NULL || |
1071 FLAG_concurrent_recompilation); | 1077 FLAG_concurrent_recompilation); |
1072 return optimizing_compiler_thread_ != NULL; | 1078 return optimizing_compiler_thread_ != NULL; |
1073 } | 1079 } |
1074 | 1080 |
1075 bool concurrent_osr_enabled() const { | 1081 bool concurrent_osr_enabled() const { |
1076 // Thread is only available with flag enabled. | 1082 // Thread is only available with flag enabled. |
1077 ASSERT(optimizing_compiler_thread_ == NULL || | 1083 ASSERT(optimizing_compiler_thread_ == NULL || |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1261 HandleScopeData handle_scope_data_; | 1267 HandleScopeData handle_scope_data_; |
1262 HandleScopeImplementer* handle_scope_implementer_; | 1268 HandleScopeImplementer* handle_scope_implementer_; |
1263 UnicodeCache* unicode_cache_; | 1269 UnicodeCache* unicode_cache_; |
1264 Zone runtime_zone_; | 1270 Zone runtime_zone_; |
1265 InnerPointerToCodeCache* inner_pointer_to_code_cache_; | 1271 InnerPointerToCodeCache* inner_pointer_to_code_cache_; |
1266 ConsStringIteratorOp* write_iterator_; | 1272 ConsStringIteratorOp* write_iterator_; |
1267 GlobalHandles* global_handles_; | 1273 GlobalHandles* global_handles_; |
1268 EternalHandles* eternal_handles_; | 1274 EternalHandles* eternal_handles_; |
1269 ThreadManager* thread_manager_; | 1275 ThreadManager* thread_manager_; |
1270 RuntimeState runtime_state_; | 1276 RuntimeState runtime_state_; |
1271 bool fp_stubs_generated_; | |
1272 Builtins builtins_; | 1277 Builtins builtins_; |
1273 bool has_installed_extensions_; | 1278 bool has_installed_extensions_; |
1274 StringTracker* string_tracker_; | 1279 StringTracker* string_tracker_; |
1275 unibrow::Mapping<unibrow::Ecma262UnCanonicalize> jsregexp_uncanonicalize_; | 1280 unibrow::Mapping<unibrow::Ecma262UnCanonicalize> jsregexp_uncanonicalize_; |
1276 unibrow::Mapping<unibrow::CanonicalizationRange> jsregexp_canonrange_; | 1281 unibrow::Mapping<unibrow::CanonicalizationRange> jsregexp_canonrange_; |
1277 ConsStringIteratorOp objects_string_compare_iterator_a_; | 1282 ConsStringIteratorOp objects_string_compare_iterator_a_; |
1278 ConsStringIteratorOp objects_string_compare_iterator_b_; | 1283 ConsStringIteratorOp objects_string_compare_iterator_b_; |
1279 StaticResource<ConsStringIteratorOp> objects_string_iterator_; | 1284 StaticResource<ConsStringIteratorOp> objects_string_iterator_; |
1280 unibrow::Mapping<unibrow::Ecma262Canonicalize> | 1285 unibrow::Mapping<unibrow::Ecma262Canonicalize> |
1281 regexp_macro_assembler_canonicalize_; | 1286 regexp_macro_assembler_canonicalize_; |
1282 RegExpStack* regexp_stack_; | 1287 RegExpStack* regexp_stack_; |
1283 DateCache* date_cache_; | 1288 DateCache* date_cache_; |
1284 unibrow::Mapping<unibrow::Ecma262Canonicalize> interp_canonicalize_mapping_; | 1289 unibrow::Mapping<unibrow::Ecma262Canonicalize> interp_canonicalize_mapping_; |
1285 CodeStubInterfaceDescriptor* code_stub_interface_descriptors_; | 1290 CodeStubInterfaceDescriptor* code_stub_interface_descriptors_; |
1286 CallInterfaceDescriptor* call_descriptors_; | 1291 CallInterfaceDescriptor* call_descriptors_; |
1287 RandomNumberGenerator* random_number_generator_; | 1292 RandomNumberGenerator* random_number_generator_; |
1288 | 1293 |
1289 // True if fatal error has been signaled for this isolate. | 1294 // True if fatal error has been signaled for this isolate. |
1290 bool has_fatal_error_; | 1295 bool has_fatal_error_; |
1291 | 1296 |
1292 // True if we are using the Crankshaft optimizing compiler. | 1297 // True if we are using the Crankshaft optimizing compiler. |
1293 bool use_crankshaft_; | 1298 bool use_crankshaft_; |
1294 | 1299 |
1295 // True if this isolate was initialized from a snapshot. | 1300 // True if this isolate was initialized from a snapshot. |
1296 bool initialized_from_snapshot_; | 1301 bool initialized_from_snapshot_; |
1297 | 1302 |
1298 // Time stamp at initialization. | 1303 // Time stamp at initialization. |
1299 double time_millis_at_init_; | 1304 double time_millis_at_init_; |
1300 | 1305 |
1301 #if V8_TARGET_ARCH_ARM && !defined(__arm__) || \ | |
1302 V8_TARGET_ARCH_A64 && !defined(__aarch64__) || \ | |
1303 V8_TARGET_ARCH_MIPS && !defined(__mips__) | |
1304 bool simulator_initialized_; | |
1305 HashMap* simulator_i_cache_; | |
1306 Redirection* simulator_redirection_; | |
1307 #endif | |
1308 | |
1309 #ifdef DEBUG | 1306 #ifdef DEBUG |
1310 // A static array of histogram info for each type. | 1307 // A static array of histogram info for each type. |
1311 HistogramInfo heap_histograms_[LAST_TYPE + 1]; | 1308 HistogramInfo heap_histograms_[LAST_TYPE + 1]; |
1312 JSObject::SpillInformation js_spill_information_; | 1309 JSObject::SpillInformation js_spill_information_; |
1313 int code_kind_statistics_[Code::NUMBER_OF_KINDS]; | |
1314 #endif | 1310 #endif |
1315 | 1311 |
1316 #ifdef ENABLE_DEBUGGER_SUPPORT | 1312 #ifdef ENABLE_DEBUGGER_SUPPORT |
1317 Debugger* debugger_; | 1313 Debugger* debugger_; |
1318 Debug* debug_; | 1314 Debug* debug_; |
1319 #endif | 1315 #endif |
1320 CpuProfiler* cpu_profiler_; | 1316 CpuProfiler* cpu_profiler_; |
1321 HeapProfiler* heap_profiler_; | 1317 HeapProfiler* heap_profiler_; |
1322 FunctionEntryHook function_entry_hook_; | 1318 FunctionEntryHook function_entry_hook_; |
1323 | 1319 |
(...skipping 16 matching lines...) Expand all Loading... |
1340 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) | 1336 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) |
1341 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) | 1337 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) |
1342 #undef ISOLATE_FIELD_OFFSET | 1338 #undef ISOLATE_FIELD_OFFSET |
1343 #endif | 1339 #endif |
1344 | 1340 |
1345 DeferredHandles* deferred_handles_head_; | 1341 DeferredHandles* deferred_handles_head_; |
1346 OptimizingCompilerThread* optimizing_compiler_thread_; | 1342 OptimizingCompilerThread* optimizing_compiler_thread_; |
1347 SweeperThread** sweeper_thread_; | 1343 SweeperThread** sweeper_thread_; |
1348 int num_sweeper_threads_; | 1344 int num_sweeper_threads_; |
1349 | 1345 |
1350 // TODO(yangguo): This will become obsolete once ResourceConstraints | |
1351 // becomes an argument to Isolate constructor. | |
1352 int max_available_threads_; | |
1353 | |
1354 // Counts deopt points if deopt_every_n_times is enabled. | 1346 // Counts deopt points if deopt_every_n_times is enabled. |
1355 unsigned int stress_deopt_count_; | 1347 unsigned int stress_deopt_count_; |
1356 | 1348 |
1357 int next_optimization_id_; | 1349 int next_optimization_id_; |
1358 | 1350 |
1359 friend class ExecutionAccess; | 1351 friend class ExecutionAccess; |
1360 friend class HandleScopeImplementer; | 1352 friend class HandleScopeImplementer; |
1361 friend class IsolateInitializer; | 1353 friend class IsolateInitializer; |
1362 friend class OptimizingCompilerThread; | 1354 friend class OptimizingCompilerThread; |
1363 friend class SweeperThread; | 1355 friend class SweeperThread; |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1560 } | 1552 } |
1561 | 1553 |
1562 EmbeddedVector<char, 128> filename_; | 1554 EmbeddedVector<char, 128> filename_; |
1563 FILE* file_; | 1555 FILE* file_; |
1564 int scope_depth_; | 1556 int scope_depth_; |
1565 }; | 1557 }; |
1566 | 1558 |
1567 } } // namespace v8::internal | 1559 } } // namespace v8::internal |
1568 | 1560 |
1569 #endif // V8_ISOLATE_H_ | 1561 #endif // V8_ISOLATE_H_ |
OLD | NEW |