|
|
|||
File indexing completed on 2026-05-07 08:43:59
0001 // Copyright 2021 the V8 project authors. All rights reserved. 0002 // Use of this source code is governed by a BSD-style license that can be 0003 // found in the LICENSE file. 0004 0005 #ifndef INCLUDE_V8_ISOLATE_H_ 0006 #define INCLUDE_V8_ISOLATE_H_ 0007 0008 #include <stddef.h> 0009 #include <stdint.h> 0010 0011 #include <memory> 0012 #include <string> 0013 #include <utility> 0014 0015 #include "cppgc/common.h" 0016 #include "v8-array-buffer.h" // NOLINT(build/include_directory) 0017 #include "v8-callbacks.h" // NOLINT(build/include_directory) 0018 #include "v8-data.h" // NOLINT(build/include_directory) 0019 #include "v8-debug.h" // NOLINT(build/include_directory) 0020 #include "v8-embedder-heap.h" // NOLINT(build/include_directory) 0021 #include "v8-exception.h" // NOLINT(build/include_directory) 0022 #include "v8-function-callback.h" // NOLINT(build/include_directory) 0023 #include "v8-internal.h" // NOLINT(build/include_directory) 0024 #include "v8-local-handle.h" // NOLINT(build/include_directory) 0025 #include "v8-microtask.h" // NOLINT(build/include_directory) 0026 #include "v8-persistent-handle.h" // NOLINT(build/include_directory) 0027 #include "v8-primitive.h" // NOLINT(build/include_directory) 0028 #include "v8-statistics.h" // NOLINT(build/include_directory) 0029 #include "v8-unwinder.h" // NOLINT(build/include_directory) 0030 #include "v8config.h" // NOLINT(build/include_directory) 0031 0032 namespace v8 { 0033 0034 class CppHeap; 0035 class HeapProfiler; 0036 class MicrotaskQueue; 0037 class StartupData; 0038 class ScriptOrModule; 0039 class SharedArrayBuffer; 0040 0041 namespace internal { 0042 class MicrotaskQueue; 0043 class ThreadLocalTop; 0044 } // namespace internal 0045 0046 namespace metrics { 0047 class Recorder; 0048 } // namespace metrics 0049 0050 /** 0051 * A set of constraints that specifies the limits of the runtime's memory use. 0052 * You must set the heap size before initializing the VM - the size cannot be 0053 * adjusted after the VM is initialized. 0054 * 0055 * If you are using threads then you should hold the V8::Locker lock while 0056 * setting the stack limit and you must set a non-default stack limit separately 0057 * for each thread. 0058 * 0059 * The arguments for set_max_semi_space_size, set_max_old_space_size, 0060 * set_max_executable_size, set_code_range_size specify limits in MB. 0061 * 0062 * The argument for set_max_semi_space_size_in_kb is in KB. 0063 */ 0064 class V8_EXPORT ResourceConstraints { 0065 public: 0066 /** 0067 * Configures the constraints with reasonable default values based on the 0068 * provided heap size limit. The heap size includes both the young and 0069 * the old generation. 0070 * 0071 * \param initial_heap_size_in_bytes The initial heap size or zero. 0072 * By default V8 starts with a small heap and dynamically grows it to 0073 * match the set of live objects. This may lead to ineffective 0074 * garbage collections at startup if the live set is large. 0075 * Setting the initial heap size avoids such garbage collections. 0076 * Note that this does not affect young generation garbage collections. 0077 * 0078 * \param maximum_heap_size_in_bytes The hard limit for the heap size. 0079 * When the heap size approaches this limit, V8 will perform series of 0080 * garbage collections and invoke the NearHeapLimitCallback. If the garbage 0081 * collections do not help and the callback does not increase the limit, 0082 * then V8 will crash with V8::FatalProcessOutOfMemory. 0083 */ 0084 void ConfigureDefaultsFromHeapSize(size_t initial_heap_size_in_bytes, 0085 size_t maximum_heap_size_in_bytes); 0086 0087 /** 0088 * Configures the constraints with reasonable default values based on the 0089 * capabilities of the current device the VM is running on. 0090 * 0091 * \param physical_memory The total amount of physical memory on the current 0092 * device, in bytes. 0093 * \param virtual_memory_limit The amount of virtual memory on the current 0094 * device, in bytes, or zero, if there is no limit. 0095 */ 0096 void ConfigureDefaults(uint64_t physical_memory, 0097 uint64_t virtual_memory_limit); 0098 0099 /** 0100 * The address beyond which the VM's stack may not grow. 0101 */ 0102 uint32_t* stack_limit() const { return stack_limit_; } 0103 void set_stack_limit(uint32_t* value) { stack_limit_ = value; } 0104 0105 /** 0106 * The amount of virtual memory reserved for generated code. This is relevant 0107 * for 64-bit architectures that rely on code range for calls in code. 0108 * 0109 * When V8_COMPRESS_POINTERS_IN_SHARED_CAGE is defined, there is a shared 0110 * process-wide code range that is lazily initialized. This value is used to 0111 * configure that shared code range when the first Isolate is 0112 * created. Subsequent Isolates ignore this value. 0113 */ 0114 size_t code_range_size_in_bytes() const { return code_range_size_; } 0115 void set_code_range_size_in_bytes(size_t limit) { code_range_size_ = limit; } 0116 0117 /** 0118 * The maximum size of the old generation. 0119 * When the old generation approaches this limit, V8 will perform series of 0120 * garbage collections and invoke the NearHeapLimitCallback. 0121 * If the garbage collections do not help and the callback does not 0122 * increase the limit, then V8 will crash with V8::FatalProcessOutOfMemory. 0123 */ 0124 size_t max_old_generation_size_in_bytes() const { 0125 return max_old_generation_size_; 0126 } 0127 void set_max_old_generation_size_in_bytes(size_t limit) { 0128 max_old_generation_size_ = limit; 0129 } 0130 0131 /** 0132 * The maximum size of the young generation, which consists of two semi-spaces 0133 * and a large object space. This affects frequency of Scavenge garbage 0134 * collections and should be typically much smaller that the old generation. 0135 */ 0136 size_t max_young_generation_size_in_bytes() const { 0137 return max_young_generation_size_; 0138 } 0139 void set_max_young_generation_size_in_bytes(size_t limit) { 0140 max_young_generation_size_ = limit; 0141 } 0142 0143 size_t initial_old_generation_size_in_bytes() const { 0144 return initial_old_generation_size_; 0145 } 0146 void set_initial_old_generation_size_in_bytes(size_t initial_size) { 0147 initial_old_generation_size_ = initial_size; 0148 } 0149 0150 size_t initial_young_generation_size_in_bytes() const { 0151 return initial_young_generation_size_; 0152 } 0153 void set_initial_young_generation_size_in_bytes(size_t initial_size) { 0154 initial_young_generation_size_ = initial_size; 0155 } 0156 0157 private: 0158 static constexpr size_t kMB = 1048576u; 0159 size_t code_range_size_ = 0; 0160 size_t max_old_generation_size_ = 0; 0161 size_t max_young_generation_size_ = 0; 0162 size_t initial_old_generation_size_ = 0; 0163 size_t initial_young_generation_size_ = 0; 0164 uint32_t* stack_limit_ = nullptr; 0165 }; 0166 0167 /** 0168 * Memory pressure level for the MemoryPressureNotification. 0169 * kNone hints V8 that there is no memory pressure. 0170 * kModerate hints V8 to speed up incremental garbage collection at the cost of 0171 * of higher latency due to garbage collection pauses. 0172 * kCritical hints V8 to free memory as soon as possible. Garbage collection 0173 * pauses at this level will be large. 0174 */ 0175 enum class MemoryPressureLevel { kNone, kModerate, kCritical }; 0176 0177 /** 0178 * Signal for dependants of contexts. Useful for 0179 * `ContextDisposedNotification()` to implement different strategies. 0180 */ 0181 enum class ContextDependants { 0182 /** Context has no dependants. These are usually top-level contexts. */ 0183 kNoDependants, 0184 /** Context has some dependants, i.e., it may depend on other contexts. This 0185 is usually the case for inner contexts. */ 0186 kSomeDependants 0187 }; 0188 0189 /** 0190 * Indicator for the stack state. 0191 */ 0192 using StackState = cppgc::EmbedderStackState; 0193 0194 /** 0195 * The set of V8 isolates in a process is partitioned into groups. Each group 0196 * has its own sandbox (if V8 was configured with support for the sandbox) and 0197 * pointer-compression cage (if configured with pointer compression). 0198 * 0199 * By default, all isolates are placed in the same group. This is the most 0200 * efficient configuration in terms of speed and memory use. However, with 0201 * pointer compression enabled, total heap usage of isolates in a group 0202 * cannot exceed 4 GB, not counting array buffers and other off-heap storage. 0203 * Using multiple isolate groups can allow embedders to allocate more than 4GB 0204 * of objects with pointer compression enabled, if the embedder's use case can 0205 * span multiple isolates. 0206 * 0207 * Creating an isolate group reserves a range of virtual memory addresses. A 0208 * group's memory mapping will be released when the last isolate in the group is 0209 * disposed, and there are no more live IsolateGroup objects that refer to it. 0210 * 0211 * Note that Isolate groups are reference counted, and 0212 * the IsolateGroup type is a reference to one. 0213 * 0214 * Note that it's not going to be possible to pass shared JS objects 0215 * across IsolateGroup boundary. 0216 * 0217 */ 0218 class V8_EXPORT IsolateGroup { 0219 public: 0220 /** 0221 * Get the default isolate group. If this V8's build configuration only 0222 * supports a single group, this is a reference to that single group. 0223 * Otherwise this is a group like any other, distinguished only 0224 * in that it is the first group. 0225 */ 0226 static IsolateGroup GetDefault(); 0227 0228 /** 0229 * Return true if new isolate groups can be created at run-time, or false if 0230 * all isolates must be in the same group. 0231 */ 0232 static bool CanCreateNewGroups(); 0233 0234 /** 0235 * Create a new isolate group. If this V8's build configuration only supports 0236 * a single group, abort. 0237 */ 0238 static IsolateGroup Create(); 0239 0240 IsolateGroup(IsolateGroup&& other); 0241 IsolateGroup& operator=(IsolateGroup&& other); 0242 0243 IsolateGroup(const IsolateGroup&); 0244 IsolateGroup& operator=(const IsolateGroup&); 0245 0246 ~IsolateGroup(); 0247 0248 bool operator==(const IsolateGroup& other) const { 0249 return isolate_group_ == other.isolate_group_; 0250 } 0251 0252 bool operator!=(const IsolateGroup& other) const { 0253 return !operator==(other); 0254 } 0255 0256 private: 0257 friend class Isolate; 0258 friend class ArrayBuffer::Allocator; 0259 0260 // The isolate_group pointer should be already acquired. 0261 explicit IsolateGroup(internal::IsolateGroup*&& isolate_group); 0262 0263 internal::IsolateGroup* isolate_group_; 0264 }; 0265 0266 /** 0267 * Isolate represents an isolated instance of the V8 engine. V8 isolates have 0268 * completely separate states. Objects from one isolate must not be used in 0269 * other isolates. The embedder can create multiple isolates and use them in 0270 * parallel in multiple threads. An isolate can be entered by at most one 0271 * thread at any given time. The Locker/Unlocker API must be used to 0272 * synchronize. 0273 */ 0274 class V8_EXPORT Isolate { 0275 public: 0276 /** 0277 * Initial configuration parameters for a new Isolate. 0278 */ 0279 struct V8_EXPORT CreateParams { 0280 CreateParams(); 0281 ~CreateParams(); 0282 0283 ALLOW_COPY_AND_MOVE_WITH_DEPRECATED_FIELDS(CreateParams) 0284 0285 /** 0286 * Allows the host application to provide the address of a function that is 0287 * notified each time code is added, moved or removed. 0288 */ 0289 JitCodeEventHandler code_event_handler = nullptr; 0290 0291 /** 0292 * ResourceConstraints to use for the new Isolate. 0293 */ 0294 ResourceConstraints constraints; 0295 0296 /** 0297 * Explicitly specify a startup snapshot blob. The embedder owns the blob. 0298 * The embedder *must* ensure that the snapshot is from a trusted source. 0299 */ 0300 const StartupData* snapshot_blob = nullptr; 0301 0302 /** 0303 * Enables the host application to provide a mechanism for recording 0304 * statistics counters. 0305 */ 0306 CounterLookupCallback counter_lookup_callback = nullptr; 0307 0308 /** 0309 * Enables the host application to provide a mechanism for recording 0310 * histograms. The CreateHistogram function returns a 0311 * histogram which will later be passed to the AddHistogramSample 0312 * function. 0313 */ 0314 CreateHistogramCallback create_histogram_callback = nullptr; 0315 AddHistogramSampleCallback add_histogram_sample_callback = nullptr; 0316 0317 /** 0318 * The ArrayBuffer::Allocator to use for allocating and freeing the backing 0319 * store of ArrayBuffers. 0320 * 0321 * If the shared_ptr version is used, the Isolate instance and every 0322 * |BackingStore| allocated using this allocator hold a std::shared_ptr 0323 * to the allocator, in order to facilitate lifetime 0324 * management for the allocator instance. 0325 */ 0326 ArrayBuffer::Allocator* array_buffer_allocator = nullptr; 0327 std::shared_ptr<ArrayBuffer::Allocator> array_buffer_allocator_shared; 0328 0329 /** 0330 * Specifies an optional nullptr-terminated array of raw addresses in the 0331 * embedder that V8 can match against during serialization and use for 0332 * deserialization. This array and its content must stay valid for the 0333 * entire lifetime of the isolate. 0334 */ 0335 const intptr_t* external_references = nullptr; 0336 0337 /** 0338 * Whether calling Atomics.wait (a function that may block) is allowed in 0339 * this isolate. This can also be configured via SetAllowAtomicsWait. 0340 */ 0341 bool allow_atomics_wait = true; 0342 0343 /** 0344 * The following parameters describe the offsets for addressing type info 0345 * for wrapped API objects and are used by the fast C API 0346 * (for details see v8-fast-api-calls.h). 0347 */ 0348 int embedder_wrapper_type_index = -1; 0349 int embedder_wrapper_object_index = -1; 0350 0351 /** 0352 * Callbacks to invoke in case of fatal or OOM errors. 0353 */ 0354 FatalErrorCallback fatal_error_callback = nullptr; 0355 OOMErrorCallback oom_error_callback = nullptr; 0356 0357 /** 0358 * A CppHeap used to construct the Isolate. V8 takes ownership of the 0359 * CppHeap passed this way. 0360 */ 0361 CppHeap* cpp_heap = nullptr; 0362 }; 0363 0364 /** 0365 * Stack-allocated class which sets the isolate for all operations 0366 * executed within a local scope. 0367 */ 0368 class V8_EXPORT V8_NODISCARD Scope { 0369 public: 0370 explicit Scope(Isolate* isolate) : v8_isolate_(isolate) { 0371 v8_isolate_->Enter(); 0372 } 0373 0374 ~Scope() { v8_isolate_->Exit(); } 0375 0376 // Prevent copying of Scope objects. 0377 Scope(const Scope&) = delete; 0378 Scope& operator=(const Scope&) = delete; 0379 0380 private: 0381 Isolate* const v8_isolate_; 0382 }; 0383 0384 /** 0385 * Assert that no Javascript code is invoked. 0386 */ 0387 class V8_EXPORT V8_NODISCARD DisallowJavascriptExecutionScope { 0388 public: 0389 enum OnFailure { CRASH_ON_FAILURE, THROW_ON_FAILURE, DUMP_ON_FAILURE }; 0390 0391 DisallowJavascriptExecutionScope(Isolate* isolate, OnFailure on_failure); 0392 ~DisallowJavascriptExecutionScope(); 0393 0394 // Prevent copying of Scope objects. 0395 DisallowJavascriptExecutionScope(const DisallowJavascriptExecutionScope&) = 0396 delete; 0397 DisallowJavascriptExecutionScope& operator=( 0398 const DisallowJavascriptExecutionScope&) = delete; 0399 0400 private: 0401 v8::Isolate* const v8_isolate_; 0402 const OnFailure on_failure_; 0403 bool was_execution_allowed_; 0404 }; 0405 0406 /** 0407 * Introduce exception to DisallowJavascriptExecutionScope. 0408 */ 0409 class V8_EXPORT V8_NODISCARD AllowJavascriptExecutionScope { 0410 public: 0411 explicit AllowJavascriptExecutionScope(Isolate* isolate); 0412 ~AllowJavascriptExecutionScope(); 0413 0414 // Prevent copying of Scope objects. 0415 AllowJavascriptExecutionScope(const AllowJavascriptExecutionScope&) = 0416 delete; 0417 AllowJavascriptExecutionScope& operator=( 0418 const AllowJavascriptExecutionScope&) = delete; 0419 0420 private: 0421 Isolate* const v8_isolate_; 0422 bool was_execution_allowed_assert_; 0423 bool was_execution_allowed_throws_; 0424 bool was_execution_allowed_dump_; 0425 }; 0426 0427 /** 0428 * Do not run microtasks while this scope is active, even if microtasks are 0429 * automatically executed otherwise. 0430 */ 0431 class V8_EXPORT V8_NODISCARD SuppressMicrotaskExecutionScope { 0432 public: 0433 explicit SuppressMicrotaskExecutionScope( 0434 Isolate* isolate, MicrotaskQueue* microtask_queue = nullptr); 0435 ~SuppressMicrotaskExecutionScope(); 0436 0437 // Prevent copying of Scope objects. 0438 SuppressMicrotaskExecutionScope(const SuppressMicrotaskExecutionScope&) = 0439 delete; 0440 SuppressMicrotaskExecutionScope& operator=( 0441 const SuppressMicrotaskExecutionScope&) = delete; 0442 0443 private: 0444 internal::Isolate* const i_isolate_; 0445 internal::MicrotaskQueue* const microtask_queue_; 0446 internal::Address previous_stack_height_; 0447 0448 friend class internal::ThreadLocalTop; 0449 }; 0450 0451 /** 0452 * Types of garbage collections that can be requested via 0453 * RequestGarbageCollectionForTesting. 0454 */ 0455 enum GarbageCollectionType { 0456 kFullGarbageCollection, 0457 kMinorGarbageCollection 0458 }; 0459 0460 /** 0461 * Features reported via the SetUseCounterCallback callback. Do not change 0462 * assigned numbers of existing items; add new features to the end of this 0463 * list. 0464 * Dead features can be marked `V8_DEPRECATE_SOON`, then `V8_DEPRECATED`, and 0465 * then finally be renamed to `kOBSOLETE_...` to stop embedders from using 0466 * them. 0467 */ 0468 enum UseCounterFeature { 0469 kUseAsm = 0, 0470 kBreakIterator = 1, 0471 kOBSOLETE_LegacyConst = 2, 0472 kOBSOLETE_MarkDequeOverflow = 3, 0473 kOBSOLETE_StoreBufferOverflow = 4, 0474 kOBSOLETE_SlotsBufferOverflow = 5, 0475 kOBSOLETE_ObjectObserve = 6, 0476 kForcedGC = 7, 0477 kSloppyMode = 8, 0478 kStrictMode = 9, 0479 kOBSOLETE_StrongMode = 10, 0480 kRegExpPrototypeStickyGetter = 11, 0481 kRegExpPrototypeToString = 12, 0482 kRegExpPrototypeUnicodeGetter = 13, 0483 kOBSOLETE_IntlV8Parse = 14, 0484 kOBSOLETE_IntlPattern = 15, 0485 kOBSOLETE_IntlResolved = 16, 0486 kOBSOLETE_PromiseChain = 17, 0487 kOBSOLETE_PromiseAccept = 18, 0488 kOBSOLETE_PromiseDefer = 19, 0489 kHtmlCommentInExternalScript = 20, 0490 kHtmlComment = 21, 0491 kSloppyModeBlockScopedFunctionRedefinition = 22, 0492 kForInInitializer = 23, 0493 kOBSOLETE_ArrayProtectorDirtied = 24, 0494 kArraySpeciesModified = 25, 0495 kArrayPrototypeConstructorModified = 26, 0496 kOBSOLETE_ArrayInstanceProtoModified = 27, 0497 kArrayInstanceConstructorModified = 28, 0498 kOBSOLETE_LegacyFunctionDeclaration = 29, 0499 kOBSOLETE_RegExpPrototypeSourceGetter = 30, 0500 kOBSOLETE_RegExpPrototypeOldFlagGetter = 31, 0501 kDecimalWithLeadingZeroInStrictMode = 32, 0502 kLegacyDateParser = 33, 0503 kDefineGetterOrSetterWouldThrow = 34, 0504 kFunctionConstructorReturnedUndefined = 35, 0505 kAssigmentExpressionLHSIsCallInSloppy = 36, 0506 kAssigmentExpressionLHSIsCallInStrict = 37, 0507 kPromiseConstructorReturnedUndefined = 38, 0508 kOBSOLETE_ConstructorNonUndefinedPrimitiveReturn = 39, 0509 kOBSOLETE_LabeledExpressionStatement = 40, 0510 kOBSOLETE_LineOrParagraphSeparatorAsLineTerminator = 41, 0511 kIndexAccessor = 42, 0512 kErrorCaptureStackTrace = 43, 0513 kErrorPrepareStackTrace = 44, 0514 kErrorStackTraceLimit = 45, 0515 kWebAssemblyInstantiation = 46, 0516 kDeoptimizerDisableSpeculation = 47, 0517 kOBSOLETE_ArrayPrototypeSortJSArrayModifiedPrototype = 48, 0518 kFunctionTokenOffsetTooLongForToString = 49, 0519 kWasmSharedMemory = 50, 0520 kWasmThreadOpcodes = 51, 0521 kOBSOLETE_AtomicsNotify = 52, 0522 kOBSOLETE_AtomicsWake = 53, 0523 kCollator = 54, 0524 kNumberFormat = 55, 0525 kDateTimeFormat = 56, 0526 kPluralRules = 57, 0527 kRelativeTimeFormat = 58, 0528 kLocale = 59, 0529 kListFormat = 60, 0530 kSegmenter = 61, 0531 kStringLocaleCompare = 62, 0532 kOBSOLETE_StringToLocaleUpperCase = 63, 0533 kStringToLocaleLowerCase = 64, 0534 kNumberToLocaleString = 65, 0535 kDateToLocaleString = 66, 0536 kDateToLocaleDateString = 67, 0537 kDateToLocaleTimeString = 68, 0538 kAttemptOverrideReadOnlyOnPrototypeSloppy = 69, 0539 kAttemptOverrideReadOnlyOnPrototypeStrict = 70, 0540 kOBSOLETE_OptimizedFunctionWithOneShotBytecode = 71, 0541 kRegExpMatchIsTrueishOnNonJSRegExp = 72, 0542 kRegExpMatchIsFalseishOnJSRegExp = 73, 0543 kOBSOLETE_DateGetTimezoneOffset = 74, 0544 kStringNormalize = 75, 0545 kCallSiteAPIGetFunctionSloppyCall = 76, 0546 kCallSiteAPIGetThisSloppyCall = 77, 0547 kOBSOLETE_RegExpMatchAllWithNonGlobalRegExp = 78, 0548 kRegExpExecCalledOnSlowRegExp = 79, 0549 kRegExpReplaceCalledOnSlowRegExp = 80, 0550 kDisplayNames = 81, 0551 kSharedArrayBufferConstructed = 82, 0552 kArrayPrototypeHasElements = 83, 0553 kObjectPrototypeHasElements = 84, 0554 kNumberFormatStyleUnit = 85, 0555 kDateTimeFormatRange = 86, 0556 kDateTimeFormatDateTimeStyle = 87, 0557 kBreakIteratorTypeWord = 88, 0558 kBreakIteratorTypeLine = 89, 0559 kInvalidatedArrayBufferDetachingProtector = 90, 0560 kInvalidatedArrayConstructorProtector = 91, 0561 kInvalidatedArrayIteratorLookupChainProtector = 92, 0562 kInvalidatedArraySpeciesLookupChainProtector = 93, 0563 kInvalidatedIsConcatSpreadableLookupChainProtector = 94, 0564 kInvalidatedMapIteratorLookupChainProtector = 95, 0565 kInvalidatedNoElementsProtector = 96, 0566 kInvalidatedPromiseHookProtector = 97, 0567 kInvalidatedPromiseResolveLookupChainProtector = 98, 0568 kInvalidatedPromiseSpeciesLookupChainProtector = 99, 0569 kInvalidatedPromiseThenLookupChainProtector = 100, 0570 kInvalidatedRegExpSpeciesLookupChainProtector = 101, 0571 kInvalidatedSetIteratorLookupChainProtector = 102, 0572 kInvalidatedStringIteratorLookupChainProtector = 103, 0573 kInvalidatedStringLengthOverflowLookupChainProtector = 104, 0574 kInvalidatedTypedArraySpeciesLookupChainProtector = 105, 0575 kWasmSimdOpcodes = 106, 0576 kVarRedeclaredCatchBinding = 107, 0577 kWasmRefTypes = 108, 0578 kOBSOLETE_WasmBulkMemory = 109, 0579 kOBSOLETE_WasmMultiValue = 110, 0580 kWasmExceptionHandling = 111, 0581 kInvalidatedMegaDOMProtector = 112, 0582 kFunctionPrototypeArguments = 113, 0583 kFunctionPrototypeCaller = 114, 0584 kTurboFanOsrCompileStarted = 115, 0585 kAsyncStackTaggingCreateTaskCall = 116, 0586 kDurationFormat = 117, 0587 kInvalidatedNumberStringNotRegexpLikeProtector = 118, 0588 kOBSOLETE_RegExpUnicodeSetIncompatibilitiesWithUnicodeMode = 119, 0589 kOBSOLETE_ImportAssertionDeprecatedSyntax = 120, 0590 kLocaleInfoObsoletedGetters = 121, 0591 kLocaleInfoFunctions = 122, 0592 kCompileHintsMagicAll = 123, 0593 kInvalidatedNoProfilingProtector = 124, 0594 kWasmMemory64 = 125, 0595 kWasmMultiMemory = 126, 0596 kWasmGC = 127, 0597 kWasmImportedStrings = 128, 0598 kSourceMappingUrlMagicCommentAtSign = 129, 0599 kTemporalObject = 130, 0600 kWasmModuleCompilation = 131, 0601 kInvalidatedNoUndetectableObjectsProtector = 132, 0602 kWasmJavaScriptPromiseIntegration = 133, 0603 kWasmReturnCall = 134, 0604 kWasmExtendedConst = 135, 0605 kWasmRelaxedSimd = 136, 0606 kWasmTypeReflection = 137, 0607 kWasmExnRef = 138, 0608 kWasmTypedFuncRef = 139, 0609 kInvalidatedStringWrapperToPrimitiveProtector = 140, 0610 kDocumentAllLegacyCall = 141, 0611 kDocumentAllLegacyConstruct = 142, 0612 kConsoleContext = 143, 0613 kWasmImportedStringsUtf8 = 144, 0614 kResizableArrayBuffer = 145, 0615 kGrowableSharedArrayBuffer = 146, 0616 kArrayByCopy = 147, 0617 kArrayFromAsync = 148, 0618 kIteratorMethods = 149, 0619 kPromiseAny = 150, 0620 kSetMethods = 151, 0621 kArrayFindLast = 152, 0622 kArrayGroup = 153, 0623 kArrayBufferTransfer = 154, 0624 kPromiseWithResolvers = 155, 0625 kAtomicsWaitAsync = 156, 0626 kExtendingNonExtensibleWithPrivate = 157, 0627 kPromiseTry = 158, 0628 kStringReplaceAll = 159, 0629 kStringWellFormed = 160, 0630 kWeakReferences = 161, 0631 kErrorIsError = 162, 0632 kInvalidatedTypedArrayLengthLookupChainProtector = 163, 0633 kRegExpEscape = 164, 0634 kFloat16Array = 165, 0635 kExplicitResourceManagement = 166, 0636 kWasmBranchHinting = 167, 0637 0638 // If you add new values here, you'll also need to update Chromium's: 0639 // web_feature.mojom, use_counter_callback.cc, and enums.xml. V8 changes to 0640 // this list need to be landed first, then changes on the Chromium side. 0641 kUseCounterFeatureCount // This enum value must be last. 0642 }; 0643 0644 enum MessageErrorLevel { 0645 kMessageLog = (1 << 0), 0646 kMessageDebug = (1 << 1), 0647 kMessageInfo = (1 << 2), 0648 kMessageError = (1 << 3), 0649 kMessageWarning = (1 << 4), 0650 kMessageAll = kMessageLog | kMessageDebug | kMessageInfo | kMessageError | 0651 kMessageWarning, 0652 }; 0653 0654 // The different priorities that an isolate can have. 0655 enum class Priority { 0656 // The isolate does not relate to content that is currently important 0657 // to the user. Lowest priority. 0658 kBestEffort, 0659 0660 // The isolate contributes to content that is visible to the user, like a 0661 // visible iframe that's not interacted directly with. High priority. 0662 kUserVisible, 0663 0664 // The isolate contributes to content that is of the utmost importance to 0665 // the user, like visible content in the focused window. Highest priority. 0666 kUserBlocking, 0667 }; 0668 0669 using UseCounterCallback = void (*)(Isolate* isolate, 0670 UseCounterFeature feature); 0671 0672 /** 0673 * Allocates a new isolate but does not initialize it. Does not change the 0674 * currently entered isolate. 0675 * 0676 * Only Isolate::GetData() and Isolate::SetData(), which access the 0677 * embedder-controlled parts of the isolate, as well as Isolate::GetGroup(), 0678 * are allowed to be called on the uninitialized isolate. To initialize the 0679 * isolate, call `Isolate::Initialize()` or initialize a `SnapshotCreator`. 0680 * 0681 * When an isolate is no longer used its resources should be freed 0682 * by calling Dispose(). Using the delete operator is not allowed. 0683 * 0684 * V8::Initialize() must have run prior to this. 0685 */ 0686 static Isolate* Allocate(); 0687 static Isolate* Allocate(const IsolateGroup& group); 0688 0689 /** 0690 * Return the group for this isolate. 0691 */ 0692 IsolateGroup GetGroup() const; 0693 0694 /** 0695 * Initialize an Isolate previously allocated by Isolate::Allocate(). 0696 */ 0697 static void Initialize(Isolate* isolate, const CreateParams& params); 0698 0699 /** 0700 * Creates a new isolate. Does not change the currently entered 0701 * isolate. 0702 * 0703 * When an isolate is no longer used its resources should be freed 0704 * by calling Dispose(). Using the delete operator is not allowed. 0705 * 0706 * V8::Initialize() must have run prior to this. 0707 */ 0708 static Isolate* New(const CreateParams& params); 0709 static Isolate* New(const IsolateGroup& group, const CreateParams& params); 0710 0711 /** 0712 * Returns the entered isolate for the current thread or NULL in 0713 * case there is no current isolate. 0714 * 0715 * This method must not be invoked before V8::Initialize() was invoked. 0716 */ 0717 static Isolate* GetCurrent(); 0718 0719 /** 0720 * Returns the entered isolate for the current thread or NULL in 0721 * case there is no current isolate. 0722 * 0723 * No checks are performed by this method. 0724 */ 0725 static Isolate* TryGetCurrent(); 0726 0727 /** 0728 * Return true if this isolate is currently active. 0729 **/ 0730 bool IsCurrent() const; 0731 0732 /** 0733 * Clears the set of objects held strongly by the heap. This set of 0734 * objects are originally built when a WeakRef is created or 0735 * successfully dereferenced. 0736 * 0737 * This is invoked automatically after microtasks are run. See 0738 * MicrotasksPolicy for when microtasks are run. 0739 * 0740 * This needs to be manually invoked only if the embedder is manually running 0741 * microtasks via a custom MicrotaskQueue class's PerformCheckpoint. In that 0742 * case, it is the embedder's responsibility to make this call at a time which 0743 * does not interrupt synchronous ECMAScript code execution. 0744 */ 0745 void ClearKeptObjects(); 0746 0747 /** 0748 * Custom callback used by embedders to help V8 determine if it should abort 0749 * when it throws and no internal handler is predicted to catch the 0750 * exception. If --abort-on-uncaught-exception is used on the command line, 0751 * then V8 will abort if either: 0752 * - no custom callback is set. 0753 * - the custom callback set returns true. 0754 * Otherwise, the custom callback will not be called and V8 will not abort. 0755 */ 0756 using AbortOnUncaughtExceptionCallback = bool (*)(Isolate*); 0757 void SetAbortOnUncaughtExceptionCallback( 0758 AbortOnUncaughtExceptionCallback callback); 0759 0760 /** 0761 * This specifies the callback called by the upcoming dynamic 0762 * import() language feature to load modules. 0763 */ 0764 void SetHostImportModuleDynamicallyCallback( 0765 HostImportModuleDynamicallyCallback callback); 0766 0767 /** 0768 * This specifies the callback called by the upcoming dynamic 0769 * import() and import.source() language feature to load modules. 0770 * 0771 * This API is experimental and is expected to be changed or removed in the 0772 * future. The callback is currently only called when for source-phase 0773 * imports. Evaluation-phase imports use the existing 0774 * HostImportModuleDynamicallyCallback callback. 0775 */ 0776 void SetHostImportModuleWithPhaseDynamicallyCallback( 0777 HostImportModuleWithPhaseDynamicallyCallback callback); 0778 0779 /** 0780 * This specifies the callback called by the upcoming import.meta 0781 * language feature to retrieve host-defined meta data for a module. 0782 */ 0783 void SetHostInitializeImportMetaObjectCallback( 0784 HostInitializeImportMetaObjectCallback callback); 0785 0786 /** 0787 * This specifies the callback called by the upcoming ShadowRealm 0788 * construction language feature to retrieve host created globals. 0789 */ 0790 void SetHostCreateShadowRealmContextCallback( 0791 HostCreateShadowRealmContextCallback callback); 0792 0793 /** 0794 * Set the callback that checks whether a Error.isError should return true for 0795 * a JSApiWrapper object, i.e. whether it represents a native JS error. For 0796 * example, in an HTML embedder, DOMExceptions are considered native errors. 0797 */ 0798 void SetIsJSApiWrapperNativeErrorCallback( 0799 IsJSApiWrapperNativeErrorCallback callback); 0800 0801 /** 0802 * This specifies the callback called when the stack property of Error 0803 * is accessed. 0804 */ 0805 void SetPrepareStackTraceCallback(PrepareStackTraceCallback callback); 0806 0807 /** 0808 * Get the stackTraceLimit property of Error. 0809 */ 0810 int GetStackTraceLimit(); 0811 0812 #if defined(V8_OS_WIN) 0813 /** 0814 * This specifies the callback called when an ETW tracing session starts. 0815 */ 0816 V8_DEPRECATE_SOON("Use SetFilterETWSessionByURL2Callback instead") 0817 void SetFilterETWSessionByURLCallback(FilterETWSessionByURLCallback callback); 0818 void SetFilterETWSessionByURL2Callback( 0819 FilterETWSessionByURL2Callback callback); 0820 #endif // V8_OS_WIN 0821 0822 /** 0823 * Optional notification that the system is running low on memory. 0824 * V8 uses these notifications to guide heuristics. 0825 * It is allowed to call this function from another thread while 0826 * the isolate is executing long running JavaScript code. 0827 */ 0828 void MemoryPressureNotification(MemoryPressureLevel level); 0829 0830 /** 0831 * Optional request from the embedder to tune v8 towards energy efficiency 0832 * rather than speed if `battery_saver_mode_enabled` is true, because the 0833 * embedder is in battery saver mode. If false, the correct tuning is left 0834 * to v8 to decide. 0835 */ 0836 void SetBatterySaverMode(bool battery_saver_mode_enabled); 0837 0838 /** 0839 * Optional request from the embedder to tune v8 towards memory efficiency 0840 * rather than speed if `memory_saver_mode_enabled` is true, because the 0841 * embedder is in memory saver mode. If false, the correct tuning is left 0842 * to v8 to decide. 0843 */ 0844 void SetMemorySaverMode(bool memory_saver_mode_enabled); 0845 0846 /** 0847 * Drop non-essential caches. Should only be called from testing code. 0848 * The method can potentially block for a long time and does not necessarily 0849 * trigger GC. 0850 */ 0851 void ClearCachesForTesting(); 0852 0853 /** 0854 * Methods below this point require holding a lock (using Locker) in 0855 * a multi-threaded environment. 0856 */ 0857 0858 /** 0859 * Sets this isolate as the entered one for the current thread. 0860 * Saves the previously entered one (if any), so that it can be 0861 * restored when exiting. Re-entering an isolate is allowed. 0862 */ 0863 void Enter(); 0864 0865 /** 0866 * Exits this isolate by restoring the previously entered one in the 0867 * current thread. The isolate may still stay the same, if it was 0868 * entered more than once. 0869 * 0870 * Requires: this == Isolate::GetCurrent(). 0871 */ 0872 void Exit(); 0873 0874 /** 0875 * Deinitializes and frees the isolate. The isolate must not be entered by any 0876 * thread to be disposable. 0877 */ 0878 void Dispose(); 0879 0880 /** 0881 * Deinitializes the isolate, but does not free the address. The isolate must 0882 * not be entered by any thread to be deinitializable. Embedders must call 0883 * Isolate::Free() to free the isolate afterwards. 0884 */ 0885 void Deinitialize(); 0886 0887 /** 0888 * Frees the memory allocated for the isolate. Can only be called after the 0889 * Isolate has already been deinitialized with Isolate::Deinitialize(). After 0890 * the isolate is freed, the next call to Isolate::New() or 0891 * Isolate::Allocate() might return the same address that just get freed. 0892 */ 0893 static void Free(Isolate* isolate); 0894 0895 /** 0896 * Dumps activated low-level V8 internal stats. This can be used instead 0897 * of performing a full isolate disposal. 0898 */ 0899 void DumpAndResetStats(); 0900 0901 /** 0902 * Discards all V8 thread-specific data for the Isolate. Should be used 0903 * if a thread is terminating and it has used an Isolate that will outlive 0904 * the thread -- all thread-specific data for an Isolate is discarded when 0905 * an Isolate is disposed so this call is pointless if an Isolate is about 0906 * to be Disposed. 0907 */ 0908 void DiscardThreadSpecificMetadata(); 0909 0910 /** 0911 * Associate embedder-specific data with the isolate. |slot| has to be 0912 * between 0 and GetNumberOfDataSlots() - 1. 0913 */ 0914 V8_INLINE void SetData(uint32_t slot, void* data); 0915 0916 /** 0917 * Retrieve embedder-specific data from the isolate. 0918 * Returns NULL if SetData has never been called for the given |slot|. 0919 */ 0920 V8_INLINE void* GetData(uint32_t slot); 0921 0922 /** 0923 * Returns the maximum number of available embedder data slots. Valid slots 0924 * are in the range of 0 - GetNumberOfDataSlots() - 1. 0925 */ 0926 V8_INLINE static uint32_t GetNumberOfDataSlots(); 0927 0928 /** 0929 * Return data that was previously attached to the isolate snapshot via 0930 * SnapshotCreator, and removes the reference to it. 0931 * Repeated call with the same index returns an empty MaybeLocal. 0932 */ 0933 template <class T> 0934 V8_INLINE MaybeLocal<T> GetDataFromSnapshotOnce(size_t index); 0935 0936 /** 0937 * Returns the value that was set or restored by 0938 * SetContinuationPreservedEmbedderData(), if any. 0939 */ 0940 Local<Value> GetContinuationPreservedEmbedderData(); 0941 0942 /** 0943 * Sets a value that will be stored on continuations and reset while the 0944 * continuation runs. 0945 */ 0946 void SetContinuationPreservedEmbedderData(Local<Value> data); 0947 0948 /** 0949 * Get statistics about the heap memory usage. 0950 */ 0951 void GetHeapStatistics(HeapStatistics* heap_statistics); 0952 0953 /** 0954 * Returns the number of spaces in the heap. 0955 */ 0956 size_t NumberOfHeapSpaces(); 0957 0958 /** 0959 * Get the memory usage of a space in the heap. 0960 * 0961 * \param space_statistics The HeapSpaceStatistics object to fill in 0962 * statistics. 0963 * \param index The index of the space to get statistics from, which ranges 0964 * from 0 to NumberOfHeapSpaces() - 1. 0965 * \returns true on success. 0966 */ 0967 bool GetHeapSpaceStatistics(HeapSpaceStatistics* space_statistics, 0968 size_t index); 0969 0970 /** 0971 * Returns the number of types of objects tracked in the heap at GC. 0972 */ 0973 size_t NumberOfTrackedHeapObjectTypes(); 0974 0975 /** 0976 * Get statistics about objects in the heap. 0977 * 0978 * \param object_statistics The HeapObjectStatistics object to fill in 0979 * statistics of objects of given type, which were live in the previous GC. 0980 * \param type_index The index of the type of object to fill details about, 0981 * which ranges from 0 to NumberOfTrackedHeapObjectTypes() - 1. 0982 * \returns true on success. 0983 */ 0984 bool GetHeapObjectStatisticsAtLastGC(HeapObjectStatistics* object_statistics, 0985 size_t type_index); 0986 0987 /** 0988 * Get statistics about code and its metadata in the heap. 0989 * 0990 * \param object_statistics The HeapCodeStatistics object to fill in 0991 * statistics of code, bytecode and their metadata. 0992 * \returns true on success. 0993 */ 0994 bool GetHeapCodeAndMetadataStatistics(HeapCodeStatistics* object_statistics); 0995 0996 /** 0997 * This API is experimental and may change significantly. 0998 * 0999 * Enqueues a memory measurement request and invokes the delegate with the 1000 * results. 1001 * 1002 * \param delegate the delegate that defines which contexts to measure and 1003 * reports the results. 1004 * 1005 * \param execution promptness executing the memory measurement. 1006 * The kEager value is expected to be used only in tests. 1007 */ 1008 bool MeasureMemory( 1009 std::unique_ptr<MeasureMemoryDelegate> delegate, 1010 MeasureMemoryExecution execution = MeasureMemoryExecution::kDefault); 1011 1012 /** 1013 * Get a call stack sample from the isolate. 1014 * \param state Execution state. 1015 * \param frames Caller allocated buffer to store stack frames. 1016 * \param frames_limit Maximum number of frames to capture. The buffer must 1017 * be large enough to hold the number of frames. 1018 * \param sample_info The sample info is filled up by the function 1019 * provides number of actual captured stack frames and 1020 * the current VM state. 1021 * \note GetStackSample should only be called when the JS thread is paused or 1022 * interrupted. Otherwise the behavior is undefined. 1023 */ 1024 void GetStackSample(const RegisterState& state, void** frames, 1025 size_t frames_limit, SampleInfo* sample_info); 1026 1027 /** 1028 * Adjusts the amount of registered external memory. 1029 * 1030 * \param change_in_bytes the change in externally allocated memory that is 1031 * kept alive by JavaScript objects. 1032 * \returns the adjusted value. 1033 */ 1034 V8_DEPRECATE_SOON("Use ExternalMemoryAccounter instead.") 1035 int64_t AdjustAmountOfExternalAllocatedMemory(int64_t change_in_bytes); 1036 1037 /** 1038 * Returns heap profiler for this isolate. Will return NULL until the isolate 1039 * is initialized. 1040 */ 1041 HeapProfiler* GetHeapProfiler(); 1042 1043 /** 1044 * Tells the VM whether the embedder is idle or not. 1045 */ 1046 void SetIdle(bool is_idle); 1047 1048 /** Returns the ArrayBuffer::Allocator used in this isolate. */ 1049 ArrayBuffer::Allocator* GetArrayBufferAllocator(); 1050 1051 /** Returns true if this isolate has a current context. */ 1052 bool InContext(); 1053 1054 /** 1055 * Returns the context of the currently running JavaScript, or the context 1056 * on the top of the stack if no JavaScript is running. 1057 */ 1058 Local<Context> GetCurrentContext(); 1059 1060 /** 1061 * Returns either the last context entered through V8's C++ API, or the 1062 * context of the currently running microtask while processing microtasks. 1063 * If a context is entered while executing a microtask, that context is 1064 * returned. 1065 */ 1066 Local<Context> GetEnteredOrMicrotaskContext(); 1067 1068 /** 1069 * Returns the Context that corresponds to the Incumbent realm in HTML spec. 1070 * https://html.spec.whatwg.org/multipage/webappapis.html#incumbent 1071 */ 1072 Local<Context> GetIncumbentContext(); 1073 1074 /** 1075 * Returns the host defined options set for currently running script or 1076 * module, if available. 1077 */ 1078 MaybeLocal<Data> GetCurrentHostDefinedOptions(); 1079 1080 /** 1081 * Schedules a v8::Exception::Error with the given message. 1082 * See ThrowException for more details. Templatized to provide compile-time 1083 * errors in case of too long strings (see v8::String::NewFromUtf8Literal). 1084 */ 1085 template <int N> 1086 Local<Value> ThrowError(const char (&message)[N]) { 1087 return ThrowError(String::NewFromUtf8Literal(this, message)); 1088 } 1089 Local<Value> ThrowError(Local<String> message); 1090 1091 /** 1092 * Schedules an exception to be thrown when returning to JavaScript. When an 1093 * exception has been scheduled it is illegal to invoke any JavaScript 1094 * operation; the caller must return immediately and only after the exception 1095 * has been handled does it become legal to invoke JavaScript operations. 1096 */ 1097 Local<Value> ThrowException(Local<Value> exception); 1098 1099 /** 1100 * Returns true if an exception was thrown but not processed yet by an 1101 * exception handler on JavaScript side or by v8::TryCatch handler. 1102 * 1103 * This is an experimental feature and may still change significantly. 1104 */ 1105 bool HasPendingException(); 1106 1107 using GCCallback = void (*)(Isolate* isolate, GCType type, 1108 GCCallbackFlags flags); 1109 using GCCallbackWithData = void (*)(Isolate* isolate, GCType type, 1110 GCCallbackFlags flags, void* data); 1111 1112 /** 1113 * Enables the host application to receive a notification before a 1114 * garbage collection. 1115 * 1116 * \param callback The callback to be invoked. The callback is allowed to 1117 * allocate but invocation is not re-entrant: a callback triggering 1118 * garbage collection will not be called again. JS execution is prohibited 1119 * from these callbacks. A single callback may only be registered once. 1120 * \param gc_type_filter A filter in case it should be applied. 1121 */ 1122 void AddGCPrologueCallback(GCCallback callback, 1123 GCType gc_type_filter = kGCTypeAll); 1124 1125 /** 1126 * \copydoc AddGCPrologueCallback(GCCallback, GCType) 1127 * 1128 * \param data Additional data that should be passed to the callback. 1129 */ 1130 void AddGCPrologueCallback(GCCallbackWithData callback, void* data = nullptr, 1131 GCType gc_type_filter = kGCTypeAll); 1132 1133 /** 1134 * This function removes a callback which was added by 1135 * `AddGCPrologueCallback`. 1136 * 1137 * \param callback the callback to remove. 1138 */ 1139 void RemoveGCPrologueCallback(GCCallback callback); 1140 1141 /** 1142 * \copydoc AddGCPrologueCallback(GCCallback) 1143 * 1144 * \param data Additional data that was used to install the callback. 1145 */ 1146 void RemoveGCPrologueCallback(GCCallbackWithData, void* data = nullptr); 1147 1148 /** 1149 * Enables the host application to receive a notification after a 1150 * garbage collection. 1151 * 1152 * \copydetails AddGCPrologueCallback(GCCallback, GCType) 1153 */ 1154 void AddGCEpilogueCallback(GCCallback callback, 1155 GCType gc_type_filter = kGCTypeAll); 1156 1157 /** 1158 * \copydoc AddGCEpilogueCallback(GCCallback, GCType) 1159 * 1160 * \param data Additional data that should be passed to the callback. 1161 */ 1162 void AddGCEpilogueCallback(GCCallbackWithData callback, void* data = nullptr, 1163 GCType gc_type_filter = kGCTypeAll); 1164 1165 /** 1166 * This function removes a callback which was added by 1167 * `AddGCEpilogueCallback`. 1168 * 1169 * \param callback the callback to remove. 1170 */ 1171 void RemoveGCEpilogueCallback(GCCallback callback); 1172 1173 /** 1174 * \copydoc RemoveGCEpilogueCallback(GCCallback) 1175 * 1176 * \param data Additional data that was used to install the callback. 1177 */ 1178 void RemoveGCEpilogueCallback(GCCallbackWithData callback, 1179 void* data = nullptr); 1180 1181 /** 1182 * Sets an embedder roots handle that V8 should consider when performing 1183 * non-unified heap garbage collections. The intended use case is for setting 1184 * a custom handler after invoking `AttachCppHeap()`. 1185 * 1186 * V8 does not take ownership of the handler. 1187 */ 1188 void SetEmbedderRootsHandler(EmbedderRootsHandler* handler); 1189 1190 using ReleaseCppHeapCallback = void (*)(std::unique_ptr<CppHeap>); 1191 1192 /** 1193 * Sets a callback on the isolate that gets called when the CppHeap gets 1194 * detached. The callback can then either take ownership of the CppHeap, or 1195 * the CppHeap gets deallocated. 1196 */ 1197 void SetReleaseCppHeapCallbackForTesting(ReleaseCppHeapCallback callback); 1198 1199 /** 1200 * \returns the C++ heap managed by V8. Only available if such a heap has been 1201 * attached using `AttachCppHeap()`. 1202 */ 1203 CppHeap* GetCppHeap() const; 1204 1205 using GetExternallyAllocatedMemoryInBytesCallback = size_t (*)(); 1206 1207 /** 1208 * Set the callback that tells V8 how much memory is currently allocated 1209 * externally of the V8 heap. Ideally this memory is somehow connected to V8 1210 * objects and may get freed-up when the corresponding V8 objects get 1211 * collected by a V8 garbage collection. 1212 */ 1213 void SetGetExternallyAllocatedMemoryInBytesCallback( 1214 GetExternallyAllocatedMemoryInBytesCallback callback); 1215 1216 /** 1217 * Forcefully terminate the current thread of JavaScript execution 1218 * in the given isolate. 1219 * 1220 * This method can be used by any thread even if that thread has not 1221 * acquired the V8 lock with a Locker object. 1222 */ 1223 void TerminateExecution(); 1224 1225 /** 1226 * Is V8 terminating JavaScript execution. 1227 * 1228 * Returns true if JavaScript execution is currently terminating 1229 * because of a call to TerminateExecution. In that case there are 1230 * still JavaScript frames on the stack and the termination 1231 * exception is still active. 1232 */ 1233 bool IsExecutionTerminating(); 1234 1235 /** 1236 * Resume execution capability in the given isolate, whose execution 1237 * was previously forcefully terminated using TerminateExecution(). 1238 * 1239 * When execution is forcefully terminated using TerminateExecution(), 1240 * the isolate can not resume execution until all JavaScript frames 1241 * have propagated the uncatchable exception which is generated. This 1242 * method allows the program embedding the engine to handle the 1243 * termination event and resume execution capability, even if 1244 * JavaScript frames remain on the stack. 1245 * 1246 * This method can be used by any thread even if that thread has not 1247 * acquired the V8 lock with a Locker object. 1248 */ 1249 void CancelTerminateExecution(); 1250 1251 /** 1252 * Request V8 to interrupt long running JavaScript code and invoke 1253 * the given |callback| passing the given |data| to it. After |callback| 1254 * returns control will be returned to the JavaScript code. 1255 * There may be a number of interrupt requests in flight. 1256 * Can be called from another thread without acquiring a |Locker|. 1257 * Registered |callback| must not reenter interrupted Isolate. 1258 */ 1259 void RequestInterrupt(InterruptCallback callback, void* data); 1260 1261 /** 1262 * Returns true if there is ongoing background work within V8 that will 1263 * eventually post a foreground task, like asynchronous WebAssembly 1264 * compilation. 1265 */ 1266 bool HasPendingBackgroundTasks(); 1267 1268 /** 1269 * Request garbage collection in this Isolate. It is only valid to call this 1270 * function if --expose_gc was specified. 1271 * 1272 * This should only be used for testing purposes and not to enforce a garbage 1273 * collection schedule. It has strong negative impact on the garbage 1274 * collection performance. Use MemoryPressureNotification() instead to 1275 * influence the garbage collection schedule. 1276 */ 1277 void RequestGarbageCollectionForTesting(GarbageCollectionType type); 1278 1279 /** 1280 * Request garbage collection with a specific embedderstack state in this 1281 * Isolate. It is only valid to call this function if --expose_gc was 1282 * specified. 1283 * 1284 * This should only be used for testing purposes and not to enforce a garbage 1285 * collection schedule. It has strong negative impact on the garbage 1286 * collection performance. Use MemoryPressureNotification() instead to 1287 * influence the garbage collection schedule. 1288 */ 1289 void RequestGarbageCollectionForTesting(GarbageCollectionType type, 1290 StackState stack_state); 1291 1292 /** 1293 * Set the callback to invoke for logging event. 1294 */ 1295 void SetEventLogger(LogEventCallback that); 1296 1297 /** 1298 * Adds a callback to notify the host application right before a script 1299 * is about to run. If a script re-enters the runtime during executing, the 1300 * BeforeCallEnteredCallback is invoked for each re-entrance. 1301 * Executing scripts inside the callback will re-trigger the callback. 1302 */ 1303 void AddBeforeCallEnteredCallback(BeforeCallEnteredCallback callback); 1304 1305 /** 1306 * Removes callback that was installed by AddBeforeCallEnteredCallback. 1307 */ 1308 void RemoveBeforeCallEnteredCallback(BeforeCallEnteredCallback callback); 1309 1310 /** 1311 * Adds a callback to notify the host application when a script finished 1312 * running. If a script re-enters the runtime during executing, the 1313 * CallCompletedCallback is only invoked when the outer-most script 1314 * execution ends. Executing scripts inside the callback do not trigger 1315 * further callbacks. 1316 */ 1317 void AddCallCompletedCallback(CallCompletedCallback callback); 1318 1319 /** 1320 * Removes callback that was installed by AddCallCompletedCallback. 1321 */ 1322 void RemoveCallCompletedCallback(CallCompletedCallback callback); 1323 1324 /** 1325 * Set the PromiseHook callback for various promise lifecycle 1326 * events. 1327 */ 1328 void SetPromiseHook(PromiseHook hook); 1329 1330 /** 1331 * Set callback to notify about promise reject with no handler, or 1332 * revocation of such a previous notification once the handler is added. 1333 */ 1334 void SetPromiseRejectCallback(PromiseRejectCallback callback); 1335 1336 /** 1337 * This is a part of experimental Api and might be changed without further 1338 * notice. 1339 * Do not use it. 1340 * 1341 * Set callback to notify about a new exception being thrown. 1342 */ 1343 void SetExceptionPropagationCallback(ExceptionPropagationCallback callback); 1344 1345 /** 1346 * Runs the default MicrotaskQueue until it gets empty and perform other 1347 * microtask checkpoint steps, such as calling ClearKeptObjects. Asserts that 1348 * the MicrotasksPolicy is not kScoped. Any exceptions thrown by microtask 1349 * callbacks are swallowed. 1350 */ 1351 void PerformMicrotaskCheckpoint(); 1352 1353 /** 1354 * Enqueues the callback to the default MicrotaskQueue 1355 */ 1356 void EnqueueMicrotask(Local<Function> microtask); 1357 1358 /** 1359 * Enqueues the callback to the default MicrotaskQueue 1360 */ 1361 void EnqueueMicrotask(MicrotaskCallback callback, void* data = nullptr); 1362 1363 /** 1364 * Controls how Microtasks are invoked. See MicrotasksPolicy for details. 1365 */ 1366 void SetMicrotasksPolicy(MicrotasksPolicy policy); 1367 1368 /** 1369 * Returns the policy controlling how Microtasks are invoked. 1370 */ 1371 MicrotasksPolicy GetMicrotasksPolicy() const; 1372 1373 /** 1374 * Adds a callback to notify the host application after 1375 * microtasks were run on the default MicrotaskQueue. The callback is 1376 * triggered by explicit RunMicrotasks call or automatic microtasks execution 1377 * (see SetMicrotaskPolicy). 1378 * 1379 * Callback will trigger even if microtasks were attempted to run, 1380 * but the microtasks queue was empty and no single microtask was actually 1381 * executed. 1382 * 1383 * Executing scripts inside the callback will not re-trigger microtasks and 1384 * the callback. 1385 */ 1386 void AddMicrotasksCompletedCallback( 1387 MicrotasksCompletedCallbackWithData callback, void* data = nullptr); 1388 1389 /** 1390 * Removes callback that was installed by AddMicrotasksCompletedCallback. 1391 */ 1392 void RemoveMicrotasksCompletedCallback( 1393 MicrotasksCompletedCallbackWithData callback, void* data = nullptr); 1394 1395 /** 1396 * Sets a callback for counting the number of times a feature of V8 is used. 1397 */ 1398 void SetUseCounterCallback(UseCounterCallback callback); 1399 1400 /** 1401 * Enables the host application to provide a mechanism for recording 1402 * statistics counters. 1403 */ 1404 void SetCounterFunction(CounterLookupCallback); 1405 1406 /** 1407 * Enables the host application to provide a mechanism for recording 1408 * histograms. The CreateHistogram function returns a 1409 * histogram which will later be passed to the AddHistogramSample 1410 * function. 1411 */ 1412 void SetCreateHistogramFunction(CreateHistogramCallback); 1413 void SetAddHistogramSampleFunction(AddHistogramSampleCallback); 1414 1415 /** 1416 * Enables the host application to provide a mechanism for recording 1417 * event based metrics. In order to use this interface 1418 * include/v8-metrics.h 1419 * needs to be included and the recorder needs to be derived from the 1420 * Recorder base class defined there. 1421 * This method can only be called once per isolate and must happen during 1422 * isolate initialization before background threads are spawned. 1423 */ 1424 void SetMetricsRecorder( 1425 const std::shared_ptr<metrics::Recorder>& metrics_recorder); 1426 1427 /** 1428 * Enables the host application to provide a mechanism for recording a 1429 * predefined set of data as crash keys to be used in postmortem debugging in 1430 * case of a crash. 1431 */ 1432 void SetAddCrashKeyCallback(AddCrashKeyCallback); 1433 1434 /** 1435 * Optional notification that the system is running low on memory. 1436 * V8 uses these notifications to attempt to free memory. 1437 */ 1438 void LowMemoryNotification(); 1439 1440 /** 1441 * Optional notification that a context has been disposed. V8 uses these 1442 * notifications to guide the GC heuristic and cancel FinalizationRegistry 1443 * cleanup tasks. Returns the number of context disposals - including this one 1444 * - since the last time V8 had a chance to clean up. 1445 * 1446 * The optional parameter |dependant_context| specifies whether the disposed 1447 * context was depending on state from other contexts or not. 1448 */ 1449 V8_DEPRECATE_SOON("Use version that passes ContextDependants.") 1450 int ContextDisposedNotification(bool dependant_context = true); 1451 1452 /** 1453 * Optional notification that a context has been disposed. V8 uses these 1454 * notifications to guide heuristics on e.g. GC or compilers. 1455 * 1456 * \param dependants A signal on whether this context possibly had any 1457 * dependants. 1458 */ 1459 void ContextDisposedNotification(ContextDependants dependants); 1460 1461 /** 1462 * Optional notification that the isolate switched to the foreground. 1463 * V8 uses these notifications to guide heuristics. 1464 */ 1465 V8_DEPRECATE_SOON("Use SetPriority(Priority::kUserBlocking) instead") 1466 void IsolateInForegroundNotification(); 1467 1468 /** 1469 * Optional notification that the isolate switched to the background. 1470 * V8 uses these notifications to guide heuristics. 1471 */ 1472 V8_DEPRECATE_SOON("Use SetPriority(Priority::kBestEffort) instead") 1473 void IsolateInBackgroundNotification(); 1474 1475 /** 1476 * Optional notification that the isolate changed `priority`. 1477 * V8 uses the priority value to guide heuristics. 1478 */ 1479 void SetPriority(Priority priority); 1480 1481 /** 1482 * Optional notification to tell V8 whether the embedder is currently loading 1483 * resources. If the embedder uses this notification, it should call 1484 * SetIsLoading(true) when loading starts and SetIsLoading(false) when it 1485 * ends. 1486 * It's valid to call SetIsLoading(true) again while loading, which will 1487 * update the timestamp when V8 considers the load started. Calling 1488 * SetIsLoading(false) while not loading does nothing. 1489 * V8 uses these notifications to guide heuristics. 1490 * This is an unfinished experimental feature. Semantics and implementation 1491 * may change frequently. 1492 */ 1493 void SetIsLoading(bool is_loading); 1494 1495 /** 1496 * Optional notification to tell V8 whether the embedder is currently frozen. 1497 * V8 uses these notifications to guide heuristics. 1498 * This is an unfinished experimental feature. Semantics and implementation 1499 * may change frequently. 1500 */ 1501 void Freeze(bool is_frozen); 1502 1503 /** 1504 * Optional notification to tell V8 the current isolate is used for debugging 1505 * and requires higher heap limit. 1506 */ 1507 void IncreaseHeapLimitForDebugging(); 1508 1509 /** 1510 * Restores the original heap limit after IncreaseHeapLimitForDebugging(). 1511 */ 1512 void RestoreOriginalHeapLimit(); 1513 1514 /** 1515 * Returns true if the heap limit was increased for debugging and the 1516 * original heap limit was not restored yet. 1517 */ 1518 bool IsHeapLimitIncreasedForDebugging(); 1519 1520 /** 1521 * Allows the host application to provide the address of a function that is 1522 * notified each time code is added, moved or removed. 1523 * 1524 * \param options options for the JIT code event handler. 1525 * \param event_handler the JIT code event handler, which will be invoked 1526 * each time code is added, moved or removed. 1527 * \note \p event_handler won't get notified of existent code. 1528 * \note since code removal notifications are not currently issued, the 1529 * \p event_handler may get notifications of code that overlaps earlier 1530 * code notifications. This happens when code areas are reused, and the 1531 * earlier overlapping code areas should therefore be discarded. 1532 * \note the events passed to \p event_handler and the strings they point to 1533 * are not guaranteed to live past each call. The \p event_handler must 1534 * copy strings and other parameters it needs to keep around. 1535 * \note the set of events declared in JitCodeEvent::EventType is expected to 1536 * grow over time, and the JitCodeEvent structure is expected to accrue 1537 * new members. The \p event_handler function must ignore event codes 1538 * it does not recognize to maintain future compatibility. 1539 * \note Use Isolate::CreateParams to get events for code executed during 1540 * Isolate setup. 1541 */ 1542 void SetJitCodeEventHandler(JitCodeEventOptions options, 1543 JitCodeEventHandler event_handler); 1544 1545 /** 1546 * Modifies the stack limit for this Isolate. 1547 * 1548 * \param stack_limit An address beyond which the Vm's stack may not grow. 1549 * 1550 * \note If you are using threads then you should hold the V8::Locker lock 1551 * while setting the stack limit and you must set a non-default stack 1552 * limit separately for each thread. 1553 */ 1554 void SetStackLimit(uintptr_t stack_limit); 1555 1556 /** 1557 * Returns a memory range that can potentially contain jitted code. Code for 1558 * V8's 'builtins' will not be in this range if embedded builtins is enabled. 1559 * 1560 * On Win64, embedders are advised to install function table callbacks for 1561 * these ranges, as default SEH won't be able to unwind through jitted code. 1562 * The first page of the code range is reserved for the embedder and is 1563 * committed, writable, and executable, to be used to store unwind data, as 1564 * documented in 1565 * https://docs.microsoft.com/en-us/cpp/build/exception-handling-x64. 1566 * 1567 * Might be empty on other platforms. 1568 * 1569 * https://code.google.com/p/v8/issues/detail?id=3598 1570 */ 1571 void GetCodeRange(void** start, size_t* length_in_bytes); 1572 1573 /** 1574 * As GetCodeRange, but for embedded builtins (these live in a distinct 1575 * memory region from other V8 Code objects). 1576 */ 1577 void GetEmbeddedCodeRange(const void** start, size_t* length_in_bytes); 1578 1579 /** 1580 * Returns the JSEntryStubs necessary for use with the Unwinder API. 1581 */ 1582 JSEntryStubs GetJSEntryStubs(); 1583 1584 static constexpr size_t kMinCodePagesBufferSize = 32; 1585 1586 /** 1587 * Copies the code heap pages currently in use by V8 into |code_pages_out|. 1588 * |code_pages_out| must have at least kMinCodePagesBufferSize capacity and 1589 * must be empty. 1590 * 1591 * Signal-safe, does not allocate, does not access the V8 heap. 1592 * No code on the stack can rely on pages that might be missing. 1593 * 1594 * Returns the number of pages available to be copied, which might be greater 1595 * than |capacity|. In this case, only |capacity| pages will be copied into 1596 * |code_pages_out|. The caller should provide a bigger buffer on the next 1597 * call in order to get all available code pages, but this is not required. 1598 */ 1599 size_t CopyCodePages(size_t capacity, MemoryRange* code_pages_out); 1600 1601 /** Set the callback to invoke in case of fatal errors. */ 1602 void SetFatalErrorHandler(FatalErrorCallback that); 1603 1604 /** Set the callback to invoke in case of OOM errors. */ 1605 void SetOOMErrorHandler(OOMErrorCallback that); 1606 1607 /** 1608 * Add a callback to invoke in case the heap size is close to the heap limit. 1609 * If multiple callbacks are added, only the most recently added callback is 1610 * invoked. 1611 */ 1612 void AddNearHeapLimitCallback(NearHeapLimitCallback callback, void* data); 1613 1614 /** 1615 * Remove the given callback and restore the heap limit to the 1616 * given limit. If the given limit is zero, then it is ignored. 1617 * If the current heap size is greater than the given limit, 1618 * then the heap limit is restored to the minimal limit that 1619 * is possible for the current heap size. 1620 */ 1621 void RemoveNearHeapLimitCallback(NearHeapLimitCallback callback, 1622 size_t heap_limit); 1623 1624 /** 1625 * If the heap limit was changed by the NearHeapLimitCallback, then the 1626 * initial heap limit will be restored once the heap size falls below the 1627 * given threshold percentage of the initial heap limit. 1628 * The threshold percentage is a number in (0.0, 1.0) range. 1629 */ 1630 void AutomaticallyRestoreInitialHeapLimit(double threshold_percent = 0.5); 1631 1632 /** 1633 * Set the callback to invoke to check if code generation from 1634 * strings should be allowed. 1635 */ 1636 void SetModifyCodeGenerationFromStringsCallback( 1637 ModifyCodeGenerationFromStringsCallback2 callback); 1638 1639 /** 1640 * Set the callback to invoke to check if wasm code generation should 1641 * be allowed. 1642 */ 1643 void SetAllowWasmCodeGenerationCallback( 1644 AllowWasmCodeGenerationCallback callback); 1645 1646 /** 1647 * Embedder over{ride|load} injection points for wasm APIs. The expectation 1648 * is that the embedder sets them at most once. 1649 */ 1650 void SetWasmModuleCallback(ExtensionCallback callback); 1651 void SetWasmInstanceCallback(ExtensionCallback callback); 1652 1653 void SetWasmStreamingCallback(WasmStreamingCallback callback); 1654 1655 void SetWasmAsyncResolvePromiseCallback( 1656 WasmAsyncResolvePromiseCallback callback); 1657 1658 void SetWasmLoadSourceMapCallback(WasmLoadSourceMapCallback callback); 1659 1660 void SetWasmImportedStringsEnabledCallback( 1661 WasmImportedStringsEnabledCallback callback); 1662 1663 void SetSharedArrayBufferConstructorEnabledCallback( 1664 SharedArrayBufferConstructorEnabledCallback callback); 1665 1666 void SetWasmJSPIEnabledCallback(WasmJSPIEnabledCallback callback); 1667 1668 /** 1669 * Register callback to control whether compile hints magic comments are 1670 * enabled. 1671 */ 1672 V8_DEPRECATED( 1673 "Will be removed, use ScriptCompiler::CompileOptions for enabling the " 1674 "compile hints magic comments") 1675 void SetJavaScriptCompileHintsMagicEnabledCallback( 1676 JavaScriptCompileHintsMagicEnabledCallback callback); 1677 1678 /** 1679 * This function can be called by the embedder to signal V8 that the dynamic 1680 * enabling of features has finished. V8 can now set up dynamically added 1681 * features. 1682 */ 1683 void InstallConditionalFeatures(Local<Context> context); 1684 1685 /** 1686 * Check if V8 is dead and therefore unusable. This is the case after 1687 * fatal errors such as out-of-memory situations. 1688 */ 1689 bool IsDead(); 1690 1691 /** 1692 * Adds a message listener (errors only). 1693 * 1694 * The same message listener can be added more than once and in that 1695 * case it will be called more than once for each message. 1696 * 1697 * If data is specified, it will be passed to the callback when it is called. 1698 * Otherwise, the exception object will be passed to the callback instead. 1699 */ 1700 bool AddMessageListener(MessageCallback that, 1701 Local<Value> data = Local<Value>()); 1702 1703 /** 1704 * Adds a message listener. 1705 * 1706 * The same message listener can be added more than once and in that 1707 * case it will be called more than once for each message. 1708 * 1709 * If data is specified, it will be passed to the callback when it is called. 1710 * Otherwise, the exception object will be passed to the callback instead. 1711 * 1712 * A listener can listen for particular error levels by providing a mask. 1713 */ 1714 bool AddMessageListenerWithErrorLevel(MessageCallback that, 1715 int message_levels, 1716 Local<Value> data = Local<Value>()); 1717 1718 /** 1719 * Remove all message listeners from the specified callback function. 1720 */ 1721 void RemoveMessageListeners(MessageCallback that); 1722 1723 /** Callback function for reporting failed access checks.*/ 1724 void SetFailedAccessCheckCallbackFunction(FailedAccessCheckCallback); 1725 1726 /** 1727 * Tells V8 to capture current stack trace when uncaught exception occurs 1728 * and report it to the message listeners. The option is off by default. 1729 */ 1730 void SetCaptureStackTraceForUncaughtExceptions( 1731 bool capture, int frame_limit = 10, 1732 StackTrace::StackTraceOptions options = StackTrace::kOverview); 1733 1734 /** 1735 * Check if this isolate is in use. 1736 * True if at least one thread Enter'ed this isolate. 1737 */ 1738 bool IsInUse(); 1739 1740 /** 1741 * Set whether calling Atomics.wait (a function that may block) is allowed in 1742 * this isolate. This can also be configured via 1743 * CreateParams::allow_atomics_wait. 1744 */ 1745 void SetAllowAtomicsWait(bool allow); 1746 1747 /** 1748 * Time zone redetection indicator for 1749 * DateTimeConfigurationChangeNotification. 1750 * 1751 * kSkip indicates V8 that the notification should not trigger redetecting 1752 * host time zone. kRedetect indicates V8 that host time zone should be 1753 * redetected, and used to set the default time zone. 1754 * 1755 * The host time zone detection may require file system access or similar 1756 * operations unlikely to be available inside a sandbox. If v8 is run inside a 1757 * sandbox, the host time zone has to be detected outside the sandbox before 1758 * calling DateTimeConfigurationChangeNotification function. 1759 */ 1760 enum class TimeZoneDetection { kSkip, kRedetect }; 1761 1762 /** 1763 * Notification that the embedder has changed the time zone, daylight savings 1764 * time or other date / time configuration parameters. V8 keeps a cache of 1765 * various values used for date / time computation. This notification will 1766 * reset those cached values for the current context so that date / time 1767 * configuration changes would be reflected. 1768 * 1769 * This API should not be called more than needed as it will negatively impact 1770 * the performance of date operations. 1771 */ 1772 void DateTimeConfigurationChangeNotification( 1773 TimeZoneDetection time_zone_detection = TimeZoneDetection::kSkip); 1774 1775 /** 1776 * Notification that the embedder has changed the locale. V8 keeps a cache of 1777 * various values used for locale computation. This notification will reset 1778 * those cached values for the current context so that locale configuration 1779 * changes would be reflected. 1780 * 1781 * This API should not be called more than needed as it will negatively impact 1782 * the performance of locale operations. 1783 */ 1784 void LocaleConfigurationChangeNotification(); 1785 1786 /** 1787 * Returns the default locale in a string if Intl support is enabled. 1788 * Otherwise returns an empty string. 1789 */ 1790 std::string GetDefaultLocale(); 1791 1792 /** 1793 * Returns the hash seed for that isolate, for testing purposes. 1794 */ 1795 uint64_t GetHashSeed(); 1796 1797 Isolate() = delete; 1798 ~Isolate() = delete; 1799 Isolate(const Isolate&) = delete; 1800 Isolate& operator=(const Isolate&) = delete; 1801 // Deleting operator new and delete here is allowed as ctor and dtor is also 1802 // deleted. 1803 void* operator new(size_t size) = delete; 1804 void* operator new[](size_t size) = delete; 1805 void operator delete(void*, size_t) = delete; 1806 void operator delete[](void*, size_t) = delete; 1807 1808 private: 1809 template <class K, class V, class Traits> 1810 friend class PersistentValueMapBase; 1811 friend class ExternalMemoryAccounter; 1812 1813 internal::ValueHelper::InternalRepresentationType GetDataFromSnapshotOnce( 1814 size_t index); 1815 int64_t AdjustAmountOfExternalAllocatedMemoryImpl(int64_t change_in_bytes); 1816 void HandleExternalMemoryInterrupt(); 1817 }; 1818 1819 void Isolate::SetData(uint32_t slot, void* data) { 1820 using I = internal::Internals; 1821 I::SetEmbedderData(this, slot, data); 1822 } 1823 1824 void* Isolate::GetData(uint32_t slot) { 1825 using I = internal::Internals; 1826 return I::GetEmbedderData(this, slot); 1827 } 1828 1829 uint32_t Isolate::GetNumberOfDataSlots() { 1830 using I = internal::Internals; 1831 return I::kNumIsolateDataSlots; 1832 } 1833 1834 template <class T> 1835 MaybeLocal<T> Isolate::GetDataFromSnapshotOnce(size_t index) { 1836 if (auto repr = GetDataFromSnapshotOnce(index); 1837 repr != internal::ValueHelper::kEmpty) { 1838 internal::PerformCastCheck(internal::ValueHelper::ReprAsValue<T>(repr)); 1839 return Local<T>::FromRepr(repr); 1840 } 1841 return {}; 1842 } 1843 1844 } // namespace v8 1845 1846 #endif // INCLUDE_V8_ISOLATE_H_
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|