| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 class EmptyStatement; | 62 class EmptyStatement; |
| 63 class ExternalReferenceTable; | 63 class ExternalReferenceTable; |
| 64 class Factory; | 64 class Factory; |
| 65 class FunctionInfoListener; | 65 class FunctionInfoListener; |
| 66 class HandleScopeImplementer; | 66 class HandleScopeImplementer; |
| 67 class HeapProfiler; | 67 class HeapProfiler; |
| 68 class InlineRuntimeFunctionsTable; | 68 class InlineRuntimeFunctionsTable; |
| 69 class NoAllocationStringAllocator; | 69 class NoAllocationStringAllocator; |
| 70 class PcToCodeCache; | 70 class PcToCodeCache; |
| 71 class PreallocatedMemoryThread; | 71 class PreallocatedMemoryThread; |
| 72 class ProducerHeapProfile; | |
| 73 class RegExpStack; | 72 class RegExpStack; |
| 74 class SaveContext; | 73 class SaveContext; |
| 75 class UnicodeCache; | 74 class UnicodeCache; |
| 76 class StringInputBuffer; | 75 class StringInputBuffer; |
| 77 class StringTracker; | 76 class StringTracker; |
| 78 class StubCache; | 77 class StubCache; |
| 79 class ThreadManager; | 78 class ThreadManager; |
| 80 class ThreadState; | 79 class ThreadState; |
| 81 class ThreadVisitor; // Defined in v8threads.h | 80 class ThreadVisitor; // Defined in v8threads.h |
| 82 class VMState; | 81 class VMState; |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 | 325 |
| 327 #endif | 326 #endif |
| 328 | 327 |
| 329 #define ISOLATE_INIT_ARRAY_LIST(V) \ | 328 #define ISOLATE_INIT_ARRAY_LIST(V) \ |
| 330 /* SerializerDeserializer state. */ \ | 329 /* SerializerDeserializer state. */ \ |
| 331 V(Object*, serialize_partial_snapshot_cache, kPartialSnapshotCacheCapacity) \ | 330 V(Object*, serialize_partial_snapshot_cache, kPartialSnapshotCacheCapacity) \ |
| 332 V(int, jsregexp_static_offsets_vector, kJSRegexpStaticOffsetsVectorSize) \ | 331 V(int, jsregexp_static_offsets_vector, kJSRegexpStaticOffsetsVectorSize) \ |
| 333 V(int, bad_char_shift_table, kUC16AlphabetSize) \ | 332 V(int, bad_char_shift_table, kUC16AlphabetSize) \ |
| 334 V(int, good_suffix_shift_table, (kBMMaxShift + 1)) \ | 333 V(int, good_suffix_shift_table, (kBMMaxShift + 1)) \ |
| 335 V(int, suffix_table, (kBMMaxShift + 1)) \ | 334 V(int, suffix_table, (kBMMaxShift + 1)) \ |
| 335 V(uint32_t, random_seed, 2) \ |
| 336 V(uint32_t, private_random_seed, 2) \ |
| 336 ISOLATE_INIT_DEBUG_ARRAY_LIST(V) | 337 ISOLATE_INIT_DEBUG_ARRAY_LIST(V) |
| 337 | 338 |
| 338 typedef List<HeapObject*, PreallocatedStorage> DebugObjectCache; | 339 typedef List<HeapObject*, PreallocatedStorage> DebugObjectCache; |
| 339 | 340 |
| 340 #define ISOLATE_INIT_LIST(V) \ | 341 #define ISOLATE_INIT_LIST(V) \ |
| 341 /* AssertNoZoneAllocation state. */ \ | 342 /* AssertNoZoneAllocation state. */ \ |
| 342 V(bool, zone_allow_allocation, true) \ | 343 V(bool, zone_allow_allocation, true) \ |
| 343 /* SerializerDeserializer state. */ \ | 344 /* SerializerDeserializer state. */ \ |
| 344 V(int, serialize_partial_snapshot_cache_length, 0) \ | 345 V(int, serialize_partial_snapshot_cache_length, 0) \ |
| 345 /* Assembler state. */ \ | 346 /* Assembler state. */ \ |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 | 523 |
| 523 // Debug. | 524 // Debug. |
| 524 // Mutex for serializing access to break control structures. | 525 // Mutex for serializing access to break control structures. |
| 525 Mutex* break_access() { return break_access_; } | 526 Mutex* break_access() { return break_access_; } |
| 526 | 527 |
| 527 Address get_address_from_id(AddressId id); | 528 Address get_address_from_id(AddressId id); |
| 528 | 529 |
| 529 // Access to top context (where the current function object was created). | 530 // Access to top context (where the current function object was created). |
| 530 Context* context() { return thread_local_top_.context_; } | 531 Context* context() { return thread_local_top_.context_; } |
| 531 void set_context(Context* context) { | 532 void set_context(Context* context) { |
| 533 ASSERT(context == NULL || context->IsContext()); |
| 532 thread_local_top_.context_ = context; | 534 thread_local_top_.context_ = context; |
| 533 } | 535 } |
| 534 Context** context_address() { return &thread_local_top_.context_; } | 536 Context** context_address() { return &thread_local_top_.context_; } |
| 535 | 537 |
| 536 SaveContext* save_context() {return thread_local_top_.save_context_; } | 538 SaveContext* save_context() {return thread_local_top_.save_context_; } |
| 537 void set_save_context(SaveContext* save) { | 539 void set_save_context(SaveContext* save) { |
| 538 thread_local_top_.save_context_ = save; | 540 thread_local_top_.save_context_ = save; |
| 539 } | 541 } |
| 540 | 542 |
| 541 // Access to current thread id. | 543 // Access to current thread id. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 } | 589 } |
| 588 | 590 |
| 589 MaybeObject** scheduled_exception_address() { | 591 MaybeObject** scheduled_exception_address() { |
| 590 return &thread_local_top_.scheduled_exception_; | 592 return &thread_local_top_.scheduled_exception_; |
| 591 } | 593 } |
| 592 MaybeObject* scheduled_exception() { | 594 MaybeObject* scheduled_exception() { |
| 593 ASSERT(has_scheduled_exception()); | 595 ASSERT(has_scheduled_exception()); |
| 594 return thread_local_top_.scheduled_exception_; | 596 return thread_local_top_.scheduled_exception_; |
| 595 } | 597 } |
| 596 bool has_scheduled_exception() { | 598 bool has_scheduled_exception() { |
| 597 return !thread_local_top_.scheduled_exception_->IsTheHole(); | 599 return thread_local_top_.scheduled_exception_ != heap_.the_hole_value(); |
| 598 } | 600 } |
| 599 void clear_scheduled_exception() { | 601 void clear_scheduled_exception() { |
| 600 thread_local_top_.scheduled_exception_ = heap_.the_hole_value(); | 602 thread_local_top_.scheduled_exception_ = heap_.the_hole_value(); |
| 601 } | 603 } |
| 602 | 604 |
| 603 bool IsExternallyCaught(); | 605 bool IsExternallyCaught(); |
| 604 | 606 |
| 605 bool is_catchable_by_javascript(MaybeObject* exception) { | 607 bool is_catchable_by_javascript(MaybeObject* exception) { |
| 606 return (exception != Failure::OutOfMemoryException()) && | 608 return (exception != Failure::OutOfMemoryException()) && |
| 607 (exception != heap()->termination_exception()); | 609 (exception != heap()->termination_exception()); |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 888 return ®exp_macro_assembler_canonicalize_; | 890 return ®exp_macro_assembler_canonicalize_; |
| 889 } | 891 } |
| 890 | 892 |
| 891 RegExpStack* regexp_stack() { return regexp_stack_; } | 893 RegExpStack* regexp_stack() { return regexp_stack_; } |
| 892 | 894 |
| 893 unibrow::Mapping<unibrow::Ecma262Canonicalize>* | 895 unibrow::Mapping<unibrow::Ecma262Canonicalize>* |
| 894 interp_canonicalize_mapping() { | 896 interp_canonicalize_mapping() { |
| 895 return &interp_canonicalize_mapping_; | 897 return &interp_canonicalize_mapping_; |
| 896 } | 898 } |
| 897 | 899 |
| 898 ZoneObjectList* frame_element_constant_list() { | |
| 899 return &frame_element_constant_list_; | |
| 900 } | |
| 901 | |
| 902 ZoneObjectList* result_constant_list() { | |
| 903 return &result_constant_list_; | |
| 904 } | |
| 905 | |
| 906 void* PreallocatedStorageNew(size_t size); | 900 void* PreallocatedStorageNew(size_t size); |
| 907 void PreallocatedStorageDelete(void* p); | 901 void PreallocatedStorageDelete(void* p); |
| 908 void PreallocatedStorageInit(size_t size); | 902 void PreallocatedStorageInit(size_t size); |
| 909 | 903 |
| 910 #ifdef ENABLE_DEBUGGER_SUPPORT | 904 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 911 Debugger* debugger() { return debugger_; } | 905 Debugger* debugger() { return debugger_; } |
| 912 Debug* debug() { return debug_; } | 906 Debug* debug() { return debug_; } |
| 913 #endif | 907 #endif |
| 914 | 908 |
| 915 inline bool DebuggerHasBreakPoints(); | 909 inline bool DebuggerHasBreakPoints(); |
| 916 | 910 |
| 917 #ifdef ENABLE_LOGGING_AND_PROFILING | |
| 918 ProducerHeapProfile* producer_heap_profile() { | |
| 919 return producer_heap_profile_; | |
| 920 } | |
| 921 #endif | |
| 922 | |
| 923 #ifdef DEBUG | 911 #ifdef DEBUG |
| 924 HistogramInfo* heap_histograms() { return heap_histograms_; } | 912 HistogramInfo* heap_histograms() { return heap_histograms_; } |
| 925 | 913 |
| 926 JSObject::SpillInformation* js_spill_information() { | 914 JSObject::SpillInformation* js_spill_information() { |
| 927 return &js_spill_information_; | 915 return &js_spill_information_; |
| 928 } | 916 } |
| 929 | 917 |
| 930 int* code_kind_statistics() { return code_kind_statistics_; } | 918 int* code_kind_statistics() { return code_kind_statistics_; } |
| 931 #endif | 919 #endif |
| 932 | 920 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 966 } | 954 } |
| 967 #endif | 955 #endif |
| 968 | 956 |
| 969 #ifdef ENABLE_VMSTATE_TRACKING | 957 #ifdef ENABLE_VMSTATE_TRACKING |
| 970 StateTag current_vm_state() { | 958 StateTag current_vm_state() { |
| 971 return thread_local_top_.current_vm_state_; | 959 return thread_local_top_.current_vm_state_; |
| 972 } | 960 } |
| 973 | 961 |
| 974 void SetCurrentVMState(StateTag state) { | 962 void SetCurrentVMState(StateTag state) { |
| 975 if (RuntimeProfiler::IsEnabled()) { | 963 if (RuntimeProfiler::IsEnabled()) { |
| 964 // Make sure thread local top is initialized. |
| 965 ASSERT(thread_local_top_.isolate_ == this); |
| 976 StateTag current_state = thread_local_top_.current_vm_state_; | 966 StateTag current_state = thread_local_top_.current_vm_state_; |
| 977 if (current_state != JS && state == JS) { | 967 if (current_state != JS && state == JS) { |
| 978 // Non-JS -> JS transition. | 968 // Non-JS -> JS transition. |
| 979 RuntimeProfiler::IsolateEnteredJS(this); | 969 RuntimeProfiler::IsolateEnteredJS(this); |
| 980 } else if (current_state == JS && state != JS) { | 970 } else if (current_state == JS && state != JS) { |
| 981 // JS -> non-JS transition. | 971 // JS -> non-JS transition. |
| 982 ASSERT(RuntimeProfiler::IsSomeIsolateInJS()); | 972 ASSERT(RuntimeProfiler::IsSomeIsolateInJS()); |
| 983 RuntimeProfiler::IsolateExitedJS(this); | 973 RuntimeProfiler::IsolateExitedJS(this); |
| 984 } else { | 974 } else { |
| 985 // Other types of state transitions are not interesting to the | 975 // Other types of state transitions are not interesting to the |
| 986 // runtime profiler, because they don't affect whether we're | 976 // runtime profiler, because they don't affect whether we're |
| 987 // in JS or not. | 977 // in JS or not. |
| 988 ASSERT((current_state == JS) == (state == JS)); | 978 ASSERT((current_state == JS) == (state == JS)); |
| 989 } | 979 } |
| 990 } | 980 } |
| 991 thread_local_top_.current_vm_state_ = state; | 981 thread_local_top_.current_vm_state_ = state; |
| 992 } | 982 } |
| 993 #endif | 983 #endif |
| 994 | 984 |
| 995 void ResetEagerOptimizingData(); | |
| 996 | |
| 997 void SetData(void* data) { embedder_data_ = data; } | 985 void SetData(void* data) { embedder_data_ = data; } |
| 998 void* GetData() { return embedder_data_; } | 986 void* GetData() { return embedder_data_; } |
| 999 | 987 |
| 1000 private: | 988 private: |
| 1001 Isolate(); | 989 Isolate(); |
| 1002 | 990 |
| 1003 // The per-process lock should be acquired before the ThreadDataTable is | 991 // The per-process lock should be acquired before the ThreadDataTable is |
| 1004 // modified. | 992 // modified. |
| 1005 class ThreadDataTable { | 993 class ThreadDataTable { |
| 1006 public: | 994 public: |
| 1007 ThreadDataTable(); | 995 ThreadDataTable(); |
| 1008 ~ThreadDataTable(); | 996 ~ThreadDataTable(); |
| 1009 | 997 |
| 1010 PerIsolateThreadData* Lookup(Isolate* isolate, ThreadId thread_id); | 998 PerIsolateThreadData* Lookup(Isolate* isolate, ThreadId thread_id); |
| 1011 void Insert(PerIsolateThreadData* data); | 999 void Insert(PerIsolateThreadData* data); |
| 1012 void Remove(Isolate* isolate, ThreadId thread_id); | 1000 void Remove(Isolate* isolate, ThreadId thread_id); |
| 1013 void Remove(PerIsolateThreadData* data); | 1001 void Remove(PerIsolateThreadData* data); |
| 1002 void RemoveAllThreads(Isolate* isolate); |
| 1014 | 1003 |
| 1015 private: | 1004 private: |
| 1016 PerIsolateThreadData* list_; | 1005 PerIsolateThreadData* list_; |
| 1017 }; | 1006 }; |
| 1018 | 1007 |
| 1019 // These items form a stack synchronously with threads Enter'ing and Exit'ing | 1008 // These items form a stack synchronously with threads Enter'ing and Exit'ing |
| 1020 // the Isolate. The top of the stack points to a thread which is currently | 1009 // the Isolate. The top of the stack points to a thread which is currently |
| 1021 // running the Isolate. When the stack is empty, the Isolate is considered | 1010 // running the Isolate. When the stack is empty, the Isolate is considered |
| 1022 // not entered by any thread and can be Disposed. | 1011 // not entered by any thread and can be Disposed. |
| 1023 // If the same thread enters the Isolate more then once, the entry_count_ | 1012 // If the same thread enters the Isolate more then once, the entry_count_ |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1150 StringTracker* string_tracker_; | 1139 StringTracker* string_tracker_; |
| 1151 unibrow::Mapping<unibrow::Ecma262UnCanonicalize> jsregexp_uncanonicalize_; | 1140 unibrow::Mapping<unibrow::Ecma262UnCanonicalize> jsregexp_uncanonicalize_; |
| 1152 unibrow::Mapping<unibrow::CanonicalizationRange> jsregexp_canonrange_; | 1141 unibrow::Mapping<unibrow::CanonicalizationRange> jsregexp_canonrange_; |
| 1153 StringInputBuffer objects_string_compare_buffer_a_; | 1142 StringInputBuffer objects_string_compare_buffer_a_; |
| 1154 StringInputBuffer objects_string_compare_buffer_b_; | 1143 StringInputBuffer objects_string_compare_buffer_b_; |
| 1155 StaticResource<StringInputBuffer> objects_string_input_buffer_; | 1144 StaticResource<StringInputBuffer> objects_string_input_buffer_; |
| 1156 unibrow::Mapping<unibrow::Ecma262Canonicalize> | 1145 unibrow::Mapping<unibrow::Ecma262Canonicalize> |
| 1157 regexp_macro_assembler_canonicalize_; | 1146 regexp_macro_assembler_canonicalize_; |
| 1158 RegExpStack* regexp_stack_; | 1147 RegExpStack* regexp_stack_; |
| 1159 unibrow::Mapping<unibrow::Ecma262Canonicalize> interp_canonicalize_mapping_; | 1148 unibrow::Mapping<unibrow::Ecma262Canonicalize> interp_canonicalize_mapping_; |
| 1160 ZoneObjectList frame_element_constant_list_; | |
| 1161 ZoneObjectList result_constant_list_; | |
| 1162 void* embedder_data_; | 1149 void* embedder_data_; |
| 1163 | 1150 |
| 1164 #if defined(V8_TARGET_ARCH_ARM) && !defined(__arm__) || \ | 1151 #if defined(V8_TARGET_ARCH_ARM) && !defined(__arm__) || \ |
| 1165 defined(V8_TARGET_ARCH_MIPS) && !defined(__mips__) | 1152 defined(V8_TARGET_ARCH_MIPS) && !defined(__mips__) |
| 1166 bool simulator_initialized_; | 1153 bool simulator_initialized_; |
| 1167 HashMap* simulator_i_cache_; | 1154 HashMap* simulator_i_cache_; |
| 1168 Redirection* simulator_redirection_; | 1155 Redirection* simulator_redirection_; |
| 1169 #endif | 1156 #endif |
| 1170 | 1157 |
| 1171 #ifdef DEBUG | 1158 #ifdef DEBUG |
| 1172 // A static array of histogram info for each type. | 1159 // A static array of histogram info for each type. |
| 1173 HistogramInfo heap_histograms_[LAST_TYPE + 1]; | 1160 HistogramInfo heap_histograms_[LAST_TYPE + 1]; |
| 1174 JSObject::SpillInformation js_spill_information_; | 1161 JSObject::SpillInformation js_spill_information_; |
| 1175 int code_kind_statistics_[Code::NUMBER_OF_KINDS]; | 1162 int code_kind_statistics_[Code::NUMBER_OF_KINDS]; |
| 1176 #endif | 1163 #endif |
| 1177 | 1164 |
| 1178 #ifdef ENABLE_DEBUGGER_SUPPORT | 1165 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 1179 Debugger* debugger_; | 1166 Debugger* debugger_; |
| 1180 Debug* debug_; | 1167 Debug* debug_; |
| 1181 #endif | 1168 #endif |
| 1182 | 1169 |
| 1183 #ifdef ENABLE_LOGGING_AND_PROFILING | |
| 1184 ProducerHeapProfile* producer_heap_profile_; | |
| 1185 #endif | |
| 1186 | |
| 1187 #define GLOBAL_BACKING_STORE(type, name, initialvalue) \ | 1170 #define GLOBAL_BACKING_STORE(type, name, initialvalue) \ |
| 1188 type name##_; | 1171 type name##_; |
| 1189 ISOLATE_INIT_LIST(GLOBAL_BACKING_STORE) | 1172 ISOLATE_INIT_LIST(GLOBAL_BACKING_STORE) |
| 1190 #undef GLOBAL_BACKING_STORE | 1173 #undef GLOBAL_BACKING_STORE |
| 1191 | 1174 |
| 1192 #define GLOBAL_ARRAY_BACKING_STORE(type, name, length) \ | 1175 #define GLOBAL_ARRAY_BACKING_STORE(type, name, length) \ |
| 1193 type name##_[length]; | 1176 type name##_[length]; |
| 1194 ISOLATE_INIT_ARRAY_LIST(GLOBAL_ARRAY_BACKING_STORE) | 1177 ISOLATE_INIT_ARRAY_LIST(GLOBAL_ARRAY_BACKING_STORE) |
| 1195 #undef GLOBAL_ARRAY_BACKING_STORE | 1178 #undef GLOBAL_ARRAY_BACKING_STORE |
| 1196 | 1179 |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1373 | 1356 |
| 1374 } } // namespace v8::internal | 1357 } } // namespace v8::internal |
| 1375 | 1358 |
| 1376 // TODO(isolates): Get rid of these -inl.h includes and place them only where | 1359 // TODO(isolates): Get rid of these -inl.h includes and place them only where |
| 1377 // they're needed. | 1360 // they're needed. |
| 1378 #include "allocation-inl.h" | 1361 #include "allocation-inl.h" |
| 1379 #include "zone-inl.h" | 1362 #include "zone-inl.h" |
| 1380 #include "frames-inl.h" | 1363 #include "frames-inl.h" |
| 1381 | 1364 |
| 1382 #endif // V8_ISOLATE_H_ | 1365 #endif // V8_ISOLATE_H_ |
| OLD | NEW |