v8 10.2.154 (node 18.16.0)
V8 is Google's open source JavaScript engine
Loading...
Searching...
No Matches
v8-isolate.h
Go to the documentation of this file.
1// Copyright 2021 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef INCLUDE_V8_ISOLATE_H_
6#define INCLUDE_V8_ISOLATE_H_
7
8#include <stddef.h>
9#include <stdint.h>
10
11#include <memory>
12#include <utility>
13
14#include "cppgc/common.h"
15#include "v8-array-buffer.h" // NOLINT(build/include_directory)
16#include "v8-callbacks.h" // NOLINT(build/include_directory)
17#include "v8-data.h" // NOLINT(build/include_directory)
18#include "v8-debug.h" // NOLINT(build/include_directory)
19#include "v8-embedder-heap.h" // NOLINT(build/include_directory)
20#include "v8-function-callback.h" // NOLINT(build/include_directory)
21#include "v8-internal.h" // NOLINT(build/include_directory)
22#include "v8-local-handle.h" // NOLINT(build/include_directory)
23#include "v8-microtask.h" // NOLINT(build/include_directory)
24#include "v8-persistent-handle.h" // NOLINT(build/include_directory)
25#include "v8-primitive.h" // NOLINT(build/include_directory)
26#include "v8-statistics.h" // NOLINT(build/include_directory)
27#include "v8-unwinder.h" // NOLINT(build/include_directory)
28#include "v8config.h" // NOLINT(build/include_directory)
29
30namespace v8 {
31
32class CppHeap;
33class HeapProfiler;
34class MicrotaskQueue;
35class StartupData;
36class ScriptOrModule;
37class SharedArrayBuffer;
38
39namespace internal {
40class MicrotaskQueue;
41class ThreadLocalTop;
42} // namespace internal
43
44namespace metrics {
45class Recorder;
46} // namespace metrics
47
63 public:
82 void ConfigureDefaultsFromHeapSize(size_t initial_heap_size_in_bytes,
83 size_t maximum_heap_size_in_bytes);
84
94 void ConfigureDefaults(uint64_t physical_memory,
95 uint64_t virtual_memory_limit);
96
100 uint32_t* stack_limit() const { return stack_limit_; }
101 void set_stack_limit(uint32_t* value) { stack_limit_ = value; }
102
112 size_t code_range_size_in_bytes() const { return code_range_size_; }
113 void set_code_range_size_in_bytes(size_t limit) { code_range_size_ = limit; }
114
123 return max_old_generation_size_;
124 }
126 max_old_generation_size_ = limit;
127 }
128
135 return max_young_generation_size_;
136 }
138 max_young_generation_size_ = limit;
139 }
140
142 return initial_old_generation_size_;
143 }
145 initial_old_generation_size_ = initial_size;
146 }
147
149 return initial_young_generation_size_;
150 }
152 initial_young_generation_size_ = initial_size;
153 }
154
155 private:
156 static constexpr size_t kMB = 1048576u;
157 size_t code_range_size_ = 0;
158 size_t max_old_generation_size_ = 0;
159 size_t max_young_generation_size_ = 0;
160 size_t initial_old_generation_size_ = 0;
161 size_t initial_young_generation_size_ = 0;
162 uint32_t* stack_limit_ = nullptr;
163};
164
170enum RAILMode : unsigned {
171 // Response performance mode: In this mode very low virtual machine latency
172 // is provided. V8 will try to avoid JavaScript execution interruptions.
173 // Throughput may be throttled.
175 // Animation performance mode: In this mode low virtual machine latency is
176 // provided. V8 will try to avoid as many JavaScript execution interruptions
177 // as possible. Throughput may be throttled. This is the default mode.
179 // Idle performance mode: The embedder is idle. V8 can complete deferred work
180 // in this mode.
182 // Load performance mode: In this mode high throughput is provided. V8 may
183 // turn off latency optimizations.
186
196
206 public:
213
218 JitCodeEventHandler code_event_handler = nullptr;
219
224
229 StartupData* snapshot_blob = nullptr;
230
235 CounterLookupCallback counter_lookup_callback = nullptr;
236
243 CreateHistogramCallback create_histogram_callback = nullptr;
244 AddHistogramSampleCallback add_histogram_sample_callback = nullptr;
245
255 ArrayBuffer::Allocator* array_buffer_allocator = nullptr;
256 std::shared_ptr<ArrayBuffer::Allocator> array_buffer_allocator_shared;
257
264 const intptr_t* external_references = nullptr;
265
270 bool allow_atomics_wait = true;
271
275 bool only_terminate_in_safe_scope = false;
276
282 int embedder_wrapper_type_index = -1;
283 int embedder_wrapper_object_index = -1;
284
288 FatalErrorCallback fatal_error_callback = nullptr;
289 OOMErrorCallback oom_error_callback = nullptr;
290
295 Isolate* experimental_attach_to_shared_isolate = nullptr;
296 };
297
303 public:
304 explicit Scope(Isolate* isolate) : isolate_(isolate) { isolate->Enter(); }
305
306 ~Scope() { isolate_->Exit(); }
307
308 // Prevent copying of Scope objects.
309 Scope(const Scope&) = delete;
310 Scope& operator=(const Scope&) = delete;
311
312 private:
313 Isolate* const isolate_;
314 };
315
320 public:
321 enum OnFailure { CRASH_ON_FAILURE, THROW_ON_FAILURE, DUMP_ON_FAILURE };
322
325
326 // Prevent copying of Scope objects.
328 delete;
330 const DisallowJavascriptExecutionScope&) = delete;
331
332 private:
333 OnFailure on_failure_;
334 Isolate* isolate_;
335
336 bool was_execution_allowed_assert_;
337 bool was_execution_allowed_throws_;
338 bool was_execution_allowed_dump_;
339 };
340
345 public:
348
349 // Prevent copying of Scope objects.
351 delete;
353 const AllowJavascriptExecutionScope&) = delete;
354
355 private:
356 Isolate* isolate_;
357 bool was_execution_allowed_assert_;
358 bool was_execution_allowed_throws_;
359 bool was_execution_allowed_dump_;
360 };
361
367 public:
369 Isolate* isolate, MicrotaskQueue* microtask_queue = nullptr);
371
372 // Prevent copying of Scope objects.
374 delete;
376 const SuppressMicrotaskExecutionScope&) = delete;
377
378 private:
379 internal::Isolate* const isolate_;
380 internal::MicrotaskQueue* const microtask_queue_;
381 internal::Address previous_stack_height_;
382
383 friend class internal::ThreadLocalTop;
384 };
385
391 public:
394
395 // Prevent copying of Scope objects.
398
399 private:
400 internal::Isolate* isolate_;
401 bool prev_value_;
402 };
403
410 kMinorGarbageCollection
411 };
412
419 kUseAsm = 0,
420 kBreakIterator = 1,
421 kLegacyConst = 2,
422 kMarkDequeOverflow = 3,
423 kStoreBufferOverflow = 4,
424 kSlotsBufferOverflow = 5,
425 kObjectObserve = 6,
426 kForcedGC = 7,
427 kSloppyMode = 8,
428 kStrictMode = 9,
429 kStrongMode = 10,
430 kRegExpPrototypeStickyGetter = 11,
431 kRegExpPrototypeToString = 12,
432 kRegExpPrototypeUnicodeGetter = 13,
433 kIntlV8Parse = 14,
434 kIntlPattern = 15,
435 kIntlResolved = 16,
436 kPromiseChain = 17,
437 kPromiseAccept = 18,
438 kPromiseDefer = 19,
439 kHtmlCommentInExternalScript = 20,
440 kHtmlComment = 21,
441 kSloppyModeBlockScopedFunctionRedefinition = 22,
442 kForInInitializer = 23,
443 kArrayProtectorDirtied = 24,
444 kArraySpeciesModified = 25,
445 kArrayPrototypeConstructorModified = 26,
446 kArrayInstanceProtoModified = 27,
447 kArrayInstanceConstructorModified = 28,
448 kLegacyFunctionDeclaration = 29,
449 kRegExpPrototypeSourceGetter = 30, // Unused.
450 kRegExpPrototypeOldFlagGetter = 31, // Unused.
451 kDecimalWithLeadingZeroInStrictMode = 32,
452 kLegacyDateParser = 33,
453 kDefineGetterOrSetterWouldThrow = 34,
454 kFunctionConstructorReturnedUndefined = 35,
455 kAssigmentExpressionLHSIsCallInSloppy = 36,
456 kAssigmentExpressionLHSIsCallInStrict = 37,
457 kPromiseConstructorReturnedUndefined = 38,
458 kConstructorNonUndefinedPrimitiveReturn = 39,
459 kLabeledExpressionStatement = 40,
460 kLineOrParagraphSeparatorAsLineTerminator = 41,
461 kIndexAccessor = 42,
462 kErrorCaptureStackTrace = 43,
463 kErrorPrepareStackTrace = 44,
464 kErrorStackTraceLimit = 45,
465 kWebAssemblyInstantiation = 46,
466 kDeoptimizerDisableSpeculation = 47,
467 kArrayPrototypeSortJSArrayModifiedPrototype = 48,
468 kFunctionTokenOffsetTooLongForToString = 49,
469 kWasmSharedMemory = 50,
470 kWasmThreadOpcodes = 51,
471 kAtomicsNotify = 52, // Unused.
472 kAtomicsWake = 53, // Unused.
473 kCollator = 54,
474 kNumberFormat = 55,
475 kDateTimeFormat = 56,
476 kPluralRules = 57,
477 kRelativeTimeFormat = 58,
478 kLocale = 59,
479 kListFormat = 60,
480 kSegmenter = 61,
481 kStringLocaleCompare = 62,
482 kStringToLocaleUpperCase = 63,
483 kStringToLocaleLowerCase = 64,
484 kNumberToLocaleString = 65,
485 kDateToLocaleString = 66,
486 kDateToLocaleDateString = 67,
487 kDateToLocaleTimeString = 68,
488 kAttemptOverrideReadOnlyOnPrototypeSloppy = 69,
489 kAttemptOverrideReadOnlyOnPrototypeStrict = 70,
490 kOptimizedFunctionWithOneShotBytecode = 71, // Unused.
491 kRegExpMatchIsTrueishOnNonJSRegExp = 72,
492 kRegExpMatchIsFalseishOnJSRegExp = 73,
493 kDateGetTimezoneOffset = 74, // Unused.
494 kStringNormalize = 75,
495 kCallSiteAPIGetFunctionSloppyCall = 76,
496 kCallSiteAPIGetThisSloppyCall = 77,
497 kRegExpMatchAllWithNonGlobalRegExp = 78,
498 kRegExpExecCalledOnSlowRegExp = 79,
499 kRegExpReplaceCalledOnSlowRegExp = 80,
500 kDisplayNames = 81,
501 kSharedArrayBufferConstructed = 82,
502 kArrayPrototypeHasElements = 83,
503 kObjectPrototypeHasElements = 84,
504 kNumberFormatStyleUnit = 85,
505 kDateTimeFormatRange = 86,
506 kDateTimeFormatDateTimeStyle = 87,
507 kBreakIteratorTypeWord = 88,
508 kBreakIteratorTypeLine = 89,
509 kInvalidatedArrayBufferDetachingProtector = 90,
510 kInvalidatedArrayConstructorProtector = 91,
511 kInvalidatedArrayIteratorLookupChainProtector = 92,
512 kInvalidatedArraySpeciesLookupChainProtector = 93,
513 kInvalidatedIsConcatSpreadableLookupChainProtector = 94,
514 kInvalidatedMapIteratorLookupChainProtector = 95,
515 kInvalidatedNoElementsProtector = 96,
516 kInvalidatedPromiseHookProtector = 97,
517 kInvalidatedPromiseResolveLookupChainProtector = 98,
518 kInvalidatedPromiseSpeciesLookupChainProtector = 99,
519 kInvalidatedPromiseThenLookupChainProtector = 100,
520 kInvalidatedRegExpSpeciesLookupChainProtector = 101,
521 kInvalidatedSetIteratorLookupChainProtector = 102,
522 kInvalidatedStringIteratorLookupChainProtector = 103,
523 kInvalidatedStringLengthOverflowLookupChainProtector = 104,
524 kInvalidatedTypedArraySpeciesLookupChainProtector = 105,
525 kWasmSimdOpcodes = 106,
526 kVarRedeclaredCatchBinding = 107,
527 kWasmRefTypes = 108,
528 kWasmBulkMemory = 109, // Unused.
529 kWasmMultiValue = 110,
530 kWasmExceptionHandling = 111,
531 kInvalidatedMegaDOMProtector = 112,
532 kFunctionPrototypeArguments = 113,
533 kFunctionPrototypeCaller = 114,
534
535 // If you add new values here, you'll also need to update Chromium's:
536 // web_feature.mojom, use_counter_callback.cc, and enums.xml. V8 changes to
537 // this list need to be landed first, then changes on the Chromium side.
538 kUseCounterFeatureCount // This enum value must be last.
539 };
540
542 kMessageLog = (1 << 0),
543 kMessageDebug = (1 << 1),
544 kMessageInfo = (1 << 2),
545 kMessageError = (1 << 3),
546 kMessageWarning = (1 << 4),
547 kMessageAll = kMessageLog | kMessageDebug | kMessageInfo | kMessageError |
548 kMessageWarning,
549 };
550
551 using UseCounterCallback = void (*)(Isolate* isolate,
552 UseCounterFeature feature);
553
568 static Isolate* Allocate();
569
573 static void Initialize(Isolate* isolate, const CreateParams& params);
574
584 static Isolate* New(const CreateParams& params);
585
593
601
605 bool IsCurrent() const;
606
621
634
639 V8_DEPRECATED("Use HostImportModuleDynamicallyCallback")
640 void SetHostImportModuleDynamicallyCallback(
642 void SetHostImportModuleDynamicallyCallback(
644
649 void SetHostInitializeImportMetaObjectCallback(
651
656 void SetHostCreateShadowRealmContextCallback(
658
663 void SetPrepareStackTraceCallback(PrepareStackTraceCallback callback);
664
671 void MemoryPressureNotification(MemoryPressureLevel level);
672
678 void ClearCachesForTesting();
679
690 void Enter();
691
699 void Exit();
700
705 void Dispose();
706
711 void DumpAndResetStats();
712
720 void DiscardThreadSpecificMetadata();
721
726 V8_INLINE void SetData(uint32_t slot, void* data);
727
732 V8_INLINE void* GetData(uint32_t slot);
733
738 V8_INLINE static uint32_t GetNumberOfDataSlots();
739
745 template <class T>
746 V8_INLINE MaybeLocal<T> GetDataFromSnapshotOnce(size_t index);
747
751 void GetHeapStatistics(HeapStatistics* heap_statistics);
752
756 size_t NumberOfHeapSpaces();
757
767 bool GetHeapSpaceStatistics(HeapSpaceStatistics* space_statistics,
768 size_t index);
769
773 size_t NumberOfTrackedHeapObjectTypes();
774
784 bool GetHeapObjectStatisticsAtLastGC(HeapObjectStatistics* object_statistics,
785 size_t type_index);
786
794 bool GetHeapCodeAndMetadataStatistics(HeapCodeStatistics* object_statistics);
795
808 bool MeasureMemory(
809 std::unique_ptr<MeasureMemoryDelegate> delegate,
810 MeasureMemoryExecution execution = MeasureMemoryExecution::kDefault);
811
824 void GetStackSample(const RegisterState& state, void** frames,
825 size_t frames_limit, SampleInfo* sample_info);
826
840 int64_t AdjustAmountOfExternalAllocatedMemory(int64_t change_in_bytes);
841
846 size_t NumberOfPhantomHandleResetsSinceLastCall();
847
852 HeapProfiler* GetHeapProfiler();
853
857 void SetIdle(bool is_idle);
858
860 ArrayBuffer::Allocator* GetArrayBufferAllocator();
861
863 bool InContext();
864
869 Local<Context> GetCurrentContext();
870
877 Local<Context> GetEnteredOrMicrotaskContext();
878
883 Local<Context> GetIncumbentContext();
884
890 template <int N>
891 Local<Value> ThrowError(const char (&message)[N]) {
892 return ThrowError(String::NewFromUtf8Literal(this, message));
893 }
895
903
904 using GCCallback = void (*)(Isolate* isolate, GCType type,
905 GCCallbackFlags flags);
906 using GCCallbackWithData = void (*)(Isolate* isolate, GCType type,
907 GCCallbackFlags flags, void* data);
908
918 void AddGCPrologueCallback(GCCallbackWithData callback, void* data = nullptr,
919 GCType gc_type_filter = kGCTypeAll);
921 GCType gc_type_filter = kGCTypeAll);
922
927 void RemoveGCPrologueCallback(GCCallbackWithData, void* data = nullptr);
929
935
936 /*
937 * Gets the currently active heap tracer for the isolate that was set with
938 * SetEmbedderHeapTracer.
939 */
941
953
963
970
978
982 enum class AtomicsWaitEvent {
984 kStartWait,
986 kWokenUp,
988 kTimedOut,
990 kTerminatedExecution,
992 kAPIStopped,
994 kNotEqual
995 };
996
1002 public:
1017 void Wake();
1018 };
1019
1044 Local<SharedArrayBuffer> array_buffer,
1045 size_t offset_in_bytes, int64_t value,
1046 double timeout_in_ms,
1047 AtomicsWaitWakeHandle* stop_handle,
1048 void* data);
1049
1057
1067 void AddGCEpilogueCallback(GCCallbackWithData callback, void* data = nullptr,
1068 GCType gc_type_filter = kGCTypeAll);
1070 GCType gc_type_filter = kGCTypeAll);
1071
1077 void* data = nullptr);
1079
1081
1090
1099
1109
1125
1134 void RequestInterrupt(InterruptCallback callback, void* data);
1135
1142
1154
1169
1174
1182
1187
1196
1201
1207
1213
1221
1226
1230 void EnqueueMicrotask(MicrotaskCallback callback, void* data = nullptr);
1231
1236
1241
1256 MicrotasksCompletedCallbackWithData callback, void* data = nullptr);
1257
1262 MicrotasksCompletedCallbackWithData callback, void* data = nullptr);
1263
1268
1274
1283
1294 const std::shared_ptr<metrics::Recorder>& metrics_recorder);
1295
1302
1317 bool IdleNotificationDeadline(double deadline_in_seconds);
1318
1324
1334 int ContextDisposedNotification(bool dependant_context = true);
1335
1341
1347
1354
1359
1367 void SetRAILMode(RAILMode rail_mode);
1368
1373
1379
1384
1390
1414 JitCodeEventHandler event_handler);
1415
1425 void SetStackLimit(uintptr_t stack_limit);
1426
1442 void GetCodeRange(void** start, size_t* length_in_bytes);
1443
1448 void GetEmbeddedCodeRange(const void** start, size_t* length_in_bytes);
1449
1454
1455 static constexpr size_t kMinCodePagesBufferSize = 32;
1456
1470 size_t CopyCodePages(size_t capacity, MemoryRange* code_pages_out);
1471
1474
1477
1484
1493 size_t heap_limit);
1494
1501 void AutomaticallyRestoreInitialHeapLimit(double threshold_percent = 0.5);
1502
1509
1516
1523
1525
1527
1529
1531
1534
1537
1544
1549 bool IsDead();
1550
1561 Local<Value> data = Local<Value>());
1562
1575 int message_levels,
1576 Local<Value> data = Local<Value>());
1577
1582
1585
1591 bool capture, int frame_limit = 10,
1592 StackTrace::StackTraceOptions options = StackTrace::kOverview);
1593
1600
1606
1613
1618 bool IsInUse();
1619
1625 void SetAllowAtomicsWait(bool allow);
1626
1640 enum class TimeZoneDetection { kSkip, kRedetect };
1641
1653 TimeZoneDetection time_zone_detection = TimeZoneDetection::kSkip);
1654
1665
1666 Isolate() = delete;
1667 ~Isolate() = delete;
1668 Isolate(const Isolate&) = delete;
1669 Isolate& operator=(const Isolate&) = delete;
1670 // Deleting operator new and delete here is allowed as ctor and dtor is also
1671 // deleted.
1672 void* operator new(size_t size) = delete;
1673 void* operator new[](size_t size) = delete;
1674 void operator delete(void*, size_t) = delete;
1675 void operator delete[](void*, size_t) = delete;
1676
1677 private:
1678 template <class K, class V, class Traits>
1680
1681 internal::Address* GetDataFromSnapshotOnce(size_t index);
1682 void ReportExternalAllocationLimitReached();
1683};
1684
1685void Isolate::SetData(uint32_t slot, void* data) {
1686 using I = internal::Internals;
1687 I::SetEmbedderData(this, slot, data);
1688}
1689
1690void* Isolate::GetData(uint32_t slot) {
1691 using I = internal::Internals;
1692 return I::GetEmbedderData(this, slot);
1693}
1694
1696 using I = internal::Internals;
1697 return I::kNumIsolateDataSlots;
1698}
1699
1700template <class T>
1702 T* data = reinterpret_cast<T*>(GetDataFromSnapshotOnce(index));
1703 if (data) internal::PerformCastCheck(data);
1704 return Local<T>(data);
1705}
1706
1707} // namespace v8
1708
1709#endif // INCLUDE_V8_ISOLATE_H_
AllowJavascriptExecutionScope & operator=(const AllowJavascriptExecutionScope &)=delete
AllowJavascriptExecutionScope(const AllowJavascriptExecutionScope &)=delete
DisallowJavascriptExecutionScope(Isolate *isolate, OnFailure on_failure)
DisallowJavascriptExecutionScope(const DisallowJavascriptExecutionScope &)=delete
DisallowJavascriptExecutionScope & operator=(const DisallowJavascriptExecutionScope &)=delete
SafeForTerminationScope & operator=(const SafeForTerminationScope &)=delete
SafeForTerminationScope(const SafeForTerminationScope &)=delete
SafeForTerminationScope(v8::Isolate *isolate)
Scope(Isolate *isolate)
Definition v8-isolate.h:304
Scope(const Scope &)=delete
Scope & operator=(const Scope &)=delete
SuppressMicrotaskExecutionScope & operator=(const SuppressMicrotaskExecutionScope &)=delete
SuppressMicrotaskExecutionScope(Isolate *isolate, MicrotaskQueue *microtask_queue=nullptr)
SuppressMicrotaskExecutionScope(const SuppressMicrotaskExecutionScope &)=delete
void SetJitCodeEventHandler(JitCodeEventOptions options, JitCodeEventHandler event_handler)
void SetCounterFunction(CounterLookupCallback)
void SetWasmInstanceCallback(ExtensionCallback callback)
void SetOOMErrorHandler(OOMErrorCallback that)
void AttachCppHeap(CppHeap *)
void SetAddCrashKeyCallback(AddCrashKeyCallback)
void AddGCPrologueCallback(GCCallbackWithData callback, void *data=nullptr, GCType gc_type_filter=kGCTypeAll)
void SetSharedArrayBufferConstructorEnabledCallback(SharedArrayBufferConstructorEnabledCallback callback)
bool(*)(Isolate *) AbortOnUncaughtExceptionCallback
Definition v8-isolate.h:631
void LowMemoryNotification()
void SetWasmSimdEnabledCallback(WasmSimdEnabledCallback callback)
void SetWasmModuleCallback(ExtensionCallback callback)
void EnqueueMicrotask(MicrotaskCallback callback, void *data=nullptr)
bool IsDead()
void EnableMemorySavingsMode()
static void Initialize(Isolate *isolate, const CreateParams &params)
bool AddMessageListener(MessageCallback that, Local< Value > data=Local< Value >())
CppHeap * GetCppHeap() const
void GetEmbeddedCodeRange(const void **start, size_t *length_in_bytes)
void SetStackLimit(uintptr_t stack_limit)
@ kFullGarbageCollection
Definition v8-isolate.h:409
void AddCallCompletedCallback(CallCompletedCallback callback)
static Isolate * GetCurrent()
void VisitHandlesWithClassIds(PersistentHandleVisitor *visitor)
static V8_INLINE uint32_t GetNumberOfDataSlots()
void SetPromiseRejectCallback(PromiseRejectCallback callback)
void SetCreateHistogramFunction(CreateHistogramCallback)
Isolate()=delete
void AddGCEpilogueCallback(GCCallback callback, GCType gc_type_filter=kGCTypeAll)
MicrotasksPolicy GetMicrotasksPolicy() const
bool IsInUse()
void RequestGarbageCollectionForTesting(GarbageCollectionType type)
JSEntryStubs GetJSEntryStubs()
void RemoveGCPrologueCallback(GCCallback callback)
void SetRAILMode(RAILMode rail_mode)
void(*)(Isolate *isolate, GCType type, GCCallbackFlags flags, void *data) GCCallbackWithData
Definition v8-isolate.h:907
size_t(*)() GetExternallyAllocatedMemoryInBytesCallback
void RemoveGCEpilogueCallback(GCCallbackWithData callback, void *data=nullptr)
void SetAtomicsWaitCallback(AtomicsWaitCallback callback, void *data)
void AddGCPrologueCallback(GCCallback callback, GCType gc_type_filter=kGCTypeAll)
void DateTimeConfigurationChangeNotification(TimeZoneDetection time_zone_detection=TimeZoneDetection::kSkip)
void(*)(Isolate *isolate, UseCounterFeature feature) UseCounterCallback
Definition v8-isolate.h:552
void VisitWeakHandles(PersistentHandleVisitor *visitor)
void VisitExternalResources(ExternalResourceVisitor *visitor)
static Isolate * TryGetCurrent()
void AutomaticallyRestoreInitialHeapLimit(double threshold_percent=0.5)
void RequestInterrupt(InterruptCallback callback, void *data)
V8_INLINE void SetData(uint32_t slot, void *data)
void GetCodeRange(void **start, size_t *length_in_bytes)
void RemoveBeforeCallEnteredCallback(BeforeCallEnteredCallback callback)
void RestoreOriginalHeapLimit()
void SetWasmLoadSourceMapCallback(WasmLoadSourceMapCallback callback)
void SetWasmExceptionsEnabledCallback(WasmExceptionsEnabledCallback callback)
void RemoveNearHeapLimitCallback(NearHeapLimitCallback callback, size_t heap_limit)
void RemoveMicrotasksCompletedCallback(MicrotasksCompletedCallbackWithData callback, void *data=nullptr)
void RemoveCallCompletedCallback(CallCompletedCallback callback)
void SetEmbedderHeapTracer(EmbedderHeapTracer *tracer)
void SetAllowAtomicsWait(bool allow)
void Enter()
void SetAllowWasmCodeGenerationCallback(AllowWasmCodeGenerationCallback callback)
void DetachCppHeap()
void SetFailedAccessCheckCallbackFunction(FailedAccessCheckCallback)
void SetPromiseHook(PromiseHook hook)
void SetEmbedderRootsHandler(EmbedderRootsHandler *handler)
Local< Value > ThrowError(Local< String > message)
void SetGetExternallyAllocatedMemoryInBytesCallback(GetExternallyAllocatedMemoryInBytesCallback callback)
void SetCaptureStackTraceForUncaughtExceptions(bool capture, int frame_limit=10, StackTrace::StackTraceOptions options=StackTrace::kOverview)
V8_INLINE void * GetData(uint32_t slot)
void SetMicrotasksPolicy(MicrotasksPolicy policy)
void TerminateExecution()
V8_INLINE MaybeLocal< T > GetDataFromSnapshotOnce(size_t index)
void SetMetricsRecorder(const std::shared_ptr< metrics::Recorder > &metrics_recorder)
void DisableMemorySavingsMode()
bool IsHeapLimitIncreasedForDebugging()
void IsolateInBackgroundNotification()
Local< Value > ThrowException(Local< Value > exception)
void ClearKeptObjects()
Isolate(const Isolate &)=delete
size_t CopyCodePages(size_t capacity, MemoryRange *code_pages_out)
void RemoveGCPrologueCallback(GCCallbackWithData, void *data=nullptr)
void SetUseCounterCallback(UseCounterCallback callback)
void LocaleConfigurationChangeNotification()
~Isolate()=delete
void CancelTerminateExecution()
void AddMicrotasksCompletedCallback(MicrotasksCompletedCallbackWithData callback, void *data=nullptr)
void AddGCEpilogueCallback(GCCallbackWithData callback, void *data=nullptr, GCType gc_type_filter=kGCTypeAll)
void SetEventLogger(LogEventCallback that)
EmbedderHeapTracer * GetEmbedderHeapTracer()
void AddNearHeapLimitCallback(NearHeapLimitCallback callback, void *data)
bool IdleNotificationDeadline(double deadline_in_seconds)
void RequestGarbageCollectionForTesting(GarbageCollectionType type, EmbedderHeapTracer::EmbedderStackState stack_state)
void EnqueueMicrotask(Local< Function > microtask)
int ContextDisposedNotification(bool dependant_context=true)
Isolate & operator=(const Isolate &)=delete
void IncreaseHeapLimitForDebugging()
bool IsExecutionTerminating()
static Isolate * New(const CreateParams &params)
void RemoveGCEpilogueCallback(GCCallback callback)
void SetWasmStreamingCallback(WasmStreamingCallback callback)
void InstallConditionalFeatures(Local< Context > context)
void RemoveMessageListeners(MessageCallback that)
static Isolate * Allocate()
void(*)(Isolate *isolate, GCType type, GCCallbackFlags flags) GCCallback
Definition v8-isolate.h:905
bool IsCurrent() const
void UpdateLoadStartTime()
void SetAddHistogramSampleFunction(AddHistogramSampleCallback)
void AddBeforeCallEnteredCallback(BeforeCallEnteredCallback callback)
void SetModifyCodeGenerationFromStringsCallback(ModifyCodeGenerationFromStringsCallback2 callback)
void PerformMicrotaskCheckpoint()
void SetAbortOnUncaughtExceptionCallback(AbortOnUncaughtExceptionCallback callback)
bool AddMessageListenerWithErrorLevel(MessageCallback that, int message_levels, Local< Value > data=Local< Value >())
bool HasPendingBackgroundTasks()
void SetWasmDynamicTieringEnabledCallback(WasmDynamicTieringEnabledCallback callback)
void IsolateInForegroundNotification()
void(*)(AtomicsWaitEvent event, Local< SharedArrayBuffer > array_buffer, size_t offset_in_bytes, int64_t value, double timeout_in_ms, AtomicsWaitWakeHandle *stop_handle, void *data) AtomicsWaitCallback
void SetFatalErrorHandler(FatalErrorCallback that)
void set_max_young_generation_size_in_bytes(size_t limit)
Definition v8-isolate.h:137
void set_stack_limit(uint32_t *value)
Definition v8-isolate.h:101
void set_initial_young_generation_size_in_bytes(size_t initial_size)
Definition v8-isolate.h:151
size_t max_old_generation_size_in_bytes() const
Definition v8-isolate.h:122
size_t initial_old_generation_size_in_bytes() const
Definition v8-isolate.h:141
size_t initial_young_generation_size_in_bytes() const
Definition v8-isolate.h:148
void set_code_range_size_in_bytes(size_t limit)
Definition v8-isolate.h:113
size_t code_range_size_in_bytes() const
Definition v8-isolate.h:112
size_t max_young_generation_size_in_bytes() const
Definition v8-isolate.h:134
void ConfigureDefaults(uint64_t physical_memory, uint64_t virtual_memory_limit)
void set_max_old_generation_size_in_bytes(size_t limit)
Definition v8-isolate.h:125
uint32_t * stack_limit() const
Definition v8-isolate.h:100
void set_initial_old_generation_size_in_bytes(size_t initial_size)
Definition v8-isolate.h:144
void ConfigureDefaultsFromHeapSize(size_t initial_heap_size_in_bytes, size_t maximum_heap_size_in_bytes)
EmbedderStackState
Definition common.h:16
uintptr_t Address
Definition v8-internal.h:29
V8_INLINE void PerformCastCheck(T *data)
void(*)(const char *name, int status) LogEventCallback
bool(*)(const FunctionCallbackInfo< Value > &) ExtensionCallback
void(*)(Local< Message > message, Local< Value > data) MessageCallback
MemoryPressureLevel
Definition v8-isolate.h:195
void(*)(Isolate *, void *) MicrotasksCompletedCallbackWithData
void(*)(CrashKeyId id, const std::string &value) AddCrashKeyCallback
bool(*)(Local< Context > context) WasmExceptionsEnabledCallback
RAILMode
Definition v8-isolate.h:170
@ PERFORMANCE_IDLE
Definition v8-isolate.h:181
@ PERFORMANCE_ANIMATION
Definition v8-isolate.h:178
@ PERFORMANCE_LOAD
Definition v8-isolate.h:184
@ PERFORMANCE_RESPONSE
Definition v8-isolate.h:174
void(*)(PromiseRejectMessage message) PromiseRejectCallback
Definition v8-promise.h:170
bool(*)(Local< Context > context) WasmSimdEnabledCallback
bool(*)(Local< Context > context, Local< String > source) AllowWasmCodeGenerationCallback
void(*)(PromiseHookType type, Local< Promise > promise, Local< Value > parent) PromiseHook
Definition v8-promise.h:144
void(*)(void *data) MicrotaskCallback
ModifyCodeGenerationFromStringsResult(*)(Local< Context > context, Local< Value > source, bool is_code_like) ModifyCodeGenerationFromStringsCallback2
GCCallbackFlags
void(*)(Isolate *) CallCompletedCallback
size_t(*)(void *data, size_t current_heap_limit, size_t initial_heap_limit) NearHeapLimitCallback
JitCodeEventOptions
void(*)(Local< Object > target, AccessType type, Local< Value > data) FailedAccessCheckCallback
void(*)(Isolate *isolate, void *data) InterruptCallback
bool(*)(Local< Context > context) SharedArrayBufferConstructorEnabledCallback
MeasureMemoryExecution
void(*)(const FunctionCallbackInfo< Value > &) WasmStreamingCallback
void(*)(const char *location, const char *message) FatalErrorCallback
void(*)(Isolate *) BeforeCallEnteredCallback
void(*)(void *histogram, int sample) AddHistogramSampleCallback
int *(*)(const char *name) CounterLookupCallback
void(*)(const char *location, bool is_heap_oom) OOMErrorCallback
bool(*)(Local< Context > context) WasmDynamicTieringEnabledCallback
void(*)(Local< Context > context, Local< Module > module, Local< Object > meta) HostInitializeImportMetaObjectCallback
MicrotasksPolicy
void *(*)(const char *name, int min, int max, size_t buckets) CreateHistogramCallback
void(*)(const JitCodeEvent *event) JitCodeEventHandler
ResourceConstraints constraints
Definition v8-isolate.h:223
std::shared_ptr< ArrayBuffer::Allocator > array_buffer_allocator_shared
Definition v8-isolate.h:256
Definition v8-unwinder.h:68
#define V8_EXPORT
Definition v8config.h:578
#define V8_INLINE
Definition v8config.h:425
#define V8_DEPRECATED(message)
Definition v8config.h:462
#define V8_NODISCARD
Definition v8config.h:513