598 void operator delete(
void*) =
delete;
607 thread_id_(thread_id),
609 thread_state_(nullptr)
629 return isolate_ == isolate && thread_id_ == thread_id;
639 Simulator* simulator_;
653 static void InitializeOncePerProcess();
664 static void Delete(
Isolate* isolate);
674 V8_INLINE static PerIsolateThreadData* CurrentPerIsolateThreadData();
681 static void SetCurrent(
Isolate* isolate);
683 inline bool IsCurrent()
const;
690 void InitializeLoggingAndCounters();
691 bool InitializeCounters();
693 bool InitWithoutSnapshot();
694 bool InitWithSnapshot(
SnapshotData* startup_snapshot_data,
700 bool IsInUse() {
return entry_stack_ !=
nullptr; }
702 void ReleaseSharedPtrs();
704 void ClearSerializerData();
706 void UpdateLogObjectRelocation();
721 PerIsolateThreadData* FindOrAllocatePerThreadDataForThisThread();
725 PerIsolateThreadData* FindPerThreadDataForThisThread();
729 PerIsolateThreadData* FindPerThreadDataForThread(
ThreadId thread_id);
733 void DiscardPerThreadDataForThisThread();
744 return &internalized_string_access_;
750 return &full_transition_array_access_;
756 return &shared_function_info_access_;
771 return &boilerplate_migration_access_;
782 return OwnsStringTables() ? string_table_.get()
783 : shared_space_isolate()->string_table_.get();
786 return OwnsStringTables()
787 ? string_forwarding_table_.get()
788 : shared_space_isolate()->string_forwarding_table_.get();
792 return is_shared_space_isolate()
793 ? shared_struct_type_registry_.get()
794 : shared_space_isolate()->shared_struct_type_registry_.get();
809 return thread_local_top()->topmost_script_having_context_;
811 inline void set_topmost_script_having_context(
Tagged<Context> context);
812 inline void clear_topmost_script_having_context();
814 return &thread_local_top()->topmost_script_having_context_;
819 thread_local_top()->thread_id_.store(
id, std::memory_order_relaxed);
822 return thread_local_top()->thread_id_.load(std::memory_order_relaxed);
827#if V8_ENABLE_WEBASSEMBLY
828 void WasmInitJSPIFeature();
831 bool IsSharedArrayBufferConstructorEnabled(
851 return thread_local_top()->try_catch_handler_;
859 inline void clear_exception();
862 inline void clear_internal_exception();
863 inline bool has_exception();
866 inline void clear_pending_message();
868 inline bool has_pending_message();
882 ExceptionHandlerType TopExceptionHandlerType(
Tagged<Object> exception);
886 inline bool is_execution_terminating();
890 return thread->c_entry_fp_;
893 Address
c_function() {
return thread_local_top()->c_function_; }
896 return &thread_local_top()->c_entry_fp_;
902 isolate_root_bias());
906 return &thread_local_top()->c_function_;
909#if defined(DEBUG) || defined(VERIFY_HEAP)
917 void RegisterDeserializerStarted() { ++num_active_deserializers_; }
918 void RegisterDeserializerFinished() {
919 CHECK_GE(--num_active_deserializers_, 0);
921 bool has_active_deserializer()
const {
922 return num_active_deserializers_.load(std::memory_order_acquire) > 0;
931 Address
js_entry_sp() {
return thread_local_top()->js_entry_sp_; }
933 return &thread_local_top()->js_entry_sp_;
936 std::vector<MemoryRange>* GetCodePages()
const;
938 void SetCodePages(std::vector<MemoryRange>* new_code_pages);
953 bool WalkCallStackAndPromiseTree(
955 const std::function<
void(PromiseHandler)>&
callback);
969 void SetCaptureStackTraceForUncaughtExceptions(
971 bool get_capture_stack_trace_for_uncaught_exceptions()
const;
973 void SetAbortOnUncaughtExceptionCallback(
977 void PrintCurrentStackTrace(std::ostream& out,
979 should_include_frame_callback =
nullptr);
981 PrintStackMode mode = kPrintStackVerbose);
982 void PrintStack(FILE* out, PrintStackMode mode = kPrintStackVerbose);
987 void* ptr1 =
nullptr,
void* ptr2 =
nullptr,
void* ptr3 =
nullptr,
988 void* ptr4 =
nullptr,
void* ptr5 =
nullptr,
void* ptr6 =
nullptr);
990 V8_NOINLINE void PushParamsAndDie(
void* ptr1 =
nullptr,
void* ptr2 =
nullptr,
991 void* ptr3 =
nullptr,
void* ptr4 =
nullptr,
992 void* ptr5 =
nullptr,
void* ptr6 =
nullptr);
996 void* ptr1 =
nullptr,
void* ptr2 =
nullptr,
void* ptr3 =
nullptr,
997 void* ptr4 =
nullptr,
void* ptr5 =
nullptr,
void* ptr6 =
nullptr);
1001 void* ptr1 =
nullptr,
void* ptr2 =
nullptr,
void* ptr3 =
nullptr,
1002 void* ptr4 =
nullptr,
void* ptr5 =
nullptr,
void* ptr6 =
nullptr);
1018 Address GetAbstractPC(
int* line,
int* column);
1039 heap()->FatalProcessOutOfMemory(location);
1043 console_delegate_ = delegate;
1048 async_event_delegate_ = delegate;
1049 PromiseHookStateUpdated();
1059 void OnTerminationDuringRunMicrotasks();
1082 CatchType PredictExceptionCatcher();
1084 void ReportPendingMessages(
bool report =
true);
1111 void CancelTerminateExecution();
1114 void InvokeApiInterruptCallbacks();
1116 void RequestInvalidateNoProfilingProtector();
1134 char* ArchiveThread(
char* to);
1135 char* RestoreThread(
char* from);
1137 static const int kUC16AlphabetSize = 256;
1138 static const int kBMMaxShift = 250;
1141#define GLOBAL_ACCESSOR(type, name, initialvalue) \
1142 inline type name() const { \
1143 DCHECK_EQ(OFFSET_OF(Isolate, name##_), name##_debug_offset_); \
1146 inline void set_##name(type value) { \
1147 DCHECK_EQ(OFFSET_OF(Isolate, name##_), name##_debug_offset_); \
1151#undef GLOBAL_ACCESSOR
1155 CollectSourcePositionsForAllBytecodeArrays();
1157 detailed_source_positions_for_profiling_ =
value;
1161 return detailed_source_positions_for_profiling_;
1164#define GLOBAL_ARRAY_ACCESSOR(type, name, length) \
1165 inline type* name() { \
1166 DCHECK(OFFSET_OF(Isolate, name##_) == name##_debug_offset_); \
1167 return &(name##_)[0]; \
1170#undef GLOBAL_ARRAY_ACCESSOR
1172#define NATIVE_CONTEXT_FIELD_ACCESSOR(index, type, name) \
1173 inline Handle<UNPAREN(type)> name(); \
1174 inline bool is_##name(Tagged<UNPAREN(type)> value);
1176#undef NATIVE_CONTEXT_FIELD_ACCESSOR
1196 return v8_file_logger_;
1203 return reinterpret_cast<Isolate*
>(
reinterpret_cast<Address
>(
heap) -
1215 isolate_data()->cage_base() == kNullAddress);
1216 return isolate_data()->cage_base();
1223#ifdef V8_EXTERNAL_CODE_SPACE
1224 return code_cage_base_;
1232#ifdef V8_COMPRESS_POINTERS
1234 return isolate_group()->GetPtrComprCage();
1236 VirtualMemoryCage* GetPtrComprCodeCageForTesting();
1247 return reinterpret_cast<Isolate*
>(isolate_root - isolate_root_bias());
1274 DCHECK(isolate_data()->external_reference_table()->is_initialized());
1275 return isolate_data()->external_reference_table();
1280 return isolate_data()->external_reference_table();
1285#ifdef V8_ENABLE_LEAPTIERING
1287 builtin_dispatch_handle(JSBuiltinDispatchHandleRoot::Idx idx) {
1288#if V8_STATIC_DISPATCH_HANDLES_BOOL
1289 return JSDispatchTable::GetStaticHandleForReadOnlySegmentEntry(idx);
1291 return isolate_data_.builtin_dispatch_table()[idx];
1294 V8_INLINE JSDispatchHandle builtin_dispatch_handle(Builtin builtin) {
1295 return builtin_dispatch_handle(
1296 JSBuiltinDispatchHandleRoot::to_idx(builtin));
1299 JSDispatchTable::Space* GetJSDispatchTableSpaceFor(Address owning_slot) {
1300 DCHECK(!ReadOnlyHeap::Contains(owning_slot));
1301 return heap()->js_dispatch_table_space();
1307 return isolate_data_.builtin_tier0_table();
1310 bool IsBuiltinTableHandleLocation(Address* handle_location);
1318 current_deoptimizer_ =
nullptr;
1324 current_deoptimizer_ = deoptimizer;
1328 deoptimizer_lazy_throw_ =
value;
1330 void InitializeThreadLocal();
1332 return &isolate_data_.thread_local_top_;
1335 return &isolate_data_.thread_local_top_;
1344 return static_cast<uint32_t
>(
1348 isolate_root_bias());
1352 return static_cast<uint32_t
>(
1356 isolate_root_bias());
1363 isolate_root_bias());
1367 return static_cast<uintptr_t
>(
1376 isolate_root_bias());
1386 return materialized_object_store_;
1390 return descriptor_lookup_cache_;
1394 return &isolate_data_.handle_scope_data_;
1398 DCHECK(handle_scope_implementer_);
1399 return handle_scope_implementer_;
1405 return inner_pointer_to_code_cache_;
1408#if V8_ENABLE_WEBASSEMBLY
1410 return wasm_code_look_up_cache_;
1412 wasm::WasmOrphanedGlobalHandle* NewWasmOrphanedGlobalHandle();
1413 wasm::StackPool& stack_pool() {
return stack_pool_; }
1426#ifndef V8_INTL_SUPPORT
1428 return &jsregexp_uncanonicalize_;
1432 return &jsregexp_canonrange_;
1437 return ®exp_macro_assembler_canonicalize_;
1450 return isolate_data()->regexp_static_result_offsets_vector();
1454 regexp_static_result_offsets_vector() !=
nullptr);
1455 isolate_data()->set_regexp_static_result_offsets_vector(value);
1458 return isolate_data()->regexp_static_result_offsets_vector_address();
1462 return active_dynamic_regexp_result_vectors_;
1470 return total_regexp_code_generated_;
1477 return isolate_data_.execution_mode_ &
1478 IsolateExecutionModeFlag::kIsProfiling;
1483 CollectSourcePositionsForAllBytecodeArrays();
1484 RequestInvalidateNoProfilingProtector();
1486 isolate_data_.execution_mode_.set(IsolateExecutionModeFlag::kIsProfiling,
1488 UpdateLogObjectRelocation();
1494 return isolate_data_.execution_mode_ &
1495 IsolateExecutionModeFlag::kCheckSideEffects;
1499 return should_check_side_effects() ? DebugInfo::kSideEffects
1500 : DebugInfo::kBreakpoints;
1503 bool check_side_effects = debug_execution_mode == DebugInfo::kSideEffects;
1504 isolate_data_.execution_mode_.set(
1505 IsolateExecutionModeFlag::kCheckSideEffects, check_side_effects);
1511 static size_t non_disposed_isolates() {
return non_disposed_isolates_; }
1521 bool has_turbofan_string_builders() {
return has_turbofan_string_builders_; }
1522 void set_has_turbofan_string_builders() {
1523 has_turbofan_string_builders_ =
true;
1533 static const int kJSRegexpStaticOffsetsVectorSize = 128;
1540 void SetData(uint32_t slot,
void* data) {
1541 DCHECK_LT(slot, Internals::kNumIsolateDataSlots);
1542 isolate_data_.embedder_data_[slot] =
data;
1545 DCHECK_LT(slot, Internals::kNumIsolateDataSlots);
1546 return isolate_data_.embedder_data_[slot];
1554 return snapshot_blob_ !=
nullptr && snapshot_blob_->raw_size != 0;
1557 bool IsDead()
const {
return has_fatal_error_; }
1560 bool use_optimizer();
1564 bool NeedsSourcePositions()
const;
1566 bool IsLoggingCodeCreation()
const;
1568 inline bool InFastCCall()
const;
1570 bool AllowsCodeCompaction()
const;
1572 bool NeedsDetailedOptimizedCodeLineInfo()
const;
1575 return code_coverage_mode() == debug::CoverageMode::kBestEffort;
1579 return code_coverage_mode() == debug::CoverageMode::kPreciseCount;
1583 return code_coverage_mode() == debug::CoverageMode::kPreciseBinary;
1587 return code_coverage_mode() == debug::CoverageMode::kBlockCount;
1591 return code_coverage_mode() == debug::CoverageMode::kBlockBinary;
1595 return is_block_count_code_coverage() || is_block_binary_code_coverage();
1599 return is_precise_binary_code_coverage() || is_block_binary_code_coverage();
1603 return is_precise_count_code_coverage() || is_block_count_code_coverage();
1613 void MaybeInitializeVectorListFromHeap();
1616 return heap_.MonotonicallyIncreasingTimeInMs() - time_millis_at_init_;
1621 void set_date_cache(
DateCache* date_cache);
1623#ifdef V8_INTL_SUPPORT
1625 const std::string& DefaultLocale();
1627 void ResetDefaultLocale();
1629 void set_default_locale(
const std::string& locale) {
1631 default_locale_ = locale;
1634 enum class ICUObjectCacheType{
1635 kDefaultCollator, kDefaultNumberFormat, kDefaultSimpleDateFormat,
1636 kDefaultSimpleDateFormatForTime, kDefaultSimpleDateFormatForDate};
1637 static constexpr int kICUObjectCacheTypeCount = 5;
1639 icu::UMemory* get_cached_icu_object(ICUObjectCacheType cache_type,
1640 DirectHandle<Object> locales);
1641 void set_icu_object_in_cache(ICUObjectCacheType cache_type,
1642 DirectHandle<Object> locales,
1643 std::shared_ptr<icu::UMemory> obj);
1644 void clear_cached_icu_object(ICUObjectCacheType cache_type);
1645 void clear_cached_icu_objects();
1659 UpdateNoElementsProtectorOnSetElement(
object);
1666 UpdateNoElementsProtectorOnSetElement(
object);
1668 void UpdateTypedArrayLengthLookupChainProtectorOnSetPrototype(
1670 void UpdateTypedArraySpeciesLookupChainProtectorOnSetPrototype(
1672 void UpdateNumberStringNotRegexpLikeProtectorOnSetPrototype(
1676 UpdateNoElementsProtectorOnSetElement(
object);
1678 void UpdateStringWrapperToPrimitiveProtectorOnSetPrototype(
1685 std::unique_ptr<PersistentHandles> NewPersistentHandles();
1688 return persistent_handles_list_.get();
1691#ifdef V8_ENABLE_SPARKPLUG
1694 return baseline_batch_compiler_;
1698#ifdef V8_ENABLE_MAGLEV
1699 maglev::MaglevConcurrentDispatcher* maglev_concurrent_dispatcher() {
1701 return maglev_concurrent_dispatcher_;
1707 DCHECK(optimizing_compile_dispatcher_ ==
nullptr ||
1708 v8_flags.concurrent_recompilation);
1709 return optimizing_compile_dispatcher_ !=
nullptr;
1712 void IncreaseConcurrentOptimizationPriority(
1717 return optimizing_compile_dispatcher_;
1727 int id()
const {
return id_; }
1730 return was_locker_ever_used_.load(std::memory_order_relaxed);
1733 was_locker_ever_used_.store(
true, std::memory_order_relaxed);
1736 std::shared_ptr<CompilationStatistics> GetTurboStatistics();
1737#ifdef V8_ENABLE_MAGLEV
1738 std::shared_ptr<CompilationStatistics> GetMaglevStatistics();
1742 void DumpAndResetStats();
1743 void DumpAndResetBuiltinsProfileData();
1762 int GenerateIdentityHash(uint32_t
mask);
1765 int id = next_optimization_id_.load();
1767 int next_id =
id + 1;
1768 if (!Smi::IsValid(next_id)) next_id = 0;
1769 if (next_optimization_id_.compare_exchange_strong(
id, next_id)) {
1786 return next_module_async_evaluation_ordinal_++;
1792 if (!thread_local_top()->CallDepthIsZero())
return;
1798 inline void FireBeforeCallEnteredCallback();
1805 void SetTerminationOnExternalTryCatch();
1816 static std::string GetTurboCfgFileName(
Isolate* isolate);
1818 int GetNextScriptId();
1821 return next_unique_sfi_id_.load(std::memory_order_relaxed);
1824 return next_unique_sfi_id_.fetch_add(1, std::memory_order_relaxed);
1827#ifdef V8_ENABLE_JAVASCRIPT_PROMISE_HOOKS
1828 void SetHasContextPromiseHooks(
bool context_promise_hook) {
1829 promise_hook_flags_ = PromiseHookFields::HasContextPromiseHook::update(
1830 promise_hook_flags_, context_promise_hook);
1831 PromiseHookStateUpdated();
1836 return PromiseHookFields::HasContextPromiseHook::decode(
1837 promise_hook_flags_);
1841 return reinterpret_cast<Address
>(&promise_hook_flags_);
1845 return reinterpret_cast<Address
>(&promise_hook_);
1849 return reinterpret_cast<Address
>(&async_event_delegate_);
1853 return reinterpret_cast<Address
>(&javascript_execution_assert_);
1857 javascript_execution_counter_++;
1861 return reinterpret_cast<Address
>(&handle_scope_implementer_);
1866 void RunReleaseCppHeapCallback(std::unique_ptr<v8::CppHeap> cpp_heap);
1873 void UpdatePromiseHookProtector();
1874 void PromiseHookStateUpdated();
1877 void CheckDetachedContextsAfterGC();
1883 return &startup_object_cache_;
1890 if (OwnsStringTables()) {
1891 return &shared_heap_object_cache_;
1893 return &shared_space_isolate()->shared_heap_object_cache_;
1898 return builtins_constants_table_builder() !=
nullptr;
1902 return builtins_constants_table_builder_;
1909 size_t HashIsolateForEmbeddedBlob();
1911 static const uint8_t* CurrentEmbeddedBlobCode();
1912 static uint32_t CurrentEmbeddedBlobCodeSize();
1913 static const uint8_t* CurrentEmbeddedBlobData();
1914 static uint32_t CurrentEmbeddedBlobDataSize();
1915 static bool CurrentEmbeddedBlobIsBinaryEmbedded();
1919 const uint8_t* embedded_blob_code()
const;
1920 uint32_t embedded_blob_code_size()
const;
1921 const uint8_t* embedded_blob_data()
const;
1922 uint32_t embedded_blob_data_size()
const;
1936 array_buffer_allocator_ = allocator;
1939 return array_buffer_allocator_;
1943 std::shared_ptr<v8::ArrayBuffer::Allocator> allocator) {
1944 array_buffer_allocator_shared_ = std::move(allocator);
1948 return array_buffer_allocator_shared_;
1952 if (array_buffer_max_size_ == 0) {
1953 array_buffer_max_size_ = array_buffer_allocator_->MaxAllocationSize();
1955 return &array_buffer_max_size_;
1961 return cancelable_task_manager_;
1965 return ast_string_constants_;
1971 return compiler_cache_;
1975 compiler_cache_ = cache;
1976 compiler_zone_ = zone;
1982 return lazy_compile_dispatcher_.get();
1987 void ClearKeptObjects();
1989 void SetHostImportModuleDynamicallyCallback(
1991 void SetHostImportModuleWithPhaseDynamicallyCallback(
1998 void SetHostInitializeImportMetaObjectCallback(
2003 void SetHostCreateShadowRealmContextCallback(
2010 embedded_file_writer_ = writer;
2013 int LookupOrAddExternallyCompiledFilename(
const char*
filename);
2014 const char* GetExternallyCompiledFilename(
int index)
const;
2015 int GetExternallyCompiledFilenameCount()
const;
2020 void PrepareBuiltinSourcePositionMap();
2022#if defined(V8_OS_WIN64)
2023 void SetBuiltinUnwindData(
2025 const win64_unwindinfo::BuiltinUnwindInfo& unwinding_info);
2032 bool HasPrepareStackTraceCallback()
const;
2036 if (add_crash_key_callback_) {
2037 add_crash_key_callback_(
id, value);
2041#if defined(V8_ENABLE_ETW_STACK_WALKING)
2045 void SetFilterETWSessionByURLCallback(FilterETWSessionByURLCallback
callback);
2047 void SetFilterETWSessionByURL2Callback(
2048 FilterETWSessionByURL2Callback
callback);
2049 FilterETWSessionByURLResult RunFilterETWSessionByURLCallback(
2050 const std::string& payload);
2052 bool IsETWTracingEnabled()
const {
return etw_tracing_enabled_; }
2053 void SetETWTracingEnabled(
bool enabled) { etw_tracing_enabled_ = enabled; }
2055 bool ETWIsInRundown()
const {
return etw_in_rundown_; }
2056 void SetETWIsInRundown(
bool is_rundown) { etw_in_rundown_ = is_rundown; }
2058 void set_etw_trace_interpreted_frames() {
2059 etw_trace_interpreted_frames_ =
true;
2061 bool interpreted_frames_native_stack()
const {
2062 return v8_flags.interpreted_frames_native_stack ||
2063 etw_trace_interpreted_frames_;
2067 return v8_flags.interpreted_frames_native_stack;
2071 void SetIsLoading(
bool is_loading);
2074 code_coverage_mode_.store(coverage_mode, std::memory_order_relaxed);
2077 return code_coverage_mode_.load(std::memory_order_relaxed);
2096 return *
v8_flags.efficiency_mode.value();
2103 return v8_flags.efficiency_mode_for_tiering_heuristics &&
2104 EfficiencyModeEnabled();
2113 return *
v8_flags.battery_saver_mode.value();
2123 return *
v8_flags.memory_saver_mode.value();
2130 void set_allow_atomics_wait(
bool set) { allow_atomics_wait_ = set; }
2143 elements_deletion_counter_ =
value;
2146#if V8_ENABLE_WEBASSEMBLY
2151 return thread_local_top()->top_backup_incumbent_scope_;
2155 thread_local_top()->top_backup_incumbent_scope_ =
2156 top_backup_incumbent_scope;
2159 void SetIdle(
bool is_idle);
2164 void CollectSourcePositionsForAllBytecodeArrays();
2168 void AddCodeRange(Address begin,
size_t length_in_bytes);
2170 bool RequiresCodeRange()
const;
2172 static Address load_from_stack_count_address(
const char* function_name);
2173 static Address store_to_stack_count_address(
const char* function_name);
2180 void UpdateLongTaskStats();
2184 return main_thread_local_isolate_.get();
2194#ifdef V8_COMPRESS_POINTERS
2195 ExternalPointerTable& external_pointer_table() {
2196 return isolate_data_.external_pointer_table_;
2199 const ExternalPointerTable& external_pointer_table()
const {
2200 return isolate_data_.external_pointer_table_;
2203 Address external_pointer_table_address() {
2204 return reinterpret_cast<Address
>(&isolate_data_.external_pointer_table_);
2207 ExternalPointerTable& shared_external_pointer_table() {
2208 return *isolate_data_.shared_external_pointer_table_;
2211 const ExternalPointerTable& shared_external_pointer_table()
const {
2212 return *isolate_data_.shared_external_pointer_table_;
2215 ExternalPointerTable::Space* shared_external_pointer_space() {
2216 return shared_external_pointer_space_;
2219 Address shared_external_pointer_table_address_address() {
2220 return reinterpret_cast<Address>(
2221 &isolate_data_.shared_external_pointer_table_);
2224 CppHeapPointerTable& cpp_heap_pointer_table() {
2225 return isolate_data_.cpp_heap_pointer_table_;
2228 const CppHeapPointerTable& cpp_heap_pointer_table()
const {
2229 return isolate_data_.cpp_heap_pointer_table_;
2234#ifdef V8_ENABLE_SANDBOX
2235 TrustedPointerTable& trusted_pointer_table() {
2236 return isolate_data_.trusted_pointer_table_;
2239 const TrustedPointerTable& trusted_pointer_table()
const {
2240 return isolate_data_.trusted_pointer_table_;
2243 Address trusted_pointer_table_base_address()
const {
2244 return isolate_data_.trusted_pointer_table_.base_address();
2247 TrustedPointerTable& shared_trusted_pointer_table() {
2248 return *isolate_data_.shared_trusted_pointer_table_;
2251 const TrustedPointerTable& shared_trusted_pointer_table()
const {
2252 return *isolate_data_.shared_trusted_pointer_table_;
2255 TrustedPointerTable::Space* shared_trusted_pointer_space() {
2256 return shared_trusted_pointer_space_;
2259 Address shared_trusted_pointer_table_base_address() {
2260 return reinterpret_cast<Address>(
2261 &isolate_data_.shared_trusted_pointer_table_);
2264 TrustedPointerPublishingScope* trusted_pointer_publishing_scope()
const {
2265 return isolate_data_.trusted_pointer_publishing_scope_;
2267 void set_trusted_pointer_publishing_scope(
2268 TrustedPointerPublishingScope* scope) {
2269 DCHECK_NE((trusted_pointer_publishing_scope() ==
nullptr),
2270 (scope ==
nullptr));
2271 isolate_data_.trusted_pointer_publishing_scope_ = scope;
2274 Address code_pointer_table_base_address() {
2275 return isolate_data_.code_pointer_table_base_address_;
2280 return reinterpret_cast<Address
>(
2281 &isolate_data_.continuation_preserved_embedder_data_);
2296 DCHECK(has_shared_space());
2297 Isolate* isolate = shared_space_isolate_.value();
2298 DCHECK(has_shared_space());
2307#if V8_ENABLE_DRUMBRAKE
2308 void initialize_wasm_execution_timer();
2311 return wasm_execution_timer_.get();
2322 return !
v8_flags.shared_string_table || is_shared_space_isolate();
2326 SimulatorData* simulator_data() {
return simulator_data_; }
2329#ifdef V8_ENABLE_WEBASSEMBLY
2330 bool IsOnCentralStack();
2331 std::vector<std::unique_ptr<wasm::StackMemory>>& wasm_stacks() {
2332 return wasm_stacks_;
2336 void SwitchStacks(wasm::StackMemory* from, wasm::StackMemory* to);
2343 void RetireWasmStack(wasm::StackMemory* stack);
2352 void LocalsBlockListCacheRehash();
2359 void VerifyStaticRoots();
2366 isolate_->enable_ro_allocation_for_snapshot_ =
true;
2371 isolate_->enable_ro_allocation_for_snapshot_ =
false;
2379 return enable_ro_allocation_for_snapshot_;
2383 battery_saver_mode_enabled_ = battery_saver_mode_enabled;
2387 memory_saver_mode_enabled_ = memory_saver_mode_enabled;
2390 std::list<std::unique_ptr<detail::WaiterQueueNode>>&
2391 async_waiter_queue_nodes();
2393 void ReportExceptionFunctionCallback(
2402#ifdef V8_ENABLE_WASM_SIMD256_REVEC
2403 void set_wasm_revec_verifier_for_test(
2405 wasm_revec_verifier_for_test_ = verifier;
2408 compiler::turboshaft::WasmRevecVerifier* wasm_revec_verifier_for_test()
2410 return wasm_revec_verifier_for_test_;
2417 is_frozen_ = is_frozen;
2418 if (
v8_flags.memory_reducer_respects_frozen_state && IsFrozen()) {
2421 heap()->FinalizeIncrementalMarkingAtomicallyIfRunning(
2422 i::GarbageCollectionReason::kFrozen);
2423 heap()->EnsureSweepingCompleted(
2424 Heap::SweepingForcedFinalizationMode::kUnifiedHeap);
2428 static void IterateRegistersAndStackOfSimulator(
2431 std::shared_ptr<v8::TaskRunner>
task_runner()
const {
return task_runner_; }
2441 SnapshotData* shared_heap_snapshot_data,
bool can_rehash);
2443 void CheckIsolateLayout();
2445 void InitializeCodeRanges();
2462 void RemoveAllThreads();
2467 return std::hash<int>()(t.ToInteger());
2471 std::unordered_map<ThreadId, PerIsolateThreadData*, Hasher>
table_;
2485 previous_thread_data(previous_thread_data),
2486 previous_isolate(previous_isolate),
2487 previous_item(previous_item) {}
2499 static void SetIsolateThreadLocals(
Isolate* isolate,
2511 void NotifyExceptionPropagationCallback();
2514 return PromiseHookFields::HasIsolatePromiseHook::decode(
2515 promise_hook_flags_);
2519 return PromiseHookFields::HasAsyncEventDelegate::decode(
2520 promise_hook_flags_);
2523 void AddCrashKeysForIsolateAndHeapPointers();
2525#if V8_ENABLE_WEBASSEMBLY
2526 bool IsOnCentralStack(Address addr);
2537 bool is_shared_space_isolate_{
false};
2548 std::atomic<EntryStackItem*> entry_stack_ =
nullptr;
2549 int stack_trace_nesting_level_ = 0;
2550 std::atomic<bool> was_locker_ever_used_{
false};
2569 bool deoptimizer_lazy_throw_ =
false;
2571 bool capture_stack_trace_for_uncaught_exceptions_ =
false;
2572 int stack_trace_for_uncaught_exceptions_frame_limit_ = 0;
2574 StackTrace::kOverview;
2577 UnicodeCache* unicode_cache_ =
nullptr;
2588#if defined(DEBUG) || defined(VERIFY_HEAP)
2589 std::atomic<int> num_active_deserializers_;
2591#ifndef V8_INTL_SUPPORT
2610 host_import_module_with_phase_dynamically_callback_ =
nullptr;
2611 std::atomic<debug::CoverageMode> code_coverage_mode_{
2612 debug::CoverageMode::kBestEffort};
2614 std::atomic<bool> battery_saver_mode_enabled_ =
false;
2615 std::atomic<bool> memory_saver_mode_enabled_ =
false;
2628 host_initialize_import_meta_object_callback_ =
nullptr;
2630 host_create_shadow_realm_context_callback_ =
nullptr;
2632#ifdef V8_INTL_SUPPORT
2633 std::string default_locale_;
2637 struct ICUObjectCacheEntry {
2638 std::string locales;
2639 std::shared_ptr<icu::UMemory> obj;
2641 ICUObjectCacheEntry() =
default;
2642 ICUObjectCacheEntry(std::string locales, std::shared_ptr<icu::UMemory> obj)
2643 : locales(locales), obj(std::move(obj)) {}
2646 ICUObjectCacheEntry icu_object_cache_[kICUObjectCacheTypeCount];
2650 bool serializer_enabled_ =
false;
2653 bool has_fatal_error_ =
false;
2656 bool initialized_from_snapshot_ =
false;
2659 bool is_short_builtin_calls_enabled_ =
false;
2663 std::atomic<v8::Isolate::Priority> priority_ =
2668 bool owns_shareable_data_ =
true;
2670 bool log_object_relocation_ =
false;
2672#ifdef V8_EXTERNAL_CODE_SPACE
2675 Address code_cage_base_ = 0;
2679 double time_millis_at_init_ = 0;
2682 static std::atomic<size_t> non_disposed_isolates_;
2684 JSObject::SpillInformation js_spill_information_;
2686 std::atomic<bool> has_turbofan_string_builders_ =
false;
2702#ifdef V8_ENABLE_SPARKPLUG
2705#ifdef V8_ENABLE_MAGLEV
2706 maglev::MaglevConcurrentDispatcher* maglev_concurrent_dispatcher_ =
nullptr;
2712#define GLOBAL_BACKING_STORE(type, name, initialvalue) type name##_;
2714#undef GLOBAL_BACKING_STORE
2716#define GLOBAL_ARRAY_BACKING_STORE(type, name, length) type name##_[length];
2718#undef GLOBAL_ARRAY_BACKING_STORE
2724#define ISOLATE_FIELD_OFFSET(type, name, ignored) \
2725 static const intptr_t name##_debug_offset_;
2728#undef ISOLATE_FIELD_OFFSET
2732 bool preprocessing_exception_ =
false;
2739 uint64_t stress_deopt_count_ = 0;
2741 bool force_slow_path_ =
false;
2744 bool enable_ro_allocation_for_snapshot_ =
false;
2746 bool initialized_ =
false;
2747 bool jitless_ =
false;
2749 std::atomic<int> next_optimization_id_ = 0;
2752 uint32_t expected = 0;
2753 bool successfully_exchanged = next_unique_sfi_id_.compare_exchange_strong(
2754 expected,
id, std::memory_order_relaxed, std::memory_order_relaxed);
2755 CHECK(successfully_exchanged);
2770#ifdef V8_ENABLE_MAGLEV
2771 std::shared_ptr<CompilationStatistics> maglev_statistics_;
2774 uintptr_t last_recorder_context_id_ = 0;
2775 std::unordered_map<uintptr_t, v8::Global<v8::Context>>
2778 size_t last_long_task_stats_counter_ = 0;
2793 void InitializeDefaultEmbeddedBlob();
2794 void CreateAndSetEmbeddedBlob();
2795 void InitializeIsShortBuiltinCallsEnabled();
2796 void MaybeRemapEmbeddedBuiltinsIntoCodeRange();
2797 void TearDownEmbeddedBlob();
2798 void SetEmbeddedBlob(
const uint8_t* code, uint32_t code_size,
2799 const uint8_t* data, uint32_t data_size);
2800 void ClearEmbeddedBlob();
2802 void InitializeBuiltinJSDispatchTable();
2804 const uint8_t* embedded_blob_code_ =
nullptr;
2805 uint32_t embedded_blob_code_size_ = 0;
2806 const uint8_t* embedded_blob_data_ =
nullptr;
2807 uint32_t embedded_blob_data_size_ = 0;
2811 size_t array_buffer_max_size_ = 0;
2822 uint32_t promise_hook_flags_ = 0;
2823 uint32_t current_async_task_id_ = 0;
2828 abort_on_uncaught_exception_callback_ =
nullptr;
2830 bool allow_atomics_wait_ =
true;
2831 bool flush_denormals_ =
false;
2836 size_t total_regexp_code_generated_ = 0;
2838 size_t elements_deletion_counter_ = 0;
2846#if defined(V8_ENABLE_ETW_STACK_WALKING)
2847 FilterETWSessionByURLCallback filter_etw_session_by_url_callback_ =
nullptr;
2848 FilterETWSessionByURL2Callback filter_etw_session_by_url2_callback_ =
nullptr;
2849 bool etw_tracing_enabled_;
2850 bool etw_trace_interpreted_frames_;
2851 bool etw_in_rundown_;
2868#ifdef V8_COMPRESS_POINTERS
2871 ExternalPointerTable::Space* shared_external_pointer_space_ =
nullptr;
2874#ifdef V8_ENABLE_SANDBOX
2877 TrustedPointerTable::Space* shared_trusted_pointer_space_ =
nullptr;
2888 Isolate* global_safepoint_prev_client_isolate_ =
nullptr;
2889 Isolate* global_safepoint_next_client_isolate_ =
nullptr;
2893 std::atomic<std::vector<MemoryRange>*> code_pages_{
nullptr};
2902#ifdef V8_ENABLE_WEBASSEMBLY
2904 std::vector<std::unique_ptr<wasm::StackMemory>> wasm_stacks_;
2905#if V8_ENABLE_DRUMBRAKE
2906 std::unique_ptr<wasm::WasmExecutionTimer> wasm_execution_timer_;
2917#ifdef V8_ENABLE_WASM_SIMD256_REVEC
2924 void*
operator new(
size_t,
void* ptr) {
return ptr; }
2927 SimulatorData* simulator_data_ =
nullptr;
2930#ifdef V8_ENABLE_CHECKS
2932 int current_thread_counter_ = 0;
2935 bool is_frozen_ =
false;
2938 friend class heap::HeapTester;
2942 friend class TestSerializer;
2943 friend class SharedHeapNoClientsTest;