12 #include <unordered_map> 15 #include "include/v8-inspector.h" 16 #include "include/v8-internal.h" 17 #include "include/v8.h" 18 #include "src/allocation.h" 19 #include "src/base/atomicops.h" 20 #include "src/base/macros.h" 21 #include "src/builtins/builtins.h" 22 #include "src/contexts.h" 23 #include "src/debug/debug-interface.h" 24 #include "src/execution.h" 25 #include "src/futex-emulation.h" 26 #include "src/globals.h" 27 #include "src/handles.h" 28 #include "src/heap/factory.h" 29 #include "src/heap/heap.h" 30 #include "src/isolate-allocator.h" 31 #include "src/isolate-data.h" 32 #include "src/messages.h" 33 #include "src/objects/code.h" 34 #include "src/objects/debug-objects.h" 35 #include "src/runtime/runtime.h" 36 #include "src/thread-id.h" 39 #ifdef V8_INTL_SUPPORT 40 #include "unicode/uversion.h" 44 #endif // V8_INTL_SUPPORT 49 class RandomNumberGenerator;
53 class ConsoleDelegate;
62 class AddressToIndexHashMap;
63 class AstStringConstants;
65 class BuiltinsConstantsTableBuilder;
66 class CancelableTaskManager;
67 class CodeEventDispatcher;
69 class CompilationCache;
70 class CompilationStatistics;
71 class CompilerDispatcher;
72 class ContextSlotCache;
75 class DeoptimizerData;
76 class DescriptorLookupCache;
78 class ExternalCallbackScope;
79 class HandleScopeImplementer;
80 class HeapObjectToIndexHashMap;
82 class InnerPointerToCodeCache;
84 class MaterializedObjectStore;
87 class OptimizingCompileDispatcher;
91 class RuntimeProfiler;
93 class SetupIsolateDelegate;
95 class StartupDeserializer;
101 class TracingCpuProfilerImpl;
103 struct ManagedPtrDestructor;
107 namespace interpreter {
112 class PerIsolateCompilerCache;
119 #define RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate) \ 121 Isolate* __isolate__ = (isolate); \ 122 DCHECK(!__isolate__->has_pending_exception()); \ 123 if (__isolate__->has_scheduled_exception()) { \ 124 return __isolate__->PromoteScheduledException(); \ 130 #define RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, value) \ 132 Isolate* __isolate__ = (isolate); \ 133 DCHECK(!__isolate__->has_pending_exception()); \ 134 if (__isolate__->has_scheduled_exception()) { \ 135 __isolate__->PromoteScheduledException(); \ 140 #define RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, T) \ 141 RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, MaybeHandle<T>()) 143 #define ASSIGN_RETURN_ON_SCHEDULED_EXCEPTION_VALUE(isolate, dst, call, value) \ 145 Isolate* __isolate__ = (isolate); \ 146 if (!(call).ToLocal(&dst)) { \ 147 DCHECK(__isolate__->has_scheduled_exception()); \ 148 __isolate__->PromoteScheduledException(); \ 153 #define RETURN_ON_SCHEDULED_EXCEPTION_VALUE(isolate, call, value) \ 155 Isolate* __isolate__ = (isolate); \ 156 if ((call).IsNothing()) { \ 157 DCHECK(__isolate__->has_scheduled_exception()); \ 158 __isolate__->PromoteScheduledException(); \ 181 #define RETURN_RESULT_OR_FAILURE(isolate, call) \ 183 Handle<Object> __result__; \ 184 Isolate* __isolate__ = (isolate); \ 185 if (!(call).ToHandle(&__result__)) { \ 186 DCHECK(__isolate__->has_pending_exception()); \ 187 return ReadOnlyRoots(__isolate__).exception(); \ 189 DCHECK(!__isolate__->has_pending_exception()); \ 190 return *__result__; \ 193 #define ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, dst, call, value) \ 195 if (!(call).ToHandle(&dst)) { \ 196 DCHECK((isolate)->has_pending_exception()); \ 201 #define ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, dst, call) \ 203 Isolate* __isolate__ = (isolate); \ 204 ASSIGN_RETURN_ON_EXCEPTION_VALUE(__isolate__, dst, call, \ 205 ReadOnlyRoots(__isolate__).exception()); \ 208 #define ASSIGN_RETURN_ON_EXCEPTION(isolate, dst, call, T) \ 209 ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, dst, call, MaybeHandle<T>()) 211 #define THROW_NEW_ERROR(isolate, call, T) \ 213 Isolate* __isolate__ = (isolate); \ 214 return __isolate__->Throw<T>(__isolate__->factory()->call); \ 217 #define THROW_NEW_ERROR_RETURN_FAILURE(isolate, call) \ 219 Isolate* __isolate__ = (isolate); \ 220 return __isolate__->Throw(*__isolate__->factory()->call); \ 223 #define THROW_NEW_ERROR_RETURN_VALUE(isolate, call, value) \ 225 Isolate* __isolate__ = (isolate); \ 226 __isolate__->Throw(*__isolate__->factory()->call); \ 260 #define RETURN_ON_EXCEPTION_VALUE(isolate, call, value) \ 262 if ((call).is_null()) { \ 263 DCHECK((isolate)->has_pending_exception()); \ 288 #define RETURN_FAILURE_ON_EXCEPTION(isolate, call) \ 290 Isolate* __isolate__ = (isolate); \ 291 RETURN_ON_EXCEPTION_VALUE(__isolate__, call, \ 292 ReadOnlyRoots(__isolate__).exception()); \ 315 #define RETURN_ON_EXCEPTION(isolate, call, T) \ 316 RETURN_ON_EXCEPTION_VALUE(isolate, call, MaybeHandle<T>()) 319 #define FOR_WITH_HANDLE_SCOPE(isolate, loop_var_type, init, loop_var, \ 320 limit_check, increment, body) \ 322 loop_var_type init; \ 323 loop_var_type for_with_handle_limit = loop_var; \ 324 Isolate* for_with_handle_isolate = isolate; \ 325 while (limit_check) { \ 326 for_with_handle_limit += 1024; \ 327 HandleScope loop_scope(for_with_handle_isolate); \ 328 for (; limit_check && loop_var < for_with_handle_limit; increment) { \ 334 #define FIELD_ACCESSOR(type, name) \ 335 inline void set_##name(type v) { name##_ = v; } \ 336 inline type name() const { return name##_; } 340 V8_EXPORT_PRIVATE
void DisableEmbeddedBlobRefcounting();
341 V8_EXPORT_PRIVATE
void FreeCurrentEmbeddedBlob();
357 FIELD_ACCESSOR(v8::TryCatch*, try_catch_handler)
369 Address try_catch_handler_address() {
370 return reinterpret_cast<Address>(
371 v8::TryCatch::JSStackComparableAddress(try_catch_handler()));
383 STATIC_ASSERT(
sizeof(
Context) == kPointerSize);
385 ThreadId thread_id_ = ThreadId::Invalid();
386 Object* pending_exception_ =
nullptr;
389 Context pending_handler_context_;
390 Address pending_handler_entrypoint_ = kNullAddress;
391 Address pending_handler_constant_pool_ = kNullAddress;
392 Address pending_handler_fp_ = kNullAddress;
393 Address pending_handler_sp_ = kNullAddress;
396 bool rethrowing_message_ =
false;
397 Object* pending_message_obj_ =
nullptr;
402 Object* scheduled_exception_ =
nullptr;
403 bool external_caught_exception_ =
false;
408 Address c_entry_fp_ = kNullAddress;
410 Address handler_ = kNullAddress;
412 Address c_function_ = kNullAddress;
420 Simulator* simulator_ =
nullptr;
424 Address js_entry_sp_ = kNullAddress;
427 StateTag current_vm_state_ = EXTERNAL;
430 v8::FailedAccessCheckCallback failed_access_check_callback_ =
nullptr;
433 Address thread_in_wasm_flag_address_ = kNullAddress;
436 v8::TryCatch* try_catch_handler_ =
nullptr;
441 #define ISOLATE_INIT_DEBUG_ARRAY_LIST(V) \ 442 V(CommentStatistic, paged_space_comments_statistics, \ 443 CommentStatistic::kMaxComments + 1) \ 444 V(int, code_kind_statistics, AbstractCode::NUMBER_OF_KINDS) 447 #define ISOLATE_INIT_DEBUG_ARRAY_LIST(V) 451 #define ISOLATE_INIT_ARRAY_LIST(V) \ 453 V(int32_t, jsregexp_static_offsets_vector, kJSRegexpStaticOffsetsVectorSize) \ 454 V(int, bad_char_shift_table, kUC16AlphabetSize) \ 455 V(int, good_suffix_shift_table, (kBMMaxShift + 1)) \ 456 V(int, suffix_table, (kBMMaxShift + 1)) \ 457 ISOLATE_INIT_DEBUG_ARRAY_LIST(V) 459 typedef std::vector<HeapObject*> DebugObjectCache;
461 #define ISOLATE_INIT_LIST(V) \ 463 V(FatalErrorCallback, exception_behavior, nullptr) \ 464 V(OOMErrorCallback, oom_behavior, nullptr) \ 465 V(LogEventCallback, event_logger, nullptr) \ 466 V(AllowCodeGenerationFromStringsCallback, allow_code_gen_callback, nullptr) \ 467 V(AllowWasmCodeGenerationCallback, allow_wasm_code_gen_callback, nullptr) \ 468 V(ExtensionCallback, wasm_module_callback, &NoExtension) \ 469 V(ExtensionCallback, wasm_instance_callback, &NoExtension) \ 470 V(ApiImplementationCallback, wasm_compile_streaming_callback, nullptr) \ 471 V(WasmStreamingCallback, wasm_streaming_callback, nullptr) \ 472 V(WasmThreadsEnabledCallback, wasm_threads_enabled_callback, nullptr) \ 474 V(Relocatable*, relocatable_top, nullptr) \ 475 V(DebugObjectCache*, string_stream_debug_object_cache, nullptr) \ 476 V(Object*, string_stream_current_security_token, nullptr) \ 477 V(const intptr_t*, api_external_references, nullptr) \ 478 V(AddressToIndexHashMap*, external_reference_map, nullptr) \ 479 V(HeapObjectToIndexHashMap*, root_index_map, nullptr) \ 480 V(MicrotaskQueue*, default_microtask_queue, nullptr) \ 481 V(CompilationStatistics*, turbo_statistics, nullptr) \ 482 V(CodeTracer*, code_tracer, nullptr) \ 483 V(uint32_t, per_isolate_assert_data, 0xFFFFFFFFu) \ 484 V(PromiseRejectCallback, promise_reject_callback, nullptr) \ 485 V(const v8::StartupData*, snapshot_blob, nullptr) \ 486 V(int, code_and_metadata_size, 0) \ 487 V(int, bytecode_and_metadata_size, 0) \ 488 V(int, external_script_source_size, 0) \ 490 V(bool, is_profiling, false) \ 492 V(bool, formatting_stack_trace, false) \ 494 V(DebugInfo::ExecutionMode, debug_execution_mode, DebugInfo::kBreakpoints) \ 496 V(debug::Coverage::Mode, code_coverage_mode, debug::Coverage::kBestEffort) \ 497 V(debug::TypeProfile::Mode, type_profile_mode, debug::TypeProfile::kNone) \ 498 V(int, last_stack_frame_info_id, 0) \ 499 V(int, last_console_context_id, 0) \ 500 V(v8_inspector::V8Inspector*, inspector, nullptr) \ 501 V(bool, next_v8_call_is_safe_for_termination, false) \ 502 V(bool, only_terminate_in_safe_scope, false) \ 503 V(bool, detailed_source_positions_for_profiling, FLAG_detailed_line_info) 505 #define THREAD_LOCAL_TOP_ACCESSOR(type, name) \ 506 inline void set_##name(type v) { thread_local_top_.name##_ = v; } \ 507 inline type name() const { return thread_local_top_.name##_; } 509 #define THREAD_LOCAL_TOP_ADDRESS(type, name) \ 510 type* name##_address() { return &thread_local_top_.name##_; } 519 class ThreadDataTable;
520 class EntryStackItem;
529 thread_id_(thread_id),
531 thread_state_(
nullptr),
539 Isolate* isolate()
const {
return isolate_; }
540 ThreadId thread_id()
const {
return thread_id_; }
546 FIELD_ACCESSOR(Simulator*, simulator)
550 return isolate_ == isolate && thread_id_.Equals(thread_id);
560 Simulator* simulator_;
567 friend class ThreadDataTable;
568 friend class EntryStackItem;
573 static void InitializeOncePerProcess();
577 static V8_EXPORT_PRIVATE
Isolate* New(
578 IsolateAllocationMode mode = IsolateAllocationMode::kDefault);
584 static void Delete(
Isolate* isolate);
587 V8_INLINE IsolateAllocationMode isolate_allocation_mode();
596 base::Thread::GetThreadLocal(per_isolate_thread_data_key_));
600 V8_INLINE
static Isolate* TryGetCurrent() {
601 DCHECK_EQ(base::Relaxed_Load(&isolate_key_created_), 1);
602 return reinterpret_cast<Isolate*
>(
603 base::Thread::GetExistingThreadLocal(isolate_key_));
607 V8_INLINE
static Isolate* Current() {
608 Isolate* isolate = TryGetCurrent();
609 DCHECK_NOT_NULL(isolate);
616 inline static bool FromWritableHeapObject(HeapObject* obj, Isolate** isolate);
623 void InitializeLoggingAndCounters();
624 bool InitializeCounters();
626 bool Init(StartupDeserializer* des);
629 bool IsInUse() {
return entry_stack_ !=
nullptr; }
631 void ReleaseSharedPtrs();
633 void ClearSerializerData();
635 bool LogObjectRelocation();
650 PerIsolateThreadData* FindOrAllocatePerThreadDataForThisThread();
654 PerIsolateThreadData* FindPerThreadDataForThisThread();
658 PerIsolateThreadData* FindPerThreadDataForThread(ThreadId thread_id);
662 void DiscardPerThreadDataForThisThread();
667 static base::Thread::LocalStorageKey isolate_key() {
671 static base::Thread::LocalStorageKey per_isolate_thread_data_key();
674 base::RecursiveMutex* break_access() {
return &break_access_; }
676 Address get_address_from_id(IsolateAddressId
id);
679 Context context() {
return thread_local_top_.context_; }
680 inline void set_context(Context context);
681 Context* context_address() {
return &thread_local_top_.context_; }
683 THREAD_LOCAL_TOP_ACCESSOR(SaveContext*, save_context)
686 THREAD_LOCAL_TOP_ACCESSOR(ThreadId, thread_id)
689 inline Object* pending_exception();
690 inline void set_pending_exception(Object* exception_obj);
691 inline void clear_pending_exception();
693 bool AreWasmThreadsEnabled(Handle<Context> context);
695 THREAD_LOCAL_TOP_ADDRESS(Object*, pending_exception)
697 inline bool has_pending_exception();
699 THREAD_LOCAL_TOP_ADDRESS(Context, pending_handler_context)
700 THREAD_LOCAL_TOP_ADDRESS(Address, pending_handler_entrypoint)
701 THREAD_LOCAL_TOP_ADDRESS(Address, pending_handler_constant_pool)
702 THREAD_LOCAL_TOP_ADDRESS(Address, pending_handler_fp)
703 THREAD_LOCAL_TOP_ADDRESS(Address, pending_handler_sp)
705 THREAD_LOCAL_TOP_ACCESSOR(
bool, external_caught_exception)
707 v8::TryCatch* try_catch_handler() {
708 return thread_local_top_.try_catch_handler();
710 bool* external_caught_exception_address() {
711 return &thread_local_top_.external_caught_exception_;
714 THREAD_LOCAL_TOP_ADDRESS(Object*, scheduled_exception)
716 inline void clear_pending_message();
717 Address pending_message_obj_address() {
718 return reinterpret_cast<Address
>(&thread_local_top_.pending_message_obj_);
721 inline Object* scheduled_exception();
722 inline bool has_scheduled_exception();
723 inline void clear_scheduled_exception();
725 bool IsJavaScriptHandlerOnTop(Object* exception);
726 bool IsExternalHandlerOnTop(Object* exception);
728 inline bool is_catchable_by_javascript(Object* exception);
731 static Address c_entry_fp(ThreadLocalTop* thread) {
732 return thread->c_entry_fp_;
734 static Address handler(ThreadLocalTop* thread) {
return thread->handler_; }
735 Address c_function() {
return thread_local_top_.c_function_; }
737 inline Address* c_entry_fp_address() {
738 return &thread_local_top_.c_entry_fp_;
740 inline Address* handler_address() {
return &thread_local_top_.handler_; }
741 inline Address* c_function_address() {
742 return &thread_local_top_.c_function_;
746 Address js_entry_sp() {
747 return thread_local_top_.js_entry_sp_;
749 inline Address* js_entry_sp_address() {
750 return &thread_local_top_.js_entry_sp_;
755 inline Handle<JSGlobalObject> global_object();
758 inline Handle<JSObject> global_proxy();
760 static int ArchiveSpacePerThread() {
return sizeof(ThreadLocalTop); }
761 void FreeThreadResources() { thread_local_top_.Free(); }
767 V8_EXPORT_PRIVATE
bool OptionalRescheduleException(
bool is_bottom_call);
770 void PushPromise(Handle<JSObject> promise);
775 Handle<Object> GetPromiseOnStackOnThrow();
778 bool PromiseHasUserDefinedRejectHandler(Handle<Object> promise);
792 void SetCaptureStackTraceForUncaughtExceptions(
797 void SetAbortOnUncaughtExceptionCallback(
798 v8::Isolate::AbortOnUncaughtExceptionCallback callback);
800 enum PrintStackMode { kPrintStackConcise, kPrintStackVerbose };
801 void PrintCurrentStackTrace(FILE* out);
803 PrintStackMode mode = kPrintStackVerbose);
804 V8_EXPORT_PRIVATE
void PrintStack(FILE* out,
805 PrintStackMode mode = kPrintStackVerbose);
809 V8_NOINLINE
void PushStackTraceAndDie(
void* ptr1 =
nullptr,
810 void* ptr2 =
nullptr,
811 void* ptr3 =
nullptr,
812 void* ptr4 =
nullptr);
825 Address GetAbstractPC(
int* line,
int* column);
832 void SetFailedAccessCheckCallback(v8::FailedAccessCheckCallback callback);
838 Object* ThrowIllegalOperation();
840 template <
typename T>
843 Throw(*exception, location);
848 console_delegate_ = delegate;
850 debug::ConsoleDelegate* console_delegate() {
return console_delegate_; }
852 void set_async_event_delegate(debug::AsyncEventDelegate* delegate) {
853 async_event_delegate_ = delegate;
854 PromiseHookStateUpdated();
856 void OnAsyncFunctionStateChanged(Handle<JSPromise> promise,
857 debug::DebugAsyncActionType);
861 Object* ReThrow(Object* exception);
865 Object* UnwindAndFindHandler();
872 CAUGHT_BY_JAVASCRIPT,
874 CAUGHT_BY_DESUGARING,
876 CAUGHT_BY_ASYNC_AWAIT
878 CatchType PredictExceptionCatcher();
880 V8_EXPORT_PRIVATE
void ScheduleThrow(Object* exception);
883 void RestorePendingMessageFromTryCatch(v8::TryCatch* handler);
885 void CancelScheduledExceptionFromTryCatch(v8::TryCatch* handler);
886 void ReportPendingMessages();
887 void ReportPendingMessagesFromJavaScript();
890 void ReportPendingMessagesImpl(
bool report_externally);
893 MessageLocation GetMessageLocation();
896 Object* PromoteScheduledException();
902 bool ComputeLocation(MessageLocation* target);
903 bool ComputeLocationFromException(MessageLocation* target,
904 Handle<Object> exception);
905 bool ComputeLocationFromStackTrace(MessageLocation* target,
906 Handle<Object> exception);
908 Handle<JSMessageObject> CreateMessage(Handle<Object> exception,
909 MessageLocation* location);
912 Object* StackOverflow();
913 Object* TerminateExecution();
914 void CancelTerminateExecution();
916 void RequestInterrupt(InterruptCallback callback,
void* data);
917 void InvokeApiInterruptCallbacks();
920 void Iterate(RootVisitor* v);
921 void Iterate(RootVisitor* v, ThreadLocalTop* t);
922 char* Iterate(RootVisitor* v,
char* t);
923 void IterateThread(ThreadVisitor* v,
char* t);
926 inline Handle<NativeContext> native_context();
927 inline NativeContext raw_native_context();
929 Handle<Context> GetIncumbentContext();
931 void RegisterTryCatchHandler(v8::TryCatch* that);
932 void UnregisterTryCatchHandler(v8::TryCatch* that);
934 char* ArchiveThread(
char* to);
935 char* RestoreThread(
char* from);
937 static const int kUC16AlphabetSize = 256;
938 static const int kBMMaxShift = 250;
941 #define GLOBAL_ACCESSOR(type, name, initialvalue) \ 942 inline type name() const { \ 943 DCHECK(OFFSET_OF(Isolate, name##_) == name##_debug_offset_); \ 946 inline void set_##name(type value) { \ 947 DCHECK(OFFSET_OF(Isolate, name##_) == name##_debug_offset_); \ 950 ISOLATE_INIT_LIST(GLOBAL_ACCESSOR)
951 #undef GLOBAL_ACCESSOR 953 #define GLOBAL_ARRAY_ACCESSOR(type, name, length) \ 954 inline type* name() { \ 955 DCHECK(OFFSET_OF(Isolate, name##_) == name##_debug_offset_); \ 956 return &(name##_)[0]; \ 958 ISOLATE_INIT_ARRAY_LIST(GLOBAL_ARRAY_ACCESSOR)
959 #undef GLOBAL_ARRAY_ACCESSOR 961 #define NATIVE_CONTEXT_FIELD_ACCESSOR(index, type, name) \ 962 inline Handle<type> name(); \ 963 inline bool is_##name(type##ArgType value); 964 NATIVE_CONTEXT_FIELDS(NATIVE_CONTEXT_FIELD_ACCESSOR)
965 #undef NATIVE_CONTEXT_FIELD_ACCESSOR 967 Bootstrapper* bootstrapper() {
return bootstrapper_; }
969 Counters* counters() {
return async_counters().get(); }
971 const std::shared_ptr<Counters>& async_counters() {
973 DCHECK_NOT_NULL(async_counters_.get());
974 return async_counters_;
976 RuntimeProfiler* runtime_profiler() {
return runtime_profiler_; }
977 CompilationCache* compilation_cache() {
return compilation_cache_; }
981 DCHECK_NOT_NULL(logger_);
984 StackGuard* stack_guard() {
return &stack_guard_; }
985 Heap* heap() {
return &heap_; }
987 const IsolateData* isolate_data()
const {
return &isolate_data_; }
988 IsolateData* isolate_data() {
return &isolate_data_; }
993 Address isolate_root()
const {
return isolate_data()->isolate_root(); }
994 static size_t isolate_root_bias() {
995 return OFFSET_OF(Isolate, isolate_data_) + IsolateData::kIsolateRootBias;
998 RootsTable& roots_table() {
return isolate_data()->roots(); }
1007 base::AddressRegion root_register_addressable_region()
const {
1008 return base::AddressRegion(reinterpret_cast<Address>(&isolate_data_),
1009 sizeof(IsolateData));
1012 Object* root(RootIndex index) {
return roots_table()[index]; }
1014 Handle<Object> root_handle(RootIndex index) {
1015 return Handle<Object>(&roots_table()[index]);
1018 ExternalReferenceTable* external_reference_table() {
1019 DCHECK(isolate_data()->external_reference_table()->is_initialized());
1020 return isolate_data()->external_reference_table();
1023 V8_INLINE Address* builtins_table() {
return isolate_data_.builtins(); }
1025 StubCache* load_stub_cache() {
return load_stub_cache_; }
1026 StubCache* store_stub_cache() {
return store_stub_cache_; }
1027 DeoptimizerData* deoptimizer_data() {
return deoptimizer_data_; }
1028 bool deoptimizer_lazy_throw()
const {
return deoptimizer_lazy_throw_; }
1029 void set_deoptimizer_lazy_throw(
bool value) {
1030 deoptimizer_lazy_throw_ = value;
1032 ThreadLocalTop* thread_local_top() {
return &thread_local_top_; }
1034 static uint32_t thread_in_wasm_flag_address_offset() {
1041 OFFSET_OF(Isolate, thread_local_top_.thread_in_wasm_flag_address_) -
1042 isolate_root_bias());
1045 MaterializedObjectStore* materialized_object_store() {
1046 return materialized_object_store_;
1049 DescriptorLookupCache* descriptor_lookup_cache() {
1050 return descriptor_lookup_cache_;
1053 HandleScopeData* handle_scope_data() {
return &handle_scope_data_; }
1055 HandleScopeImplementer* handle_scope_implementer() {
1056 DCHECK(handle_scope_implementer_);
1057 return handle_scope_implementer_;
1060 UnicodeCache* unicode_cache() {
1061 return unicode_cache_;
1064 InnerPointerToCodeCache* inner_pointer_to_code_cache() {
1065 return inner_pointer_to_code_cache_;
1068 GlobalHandles* global_handles() {
return global_handles_; }
1070 EternalHandles* eternal_handles() {
return eternal_handles_; }
1072 ThreadManager* thread_manager() {
return thread_manager_; }
1075 return &jsregexp_uncanonicalize_;
1079 return &jsregexp_canonrange_;
1082 RuntimeState* runtime_state() {
return &runtime_state_; }
1084 Builtins* builtins() {
return &builtins_; }
1087 regexp_macro_assembler_canonicalize() {
1088 return ®exp_macro_assembler_canonicalize_;
1091 RegExpStack* regexp_stack() {
return regexp_stack_; }
1093 size_t total_regexp_code_generated() {
return total_regexp_code_generated_; }
1094 void IncreaseTotalRegexpCodeGenerated(
int size) {
1095 total_regexp_code_generated_ += size;
1098 std::vector<int>* regexp_indices() {
return ®exp_indices_; }
1101 interp_canonicalize_mapping() {
1102 return ®exp_macro_assembler_canonicalize_;
1105 Debug* debug() {
return debug_; }
1107 bool* is_profiling_address() {
return &is_profiling_; }
1108 CodeEventDispatcher* code_event_dispatcher()
const {
1109 return code_event_dispatcher_.get();
1111 HeapProfiler* heap_profiler()
const {
return heap_profiler_; }
1114 static size_t non_disposed_isolates() {
return non_disposed_isolates_; }
1124 static const int kJSRegexpStaticOffsetsVectorSize = 128;
1126 THREAD_LOCAL_TOP_ACCESSOR(ExternalCallbackScope*, external_callback_scope)
1128 THREAD_LOCAL_TOP_ACCESSOR(StateTag, current_vm_state)
1130 void SetData(
uint32_t slot,
void* data) {
1131 DCHECK_LT(slot, Internals::kNumIsolateDataSlots);
1132 isolate_data_.embedder_data_[slot] = data;
1135 DCHECK_LT(slot, Internals::kNumIsolateDataSlots);
1136 return isolate_data_.embedder_data_[slot];
1139 bool serializer_enabled()
const {
return serializer_enabled_; }
1141 void enable_serializer() { serializer_enabled_ =
true; }
1143 bool snapshot_available()
const {
1144 return snapshot_blob_ !=
nullptr && snapshot_blob_->raw_size != 0;
1147 bool IsDead() {
return has_fatal_error_; }
1148 void SignalFatalError() { has_fatal_error_ =
true; }
1150 bool use_optimizer();
1152 bool initialized_from_snapshot() {
return initialized_from_snapshot_; }
1154 bool NeedsSourcePositionsForProfiling()
const;
1156 bool NeedsDetailedOptimizedCodeLineInfo()
const;
1158 bool is_best_effort_code_coverage()
const {
1159 return code_coverage_mode() == debug::Coverage::kBestEffort;
1162 bool is_precise_count_code_coverage()
const {
1163 return code_coverage_mode() == debug::Coverage::kPreciseCount;
1166 bool is_precise_binary_code_coverage()
const {
1167 return code_coverage_mode() == debug::Coverage::kPreciseBinary;
1170 bool is_block_count_code_coverage()
const {
1171 return code_coverage_mode() == debug::Coverage::kBlockCount;
1174 bool is_block_binary_code_coverage()
const {
1175 return code_coverage_mode() == debug::Coverage::kBlockBinary;
1178 bool is_block_code_coverage()
const {
1179 return is_block_count_code_coverage() || is_block_binary_code_coverage();
1182 bool is_collecting_type_profile()
const {
1183 return type_profile_mode() == debug::TypeProfile::kCollect;
1191 void SetFeedbackVectorsForProfilingTools(Object* value);
1193 void MaybeInitializeVectorListFromHeap();
1195 double time_millis_since_init() {
1196 return heap_.MonotonicallyIncreasingTimeInMs() - time_millis_at_init_;
1199 DateCache* date_cache() {
1203 void set_date_cache(DateCache* date_cache);
1205 #ifdef V8_INTL_SUPPORT 1207 const std::string& default_locale() {
return default_locale_; }
1209 void set_default_locale(
const std::string& locale) {
1210 DCHECK_EQ(default_locale_.length(), 0);
1211 default_locale_ = locale;
1215 enum class ICUObjectCacheType{
1216 kDefaultCollator, kDefaultNumberFormat, kDefaultSimpleDateFormat,
1217 kDefaultSimpleDateFormatForTime, kDefaultSimpleDateFormatForDate};
1219 icu::UObject* get_cached_icu_object(ICUObjectCacheType cache_type);
1220 void set_icu_object_in_cache(ICUObjectCacheType cache_type,
1221 std::shared_ptr<icu::UObject> obj);
1222 void clear_cached_icu_object(ICUObjectCacheType cache_type);
1224 #endif // V8_INTL_SUPPORT 1226 static const int kProtectorValid = 1;
1227 static const int kProtectorInvalid = 0;
1229 inline bool IsArrayConstructorIntact();
1234 bool IsNoElementsProtectorIntact(Context context);
1235 bool IsNoElementsProtectorIntact();
1237 bool IsArrayOrObjectOrStringPrototype(Object*
object);
1239 inline bool IsArraySpeciesLookupChainIntact();
1240 inline bool IsTypedArraySpeciesLookupChainIntact();
1241 inline bool IsRegExpSpeciesLookupChainIntact();
1242 inline bool IsPromiseSpeciesLookupChainIntact();
1243 bool IsIsConcatSpreadableLookupChainIntact();
1244 bool IsIsConcatSpreadableLookupChainIntact(JSReceiver* receiver);
1245 inline bool IsStringLengthOverflowIntact();
1246 inline bool IsArrayIteratorLookupChainIntact();
1257 inline bool IsMapIteratorLookupChainIntact();
1270 inline bool IsSetIteratorLookupChainIntact();
1282 inline bool IsStringIteratorLookupChainIntact();
1285 inline bool IsArrayBufferNeuteringIntact();
1289 bool IsPromiseHookProtectorIntact();
1293 bool IsPromiseResolveLookupChainIntact();
1300 bool IsPromiseThenLookupChainIntact();
1301 bool IsPromiseThenLookupChainIntact(Handle<JSReceiver> receiver);
1307 void UpdateNoElementsProtectorOnSetElement(Handle<JSObject>
object);
1308 void UpdateNoElementsProtectorOnSetLength(Handle<JSObject>
object) {
1309 UpdateNoElementsProtectorOnSetElement(
object);
1311 void UpdateNoElementsProtectorOnSetPrototype(Handle<JSObject>
object) {
1312 UpdateNoElementsProtectorOnSetElement(
object);
1314 void UpdateNoElementsProtectorOnNormalizeElements(Handle<JSObject>
object) {
1315 UpdateNoElementsProtectorOnSetElement(
object);
1317 void InvalidateArrayConstructorProtector();
1318 void InvalidateArraySpeciesProtector();
1319 void InvalidateTypedArraySpeciesProtector();
1320 void InvalidateRegExpSpeciesProtector();
1321 void InvalidatePromiseSpeciesProtector();
1322 void InvalidateIsConcatSpreadableProtector();
1323 void InvalidateStringLengthOverflowProtector();
1324 void InvalidateArrayIteratorProtector();
1325 void InvalidateMapIteratorProtector();
1326 void InvalidateSetIteratorProtector();
1327 void InvalidateStringIteratorProtector();
1328 void InvalidateArrayBufferNeuteringProtector();
1329 V8_EXPORT_PRIVATE
void InvalidatePromiseHookProtector();
1330 void InvalidatePromiseResolveProtector();
1331 void InvalidatePromiseThenProtector();
1334 bool IsAnyInitialArrayPrototype(Handle<JSArray> array);
1336 void IterateDeferredHandles(RootVisitor* visitor);
1337 void LinkDeferredHandles(DeferredHandles* deferred_handles);
1338 void UnlinkDeferredHandles(DeferredHandles* deferred_handles);
1341 bool IsDeferredHandle(Address* location);
1344 bool concurrent_recompilation_enabled() {
1346 DCHECK(optimizing_compile_dispatcher_ ==
nullptr ||
1347 FLAG_concurrent_recompilation);
1348 return optimizing_compile_dispatcher_ !=
nullptr;
1351 OptimizingCompileDispatcher* optimizing_compile_dispatcher() {
1352 return optimizing_compile_dispatcher_;
1356 void AbortConcurrentOptimization(BlockingBehavior blocking_behavior);
1358 int id()
const {
return static_cast<int>(id_); }
1360 CompilationStatistics* GetTurboStatistics();
1361 CodeTracer* GetCodeTracer();
1363 void DumpAndResetStats();
1365 void* stress_deopt_count_address() {
return &stress_deopt_count_; }
1367 void set_force_slow_path(
bool v) { force_slow_path_ = v; }
1368 bool force_slow_path()
const {
return force_slow_path_; }
1369 bool* force_slow_path_address() {
return &force_slow_path_; }
1371 DebugInfo::ExecutionMode* debug_execution_mode_address() {
1372 return &debug_execution_mode_;
1375 V8_EXPORT_PRIVATE base::RandomNumberGenerator* random_number_generator();
1377 V8_EXPORT_PRIVATE base::RandomNumberGenerator* fuzzer_rng();
1381 int GenerateIdentityHash(
uint32_t mask);
1384 Code FindCodeObject(Address a);
1386 int NextOptimizationId() {
1387 int id = next_optimization_id_++;
1388 if (!Smi::IsValid(next_optimization_id_)) {
1389 next_optimization_id_ = 0;
1394 void AddNearHeapLimitCallback(v8::NearHeapLimitCallback,
void* data);
1395 void RemoveNearHeapLimitCallback(v8::NearHeapLimitCallback callback,
1397 void AddCallCompletedCallback(CallCompletedCallback callback);
1398 void RemoveCallCompletedCallback(CallCompletedCallback callback);
1399 void FireCallCompletedCallback();
1401 void AddBeforeCallEnteredCallback(BeforeCallEnteredCallback callback);
1402 void RemoveBeforeCallEnteredCallback(BeforeCallEnteredCallback callback);
1403 inline void FireBeforeCallEnteredCallback();
1405 void AddMicrotasksCompletedCallback(MicrotasksCompletedCallback callback);
1406 void RemoveMicrotasksCompletedCallback(MicrotasksCompletedCallback callback);
1407 inline void FireMicrotasksCompletedCallback();
1409 void SetPromiseRejectCallback(PromiseRejectCallback callback);
1410 void ReportPromiseReject(Handle<JSPromise> promise, Handle<Object> value,
1411 v8::PromiseRejectEvent event);
1413 void EnqueueMicrotask(Handle<Microtask> microtask);
1414 void RunMicrotasks();
1415 bool IsRunningMicrotasks()
const {
return is_running_microtasks_; }
1417 Handle<Symbol> SymbolFor(RootIndex dictionary_index, Handle<String> name,
1418 bool private_symbol);
1420 void SetUseCounterCallback(v8::Isolate::UseCounterCallback callback);
1421 void CountUsage(v8::Isolate::UseCounterFeature feature);
1423 static std::string GetTurboCfgFileName(Isolate* isolate);
1425 #if V8_SFI_HAS_UNIQUE_ID 1426 int GetNextUniqueSharedFunctionInfoId() {
return next_unique_sfi_id_++; }
1429 Address promise_hook_address() {
1430 return reinterpret_cast<Address
>(&promise_hook_);
1433 Address async_event_delegate_address() {
1434 return reinterpret_cast<Address
>(&async_event_delegate_);
1437 Address promise_hook_or_async_event_delegate_address() {
1438 return reinterpret_cast<Address
>(&promise_hook_or_async_event_delegate_);
1441 Address default_microtask_queue_address() {
1442 return reinterpret_cast<Address
>(&default_microtask_queue_);
1445 Address promise_hook_or_debug_is_active_or_async_event_delegate_address() {
1446 return reinterpret_cast<Address
>(
1447 &promise_hook_or_debug_is_active_or_async_event_delegate_);
1450 Address handle_scope_implementer_address() {
1451 return reinterpret_cast<Address
>(&handle_scope_implementer_);
1454 void SetAtomicsWaitCallback(v8::Isolate::AtomicsWaitCallback callback,
1456 void RunAtomicsWaitCallback(v8::Isolate::AtomicsWaitEvent event,
1457 Handle<JSArrayBuffer> array_buffer,
1458 size_t offset_in_bytes, int32_t value,
1459 double timeout_in_ms,
1460 AtomicsWaitWakeHandle* stop_handle);
1462 void SetPromiseHook(PromiseHook hook);
1463 void RunPromiseHook(PromiseHookType type, Handle<JSPromise> promise,
1464 Handle<Object> parent);
1465 void PromiseHookStateUpdated();
1467 void AddDetachedContext(Handle<Context> context);
1468 void CheckDetachedContextsAfterGC();
1470 std::vector<Object*>* read_only_object_cache() {
1471 return &read_only_object_cache_;
1474 std::vector<Object*>* partial_snapshot_cache() {
1475 return &partial_snapshot_cache_;
1481 bool ShouldLoadConstantsFromRootList()
const {
1482 return FLAG_embedded_builtins &&
1483 builtins_constants_table_builder() !=
nullptr;
1486 BuiltinsConstantsTableBuilder* builtins_constants_table_builder()
const {
1487 return builtins_constants_table_builder_;
1490 static const uint8_t* CurrentEmbeddedBlob();
1491 static uint32_t CurrentEmbeddedBlobSize();
1495 const uint8_t* embedded_blob()
const;
1496 uint32_t embedded_blob_size()
const;
1499 array_buffer_allocator_ = allocator;
1502 return array_buffer_allocator_;
1505 FutexWaitListNode* futex_wait_list_node() {
return &futex_wait_list_node_; }
1507 CancelableTaskManager* cancelable_task_manager() {
1508 return cancelable_task_manager_;
1511 const AstStringConstants* ast_string_constants()
const {
1512 return ast_string_constants_;
1515 interpreter::Interpreter* interpreter()
const {
return interpreter_; }
1517 compiler::PerIsolateCompilerCache* compiler_cache()
const {
1518 return compiler_cache_;
1520 void set_compiler_utils(compiler::PerIsolateCompilerCache* cache,
1522 compiler_cache_ = cache;
1523 compiler_zone_ = zone;
1526 AccountingAllocator* allocator() {
return allocator_; }
1528 CompilerDispatcher* compiler_dispatcher()
const {
1529 return compiler_dispatcher_;
1532 bool IsInAnyContext(Object*
object,
uint32_t index);
1534 void SetHostImportModuleDynamicallyCallback(
1535 HostImportModuleDynamicallyCallback callback);
1536 MaybeHandle<JSPromise> RunHostImportModuleDynamicallyCallback(
1537 Handle<Script> referrer, Handle<Object> specifier);
1539 void SetHostInitializeImportMetaObjectCallback(
1540 HostInitializeImportMetaObjectCallback callback);
1541 Handle<JSObject> RunHostInitializeImportMetaObjectCallback(
1542 Handle<Module> module);
1544 void SetPrepareStackTraceCallback(PrepareStackTraceCallback callback);
1545 MaybeHandle<Object> RunPrepareStackTraceCallback(Handle<Context>,
1546 Handle<JSObject> Error,
1547 Handle<JSArray> sites);
1548 bool HasPrepareStackTraceCallback()
const;
1550 void SetRAILMode(RAILMode rail_mode);
1552 RAILMode rail_mode() {
return rail_mode_.Value(); }
1554 double LoadStartTimeMs();
1556 void IsolateInForegroundNotification();
1558 void IsolateInBackgroundNotification();
1560 bool IsIsolateInBackground() {
return is_isolate_in_background_; }
1562 void EnableMemorySavingsMode() { memory_savings_mode_active_ =
true; }
1564 void DisableMemorySavingsMode() { memory_savings_mode_active_ =
false; }
1566 bool IsMemorySavingsModeActive() {
return memory_savings_mode_active_; }
1568 PRINTF_FORMAT(2, 3) void PrintWithTimestamp(const
char* format, ...);
1570 void set_allow_atomics_wait(
bool set) { allow_atomics_wait_ =
set; }
1571 bool allow_atomics_wait() {
return allow_atomics_wait_; }
1574 void RegisterManagedPtrDestructor(ManagedPtrDestructor* finalizer);
1577 void UnregisterManagedPtrDestructor(ManagedPtrDestructor* finalizer);
1579 size_t elements_deletion_counter() {
return elements_deletion_counter_; }
1580 void set_elements_deletion_counter(
size_t value) {
1581 elements_deletion_counter_ = value;
1584 wasm::WasmEngine* wasm_engine()
const {
return wasm_engine_.get(); }
1585 void SetWasmEngine(std::shared_ptr<wasm::WasmEngine> engine);
1588 return top_backup_incumbent_scope_;
1590 void set_top_backup_incumbent_scope(
1592 top_backup_incumbent_scope_ = top_backup_incumbent_scope;
1595 void SetIdle(
bool is_idle);
1598 explicit Isolate(std::unique_ptr<IsolateAllocator> isolate_allocator);
1601 void CheckIsolateLayout();
1603 class ThreadDataTable {
1605 ThreadDataTable() =
default;
1607 PerIsolateThreadData* Lookup(ThreadId thread_id);
1608 void Insert(PerIsolateThreadData* data);
1609 void Remove(PerIsolateThreadData* data);
1610 void RemoveAllThreads();
1614 std::size_t operator()(
const ThreadId& t)
const {
1615 return std::hash<int>()(t.ToInteger());
1619 std::unordered_map<ThreadId, PerIsolateThreadData*, Hasher> table_;
1628 class EntryStackItem {
1630 EntryStackItem(PerIsolateThreadData* previous_thread_data,
1631 Isolate* previous_isolate,
1632 EntryStackItem* previous_item)
1634 previous_thread_data(previous_thread_data),
1635 previous_isolate(previous_isolate),
1636 previous_item(previous_item) { }
1639 PerIsolateThreadData* previous_thread_data;
1640 Isolate* previous_isolate;
1641 EntryStackItem* previous_item;
1644 DISALLOW_COPY_AND_ASSIGN(EntryStackItem);
1647 static base::Thread::LocalStorageKey per_isolate_thread_data_key_;
1648 static base::Thread::LocalStorageKey isolate_key_;
1651 static base::Atomic32 isolate_counter_;
1654 static base::Atomic32 isolate_key_created_;
1659 static void SetIsolateThreadLocals(Isolate* isolate,
1660 PerIsolateThreadData* data);
1662 void InitializeThreadLocal();
1664 void MarkCompactPrologue(
bool is_compacting,
1665 ThreadLocalTop* archived_thread_data);
1666 void MarkCompactEpilogue(
bool is_compacting,
1667 ThreadLocalTop* archived_thread_data);
1674 bool PropagatePendingExceptionToExternalTryCatch();
1676 void SetTerminationOnExternalTryCatch();
1678 void RunPromiseHookForAsyncEventDelegate(PromiseHookType type,
1679 Handle<JSPromise> promise);
1681 const char* RAILModeName(RAILMode rail_mode)
const {
1682 switch (rail_mode) {
1683 case PERFORMANCE_RESPONSE:
1685 case PERFORMANCE_ANIMATION:
1687 case PERFORMANCE_IDLE:
1689 case PERFORMANCE_LOAD:
1698 IsolateData isolate_data_;
1700 std::unique_ptr<IsolateAllocator> isolate_allocator_;
1704 EntryStackItem* entry_stack_ =
nullptr;
1705 int stack_trace_nesting_level_ = 0;
1706 StringStream* incomplete_message_ =
nullptr;
1707 Address isolate_addresses_[kIsolateAddressCount + 1] = {};
1708 Bootstrapper* bootstrapper_ =
nullptr;
1709 RuntimeProfiler* runtime_profiler_ =
nullptr;
1710 CompilationCache* compilation_cache_ =
nullptr;
1711 std::shared_ptr<Counters> async_counters_;
1712 base::RecursiveMutex break_access_;
1713 Logger* logger_ =
nullptr;
1714 StackGuard stack_guard_;
1715 StubCache* load_stub_cache_ =
nullptr;
1716 StubCache* store_stub_cache_ =
nullptr;
1717 DeoptimizerData* deoptimizer_data_ =
nullptr;
1718 bool deoptimizer_lazy_throw_ =
false;
1719 MaterializedObjectStore* materialized_object_store_ =
nullptr;
1720 ThreadLocalTop thread_local_top_;
1721 bool capture_stack_trace_for_uncaught_exceptions_ =
false;
1722 int stack_trace_for_uncaught_exceptions_frame_limit_ = 0;
1724 StackTrace::kOverview;
1725 DescriptorLookupCache* descriptor_lookup_cache_ =
nullptr;
1726 HandleScopeData handle_scope_data_;
1727 HandleScopeImplementer* handle_scope_implementer_ =
nullptr;
1728 UnicodeCache* unicode_cache_ =
nullptr;
1729 AccountingAllocator* allocator_ =
nullptr;
1730 InnerPointerToCodeCache* inner_pointer_to_code_cache_ =
nullptr;
1731 GlobalHandles* global_handles_ =
nullptr;
1732 EternalHandles* eternal_handles_ =
nullptr;
1733 ThreadManager* thread_manager_ =
nullptr;
1734 RuntimeState runtime_state_;
1736 SetupIsolateDelegate* setup_delegate_ =
nullptr;
1740 regexp_macro_assembler_canonicalize_;
1741 RegExpStack* regexp_stack_ =
nullptr;
1742 std::vector<int> regexp_indices_;
1743 DateCache* date_cache_ =
nullptr;
1744 base::RandomNumberGenerator* random_number_generator_ =
nullptr;
1745 base::RandomNumberGenerator* fuzzer_rng_ =
nullptr;
1746 base::AtomicValue<RAILMode> rail_mode_;
1747 v8::Isolate::AtomicsWaitCallback atomics_wait_callback_ =
nullptr;
1748 void* atomics_wait_callback_data_ =
nullptr;
1749 PromiseHook promise_hook_ =
nullptr;
1750 HostImportModuleDynamicallyCallback host_import_module_dynamically_callback_ =
1752 HostInitializeImportMetaObjectCallback
1753 host_initialize_import_meta_object_callback_ =
nullptr;
1754 base::Mutex rail_mutex_;
1755 double load_start_time_ms_ = 0;
1757 #ifdef V8_INTL_SUPPORT 1758 std::string default_locale_;
1760 struct ICUObjectCacheTypeHash {
1761 std::size_t operator()(ICUObjectCacheType a)
const {
1762 return static_cast<std::size_t
>(a);
1765 std::unordered_map<ICUObjectCacheType, std::shared_ptr<icu::UObject>,
1766 ICUObjectCacheTypeHash>
1769 #endif // V8_INTL_SUPPORT 1772 bool serializer_enabled_ =
false;
1775 bool has_fatal_error_ =
false;
1778 bool initialized_from_snapshot_ =
false;
1782 bool is_tail_call_elimination_enabled_ =
true;
1786 bool is_isolate_in_background_ =
false;
1790 bool memory_savings_mode_active_ =
false;
1793 double time_millis_at_init_ = 0;
1796 static std::atomic<size_t> non_disposed_isolates_;
1798 JSObject::SpillInformation js_spill_information_;
1801 Debug* debug_ =
nullptr;
1802 HeapProfiler* heap_profiler_ =
nullptr;
1803 std::unique_ptr<CodeEventDispatcher> code_event_dispatcher_;
1805 const AstStringConstants* ast_string_constants_ =
nullptr;
1807 interpreter::Interpreter* interpreter_ =
nullptr;
1809 compiler::PerIsolateCompilerCache* compiler_cache_ =
nullptr;
1810 Zone* compiler_zone_ =
nullptr;
1812 CompilerDispatcher* compiler_dispatcher_ =
nullptr;
1814 typedef std::pair<InterruptCallback, void*> InterruptEntry;
1815 std::queue<InterruptEntry> api_interrupts_queue_;
1817 #define GLOBAL_BACKING_STORE(type, name, initialvalue) \ 1819 ISOLATE_INIT_LIST(GLOBAL_BACKING_STORE)
1820 #undef GLOBAL_BACKING_STORE 1822 #define GLOBAL_ARRAY_BACKING_STORE(type, name, length) \ 1823 type name##_[length]; 1824 ISOLATE_INIT_ARRAY_LIST(GLOBAL_ARRAY_BACKING_STORE)
1825 #undef GLOBAL_ARRAY_BACKING_STORE 1831 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ 1832 V8_EXPORT_PRIVATE static const intptr_t name##_debug_offset_; 1833 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET)
1834 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET)
1835 #undef ISOLATE_FIELD_OFFSET 1838 DeferredHandles* deferred_handles_head_ =
nullptr;
1839 OptimizingCompileDispatcher* optimizing_compile_dispatcher_ =
nullptr;
1842 unsigned int stress_deopt_count_ = 0;
1844 bool force_slow_path_ =
false;
1846 int next_optimization_id_ = 0;
1848 #if V8_SFI_HAS_UNIQUE_ID 1849 int next_unique_sfi_id_ = 0;
1853 std::vector<BeforeCallEnteredCallback> before_call_entered_callbacks_;
1856 std::vector<CallCompletedCallback> call_completed_callbacks_;
1859 std::vector<MicrotasksCompletedCallback> microtasks_completed_callbacks_;
1860 bool is_running_microtasks_ =
false;
1862 v8::Isolate::UseCounterCallback use_counter_callback_ =
nullptr;
1864 std::vector<Object*> read_only_object_cache_;
1865 std::vector<Object*> partial_snapshot_cache_;
1869 BuiltinsConstantsTableBuilder* builtins_constants_table_builder_ =
nullptr;
1871 void InitializeDefaultEmbeddedBlob();
1872 void CreateAndSetEmbeddedBlob();
1873 void TearDownEmbeddedBlob();
1875 void SetEmbeddedBlob(
const uint8_t* blob,
uint32_t blob_size);
1876 void ClearEmbeddedBlob();
1878 const uint8_t* embedded_blob_ =
nullptr;
1883 FutexWaitListNode futex_wait_list_node_;
1885 CancelableTaskManager* cancelable_task_manager_ =
nullptr;
1887 debug::ConsoleDelegate* console_delegate_ =
nullptr;
1889 debug::AsyncEventDelegate* async_event_delegate_ =
nullptr;
1890 bool promise_hook_or_async_event_delegate_ =
false;
1891 bool promise_hook_or_debug_is_active_or_async_event_delegate_ =
false;
1892 int async_task_count_ = 0;
1894 v8::Isolate::AbortOnUncaughtExceptionCallback
1895 abort_on_uncaught_exception_callback_ =
nullptr;
1897 bool allow_atomics_wait_ =
true;
1899 base::Mutex managed_ptr_destructors_mutex_;
1900 ManagedPtrDestructor* managed_ptr_destructors_head_ =
nullptr;
1902 size_t total_regexp_code_generated_ = 0;
1904 size_t elements_deletion_counter_ = 0;
1906 std::shared_ptr<wasm::WasmEngine> wasm_engine_;
1908 std::unique_ptr<TracingCpuProfilerImpl> tracing_cpu_profiler_;
1914 PrepareStackTraceCallback prepare_stack_trace_callback_ =
nullptr;
1919 base::Mutex thread_data_table_mutex_;
1920 ThreadDataTable thread_data_table_;
1924 void*
operator new(
size_t,
void* ptr) {
return ptr; }
1925 void*
operator new(
size_t) =
delete;
1926 void operator delete(
void*) =
delete;
1928 friend class heap::HeapTester;
1929 friend class TestSerializer;
1931 DISALLOW_COPY_AND_ASSIGN(Isolate);
1935 #undef FIELD_ACCESSOR 1936 #undef THREAD_LOCAL_TOP_ACCESSOR 1942 : promise_(promise), prev_(prev) {}
1978 DCHECK(isolate_->context() == *context_);
1997 static void Lock(
Isolate* isolate) { isolate->break_access()->Lock(); }
1998 static void Unlock(
Isolate* isolate) { isolate->break_access()->Unlock(); }
2000 static bool TryLock(
Isolate* isolate) {
2001 return isolate->break_access()->TryLock();
2015 bool HasOverflowed()
const {
2016 StackGuard* stack_guard = isolate_->stack_guard();
2017 return GetCurrentStackPosition() < stack_guard->real_climit();
2021 bool InterruptRequested() {
2022 StackGuard* stack_guard = isolate_->stack_guard();
2023 return GetCurrentStackPosition() < stack_guard->climit();
2027 bool JsHasOverflowed(
uintptr_t gap = 0)
const;
2033 #define STACK_CHECK(isolate, result_value) \ 2035 StackLimitCheck stack_check(isolate); \ 2036 if (stack_check.HasOverflowed()) { \ 2037 isolate->StackOverflow(); \ 2038 return result_value; \ 2046 enum Mode { kPostponeInterrupts, kRunInterrupts, kNoop };
2049 if (mode_ != kNoop) stack_guard_->PopInterruptsScope();
2056 bool Intercept(StackGuard::InterruptFlag flag);
2059 : stack_guard_(isolate->stack_guard()),
2060 intercept_mask_(intercept_mask),
2061 intercepted_flags_(0),
2063 if (mode_ != kNoop) stack_guard_->PushInterruptsScope(
this);
2068 int intercept_mask_;
2069 int intercepted_flags_;
2083 int intercept_mask = StackGuard::ALL_INTERRUPTS)
2085 InterruptsScope::kPostponeInterrupts) {}
2095 int intercept_mask = StackGuard::ALL_INTERRUPTS)
2097 InterruptsScope::kRunInterrupts) {}
2104 void* ptr2 =
nullptr,
void* ptr3 =
nullptr,
2105 void* ptr4 =
nullptr);
2107 V8_NOINLINE
void Print()
volatile;
2109 static const uintptr_t kStartMarker = 0xdecade30;
2110 static const uintptr_t kEndMarker = 0xdecade31;
2111 static const int kStacktraceBufferSize = 32 * KB;
2119 void* code_objects_[4];
2120 char js_stack_trace_[kStacktraceBufferSize];
2127 #endif // V8_ISOLATE_H_