144#if V8_ENABLE_WEBASSEMBLY
156#if V8_OS_LINUX || V8_OS_DARWIN || V8_OS_FREEBSD
160#if V8_ENABLE_WEBASSEMBLY
170#if defined(V8_OS_WIN64)
176#if defined(V8_ENABLE_ETW_STACK_WALKING)
194 script->host_defined_options(), i_isolate);
196 bool is_wasm =
false;
197#if V8_ENABLE_WEBASSEMBLY
198 is_wasm = script->type() == i::Script::Type::kWasm;
201 Utils::ToLocal(scriptName), script->line_offset(),
202 script->column_offset(), options.IsSharedCrossOrigin(), script->id(),
203 Utils::ToLocal(source_map_url), options.IsOpaque(), is_wasm,
204 options.IsModule(), Utils::ToLocal(host_defined_options));
212void i::V8::FatalProcessOutOfMemory(
i::Isolate* i_isolate,
const char* location,
213 const OOMDetails& details) {
216 if (i_isolate ==
nullptr) {
220 if (i_isolate ==
nullptr) {
224 memset(&heap_stats, 0xBADC0DE,
sizeof(heap_stats));
236 if (!
v8_flags.correctness_fuzzer_suppressions) {
238 if (first_newline ==
nullptr || first_newline[1] ==
'\0')
240 base::OS::PrintError(
"\n<--- Last few GCs --->\n%s\n", first_newline);
246 FATAL(
"API fatal error handler returned after process out of memory");
249void i::V8::FatalProcessOutOfMemory(
i::Isolate* i_isolate,
const char* location,
250 const char* detail) {
252 details.detail = detail;
253 FatalProcessOutOfMemory(i_isolate, location, details);
257 i::Isolate* i_isolate = i::Isolate::TryGetCurrent();
259 if (i_isolate !=
nullptr) {
260 callback = i_isolate->exception_behavior();
263 base::OS::PrintError(
"\n#\n# Fatal error in %s\n# %s\n#\n\n", location,
274 if (
auto oom_callback = i_isolate->oom_behavior()) {
275 oom_callback(location, details);
280 if (fatal_callback ==
nullptr) {
286 fatal_callback(location,
288 ?
"Allocation failed - JavaScript heap out of memory"
289 :
"Allocation failed - process out of memory");
296 i::V8::SetSnapshotBlob(snapshot_blob);
301#ifdef V8_ENABLE_SANDBOX
307 : sandbox_(group->sandbox()),
308 allocator_(group->GetSandboxedArrayBufferAllocator()) {}
310 void* Allocate(
size_t length)
override {
314 void* AllocateUninitialized(
size_t length)
override {
318 void Free(
void* data,
size_t length)
override {
323 return sandbox_->page_allocator();
327 i::Sandbox* sandbox_ =
nullptr;
328 i::SandboxedArrayBufferAllocator*
allocator_ =
nullptr;
337 void* AllocateUninitialized(
size_t length)
override {
352 const intptr_t* external_references,
355 :
impl_(new
i::SnapshotCreatorImpl(
356 reinterpret_cast<
i::
Isolate*>(v8_isolate), external_references,
357 existing_snapshot, owns_isolate)) {}
364 :
impl_(new
i::SnapshotCreatorImpl(params)) {}
368 :
impl_(new
i::SnapshotCreatorImpl(reinterpret_cast<
i::
Isolate*>(isolate),
388 context_data_serializer,
389 api_wrapper_serializer));
400 context_data_serializer,
401 api_wrapper_serializer));
418 DCHECK(i::Snapshot::VerifyChecksum(
this));
419 return i::Snapshot::ExtractRehashability(
this);
437 i::FlagList::SetFlagsFromString(str, length);
441 using HelpOptions = i::FlagList::HelpOptions;
442 i::FlagList::SetFlagsFromCommandLine(argc, argv, remove_flags,
443 HelpOptions(HelpOptions::kDontExit));
462 while (re !=
nullptr) {
474 ExtensionResource(
const char* data,
size_t length)
476 const char*
data()
const override {
return data_; }
478 void Dispose()
override {}
491 const char** deps,
int source_length)
495 : (source ? static_cast<int>(strlen(source)) : 0)),
496 dep_count_(dep_count),
498 auto_enable_(false) {
504 size_t initial_heap_size_in_bytes,
size_t maximum_heap_size_in_bytes) {
505 CHECK_LE(initial_heap_size_in_bytes, maximum_heap_size_in_bytes);
506 if (maximum_heap_size_in_bytes == 0) {
509 size_t young_generation, old_generation;
510 i::Heap::GenerationSizesFromHeapSize(maximum_heap_size_in_bytes,
511 &young_generation, &old_generation);
513 std::max(young_generation, i::Heap::MinYoungGenerationSize()));
515 std::max(old_generation, i::Heap::MinOldGenerationSize()));
516 if (initial_heap_size_in_bytes > 0) {
517 i::Heap::GenerationSizesFromHeapSize(initial_heap_size_in_bytes,
518 &young_generation, &old_generation);
530 uint64_t virtual_memory_limit) {
531 size_t heap_size = i::Heap::HeapSizeFromPhysicalMemory(physical_memory);
532 size_t young_generation, old_generation;
533 i::Heap::GenerationSizesFromHeapSize(heap_size, &young_generation,
541 static_cast<size_t>(virtual_memory_limit / 8)));
545#ifdef ENABLE_SLOW_DCHECKS
546namespace api_internal {
548 if (internal::StackAllocatedCheck::Get()) {
559 "SetNonEmpty() called with empty handle.");
567 ->
Create(value, slot, store_mode, reference_handling)
584#if V8_STATIC_ROOTS_BOOL
590 *InstanceTypeChecker::UniqueMapRangeOfInstanceTypeRange(FIRST_STRING_TYPE,
594#define EXPORTED_STATIC_ROOTS_PTR_MAPPING(V) \
595 V(UndefinedValue, i::StaticReadOnlyRoot::kUndefinedValue) \
596 V(NullValue, i::StaticReadOnlyRoot::kNullValue) \
597 V(TrueValue, i::StaticReadOnlyRoot::kTrueValue) \
598 V(FalseValue, i::StaticReadOnlyRoot::kFalseValue) \
599 V(EmptyString, i::StaticReadOnlyRoot::kempty_string) \
600 V(TheHoleValue, i::StaticReadOnlyRoot::kTheHoleValue) \
601 V(StringMapLowerBound, kStringMapRange.first) \
602 V(StringMapUpperBound, kStringMapRange.second)
604static_assert(std::is_same_v<Internals::Tagged_t, Tagged_t>);
606#define CHECK_STATIC_ROOT(name, value) \
607 static_assert(Internals::StaticReadOnlyRoot::k##name == value);
608EXPORTED_STATIC_ROOTS_PTR_MAPPING(CHECK_STATIC_ROOT)
609#undef CHECK_STATIC_ROOT
610#define PLUS_ONE(...) +1
611static constexpr int kNumberOfCheckedStaticRoots =
612 0 EXPORTED_STATIC_ROOTS_PTR_MAPPING(
PLUS_ONE);
613#undef EXPORTED_STATIC_ROOTS_PTR_MAPPING
614static_assert(Internals::StaticReadOnlyRoot::kNumberOfExportedStaticRoots ==
615 kNumberOfCheckedStaticRoots);
621namespace api_internal {
641 i::GlobalHandles::MoveGlobal(from, to);
647 i::GlobalHandles::MakeWeak(location, parameter, weak_callback, type);
651 i::GlobalHandles::MakeWeak(location_addr);
655 return i::GlobalHandles::ClearWeakness(location);
659 i::GlobalHandles::AnnotateStrongRetainer(location,
label);
663 i::GlobalHandles::Destroy(location);
684 "WeakCallbackInfo::GetInternalField",
685 "Internal field out of bounds");
704 "HandleScope::HandleScope",
705 "Entering the V8 API without proper locking in place");
711#ifdef V8_ENABLE_CHECKS
712 scope_level_ = current->level;
717#ifdef V8_ENABLE_CHECKS
729 return i::HandleScope::NumberOfHandles(
734 return i::HandleScope::CreateHandle(i_isolate, value);
737#ifdef V8_ENABLE_DIRECT_HANDLE
740 i::Isolate* i_isolate = i::Isolate::Current();
741 return i::HandleScope::CreateHandle(i_isolate, value);
762 : i_isolate_(reinterpret_cast<
i::
Isolate*>(v8_isolate)) {
765 current->limit = current->next;
767 current->sealed_level = current->level;
772 DCHECK_EQ(current->next, current->limit);
774 DCHECK_EQ(current->level, current->sealed_level);
795 DCHECK(!IsTheHole(heap_object));
796 if (i::IsSymbol(heap_object)) {
799 return IsPrimitiveHeapObject(heap_object) || IsJSReceiver(heap_object);
824 impl->EnterContext(env);
825 impl->SaveContext(i_isolate->
context());
834 if (!
Utils::ApiCheck(impl->LastEnteredContextWas(*env),
"v8::Context::Exit()",
835 "Cannot exit non-entered context")) {
838 impl->LeaveContext();
844 : backup_incumbent_context_(backup_incumbent_context) {
851 i::SimulatorStack::RegisterJSStackComparableAddress(i_isolate);
864 i::SimulatorStack::UnregisterJSStackComparableAddress(i_isolate);
870static_assert(i::Internals::kEmbedderDataSlotExternalPointerOffset ==
871 i::EmbedderDataSlot::kExternalPointerOffset);
874 Context* context,
int index,
bool can_grow,
const char* location) {
879 "Not a native context") &&
886 if (!
Utils::ApiCheck(can_grow && index < i::EmbedderDataArray::kMaxLength,
887 location,
"Index too large")) {
890 data = i::EmbedderDataArray::EnsureCapacity(i_isolate, data, index);
891 env->set_embedder_data(*data);
899 "Context::GetNumberOfEmbedderDataFields",
900 "Not a native context");
902 return static_cast<uint32_t
>(
907 const char* location =
"v8::Context::GetEmbedderData()";
917 const char* location =
"v8::Context::SetEmbedderData()";
920 if (data.is_null())
return;
922 i::EmbedderDataSlot::store_tagged(*data, index, *val);
928 const char* location =
"v8::Context::GetAlignedPointerFromEmbedderData()";
933 if (data.is_null())
return nullptr;
937 location,
"Pointer is not aligned");
942 const char* location =
"v8::Context::SetAlignedPointerInEmbedderData()";
957 i::Isolate* i_isolate = templ->GetIsolateChecked();
962 Utils::ApiCheck(!IsJSReceiver(*value_obj) || IsTemplateInfo(*value_obj),
964 "Invalid value, must be a primitive or a Template");
969 if (i::IsObjectTemplateInfo(*value_obj)) {
970 templ->set_is_cacheable(
false);
973 i::ApiNatives::AddDataProperty(i_isolate, templ,
988 auto i_isolate = templ->GetIsolateChecked();
993 "v8::Template::SetAccessorProperty",
994 "Getter must have a call handler");
1000 "v8::Template::SetAccessorProperty",
1001 "Setter must have a call handler");
1007 i::ApiNatives::AddAccessorProperty(
1016 i::Isolate* i_isolate = self->GetIsolateChecked();
1020 if (i::IsUndefined(*heap_obj, i_isolate)) {
1022 constexpr bool do_not_cache =
true;
1025 i::FunctionTemplateInfo::SetPrototypeTemplate(i_isolate, self,
1027 return Utils::ToLocal(proto_template);
1035 i::Isolate* i_isolate = self->GetIsolateChecked();
1039 Utils::ApiCheck(i::IsUndefined(self->GetPrototypeTemplate(), i_isolate),
1040 "v8::FunctionTemplate::SetPrototypeProviderTemplate",
1041 "Protoype must be undefined");
1043 "v8::FunctionTemplate::SetPrototypeProviderTemplate",
1044 "Prototype provider must be empty");
1045 i::FunctionTemplateInfo::SetPrototypeProviderTemplate(i_isolate, self,
1054 "FunctionTemplate already instantiated");
1063 const MemorySpan<const CFunction>& c_function_overloads = {}) {
1073 if (!cached_property_name.IsEmpty()) {
1074 raw->set_cached_property_name(
1078 raw->set_remove_prototype(
true);
1082 Utils::ToLocal(obj)->SetCallHandler(
callback, data, side_effect_type,
1083 c_function_overloads);
1091 EnsureNotPublished(info,
"v8::FunctionTemplate::Inherit");
1092 i::Isolate* i_isolate = info->GetIsolateChecked();
1095 i::IsUndefined(info->GetPrototypeProviderTemplate(), i_isolate),
1096 "v8::FunctionTemplate::Inherit",
"Protoype provider must be empty");
1097 i::FunctionTemplateInfo::SetParentTemplate(i_isolate, info,
1105 uint16_t instance_type, uint16_t allowed_receiver_instance_type_range_start,
1106 uint16_t allowed_receiver_instance_type_range_end) {
1114 "FunctionTemplate::New",
1115 "Fast API calls are not supported for constructor functions")) {
1121 i_isolate,
callback, data, signature, length, behavior,
false,
1126 if (instance_type) {
1129 i::Internals::kFirstEmbedderJSApiObjectType,
1130 i::Internals::kLastEmbedderJSApiObjectType),
1131 "FunctionTemplate::New",
1132 "instance_type is outside the range of valid JSApiObject types")) {
1135 templ->SetInstanceType(instance_type);
1138 if (allowed_receiver_instance_type_range_start ||
1139 allowed_receiver_instance_type_range_end) {
1141 allowed_receiver_instance_type_range_start &&
1142 allowed_receiver_instance_type_range_start <=
1143 allowed_receiver_instance_type_range_end &&
1144 allowed_receiver_instance_type_range_end <=
1145 i::Internals::kLastEmbedderJSApiObjectType,
1146 "FunctionTemplate::New",
1147 "allowed receiver instance type range is outside the "
1148 "range of valid JSApiObject types")) {
1151 templ->SetAllowedReceiverInstanceTypeRange(
1152 allowed_receiver_instance_type_range_start,
1153 allowed_receiver_instance_type_range_end);
1155 return Utils::ToLocal(templ);
1169 for (
size_t i = 0;
i < c_function_overloads.
size(); ++
i) {
1170 for (
size_t j =
i + 1; j < c_function_overloads.
size(); ++j) {
1172 c_function_overloads.
data()[j].ArgumentCount());
1177 c_function_overloads.
empty() ||
1179 "FunctionTemplate::NewWithCFunctionOverloads",
1180 "Fast API calls are not supported for constructor functions")) {
1186 i_isolate,
callback, data, signature, length, behavior,
false,
1188 return Utils::ToLocal(templ);
1200 false, cache_property, side_effect_type);
1201 return Utils::ToLocal(templ);
1209#define SET_FIELD_WRAPPED(i_isolate, obj, setter, cdata, tag) \
1211 i::DirectHandle<i::UnionOf<i::Smi, i::Foreign>> foreign = \
1212 FromCData<tag>(i_isolate, cdata); \
1213 (obj)->setter(*foreign); \
1221 EnsureNotPublished(info,
"v8::FunctionTemplate::SetCallHandler");
1222 i::Isolate* i_isolate = info->GetIsolateChecked();
1225 info->set_has_side_effects(side_effect_type !=
1228 if (data.IsEmpty()) {
1234 if (!c_function_overloads.
empty()) {
1239 c_function_overloads.
size() *
1240 i::FunctionTemplateInfo::kFunctionOverloadEntrySize));
1241 int function_count =
static_cast<int>(c_function_overloads.
size());
1242 for (
int i = 0;
i < function_count;
i++) {
1246 function_overloads->set(
1247 i::FunctionTemplateInfo::kFunctionOverloadEntrySize *
i, *address);
1251 function_overloads->set(
1252 i::FunctionTemplateInfo::kFunctionOverloadEntrySize *
i + 1,
1255 i::FunctionTemplateInfo::SetCFunctionOverloads(i_isolate, info,
1256 function_overloads);
1262template <
typename Getter,
typename Setter>
1267 bool replace_on_access) {
1273 setter =
reinterpret_cast<Setter
>(&i::Accessors::ReconfigureToDataProperty);
1278 if (!IsUniqueName(*accessor_name)) {
1284 if (data.IsEmpty()) {
1289 raw_obj->set_name(*accessor_name);
1290 raw_obj->set_replace_on_access(replace_on_access);
1291 raw_obj->set_initial_property_attributes(
i::NONE);
1300 "v8::FunctionTemplate::InstanceTemplate()",
1301 "Reading from empty handle")) {
1304 i::Isolate* i_isolate = constructor->GetIsolateChecked();
1306 auto maybe_templ = constructor->GetInstanceTemplate();
1307 if (!i::IsUndefined(maybe_templ, i_isolate)) {
1311 constexpr bool do_not_cache =
false;
1314 i::FunctionTemplateInfo::SetInstanceTemplate(i_isolate, constructor, templ);
1315 return Utils::ToLocal(templ);
1320 EnsureNotPublished(info,
"v8::FunctionTemplate::SetLength");
1321 i::Isolate* i_isolate = info->GetIsolateChecked();
1323 info->set_length(length);
1328 EnsureNotPublished(info,
"v8::FunctionTemplate::SetClassName");
1329 i::Isolate* i_isolate = info->GetIsolateChecked();
1336 EnsureNotPublished(info,
"v8::FunctionTemplate::SetInterfaceName");
1337 i::Isolate* i_isolate = info->GetIsolateChecked();
1344 EnsureNotPublished(info,
"v8::FunctionTemplate::SetExceptionContext");
1345 i::Isolate* i_isolate = info->GetIsolateChecked();
1347 info->set_exception_context(
static_cast<uint32_t
>(context));
1352 EnsureNotPublished(info,
"v8::FunctionTemplate::SetAcceptAnyReceiver");
1353 i::Isolate* i_isolate = info->GetIsolateChecked();
1355 info->set_accept_any_receiver(value);
1360 EnsureNotPublished(info,
"v8::FunctionTemplate::ReadOnlyPrototype");
1361 i::Isolate* i_isolate = info->GetIsolateChecked();
1363 info->set_read_only_prototype(
true);
1368 EnsureNotPublished(info,
"v8::FunctionTemplate::RemovePrototype");
1369 i::Isolate* i_isolate = info->GetIsolateChecked();
1371 info->set_remove_prototype(
true);
1378 auto i_isolate =
reinterpret_cast<i::Isolate*
>(v8_isolate);
1381 constexpr bool do_not_cache =
false;
1385 return Utils::ToLocal(obj);
1395 if (!IsUndefined(obj, i_isolate)) {
1400 Local<FunctionTemplate> templ =
1403 i::FunctionTemplateInfo::SetInstanceTemplate(
1409template <
typename Getter,
typename Setter,
typename Data,
typename Template>
1416 auto i_isolate = info->GetIsolateChecked();
1420 i_isolate, name,
getter,
setter, data, replace_on_access);
1424 raw->set_initial_property_attributes(
1426 raw->set_getter_side_effect_type(getter_side_effect_type);
1427 raw->set_setter_side_effect_type(setter_side_effect_type);
1429 i::ApiNatives::AddNativeDataProperty(i_isolate, info, accessor_info);
1440 TemplateSetAccessor(
this, name,
getter,
setter, data, attribute,
false,
1441 getter_side_effect_type, setter_side_effect_type);
1450 TemplateSetAccessor(
1452 data, attribute,
true, getter_side_effect_type, setter_side_effect_type);
1458 i::Isolate* i_isolate = templ->GetIsolateChecked();
1461 i::ApiNatives::AddDataProperty(i_isolate, templ,
1467enum class PropertyType { kNamed, kIndexed };
1468template <PropertyType property_type,
typename Getter,
typename Setter,
1469 typename Query,
typename Descriptor,
typename Deleter,
1470 typename Enumerator,
typename Definer>
1473 Descriptor descriptor, Deleter deleter, Enumerator enumerator,
1474 Definer definer, Local<Value> data,
1475 base::Flags<PropertyHandlerFlags> flags) {
1481 obj->set_is_named(property_type == PropertyType::kNamed);
1483#define SET_CALLBACK_FIELD(Name, name) \
1484 if (name != nullptr) { \
1485 if constexpr (property_type == PropertyType::kNamed) { \
1486 obj->set_named_##name(i_isolate, reinterpret_cast<i::Address>(name)); \
1488 obj->set_indexed_##name(i_isolate, reinterpret_cast<i::Address>(name)); \
1492#undef SET_CALLBACK_FIELD
1494 obj->set_can_intercept_symbols(
1499 if (data.IsEmpty()) {
1506template <
typename Getter,
typename Setter,
typename Query,
typename Descriptor,
1507 typename Deleter,
typename Enumerator,
typename Definer>
1510 Descriptor descriptor, Deleter remover, Enumerator enumerator,
1511 Definer definer, Local<Value> data,
1512 base::Flags<PropertyHandlerFlags> flags) {
1513 auto interceptor = CreateInterceptorInfo<PropertyType::kNamed>(
1514 i_isolate,
getter,
setter, query, descriptor, remover, enumerator,
1515 definer, data, flags);
1519template <
typename Getter,
typename Setter,
typename Query,
typename Descriptor,
1520 typename Deleter,
typename Enumerator,
typename Definer>
1523 Descriptor descriptor, Deleter remover, Enumerator enumerator,
1524 Definer definer, Local<Value> data,
1525 base::Flags<PropertyHandlerFlags> flags) {
1526 auto interceptor = CreateInterceptorInfo<PropertyType::kIndexed>(
1527 i_isolate,
getter,
setter, query, descriptor, remover, enumerator,
1528 definer, data, flags);
1532template <
typename Getter,
typename Setter,
typename Query,
typename Descriptor,
1533 typename Deleter,
typename Enumerator,
typename Definer>
1534void ObjectTemplateSetNamedPropertyHandler(
1535 ObjectTemplate* templ, Getter
getter, Setter
setter, Query query,
1536 Descriptor descriptor, Deleter remover, Enumerator enumerator,
1541 auto cons = EnsureConstructor(i_isolate, templ);
1542 EnsureNotPublished(cons,
"ObjectTemplateSetNamedPropertyHandler");
1544 CreateNamedInterceptorInfo(i_isolate,
getter,
setter, query, descriptor,
1545 remover, enumerator, definer, data, flags);
1546 i::FunctionTemplateInfo::SetNamedPropertyHandler(i_isolate, cons, obj);
1552 ObjectTemplateSetNamedPropertyHandler(
1562 auto cons = EnsureConstructor(i_isolate,
this);
1563 EnsureNotPublished(cons,
"v8::ObjectTemplate::MarkAsUndetectable");
1564 cons->set_undetectable(
true);
1572 auto cons = EnsureConstructor(i_isolate,
this);
1573 EnsureNotPublished(cons,
"v8::ObjectTemplate::SetAccessCheckCallback");
1576 i::ACCESS_CHECK_INFO_TYPE, i::AllocationType::kOld);
1581 info->set_named_interceptor(i::Smi::zero());
1582 info->set_indexed_interceptor(i::Smi::zero());
1584 if (data.IsEmpty()) {
1589 i::FunctionTemplateInfo::SetAccessCheckInfo(i_isolate, cons, info);
1590 cons->set_needs_access_check(
true);
1601 auto cons = EnsureConstructor(i_isolate,
this);
1602 EnsureNotPublished(cons,
1603 "v8::ObjectTemplate::SetAccessCheckCallbackWithHandler");
1606 i::ACCESS_CHECK_INFO_TYPE, i::AllocationType::kOld);
1611 auto named_interceptor = CreateNamedInterceptorInfo(
1615 named_handler.
flags);
1616 info->set_named_interceptor(*named_interceptor);
1617 auto indexed_interceptor = CreateIndexedInterceptorInfo(
1618 i_isolate, indexed_handler.
getter, indexed_handler.
setter,
1622 info->set_indexed_interceptor(*indexed_interceptor);
1624 if (data.IsEmpty()) {
1629 i::FunctionTemplateInfo::SetAccessCheckInfo(i_isolate, cons, info);
1630 cons->set_needs_access_check(
true);
1638 auto cons = EnsureConstructor(i_isolate,
this);
1639 EnsureNotPublished(cons,
"v8::ObjectTemplate::SetHandler");
1640 auto obj = CreateIndexedInterceptorInfo(
1644 i::FunctionTemplateInfo::SetIndexedPropertyHandler(i_isolate, cons, obj);
1652 auto cons = EnsureConstructor(i_isolate,
this);
1653 EnsureNotPublished(cons,
"v8::ObjectTemplate::SetCallAsFunctionHandler");
1658 constexpr bool do_not_cache =
true;
1659 constexpr int length = 0;
1662 templ->set_is_object_template_call_handler(
true);
1663 Utils::ToLocal(templ)->SetCallHandler(
callback, data);
1664 i::FunctionTemplateInfo::SetInstanceCallHandler(i_isolate, cons, templ);
1674 "v8::ObjectTemplate::SetInternalFieldCount()",
1675 "Invalid embedder field count")) {
1683 EnsureConstructor(i_isolate,
this);
1696 self->set_immutable_proto(
true);
1707 self->set_code_like(
true);
1715 return Utils::ToLocal(i::DictionaryTemplateInfo::Create(i_isolate, names));
1738 buffer_policy(buffer_policy_) {}
1741 if (buffer_policy == BufferOwned) {
1752 i::SerializedCodeData::FromCachedDataWithoutSource(
1759 std::unique_ptr<ExternalSourceStream> stream,
Encoding encoding)
1760 :
impl_(new
i::ScriptStreamingData(
std::move(stream), encoding)) {}
1767 DCHECK(!i::HeapLayout::InReadOnlySpace(*function_info));
1771 i::Factory::JSFunctionBuilder{i_isolate, function_info,
1780 DCHECK(!i::HeapLayout::InReadOnlySpace(*function_info));
1788 if (i::IsScript(obj->script())) {
1791 DCHECK(!i::HeapLayout::InReadOnlySpace(*obj));
1797 return i::Script::GetLineNumber(script, code_pos);
1805 if (i::IsScript(obj->script())) {
1808 DCHECK(!i::HeapLayout::InReadOnlySpace(*obj));
1814 return i::Script::GetColumnNumber(script, code_pos);
1822 if (i::IsScript(obj->script())) {
1825 DCHECK(!i::HeapLayout::InReadOnlySpace(*obj));
1838 if (i::IsScript(obj->script())) {
1841 DCHECK(!i::HeapLayout::InReadOnlySpace(*obj));
1854 if (i::IsScript(obj->script())) {
1857 DCHECK(!i::HeapLayout::InReadOnlySpace(*obj));
1871 if (i::IsScript(obj->script())) {
1874 DCHECK(!i::HeapLayout::InReadOnlySpace(*obj));
1887 if (i::IsScript(obj->script())) {
1890 DCHECK(!i::HeapLayout::InReadOnlySpace(*obj));
1908 auto v8_isolate = context->GetIsolate();
1909 auto i_isolate =
reinterpret_cast<i::Isolate*
>(v8_isolate);
1916 i_isolate->
counters()->compile_lazy());
1918#if defined(V8_ENABLE_ETW_STACK_WALKING)
1929 i::ETWJITInterface::MaybeSetHandlerNow(i_isolate);
1940 i::Execution::CallScript(i_isolate, fun,
receiver, options), &
result);
1965 DCHECK(!i::HeapLayout::InReadOnlySpace(*sfi));
1973 CHECK(IsScript(sfi->script()));
1984 CHECK(IsScript(sfi->script()));
1987 script->compiled_lazy_function_positions();
1989 if (!IsUndefined(maybe_array_list, i_isolate)) {
1992 result.reserve(array_list->length());
1993 for (
int i = 0;
i < array_list->length(); ++
i) {
1996 result.push_back(i::Smi::ToInt(item));
2007 CHECK(IsScript(sfi->script()));
2019 script->compiled_lazy_function_positions();
2021 if (!IsUndefined(maybe_array_list, i_isolate)) {
2024 result.reserve(array_list->length());
2025 for (
int i = 0;
i < array_list->length(); ++
i) {
2028 result.push_back(i::Smi::ToInt(item));
2039 "length must be equal or greater than zero");
2055 "v8::PrimitiveArray::Set",
2056 "index must be greater than or equal to 0 and less than the "
2066 "v8::PrimitiveArray::Get",
2067 "index must be greater than or equal to 0 and less than the "
2075 i::IsFixedArray(*obj),
"v8::PrimitiveArray::Cast",
2076 "Value is not a PrimitiveArray; this is a temporary issue, v8::Data and "
2077 "v8::PrimitiveArray will not be compatible in the future");
2086 auto i_isolate =
reinterpret_cast<i::Isolate*
>(context->GetIsolate());
2099 return self->phase();
2115 switch (self->status()) {
2116 case i::Module::kUnlinked:
2117 case i::Module::kPreLinking:
2118 return kUninstantiated;
2119 case i::Module::kLinking:
2120 return kInstantiating;
2121 case i::Module::kLinked:
2122 return kInstantiated;
2123 case i::Module::kEvaluating:
2125 case i::Module::kEvaluatingAsync:
2127 case i::Module::kEvaluated:
2129 case i::Module::kErrored:
2137 "Module status must be kErrored");
2148 if (i::IsSyntheticModule(*self)) {
2165 i::IsSourceTextModule(*self),
"v8::Module::SourceOffsetToLocation",
2166 "v8::Module::SourceOffsetToLocation must be used on an SourceTextModule");
2169 i::Script::PositionInfo
info;
2170 i::Script::GetPositionInfo(script,
offset, &info);
2176 GetStatus() >= kInstantiated,
"v8::Module::GetModuleNamespace",
2177 "v8::Module::GetModuleNamespace must be used on an instantiated module");
2179 auto i_isolate = self->GetIsolate();
2182 i::Module::GetModuleNamespace(i_isolate, self);
2189 i::IsSourceTextModule(*self),
"v8::Module::GetUnboundModuleScript",
2190 "v8::Module::GetUnboundModuleScript must be used on an SourceTextModule");
2191 auto i_isolate = self->GetIsolate();
2200 "v8::Module::ScriptId must be used on an SourceTextModule");
2207 if (!i::IsSourceTextModule(self))
return false;
2213 GetStatus() >= kInstantiated,
"v8::Module::IsGraphAsync",
2214 "v8::Module::IsGraphAsync must be used on an instantiated module");
2216 auto i_isolate = self->GetIsolate();
2218 return self->IsGraphAsync(i_isolate);
2224 return i::IsSourceTextModule(*self);
2230 return i::IsSyntheticModule(*self);
2236 return self->hash();
2242 auto i_isolate =
reinterpret_cast<i::Isolate*
>(context->GetIsolate());
2246 module_callback, source_callback);
2252 auto i_isolate =
reinterpret_cast<i::Isolate*
>(context->GetIsolate());
2259 i_isolate->
counters()->compile_lazy());
2262 Utils::ApiCheck(self->status() >= i::Module::kLinked,
"Module::Evaluate",
2263 "Expected instantiated module");
2266 has_exception = !
ToLocal(i::Module::Evaluate(i_isolate, self), &
result);
2275 auto i_isolate =
reinterpret_cast<i::Isolate*
>(v8_isolate);
2280 static_cast<int>(export_names.size()));
2281 for (
int i = 0;
i < i_export_names->length(); ++
i) {
2284 i_export_names->set(
i, *str);
2286 return v8::Utils::ToLocal(
2288 i_module_name, i_export_names, evaluation_steps)));
2294 auto i_isolate =
reinterpret_cast<i::Isolate*
>(v8_isolate);
2299 "v8::Module::SyntheticModuleSetExport",
2300 "v8::Module::SyntheticModuleSetExport must only be called on "
2301 "a SyntheticModule");
2304 has_exception = i::SyntheticModule::SetExport(
2306 i_export_name, i_export_value)
2317 "v8::Module::GetStalledTopLevelAwaitMessages",
2318 "v8::Module::GetStalledTopLevelAwaitMessages must only be "
2319 "called on a SourceTextModule");
2320 std::pair<i::DirectHandleVector<i::SourceTextModule>,
2327 if (
size_t stalled_awaits_count = stalled_awaits.first.size();
2328 stalled_awaits_count > 0) {
2329 modules.reserve(stalled_awaits_count);
2330 for (
auto module : stalled_awaits.first)
2334 if (
size_t stalled_awaits_count = stalled_awaits.second.size();
2335 stalled_awaits_count > 0) {
2336 messages.reserve(stalled_awaits_count);
2337 for (
auto message : stalled_awaits.second)
2341 return {modules, messages};
2348 int resource_column_offset,
Local<Value> source_map_url,
2352 script_details.line_offset = resource_line_offset;
2353 script_details.column_offset = resource_column_offset;
2354 script_details.host_defined_options =
2355 host_defined_options.
IsEmpty()
2356 ? i_isolate->
factory()->empty_fixed_array()
2358 if (!source_map_url.
IsEmpty()) {
2361 return script_details;
2369 auto i_isolate =
reinterpret_cast<i::Isolate*
>(v8_isolate);
2379 i_isolate, source->resource_name, source->resource_line_offset,
2380 source->resource_column_offset, source->source_map_url,
2381 source->host_defined_options, source->resource_options);
2385 if (source->consume_cache_task) {
2389 std::unique_ptr<i::BackgroundDeserializeTask> deserialize_task =
2390 std::move(source->consume_cache_task->impl_);
2391 maybe_function_info =
2392 i::Compiler::GetSharedFunctionInfoForScriptWithDeserializeTask(
2393 i_isolate, str, script_details, deserialize_task.get(), options,
2395 &source->compilation_details);
2396 source->cached_data->rejected = deserialize_task->rejected();
2398 DCHECK(source->cached_data);
2400 auto cached_data = std::make_unique<i::AlignedCachedData>(
2401 source->cached_data->data, source->cached_data->length);
2402 maybe_function_info =
2403 i::Compiler::GetSharedFunctionInfoForScriptWithCachedData(
2404 i_isolate, str, script_details, cached_data.get(), options,
2406 &source->compilation_details);
2407 source->cached_data->rejected = cached_data->rejected();
2410 maybe_function_info =
2411 i::Compiler::GetSharedFunctionInfoForScriptWithCompileHints(
2412 i_isolate, str, script_details, source->compile_hint_callback,
2413 source->compile_hint_callback_data, options, no_cache_reason,
2417 maybe_function_info = i::Compiler::GetSharedFunctionInfoForScript(
2418 i_isolate, str, script_details, options, no_cache_reason,
2432 !source->GetResourceOptions().IsModule(),
2433 "v8::ScriptCompiler::CompileUnboundScript",
2434 "v8::ScriptCompiler::CompileModule must be used to compile modules");
2443 !source->GetResourceOptions().IsModule(),
"v8::ScriptCompiler::Compile",
2444 "v8::ScriptCompiler::CompileModule must be used to compile modules");
2445 auto i_isolate = context->GetIsolate();
2451 return result->BindToCurrentContext();
2458 "v8::ScriptCompiler::CompileModule",
2459 "Invalid CompileOptions");
2461 "v8::ScriptCompiler::CompileModule",
2462 "Invalid ScriptOrigin: is_module must be true");
2487 DCHECK(IsNativeContext(*context));
2491 for (
int i = 0; i < static_cast<int>(arguments_count);
i++) {
2493 if (!i::String::IsIdentifier(i_isolate, argument))
return Local<Function>();
2494 arguments_list->set(
i, *argument);
2497 for (
size_t i = 0;
i < context_extension_count; ++
i) {
2503 i::ScopeInfo::CreateForWithScope(
2505 IsNativeContext(*context)
2512 i_isolate, source->resource_name, source->resource_line_offset,
2513 source->resource_column_offset, source->source_map_url,
2514 source->host_defined_options, source->resource_options);
2517 std::unique_ptr<i::AlignedCachedData> cached_data;
2519 DCHECK(source->cached_data);
2522 source->cached_data->length));
2527 !i::Compiler::GetWrappedFunction(
2529 cached_data.get(), options, no_cache_reason)
2532 source->cached_data->rejected = cached_data->rejected();
2535 return handle_scope.Escape(Utils::CallableToLocal(
result));
2543 void* compile_hint_callback_data) {
2545 "v8::ScriptCompiler::StartStreaming",
2546 "Invalid CompileOptions");
2547 if (!
i::v8_flags.script_streaming)
return nullptr;
2550 std::unique_ptr<i::BackgroundCompileTask> task =
2551 std::make_unique<i::BackgroundCompileTask>(
2552 data, i_isolate, type, options, &source->compilation_details(),
2553 compile_hint_callback, compile_hint_callback_data);
2554 data->task = std::move(task);
2559 std::unique_ptr<i::BackgroundDeserializeTask> impl)
2576 impl_->SourceTextAvailable(i_isolate, str, script_details);
2582 .merge_background_deserialized_script_with_compilation_cache) {
2585 return impl_->ShouldMergeWithExistingScript();
2590 i::v8_flags.merge_background_deserialized_script_with_compilation_cache);
2591 impl_->MergeWithExistingScript();
2595 Isolate* v8_isolate, std::unique_ptr<CachedData> cached_data) {
2596 if (!
i::v8_flags.concurrent_cache_deserialization)
return nullptr;
2600 std::make_unique<i::BackgroundDeserializeTask>(i_isolate,
2601 std::move(cached_data)));
2606 Isolate* v8_isolate, std::unique_ptr<CachedData> cached_data) {
2607 if (!
i::v8_flags.concurrent_cache_deserialization)
return nullptr;
2610 std::make_unique<i::BackgroundDeserializeTask>(i_isolate,
2611 std::move(cached_data)));
2624 return i::Compiler::GetSharedFunctionInfoForStreamedScript(
2637 "V8.CompileStreamedScript");
2640 CompileStreamedSource(i_isolate, v8_source, full_source_string, origin);
2641 has_exception = !maybe_sfi.
ToHandle(&sfi);
2657 "V8.CompileStreamedModule");
2660 CompileStreamedSource(i_isolate, v8_source, full_source_string, origin);
2661 has_exception = !maybe_sfi.
ToHandle(&sfi);
2677 DCHECK(!i::HeapLayout::InReadOnlySpace(*shared));
2680 "ScriptCompiler::CreateCodeCache",
2681 "Cannot create code cache while creating a snapshot");
2683 DCHECK(shared->is_toplevel());
2684 return i::CodeSerializer::Serialize(i_isolate, shared);
2693 DCHECK(!i::HeapLayout::InReadOnlySpace(*shared));
2696 "ScriptCompiler::CreateCodeCache",
2697 "Cannot create code cache while creating a snapshot");
2699 DCHECK(shared->is_toplevel());
2700 return i::CodeSerializer::Serialize(i_isolate, shared);
2706 i::Isolate* i_isolate = js_function->GetIsolate();
2708 "ScriptCompiler::CreateCodeCacheForFunction",
2709 "Cannot create code cache while creating a snapshot");
2713 "v8::ScriptCompiler::CreateCodeCacheForFunction",
2714 "Expected SharedFunctionInfo with wrapped source code");
2715 return i::CodeSerializer::Serialize(i_isolate, shared);
2731 : i_isolate_(reinterpret_cast<
i::
Isolate*>(v8_isolate)),
2732 next_(i_isolate_->try_catch_handler()),
2734 can_continue_(true),
2735 capture_message_(true),
2740 i::SimulatorStack::RegisterJSStackComparableAddress(
i_isolate_));
2755 !i_isolate_->thread_local_top()->CallDepthIsZero())) {
2756 if (capture_message_) {
2761 i_isolate_->thread_local_top()->rethrowing_message_ =
true;
2762 i_isolate_->set_pending_message(ToObject(message_obj_));
2764 i_isolate_->UnregisterTryCatchHandler(
this);
2765 i_isolate_->clear_internal_exception();
2766 i_isolate_->Throw(ToObject(exception_));
2771 i_isolate_->UnregisterTryCatchHandler(
this);
2773 !i_isolate_->thread_local_top()->rethrowing_message_);
2782 return !IsTheHole(ToObject(exception_), i_isolate_);
2788 return ToObject(exception_) ==
2800 if (HasTerminated()) {
2801 return v8::Utils::ToLocal(i_isolate_->factory()->null_value());
2803 return v8::Utils::ToLocal(
i::direct_handle(ToObject(exception_), i_isolate_));
2813 Maybe<bool> maybe = i::JSReceiver::HasProperty(i_isolate, obj, name);
2819 i::JSReceiver::GetProperty(i_isolate, obj, name), &
result);
2831 DCHECK(IsJSMessageObject(message) || IsTheHole(message, i_isolate_));
2832 if (HasCaught() && !IsTheHole(message, i_isolate_)) {
2840 if (rethrow_)
return;
2841 if (
V8_UNLIKELY(i_isolate_->is_execution_terminating()) &&
2842 !i_isolate_->thread_local_top()->CallDepthIsZero()) {
2845 i_isolate_->clear_internal_exception();
2846 i_isolate_->clear_pending_message();
2852 exception_ =
reinterpret_cast<void*
>(the_hole.
ptr());
2853 message_obj_ =
reinterpret_cast<void*
>(the_hole.
ptr());
2870 Utils::ToLocal(i::MessageHandler::GetMessage(i_isolate, self));
2876 return reinterpret_cast<Isolate*
>(i_isolate);
2892 "Host-defined options has to be a PrimitiveArray");
2895 for (
int i = 0;
i < options->
length();
i++) {
2897 "PrimitiveArray can only contain primtive values");
2912 if (!IsStackTraceInfo(*stack_trace))
return {};
2922 i::JSMessageObject::EnsureSourcePositionsAvailable(i_isolate, self);
2923 return Just(self->GetLineNumber());
2931 i::JSMessageObject::EnsureSourcePositionsAvailable(i_isolate, self);
2932 return self->GetStartPosition();
2940 i::JSMessageObject::EnsureSourcePositionsAvailable(i_isolate, self);
2941 return self->GetEndPosition();
2947 return self->error_level();
2955 i::JSMessageObject::EnsureSourcePositionsAvailable(i_isolate, self);
2956 return self->GetColumnNumber();
2960#if V8_ENABLE_WEBASSEMBLY
2965 i::JSMessageObject::EnsureSourcePositionsAvailable(i_isolate, self);
2966 int start_position = self->GetColumnNumber();
2971 if (script->type() != i::Script::Type::kWasm) {
2977 ->GetContainingFunction(start_position);
2992 i::JSMessageObject::EnsureSourcePositionsAvailable(i_isolate, self);
2993 const int column_number = self->GetColumnNumber();
2994 if (column_number == -1)
return -1;
2995 const int start = self->GetStartPosition();
2996 const int end = self->GetEndPosition();
2997 return column_number + (
end -
start);
3008 return self->script()->origin_options().IsSharedCrossOrigin();
3015 return self->script()->origin_options().IsOpaque();
3032 i::JSMessageObject::EnsureSourcePositionsAvailable(i_isolate, self);
3037 Isolate* v8_isolate, std::ostream& out,
3052 uint32_t index)
const {
3055 return Utils::StackFrameToLocal(
3061 return self->length();
3071 return Utils::StackTraceToLocal(stack_trace);
3079 return Utils::ToLocal(name_or_source_url);
3088 i::Script::PositionInfo
info;
3089 CHECK(i::Script::GetPositionInfo(
3090 script, i::StackFrameInfo::GetSourcePosition(self), &info));
3091 if (script->HasSourceURLComment()) {
3092 info.line -= script->line_offset();
3093 if (info.line == 0) {
3094 info.column -= script->column_offset();
3097 return {info.line, info.column};
3103 return i::StackFrameInfo::GetSourcePosition(self);
3114 if (!IsString(*name))
return {};
3122 self->script()->GetNameOrSourceURL(), i_isolate);
3123 if (!IsString(*name_or_source_url))
return {};
3130 if (!self->script()->HasValidSource())
return {};
3133 if (!IsString(*source))
return {};
3141 self->script()->source_mapping_url(), i_isolate);
3142 if (!IsString(*source_mapping_url))
return {};
3150 if (name->length() == 0)
return {};
3151 return Utils::ToLocal(name);
3156 return self->script()->compilation_type() ==
3157 i::Script::CompilationType::kEval;
3179 source->IsOneByteRepresentation()
3196 "Invalid object, must be a JSON-serializable object.")) {
3201 ? i_isolate->
factory()->empty_string()
3217 : private_(std::move(other.private_)) {}
3223 private_ = std::move(other.private_);
3228 : private_(
std::make_unique<
i::SharedObjectConveyorHandles>(
3229 reinterpret_cast<
i::
Isolate*>(v8_isolate))) {}
3236 NewError(i_isolate->error_function(), i::MessageTemplate::kDataCloneError,
3250 i::JSObject::GetEmbedderFieldCount(js_object->map(i_isolate)));
3257 i_isolate->error_function(), i::MessageTemplate::kDataCloneError,
3271 i_isolate->error_function(), i::MessageTemplate::kDataCloneError,
3278 size_t* actual_size) {
3279 *actual_size =
size;
3289 : isolate(
i), serializer(
i, delegate) {}
3311 auto i_isolate =
reinterpret_cast<i::Isolate*
>(context->GetIsolate());
3315 has_exception =
result.IsNothing();
3350 i_isolate->error_function(),
3351 i::MessageTemplate::kDataCloneDeserializationError));
3356 Isolate* v8_isolate, uint32_t
id) {
3359 i_isolate->error_function(),
3360 i::MessageTemplate::kDataCloneDeserializationError));
3369 i_isolate->error_function(),
3370 i::MessageTemplate::kDataCloneDeserializationError));
3378 i_isolate->error_function(),
3379 i::MessageTemplate::kDataCloneDeserializationError));
3386 : isolate(i_isolate), deserializer(i_isolate, data, delegate) {}
3389 bool supports_legacy_wire_format =
false;
3405 auto i_isolate =
reinterpret_cast<i::Isolate*
>(context->GetIsolate());
3409 bool read_header =
false;
3414 static const uint32_t kMinimumNonLegacyVersion = 13;
3418 i::MessageTemplate::kDataCloneDeserializationVersionError));
3419 has_exception =
true;
3427 bool supports_legacy_wire_format) {
3494 if (
i::IsSmi(
object))
return false;
3495 return i::IsTrue(
object);
3500 if (
i::IsSmi(
object))
return false;
3501 return i::IsFalse(
object);
3531 if (!IsJSArrayBuffer(obj))
return false;
3543#define VALUE_IS_TYPED_ARRAY(Type, typeName, TYPE, ctype) \
3544 bool Value::Is##Type##Array() const { \
3545 auto obj = *Utils::OpenDirectHandle(this); \
3546 return i::IsJSTypedArray(obj) && \
3547 i::Cast<i::JSTypedArray>(obj)->type() == i::kExternal##Type##Array; \
3551#undef VALUE_IS_TYPED_ARRAY
3555 return i::IsJSTypedArray(obj) &&
3558 "Float16Array is not supported");
3563 return IsJSDataView(obj) || IsJSRabGsabDataView(obj);
3568 if (!IsJSArrayBuffer(obj))
return false;
3588#define VALUE_IS_SPECIFIC_TYPE(Type, Check) \
3589 bool Value::Is##Type() const { \
3590 return i::Is##Check(*Utils::OpenDirectHandle(this)); \
3602#if V8_ENABLE_WEBASSEMBLY
3617#undef VALUE_IS_SPECIFIC_TYPE
3625 return IsJSExternalObject(obj);
3639 if (
i::IsSmi(obj))
return i::Smi::ToInt(obj) >= 0;
3658 if (!IsJSFunction(obj))
return false;
3665 if (!IsJSFunction(obj))
return false;
3705 if (!context.IsEmpty()) {
3706 i_isolate =
reinterpret_cast<i::Isolate*
>(context->GetIsolate());
3709 i_isolate = i::Isolate::Current();
3713 return Utils::ToLocal(i::Object::NoSideEffectsToString(i_isolate, obj));
3766 auto i_isolate =
reinterpret_cast<i::Isolate*
>(v8_isolate);
3820namespace api_internal {
3825 if (i::IsJSGlobalObject(holder)) {
3834 i::ShouldThrow::kThrowOnError;
3837void i::Internals::CheckInitializedImpl(
v8::Isolate* external_isolate) {
3840 "v8::internal::Internals::CheckInitialized",
3841 "Isolate is not initialized or V8 has died");
3845 Utils::ApiCheck(that->IsValue(),
"v8::Value::Cast",
"Data is not a Value");
3850 "Value is not an External");
3856 "Value is not an Object");
3862 "Value is not a Function");
3868 "Value is not a Boolean");
3873 Utils::ApiCheck(i::IsName(*obj),
"v8::Name::Cast",
"Value is not a Name");
3879 "Value is not a String");
3885 "Value is not a Symbol");
3891 "v8::Private::Cast",
"Value is not a Private");
3897 "Value is not a FixedArray");
3903 "Value is not a ModuleRequest");
3909 "Value is not a Module");
3915 "Value is not a Numeric");
3921 "Value is not a Number");
3927 "Value is not an Integer");
3932 "Value is not a 32-bit signed integer");
3937 "Value is not a 32-bit unsigned integer");
3942 "Value is not a BigInt");
3948 "Value is not a Context");
3954 "Value is not an Array");
3959 Utils::ApiCheck(i::IsJSMap(*obj),
"v8::Map::Cast",
"Value is not a Map");
3964 Utils::ApiCheck(i::IsJSSet(*obj),
"v8_Set_Cast",
"Value is not a Set");
3969 "Value is not a Promise");
3974 "Value is not a Promise::Resolver");
3978 Utils::ApiCheck(that->IsProxy(),
"v8::Proxy::Cast",
"Value is not a Proxy");
3982 Utils::ApiCheck(that->IsWasmMemoryObject(),
"v8::WasmMemoryObject::Cast",
3983 "Value is not a WasmMemoryObject");
3988 "v8::WasmMemoryMapDescriptor::Cast",
3989 "Value is not a WasmMemoryMapDescriptor");
3993 Utils::ApiCheck(that->IsWasmModuleObject(),
"v8::WasmModuleObject::Cast",
3994 "Value is not a WasmModuleObject");
4003 return reinterpret_cast<const i::BackingStore*
>(
this)->buffer_start();
4011 return reinterpret_cast<const i::BackingStore*
>(
this)->max_byte_length();
4019 return reinterpret_cast<const i::BackingStore*
>(
this)->is_resizable_by_js();
4024 void* deleter_data) {
4030 std::shared_ptr<i::BackingStore> backing_store = self->GetBackingStore();
4031 if (!backing_store) {
4033 i::BackingStore::EmptyBackingStore(i::SharedFlag::kNotShared);
4035 std::shared_ptr<i::BackingStoreBase> bs_base = backing_store;
4036 return std::static_pointer_cast<v8::BackingStore>(bs_base);
4049 std::shared_ptr<i::BackingStore> backing_store = self->GetBackingStore();
4050 if (!backing_store) {
4051 backing_store = i::BackingStore::EmptyBackingStore(i::SharedFlag::kShared);
4053 std::shared_ptr<i::BackingStoreBase> bs_base = backing_store;
4054 return std::static_pointer_cast<v8::BackingStore>(bs_base);
4065 "v8::ArrayBuffer::Cast()",
"Value is not an ArrayBuffer");
4070 Utils::ApiCheck(i::IsJSArrayBufferView(obj),
"v8::ArrayBufferView::Cast()",
4071 "Value is not an ArrayBufferView");
4077 "Value is not a TypedArray");
4080#define CHECK_TYPED_ARRAY_CAST(Type, typeName, TYPE, ctype) \
4081 void v8::Type##Array::CheckCast(Value* that) { \
4082 auto obj = *Utils::OpenDirectHandle(that); \
4084 i::IsJSTypedArray(obj) && i::Cast<i::JSTypedArray>(obj)->type() == \
4085 i::kExternal##Type##Array, \
4086 "v8::" #Type "Array::Cast()", "Value is not a " #Type "Array"); \
4090#undef CHECK_TYPED_ARRAY_CAST
4094 "Float16Array is not supported");
4097 i::IsJSTypedArray(obj) &&
4099 "v8::Float16Array::Cast()",
"Value is not a Float16Array");
4105 "v8::DataView::Cast()",
"Value is not a DataView");
4112 "v8::SharedArrayBuffer::Cast()",
"Value is not a SharedArrayBuffer");
4117 Utils::ApiCheck(i::IsJSDate(obj),
"v8::Date::Cast()",
"Value is not a Date");
4123 "Value is not a StringObject");
4129 "Value is not a SymbolObject");
4135 "Value is not a NumberObject");
4141 "Value is not a BigIntObject");
4146 Utils::ApiCheck(i::IsBooleanWrapper(obj),
"v8::BooleanObject::Cast()",
4147 "Value is not a BooleanObject");
4153 "Value is not a RegExp");
4161 auto i_isolate =
reinterpret_cast<i::Isolate*
>(context->GetIsolate());
4164 has_exception = !i::Object::ToNumber(i_isolate, obj).ToHandle(&num);
4166 return Just(i::Object::NumberValue(*num));
4172 return Just(NumberToInt64(*obj));
4174 auto i_isolate =
reinterpret_cast<i::Isolate*
>(context->GetIsolate());
4177 has_exception = !i::Object::ToInteger(i_isolate, obj).ToHandle(&num);
4179 return Just(NumberToInt64(*num));
4185 auto i_isolate =
reinterpret_cast<i::Isolate*
>(context->GetIsolate());
4188 has_exception = !i::Object::ToInt32(i_isolate, obj).ToHandle(&num);
4190 return Just(IsSmi(*num) ? i::Smi::ToInt(*num)
4191 :
static_cast<int32_t
>(
4198 auto i_isolate =
reinterpret_cast<i::Isolate*
>(context->GetIsolate());
4201 has_exception = !i::Object::ToUint32(i_isolate, obj).ToHandle(&num);
4203 return Just(IsSmi(*num) ?
static_cast<uint32_t
>(i::Smi::ToInt(*num))
4204 :
static_cast<uint32_t
>(
4211 if (i::Smi::ToInt(*self) >= 0)
return Utils::Uint32ToLocal(self);
4216 has_exception = !i::Object::ToString(i_isolate, self).ToHandle(&string_obj);
4220 if (str->AsArrayIndex(&index)) {
4222 if (index <=
static_cast<uint32_t
>(i::Smi::kMaxValue)) {
4223 value = direct_handle(i::Smi::FromInt(index), i_isolate);
4238 has_exception =
result.IsNothing();
4246 return i::Object::StrictEquals(*self, *other);
4252 return i::Object::SameValue(*self, *other);
4259 return Utils::ToLocal(
4265 auto i_isolate =
reinterpret_cast<i::Isolate*
>(context->GetIsolate());
4270 "Value::InstanceOf",
4271 "Invalid type, must be a JS primitive or object.")) {
4277 !i::Object::InstanceOf(i_isolate, left, right).ToHandle(&
result);
4290 auto i_isolate = obj->GetIsolate();
4292 return obj->GetOrCreateIdentityHash(i_isolate).value();
4297 auto i_isolate =
reinterpret_cast<i::Isolate*
>(context->GetIsolate());
4303 i::Runtime::SetObjectProperty(i_isolate, self, key_obj, value_obj,
4304 i::StoreOrigin::kMaybeKeyed,
4305 Just(i::ShouldThrow::kDontThrow))
4314 auto i_isolate =
reinterpret_cast<i::Isolate*
>(context->GetIsolate());
4324 i::Runtime::SetObjectProperty(i_isolate, self, key_obj, value_obj,
4325 receiver_obj, i::StoreOrigin::kMaybeKeyed,
4326 Just(i::ShouldThrow::kDontThrow))
4334 auto i_isolate =
reinterpret_cast<i::Isolate*
>(context->GetIsolate());
4338 has_exception = i::Object::SetElement(i_isolate, self, index, value_obj,
4339 i::ShouldThrow::kDontThrow)
4348 auto i_isolate =
reinterpret_cast<i::Isolate*
>(context->GetIsolate());
4354 if (i::IsJSObject(*self)) {
4360 has_exception =
result.IsNothing();
4368 has_exception =
result.IsNothing();
4376 auto i_isolate =
reinterpret_cast<i::Isolate*
>(context->GetIsolate());
4381 if (i::IsJSObject(*self)) {
4387 has_exception =
result.IsNothing();
4395 has_exception =
result.IsNothing();
4427 DCHECK(get.IsEmpty() || get->IsUndefined() || get->IsFunction());
4428 DCHECK(set.IsEmpty() || set->IsUndefined() || set->IsFunction());
4436 DCHECK(private_->desc.has_value());
4437 return Utils::ToLocal(private_->desc.value());
4441 DCHECK(private_->desc.has_get());
4442 return Utils::ToLocal(private_->desc.get());
4446 DCHECK(private_->desc.has_set());
4447 return Utils::ToLocal(private_->desc.set());
4451 return private_->desc.has_value();
4454 return private_->desc.has_get();
4457 return private_->desc.has_set();
4461 DCHECK(private_->desc.has_writable());
4462 return private_->desc.writable();
4466 return private_->desc.has_writable();
4470 private_->desc.set_enumerable(enumerable);
4474 DCHECK(private_->desc.has_enumerable());
4475 return private_->desc.enumerable();
4479 return private_->desc.has_enumerable();
4483 private_->desc.set_configurable(configurable);
4487 DCHECK(private_->desc.has_configurable());
4488 return private_->desc.configurable();
4492 return private_->desc.has_configurable();
4499 auto i_isolate =
reinterpret_cast<i::Isolate*
>(context->GetIsolate());
4510 if (i::IsJSObject(*self)) {
4515 Maybe<bool> success = i::JSReceiver::DefineOwnProperty(
4523 Maybe<bool> success = i::JSReceiver::DefineOwnProperty(
4534 auto i_isolate =
reinterpret_cast<i::Isolate*
>(context->GetIsolate());
4539 Maybe<bool> success = i::JSReceiver::DefineOwnProperty(
4549 auto i_isolate =
reinterpret_cast<i::Isolate*
>(context->GetIsolate());
4554 if (i::IsJSObject(*self)) {
4557 has_exception = i::JSObject::DefineOwnPropertyIgnoreAttributes(
4563 if (i::IsJSProxy(*self)) {
4566 desc.set_enumerable(
false);
4567 desc.set_configurable(
true);
4583 has_exception = !i::Runtime::GetObjectProperty(i_isolate, self, key_obj)
4600 !i::Runtime::GetObjectProperty(i_isolate, self, key_obj, receiver_obj)
4611 !i::JSReceiver::GetElement(i_isolate, self, index).ToHandle(&
result);
4618 return Get(context,
key.UnsafeAs<
Value>());
4623 auto i_isolate =
reinterpret_cast<i::Isolate*
>(context->GetIsolate());
4627 if (!i::IsName(*key_obj)) {
4628 has_exception = !i::Object::ToString(i_isolate, key_obj).ToHandle(&key_obj);
4632 auto result = i::JSReceiver::GetPropertyAttributes(i_isolate, self, key_name);
4633 has_exception =
result.IsNothing();
4649 i::JSReceiver::GetOwnPropertyDescriptor(i_isolate, obj, key_name, &desc);
4660 auto i_isolate = self->GetIsolate();
4662 return Utils::ToLocal(i::PrototypeIterator::GetCurrent(iter));
4667 auto i_isolate = self->GetIsolate();
4669 if (i::IsJSGlobalProxy(*self)) {
4673 DCHECK(!i::IsJSGlobalObject(*i::PrototypeIterator::GetCurrent(iter)));
4674 return Utils::ToLocal(i::PrototypeIterator::GetCurrent(iter));
4681 auto i_isolate =
reinterpret_cast<i::Isolate*
>(context->GetIsolate());
4686 CHECK_IMPLIES(from_javascript, !i::IsJSGlobalObject(*value_obj));
4687 if (i::IsJSObject(*self)) {
4691 CHECK_IMPLIES(from_javascript, !i::IsJSGlobalObject(*self));
4698 if (i::IsJSProxy(*self)) {
4702 TryCatch try_catch(
reinterpret_cast<v8::Isolate*
>(i_isolate));
4706 has_exception =
result.IsNothing();
4716Maybe<bool> v8::Object::SetPrototype(Local<Context> context,
4717 Local<Value> value) {
4718 static constexpr bool from_javascript =
false;
4719 return SetPrototypeImpl(
this, context, value, from_javascript);
4724 static constexpr bool from_javascript =
true;
4725 return SetPrototypeImpl(
this, context, value, from_javascript);
4731 auto i_isolate = self->GetIsolate();
4742 return Utils::ToLocal(
4747 return GetPropertyNames(
4764 has_exception = accumulator.
CollectKeys(self, self).IsNothing();
4769 self->map()->EnumLength() == 0 ||
4770 self->map()->instance_descriptors(i_isolate)->enum_cache()->keys() !=
4777 return GetOwnPropertyNames(
4794 i_isolate, i_isolate->object_to_string(), self, {}),
4804 if (i::HeapLayout::InWritableSharedSpace(*self)) {
4805 i_isolate = i::Isolate::Current();
4807 i_isolate = self->GetIsolate();
4810 i::JSReceiver::GetConstructorName(i_isolate, self);
4811 return Utils::ToLocal(name);
4816 auto i_isolate =
reinterpret_cast<i::Isolate*
>(context->GetIsolate());
4819 i::JSReceiver::IntegrityLevel i_level =
4823 has_exception =
result.IsNothing();
4829 auto i_isolate =
reinterpret_cast<i::Isolate*
>(context->GetIsolate());
4832 if (i::IsJSProxy(*self)) {
4835 i_isolate, self, key_obj, i::LanguageMode::kSloppy);
4836 has_exception =
result.IsNothing();
4845 i_isolate, self, key_obj, i::LanguageMode::kSloppy);
4846 has_exception =
result.IsNothing();
4854 auto i_isolate =
reinterpret_cast<i::Isolate*
>(context->GetIsolate());
4861 i_isolate, self, key_obj, i::LanguageMode::kSloppy);
4862 has_exception =
result.IsNothing();
4868 auto i_isolate =
reinterpret_cast<i::Isolate*
>(context->GetIsolate());
4875 if (i::Object::ToArrayIndex(*key_obj, &index)) {
4876 maybe = i::JSReceiver::HasElement(i_isolate, self, index);
4880 if (i::Object::ToName(i_isolate, key_obj).ToHandle(&name)) {
4881 maybe = i::JSReceiver::HasProperty(i_isolate, self, name);
4890 return HasOwnProperty(context,
key.UnsafeAs<
Name>());
4894 auto i_isolate =
reinterpret_cast<i::Isolate*
>(context->GetIsolate());
4898 has_exception =
result.IsNothing();
4904 auto i_isolate =
reinterpret_cast<i::Isolate*
>(context->GetIsolate());
4907 auto maybe = i::JSReceiver::HasElement(i_isolate, self, index);
4908 has_exception = maybe.IsNothing();
4913template <
typename Getter,
typename Setter,
typename Data>
4918 bool replace_on_access,
4921 auto i_isolate =
reinterpret_cast<i::Isolate*
>(context->GetIsolate());
4926 i_isolate, name,
getter,
setter, data, replace_on_access);
4927 info->set_getter_side_effect_type(getter_side_effect_type);
4928 info->set_setter_side_effect_type(setter_side_effect_type);
4930 bool fast = obj->HasFastProperties();
4935 has_exception = !i::JSObject::SetAccessor(obj, accessor_name, info, attrs)
4938 if (i::IsUndefined(*
result, i_isolate))
return Just(
false);
4940 i::JSObject::MigrateSlowToFast(obj, 0,
"APISetAccessor");
4952 if (!IsJSObject(*self))
return;
4957 if (setter_i.
is_null()) setter_i = i_isolate->
factory()->null_value();
4962 desc.set_get(getter_i);
4963 desc.set_set(setter_i);
4969 Maybe<bool> success = i::JSReceiver::DefineOwnProperty(
4981 attributes,
false, getter_side_effect_type,
4982 setter_side_effect_type);
4992 data, attributes,
true, getter_side_effect_type,
4993 setter_side_effect_type);
4998 auto i_isolate =
reinterpret_cast<i::Isolate*
>(context->GetIsolate());
5002 auto result = i::JSReceiver::HasOwnProperty(i_isolate, self, key_val);
5003 has_exception =
result.IsNothing();
5009 auto i_isolate =
reinterpret_cast<i::Isolate*
>(context->GetIsolate());
5012 auto result = i::JSReceiver::HasOwnProperty(i_isolate, self, index);
5013 has_exception =
result.IsNothing();
5020 auto i_isolate =
reinterpret_cast<i::Isolate*
>(context->GetIsolate());
5024 if (!IsJSObject(*self))
return Just(
false);
5026 auto result = i::JSObject::HasRealNamedProperty(
5028 has_exception =
result.IsNothing();
5035 auto i_isolate =
reinterpret_cast<i::Isolate*
>(context->GetIsolate());
5039 if (!IsJSObject(*self))
return Just(
false);
5040 auto result = i::JSObject::HasRealElementProperty(
5042 has_exception =
result.IsNothing();
5049 auto i_isolate =
reinterpret_cast<i::Isolate*
>(context->GetIsolate());
5053 if (!IsJSObject(*self))
return Just(
false);
5055 auto result = i::JSObject::HasRealNamedCallbackProperty(
5057 has_exception =
result.IsNothing();
5064 if (!IsJSObject(*self))
return false;
5070 if (!IsJSObject(*self))
return false;
5083 i::PrototypeIterator::GetCurrent<i::JSReceiver>(iter);
5086 i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR);
5097 auto i_isolate =
reinterpret_cast<i::Isolate*
>(context->GetIsolate());
5106 i::PrototypeIterator::GetCurrent<i::JSReceiver>(iter);
5109 i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR);
5111 i::JSReceiver::GetPropertyAttributes(&it);
5112 has_exception =
result.IsNothing();
5126 i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR);
5136 auto i_isolate =
reinterpret_cast<i::Isolate*
>(context->GetIsolate());
5137 ENTER_V8(i_isolate, context,
Object, GetRealNamedPropertyAttributes,
5143 i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR);
5144 auto result = i::JSReceiver::GetPropertyAttributes(&it);
5145 has_exception =
result.IsNothing();
5161 return Utils::ToLocal(
result);
5166 return Clone(
reinterpret_cast<v8::Isolate*
>(self->GetIsolate()));
5173 if (object->GetCreationContext(i_isolate).ToHandle(&context)) {
5174 return Utils::ToLocal(context);
5176 return MaybeLocal<v8::Context>();
5183 return GetCreationContextImpl(self, i_isolate);
5188 return GetCreationContextImpl(self, i::Isolate::Current());
5201 Utils::ApiCheck(object->GetCreationContext(i_isolate).ToHandle(&context),
5202 "v8::Object::GetCreationContextChecked",
5203 "No creation context available");
5204 return Utils::ToLocal(context);
5211 return GetCreationContextCheckedImpl(self, i_isolate);
5216 return GetCreationContextCheckedImpl(self, i::Isolate::Current());
5220V8_INLINE void* GetAlignedPointerFromEmbedderDataInCreationContextImpl(
5223 const char* location =
5224 "v8::Object::GetAlignedPointerFromEmbedderDataInCreationContext()";
5225 auto maybe_context =
object->GetCreationContext();
5226 if (!maybe_context.has_value())
return nullptr;
5240 if (
V8_LIKELY(
static_cast<unsigned>(index) <
5241 static_cast<unsigned>(data->length()))) {
5244 .ToAlignedPointer(i_isolate_for_sandbox, &
result),
5245 location,
"Pointer is not aligned");
5260 return GetAlignedPointerFromEmbedderDataInCreationContextImpl(self, i_isolate,
5268 return GetAlignedPointerFromEmbedderDataInCreationContextImpl(self, isolate,
5275 auto i_isolate = self->GetIsolate();
5277 return self->GetOrCreateIdentityHash(i_isolate).value();
5293 return IsJSApiWrapperObject(*self);
5298 return i::IsUndetectable(*self);
5307 static_cast<size_t>(argc)};
5314 auto i_isolate =
reinterpret_cast<i::Isolate*
>(context->GetIsolate());
5322 auto args = PrepareArguments(argc, argv);
5325 i::Execution::Call(i_isolate, self, recv_obj,
args), &
result);
5332 auto i_isolate =
reinterpret_cast<i::Isolate*
>(context->GetIsolate());
5340 auto args = PrepareArguments(argc, argv);
5358 return Utils::ToLocal(templ)->GetFunction(context);
5370 auto i_isolate =
reinterpret_cast<i::Isolate*
>(context->GetIsolate());
5377 bool should_set_has_no_side_effect =
5380 if (should_set_has_no_side_effect) {
5381 CHECK(IsJSFunction(*self) &&
5385 if (func_data->has_callback(i_isolate)) {
5386 if (func_data->has_side_effects()) {
5388 handle(func_data, i_isolate));
5392 auto args = PrepareArguments(argc, argv);
5412 "Function to be called is a null pointer");
5414 auto args = PrepareArguments(argc, argv);
5417 i::Execution::Call(i_isolate, self, recv_obj,
args), &
result);
5425 return Call(context->GetIsolate(), context, recv, argc, argv);
5430 if (!IsJSFunction(*self))
return;
5439 if (i::IsJSBoundFunction(*self)) {
5443 i_isolate, name, i::JSBoundFunction::GetName(i_isolate, func),
5445 return Utils::ToLocal(name);
5447 if (i::IsJSFunction(*self)) {
5449 return Utils::ToLocal(
i::direct_handle(func->shared()->Name(), i_isolate));
5456 if (!IsJSFunction(*self)) {
5458 self->GetIsolate()->factory()->undefined_value());
5462 return Utils::ToLocal(
5469 if (!IsJSFunction(*self)) {
5481 auto shared = func->shared();
5482 if (i::IsScript(shared->script())) {
5484 func->GetIsolate());
5494 if (!IsJSFunction(self)) {
5498 auto shared = func->shared();
5499 if (i::IsScript(shared->script())) {
5501 func->GetIsolate());
5502 return i::Script::GetLineNumber(script, shared->StartPosition());
5509 if (!IsJSFunction(self)) {
5513 auto shared = func->shared();
5514 if (i::IsScript(shared->script())) {
5516 func->GetIsolate());
5517 return i::Script::GetColumnNumber(script, shared->StartPosition());
5524 if (!IsJSFunction(self)) {
5528 auto shared = func->shared();
5529 if (i::IsScript(shared->script())) {
5531 func->GetIsolate());
5532 return {i::Script::GetLineNumber(script, shared->StartPosition()),
5533 i::Script::GetColumnNumber(script, shared->StartPosition())};
5540 if (!IsJSFunction(self)) {
5544 auto shared = func->shared();
5545 if (i::IsScript(shared->script())) {
5546 return shared->StartPosition();
5555 auto script = func->shared()->script();
5562 if (i::IsJSBoundFunction(*self)) {
5565 bound_function->bound_target_function(), bound_function->GetIsolate());
5566 return Utils::CallableToLocal(bound_target_function);
5573 if (!IsJSFunction(*self))
return false;
5578 !i::Compiler::Compile(i_isolate,
i::handle(sfi, i_isolate),
5579 i::Compiler::CLEAR_EXCEPTION, &is_compiled_scope)) {
5585 if (!sfi->HasBytecodeArray())
return false;
5588 i::interpreter::BytecodeArrayIterator it(bytecode_array, 0);
5589 if (it.current_bytecode() != i::interpreter::Bytecode::kLdaUndefined) {
5594 if (it.current_bytecode() != i::interpreter::Bytecode::kReturn)
return false;
5606 i_isolate, i_isolate->function_to_string(), self, {}),
5625template <
size_t size>
5629 static const uint32_t value = 0xFF00FF00;
5633 static const uint64_t value = 0xFF00'FF00'FF00'FF00;
5638 return reinterpret_cast<const uintptr_t
>(chars) &
kAlignmentMask;
5641static inline const uint16_t*
Align(
const uint16_t* chars) {
5642 return reinterpret_cast<uint16_t*
>(
reinterpret_cast<uintptr_t
>(chars) &
5654 i::String::VisitFlat(
this,
string, 0);
5671 const uint16_t* aligned_end =
Align(
end);
5672 const int increment =
sizeof(uintptr_t) /
sizeof(uint16_t);
5673 const int inner_loops = 16;
5674 while (chars + inner_loops *
increment < aligned_end) {
5675 for (
int i = 0;
i < inner_loops;
i++) {
5676 acc |= *
reinterpret_cast<const uintptr_t*
>(chars);
5686 while (chars !=
end) {
5699 i::String::VisitFlat(
this, left, 0);
5704 i::String::VisitFlat(
this, right, 0);
5708 if (left->length() < right->length()) {
5710 cons_string = right_as_cons;
5713 cons_string = left_as_cons;
5720 if (!left_as_cons.
is_null()) {
5721 cons_string = left_as_cons;
5725 if (!right_as_cons.
is_null()) {
5726 cons_string = right_as_cons;
5739 if (str->IsOneByteRepresentation())
return true;
5741 return helper.
Check(*str);
5746 str = i::String::Flatten(
reinterpret_cast<i::Isolate*
>(v8_isolate), str);
5747 int length = str->length();
5748 if (length == 0)
return 0;
5750 i::String::FlatContent flat = str->GetFlatContent(no_gc);
5752 int utf8_length = 0;
5753 if (flat.IsOneByte()) {
5754 for (uint8_t c : flat.ToOneByteVector()) {
5755 utf8_length += c >> 7;
5760 for (uint16_t c : flat.ToUC16Vector()) {
5770 return i::String::Utf8Length(
reinterpret_cast<i::Isolate*
>(v8_isolate), str);
5783template <
typename Char>
5785 int write_capacity,
int options,
5786 int* utf16_chars_read_out) {
5789 char* current_write = write_start;
5790 const Char* read_start =
string.begin();
5792 int read_length =
string.length();
5797 static const int kMaxSizePerChar =
sizeof(Char) == 1 ? 2 : 3;
5798 while (read_index < read_length) {
5799 int up_to = read_length;
5800 if (write_capacity != -1) {
5801 int remaining_capacity =
5802 write_capacity -
static_cast<int>(current_write - write_start);
5803 int writable_length =
5804 (remaining_capacity - kMaxSizePerChar) / kMaxSizePerChar;
5806 if (writable_length <= 0)
break;
5807 up_to = std::min(up_to, read_index + writable_length);
5810 if (
sizeof(Char) == 1) {
5812 uint8_t char_mask = 0;
5813 for (
int i = read_index;
i < up_to;
i++) char_mask |= read_start[
i];
5814 if ((char_mask & 0x80) == 0) {
5815 int copy_length = up_to - read_index;
5816 memcpy(current_write, read_start + read_index, copy_length);
5817 current_write += copy_length;
5820 for (; read_index < up_to; read_index++) {
5822 current_write,
static_cast<uint8_t
>(read_start[read_index]));
5823 DCHECK(write_capacity == -1 ||
5824 (current_write - write_start) <= write_capacity);
5828 for (; read_index < up_to; read_index++) {
5831 prev_char, replace_invalid_utf8);
5833 DCHECK(write_capacity == -1 ||
5834 (current_write - write_start) <= write_capacity);
5838 if (read_index < read_length) {
5841 int remaining_capacity =
5842 write_capacity -
static_cast<int>(current_write - write_start);
5844 for (; read_index < read_length && remaining_capacity > 0; read_index++) {
5845 uint32_t
character = read_start[read_index];
5852 replace_invalid_utf8);
5858 static const int kSurrogatePairEncodedSize =
5862 if (replace_invalid_utf8 &&
5863 remaining_capacity < kSurrogatePairEncodedSize &&
5865 read_index + 1 < read_length &&
5873 replace_invalid_utf8);
5874 if (written > remaining_capacity) {
5880 for (
int i = 0;
i < written;
i++) current_write[
i] = temp_buffer[
i];
5883 current_write += written;
5884 remaining_capacity -= written;
5890 if (utf16_chars_read_out !=
nullptr) *utf16_chars_read_out = read_index;
5893 if (write_null && (write_capacity == -1 ||
5894 (current_write - write_start) < write_capacity)) {
5895 *current_write++ =
'\0';
5897 return static_cast<int>(current_write - write_start);
5902 int* nchars_ref,
int options)
const {
5907 str = i::String::Flatten(i_isolate, str);
5909 i::String::FlatContent content = str->GetFlatContent(no_gc);
5910 if (content.IsOneByte()) {
5911 return WriteUtf8Impl<uint8_t>(content.ToOneByteVector(), buffer, capacity,
5912 options, nchars_ref);
5914 return WriteUtf8Impl<uint16_t>(content.ToUC16Vector(), buffer, capacity,
5915 options, nchars_ref);
5919template <
typename CharType>
5921 CharType* buffer,
int start,
int length,
5928 if ((length == -1) || (
static_cast<uint32_t
>(length) > str->length() -
start))
5929 end = str->length();
5930 if (
end < 0)
return 0;
5932 if (
start <
end) i::String::WriteToFlat(*str, buffer,
start, write_length);
5934 (length == -1 || write_length < length)) {
5935 buffer[write_length] =
'\0';
5937 return write_length;
5941 int length,
int options)
const {
5943 start, length, options);
5947 int options)
const {
5949 start, length, options);
5952template <
typename CharType>
5954 CharType* buffer, uint32_t
offset,
5955 uint32_t length,
int flags) {
5963 i::String::WriteToFlat(*str, buffer,
offset, length);
5970 uint16_t* buffer,
int flags)
const {
5976 uint32_t length, uint8_t* buffer,
int flags)
const {
5984 size_t* processed_characters_return)
const {
5989 i::String::Utf8EncodingFlags i_flags;
5991 i_flags |= i::String::Utf8EncodingFlag::kNullTerminate;
5994 i_flags |= i::String::Utf8EncodingFlag::kReplaceInvalid;
5996 return i::String::WriteUtf8(i_isolate, str, buffer, capacity, i_flags,
5997 processed_characters_return);
6009 DCHECK(i::String::IsExternalForwardingIndex(raw_hash));
6010 const int index = i::String::ForwardingIndexValueBits::decode(raw_hash);
6014 i::Isolate::Current()->string_forwarding_table()->GetExternalResource(
6015 index, is_one_byte);
6029 uint32_t raw_hash_field = str->raw_hash_field(
kAcquireLoad);
6030 if (i::String::IsExternalForwardingIndex(raw_hash_field)) {
6032 GetExternalResourceFromForwardingTable(*str, raw_hash_field, &is_one_byte);
6033 return !is_one_byte;
6041 uint32_t raw_hash_field = str->raw_hash_field(
kAcquireLoad);
6042 if (i::String::IsExternalForwardingIndex(raw_hash_field)) {
6044 GetExternalResourceFromForwardingTable(*str, raw_hash_field, &is_one_byte);
6051 auto* isolate =
reinterpret_cast<i::Isolate*
>(v8_isolate);
6053 return Utils::ToLocal(isolate->factory()->InternalizeString(str));
6062 if (i::IsThinString(str)) {
6070 uint32_t raw_hash_field = str->raw_hash_field(
kAcquireLoad);
6071 if (i::String::IsExternalForwardingIndex(raw_hash_field)) {
6073 auto resource = GetExternalResourceFromForwardingTable(
6074 str, raw_hash_field, &is_one_byte);
6092 if (i::IsThinString(str)) {
6099 expectedEncoding = ONE_BYTE_ENCODING;
6103 expectedEncoding = TWO_BYTE_ENCODING;
6105 uint32_t raw_hash_field = str->raw_hash_field(
kAcquireLoad);
6106 if (i::String::IsExternalForwardingIndex(raw_hash_field)) {
6108 expected = GetExternalResourceFromForwardingTable(str, raw_hash_field,
6110 expectedEncoding = is_one_byte ? ONE_BYTE_ENCODING : TWO_BYTE_ENCODING;
6113 expectedEncoding = str->IsOneByteRepresentation() ? ONE_BYTE_ENCODING
6114 : TWO_BYTE_ENCODING;
6118 CHECK_EQ(expectedEncoding, encoding);
6125 if (i::IsThinString(str)) {
6130 Isolate* isolate = i::Internals::GetIsolateForSandbox(str.
ptr());
6132 i::Internals::ReadExternalPointerField<i::kExternalStringResourceTag>(
6133 isolate, str.
ptr(), i::Internals::kStringResourceOffset);
6136 uint32_t raw_hash_field = str->raw_hash_field(
kAcquireLoad);
6137 if (i::String::IsExternalForwardingIndex(raw_hash_field)) {
6139 auto resource = GetExternalResourceFromForwardingTable(
6140 str, raw_hash_field, &is_one_byte);
6173 if (i::IsThinString(str)) {
6178 int type = i::Internals::GetInstanceType(
string) &
6179 i::Internals::kStringRepresentationAndEncodingMask;
6181 static_cast<Encoding>(type & i::Internals::kStringEncodingMask);
6184 Isolate* isolate = i::Internals::GetIsolateForSandbox(
string);
6186 i::Internals::ReadExternalPointerField<i::kExternalStringResourceTag>(
6187 isolate,
string, i::Internals::kStringResourceOffset);
6190 uint32_t raw_hash_field = str->raw_hash_field();
6191 if (i::String::IsExternalForwardingIndex(raw_hash_field)) {
6193 resource = GetExternalResourceFromForwardingTable(str, raw_hash_field,
6208 }
else if (i::IsThinString(str)) {
6214 uint32_t raw_hash_field = str->raw_hash_field(
kAcquireLoad);
6215 if (i::String::IsExternalForwardingIndex(raw_hash_field)) {
6217 auto resource = GetExternalResourceFromForwardingTable(str, raw_hash_field,
6233 const Symbol* sym =
reinterpret_cast<const Symbol*
>(
this);
6252 return i::Smi::ToInt(obj);
6254 return static_cast<int64_t
>(i::Object::NumberValue(obj));
6261 return i::Smi::ToInt(obj);
6263 return static_cast<int32_t
>(i::Object::NumberValue(obj));
6270 return i::Smi::ToInt(obj);
6272 return static_cast<uint32_t
>(i::Object::NumberValue(obj));
6278 if (!IsJSObject(self))
return 0;
6283 int index,
const char* location) {
6287 location,
"Internal field out of bounds");
6292 const char* location =
"v8::Object::GetInternalField()";
6301 const char* location =
"v8::Object::SetInternalField()";
6310 const char* location =
"v8::Object::GetAlignedPointerFromInternalField()";
6316 location,
"Unaligned pointer");
6322 const char* location =
"v8::Object::GetAlignedPointerFromInternalField()";
6326 .ToAlignedPointer(obj->GetIsolate(), &
result),
6327 location,
"Unaligned pointer");
6333 const char* location =
"v8::Object::SetAlignedPointerInInternalField()";
6338 .store_aligned_pointer(obj->GetIsolate(), *obj, value),
6339 location,
"Unaligned pointer");
6340 DCHECK_EQ(value, GetAlignedPointerFromInternalField(index));
6346 if (!IsJSObject(*obj))
return;
6348 const char* location =
"v8::Object::SetAlignedPointerInInternalFields()";
6350 int nof_embedder_fields = js_obj->GetEmbedderFieldCount();
6351 for (
int i = 0;
i < argc;
i++) {
6352 int index = indices[
i];
6354 "Internal field out of bounds")) {
6357 void* value = values[
i];
6359 .store_aligned_pointer(obj->GetIsolate(), *obj, value),
6360 location,
"Unaligned pointer");
6361 DCHECK_EQ(value, GetAlignedPointerFromInternalField(index));
6386 i::V8::InitializePlatform(platform);
6392 const bool kEmbedderPointerCompression =
6393 (build_config & kPointerCompression) != 0;
6396 "Embedder-vs-V8 build configuration mismatch. On embedder side "
6397 "pointer compression is %s while on V8 side it's %s.",
6398 kEmbedderPointerCompression ?
"ENABLED" :
"DISABLED",
6402 const int kEmbedderSmiValueSize = (build_config & k31BitSmis) ? 31 : 32;
6405 "Embedder-vs-V8 build configuration mismatch. On embedder side "
6406 "Smi value size is %d while on V8 side it's %d.",
6410 const bool kEmbedderSandbox = (build_config & kSandbox) != 0;
6413 "Embedder-vs-V8 build configuration mismatch. On embedder side "
6414 "sandbox is %s while on V8 side it's %s.",
6415 kEmbedderSandbox ?
"ENABLED" :
"DISABLED",
6419 const bool kEmbedderTargetOsIsAndroid =
6420 (build_config & kTargetOsIsAndroid) != 0;
6421#ifdef V8_TARGET_OS_ANDROID
6422 const bool kV8TargetOsIsAndroid =
true;
6424 const bool kV8TargetOsIsAndroid =
false;
6426 if (kEmbedderTargetOsIsAndroid != kV8TargetOsIsAndroid) {
6428 "Embedder-vs-V8 build configuration mismatch. On embedder side "
6429 "target OS is %s while on V8 side it's %s.",
6430 kEmbedderTargetOsIsAndroid ?
"Android" :
"not Android",
6431 kV8TargetOsIsAndroid ?
"Android" :
"not Android");
6434 const bool kEmbedderEnableChecks = (build_config & kEnableChecks) != 0;
6435#ifdef V8_ENABLE_CHECKS
6436 const bool kV8EnableChecks =
true;
6438 const bool kV8EnableChecks =
false;
6440 if (kEmbedderEnableChecks != kV8EnableChecks) {
6442 "Embedder-vs-V8 build configuration mismatch. On embedder side "
6443 "V8_ENABLE_CHECKS is %s while on V8 side it's %s.",
6444 kEmbedderEnableChecks ?
"ENABLED" :
"DISABLED",
6445 kV8EnableChecks ?
"ENABLED" :
"DISABLED");
6448 i::V8::Initialize();
6458#if V8_OS_LINUX || V8_OS_DARWIN
6461#if V8_ENABLE_WEBASSEMBLY && V8_TRAP_HANDLER_SUPPORTED
6462 return i::trap_handler::TryHandleSignal(sig_code, info, context);
6471#if V8_ENABLE_WEBASSEMBLY && V8_TRAP_HANDLER_SUPPORTED
6472 return i::trap_handler::TryHandleWasmTrap(exception);
6480#if V8_ENABLE_WEBASSEMBLY
6487#if defined(V8_OS_WIN)
6488void V8::SetUnhandledExceptionCallback(
6489 UnhandledExceptionCallback unhandled_exception_callback) {
6490#if defined(V8_OS_WIN64)
6492 unhandled_exception_callback);
6510 i::StackFrame::SetReturnAddressLocationResolver(return_address_resolver);
6519 : read_only_space_size_(0),
6520 read_only_space_used_size_(0),
6521 read_only_space_physical_size_(0) {}
6524 : total_heap_size_(0),
6525 total_heap_size_executable_(0),
6526 total_physical_size_(0),
6527 total_available_size_(0),
6529 heap_size_limit_(0),
6530 malloced_memory_(0),
6531 external_memory_(0),
6532 peak_malloced_memory_(0),
6533 does_zap_garbage_(false),
6534 number_of_native_contexts_(0),
6535 number_of_detached_contexts_(0) {}
6538 : space_name_(nullptr),
6540 space_used_size_(0),
6541 space_available_size_(0),
6542 physical_space_size_(0) {}
6545 : object_type_(nullptr),
6546 object_sub_type_(nullptr),
6551 : code_and_metadata_size_(0),
6552 bytecode_and_metadata_size_(0),
6553 external_script_source_size_(0),
6554 cpu_profiler_metadata_size_(0) {}
6561 const char* icu_data_file) {
6576#ifdef V8_ENABLE_SANDBOX
6579 "v8::V8::GetSandboxAddressSpace",
6580 "The sandbox must be initialized first");
6581 return i::Sandbox::current()->address_space();
6584size_t v8::V8::GetSandboxSizeInBytes() {
6586 "v8::V8::GetSandboxSizeInBytes",
6587 "The sandbox must be initialized first.");
6588 return i::Sandbox::current()->size();
6591size_t v8::V8::GetSandboxReservationSizeInBytes() {
6593 "v8::V8::GetSandboxReservationSizeInBytes",
6594 "The sandbox must be initialized first");
6595 return i::Sandbox::current()->reservation_size();
6598bool v8::V8::IsSandboxConfiguredSecurely() {
6600 "v8::V8::IsSandoxConfiguredSecurely",
6601 "The sandbox must be initialized first");
6605 return !i::Sandbox::current()->is_partially_reserved();
6610 i::ReadOnlyHeap::PopulateReadOnlySpaceStatistics(statistics);
6613template <
typename ObjectType>
6626 maybe_global_proxy, global_proxy_template, extensions,
6627 context_snapshot_index, embedder_fields_deserializer,
microtask_queue);
6641 USE(context_snapshot_index);
6643 global_proxy_template);
6647template <
typename ObjectType>
6662 named_interceptor(i_isolate->
factory()->undefined_value());
6664 indexed_interceptor(i_isolate->
factory()->undefined_value());
6666 if (!maybe_global_template.
IsEmpty()) {
6670 global_constructor = EnsureConstructor(i_isolate, *global_template);
6675 proxy_constructor = EnsureConstructor(i_isolate, *proxy_template);
6679 i::FunctionTemplateInfo::SetPrototypeTemplate(
6680 i_isolate, proxy_constructor,
6683 proxy_template->SetInternalFieldCount(
6684 global_template->InternalFieldCount());
6689 if (!IsUndefined(global_constructor->GetAccessCheckInfo(), i_isolate)) {
6690 i::FunctionTemplateInfo::SetAccessCheckInfo(
6691 i_isolate, proxy_constructor,
6692 direct_handle(global_constructor->GetAccessCheckInfo(), i_isolate));
6693 proxy_constructor->set_needs_access_check(
6694 global_constructor->needs_access_check());
6695 global_constructor->set_needs_access_check(
false);
6696 i::FunctionTemplateInfo::SetAccessCheckInfo(
6697 i_isolate, global_constructor,
6698 i_isolate->
factory()->undefined_value());
6705 if (!IsUndefined(global_constructor->GetNamedPropertyHandler(),
6707 named_interceptor = direct_handle(
6708 global_constructor->GetNamedPropertyHandler(), i_isolate);
6709 i::FunctionTemplateInfo::SetNamedPropertyHandler(
6710 i_isolate, global_constructor,
6711 i_isolate->
factory()->noop_interceptor_info());
6713 if (!IsUndefined(global_constructor->GetIndexedPropertyHandler(),
6715 indexed_interceptor = direct_handle(
6716 global_constructor->GetIndexedPropertyHandler(), i_isolate);
6717 i::FunctionTemplateInfo::SetIndexedPropertyHandler(
6718 i_isolate, global_constructor,
6719 i_isolate->
factory()->noop_interceptor_info());
6724 if (!maybe_global_proxy.
IsEmpty()) {
6730 result = invoke.Invoke(i_isolate, maybe_proxy, proxy_template, extensions,
6731 context_snapshot_index, embedder_fields_deserializer,
6735 if (!maybe_global_template.
IsEmpty()) {
6738 i::FunctionTemplateInfo::SetAccessCheckInfo(
6739 i_isolate, global_constructor,
6741 global_constructor->set_needs_access_check(
6742 proxy_constructor->needs_access_check());
6743 i::FunctionTemplateInfo::SetNamedPropertyHandler(
6744 i_isolate, global_constructor, named_interceptor);
6745 i::FunctionTemplateInfo::SetIndexedPropertyHandler(
6746 i_isolate, global_constructor, indexed_interceptor);
6770 if (extensions ==
nullptr) extensions = &no_extensions;
6772 i_isolate, extensions, global_template, global_object,
6773 context_snapshot_index, embedder_fields_deserializer,
microtask_queue);
6787 external_isolate, extensions, global_template, global_object, 0,
6789 context_callback_deserializer,
6790 api_wrapper_deserializer),
6795 v8::Isolate* external_isolate,
size_t context_snapshot_index,
6801 size_t index_including_default_context = context_snapshot_index + 1;
6802 if (!i::Snapshot::HasContextSnapshot(
6803 reinterpret_cast<i::Isolate*
>(external_isolate),
6804 index_including_default_context)) {
6809 index_including_default_context,
6811 context_callback_deserializer,
6812 api_wrapper_deserializer),
6823 EnsureConstructor(i_isolate, *global_template);
6825 "v8::Context::NewRemoteContext",
6826 "Global template needs to have access checks enabled");
6832 "v8::Context::NewRemoteContext",
6833 "Global template needs to have access check handlers");
6836 i_isolate,
nullptr, global_template, global_object, 0,
6848 env->set_security_token(*token_handle);
6853 env->set_security_token(env->global_object());
6866 if (i::InstanceTypeChecker::IsString(
obj_type))
return false;
6868 if (i::InstanceTypeChecker::IsSharedFunctionInfo(
obj_type))
return false;
6870 if (i::InstanceTypeChecker::IsTemplateInfo(
obj_type))
return false;
6877 return (i::InstanceTypeChecker::IsJSApiObject(
obj_type) ||
6878 i::InstanceTypeChecker::IsJSExternalObject(
obj_type) ||
6879 i::InstanceTypeChecker::IsJSAPIObjectWithEmbedderSlots(
obj_type));
6886 case i::JS_OBJECT_TYPE:
6887 case i::JS_GLOBAL_OBJECT_TYPE:
6888 case i::JS_GLOBAL_PROXY_TYPE:
6889 case i::JS_PRIMITIVE_WRAPPER_TYPE:
6890 case i::JS_FUNCTION_TYPE:
6892 case i::BIGINT64_TYPED_ARRAY_CONSTRUCTOR_TYPE:
6893 case i::BIGUINT64_TYPED_ARRAY_CONSTRUCTOR_TYPE:
6894 case i::FLOAT16_TYPED_ARRAY_CONSTRUCTOR_TYPE:
6895 case i::FLOAT32_TYPED_ARRAY_CONSTRUCTOR_TYPE:
6896 case i::FLOAT64_TYPED_ARRAY_CONSTRUCTOR_TYPE:
6897 case i::INT16_TYPED_ARRAY_CONSTRUCTOR_TYPE:
6898 case i::INT32_TYPED_ARRAY_CONSTRUCTOR_TYPE:
6899 case i::INT8_TYPED_ARRAY_CONSTRUCTOR_TYPE:
6900 case i::UINT16_TYPED_ARRAY_CONSTRUCTOR_TYPE:
6901 case i::UINT32_TYPED_ARRAY_CONSTRUCTOR_TYPE:
6902 case i::UINT8_CLAMPED_TYPED_ARRAY_CONSTRUCTOR_TYPE:
6903 case i::UINT8_TYPED_ARRAY_CONSTRUCTOR_TYPE:
6904 case i::JS_ARRAY_CONSTRUCTOR_TYPE:
6905 case i::JS_PROMISE_CONSTRUCTOR_TYPE:
6906 case i::JS_REG_EXP_CONSTRUCTOR_TYPE:
6907 case i::JS_CLASS_CONSTRUCTOR_TYPE:
6909 case i::JS_ARRAY_ITERATOR_PROTOTYPE_TYPE:
6910 case i::JS_ITERATOR_PROTOTYPE_TYPE:
6911 case i::JS_MAP_ITERATOR_PROTOTYPE_TYPE:
6912 case i::JS_OBJECT_PROTOTYPE_TYPE:
6913 case i::JS_PROMISE_PROTOTYPE_TYPE:
6914 case i::JS_REG_EXP_PROTOTYPE_TYPE:
6915 case i::JS_SET_ITERATOR_PROTOTYPE_TYPE:
6916 case i::JS_SET_PROTOTYPE_TYPE:
6917 case i::JS_STRING_ITERATOR_PROTOTYPE_TYPE:
6918 case i::JS_TYPED_ARRAY_PROTOTYPE_TYPE:
6920 case i::JS_ARRAY_TYPE:
6922#if V8_ENABLE_WEBASSEMBLY
6923 case i::WASM_ARRAY_TYPE:
6924 case i::WASM_STRUCT_TYPE:
6925 case i::WASM_TAG_OBJECT_TYPE:
6927 case i::JS_PROXY_TYPE:
6930 case i::JS_MAP_KEY_ITERATOR_TYPE:
6931 case i::JS_MAP_KEY_VALUE_ITERATOR_TYPE:
6932 case i::JS_MAP_VALUE_ITERATOR_TYPE:
6933 case i::JS_SET_KEY_VALUE_ITERATOR_TYPE:
6934 case i::JS_SET_VALUE_ITERATOR_TYPE:
6935 case i::JS_GENERATOR_OBJECT_TYPE:
6936 case i::JS_ASYNC_FUNCTION_OBJECT_TYPE:
6937 case i::JS_ASYNC_GENERATOR_OBJECT_TYPE:
6938 case i::JS_ARRAY_ITERATOR_TYPE: {
6949 explicit ObjectVisitorDeepFreezer(
i::Isolate* isolate,
6950 Context::DeepFreezeDelegate* delegate)
6952 delegate_(delegate),
6953 objects_to_freeze_(isolate),
6954 lazy_accessor_pairs_to_freeze_(isolate) {}
6959 success = InstantiateAndVisitLazyAccessorPairs();
6964 isolate_, NewTypeError(
error_->msg_id,
error_->name),
false);
6966 for (
const auto& obj : objects_to_freeze_) {
6969 i::JSReceiver::SetIntegrityLevel(isolate_, obj,
i::FROZEN,
6985 VisitPointer(host, host->map_slot());
6998 template <
typename TSlot>
6999 void VisitPointersImpl(TSlot
start, TSlot
end) {
7001 typename TSlot::TObject
object = current.load(isolate_);
7003 if (
object.GetHeapObjectIfStrong(&heap_object)) {
7013 LocalVector<Object>
children(
reinterpret_cast<Isolate*
>(isolate_));
7014 if (!delegate_->FreezeEmbedderObjectAndGetChildren(Utils::ToLocal(obj),
7029 if (
error_.has_value()) {
7037 if (!MayContainObjectsToFreeze(
obj_type)) {
7041 if (!done_list_.insert(obj).second) {
7047 if (i::InstanceTypeChecker::IsAccessorPair(
obj_type)) {
7053 if (i::IsFunctionTemplateInfo(accessor_pair->getter()) ||
7054 IsFunctionTemplateInfo(accessor_pair->setter())) {
7057 lazy_accessor_pairs_to_freeze_.push_back(lazy_accessor_pair);
7059 }
else if (i::InstanceTypeChecker::IsContext(
obj_type)) {
7064 for (
auto it : i::ScopeInfo::IterateLocalNames(scope_info, no_gc)) {
7066 scope_info->ContextLocalMode(it->index()))) {
7068 error_ = ErrorInfo{i::MessageTemplate::kCannotDeepFreezeValue,
7073 }
else if (i::InstanceTypeChecker::IsJSReceiver(
obj_type)) {
7076 if (RequiresEmbedderSupportToFreeze(
obj_type)) {
7081 if (i::InstanceTypeChecker::IsJSExternalObject(
obj_type) ||
7082 js_obj->GetEmbedderFieldCount() > 0) {
7086 ErrorInfo{i::MessageTemplate::kCannotDeepFreezeObject,
7093 if (!FreezeEmbedderObjectAndVisitChildren(js_obj)) {
7097 DCHECK_EQ(js_obj->GetEmbedderFieldCount(), 0);
7101 i::InstanceTypeChecker::IsJSObject(
obj_type),
7103 if (!IsJSReceiverSafeToFreeze(
obj_type)) {
7106 ErrorInfo{i::MessageTemplate::kCannotDeepFreezeObject,
7115 objects_to_freeze_.push_back(
receiver);
7126 return !
error_.has_value();
7129 bool InstantiateAndVisitLazyAccessorPairs() {
7135 std::swap(lazy_accessor_pairs_to_freeze, lazy_accessor_pairs_to_freeze_);
7137 for (
const auto& accessor_pair : lazy_accessor_pairs_to_freeze) {
7138 i::AccessorPair::GetComponent(isolate_, native_context, accessor_pair,
7140 i::AccessorPair::GetComponent(isolate_, native_context, accessor_pair,
7145 CHECK_EQ(lazy_accessor_pairs_to_freeze_.size(), 0);
7150 Context::DeepFreezeDelegate* delegate_;
7151 std::unordered_set<i::Tagged<i::Object>, i::Object::Hasher> done_list_;
7154 std::optional<ErrorInfo>
error_;
7169 ObjectVisitorDeepFreezer vfreezer(i_isolate, delegate);
7170 has_exception = !vfreezer.DeepFreeze(env);
7177 return reinterpret_cast<Isolate*
>(
7183 Utils::ApiCheck(i::IsNativeContext(*env),
"v8::Context::GetMicrotaskQueue",
7184 "Must be called on a native context");
7185 return env->microtask_queue();
7190 i::Isolate* i_isolate = context->GetIsolate();
7192 "v8::Context::SetMicrotaskQueue",
7193 "Must be called on a native context");
7196 "v8::Context::SetMicrotaskQueue",
7197 "Must not be running microtasks");
7198 Utils::ApiCheck(context->microtask_queue()->GetMicrotasksScopeDepth() == 0,
7199 "v8::Context::SetMicrotaskQueue",
7200 "Must not have microtask scope pushed");
7202 "v8::Context::SetMicrotaskQueue()",
7203 "Cannot set Microtask Queue with an entered context");
7204 context->set_microtask_queue(i_isolate,
7210 i::Isolate* i_isolate = context->GetIsolate();
7214 if (global->IsDetachedFrom(context->global_object())) {
7216 return Utils::ToLocal(
result);
7223 i::Isolate* i_isolate = context->GetIsolate();
7230 i::Isolate* i_isolate = context->GetIsolate();
7231 return Utils::ToLocal(
7237 i::Isolate* i_isolate = context->GetIsolate();
7239 context->set_allow_code_gen_from_strings(
7245 return !IsFalse(context->allow_code_gen_from_strings(),
7246 context->GetIsolate());
7252 context->set_error_message_for_code_gen_from_strings(*error_handle);
7258 context->set_error_message_for_wasm_code_gen(*error_handle);
7264 i::Isolate* i_isolate = context->GetIsolate();
7266 context->set_script_execution_callback(
7278#ifdef V8_ENABLE_JAVASCRIPT_PROMISE_HOOKS
7280 i::Isolate* i_isolate = context->GetIsolate();
7282 auto undefined = i_isolate->
factory()->undefined_value();
7288 bool has_hook =
false;
7302 if (!resolve_hook.
IsEmpty()) {
7307 i_isolate->SetHasContextPromiseHooks(has_hook);
7309 context->
native_context()->set_promise_hook_init_function(*init);
7310 context->native_context()->set_promise_hook_before_function(*before);
7311 context->native_context()->set_promise_hook_after_function(*after);
7312 context->native_context()->set_promise_hook_resolve_function(*resolve);
7315 "V8 was compiled without JavaScript Promise hooks");
7322 if (!IsJSArray(i_object))
return false;
7337 i::Isolate* i_isolate = i_context->GetIsolate();
7339 direct_handle(i_context->native_context(), i_isolate));
7348i::ValueHelper::InternalRepresentationType GetSerializedDataFromFixedArray(
7350 if (index <
static_cast<size_t>(list->length())) {
7351 int int_index =
static_cast<int>(
index);
7353 if (!IsTheHole(
object, i_isolate)) {
7354 list->set_the_hole(i_isolate, int_index);
7358 int last = list->length() - 1;
7359 while (last >= 0 && list->is_the_hole(i_isolate, last)) last--;
7360 if (last != -1) list->RightTrim(i_isolate, last + 1);
7364 return i::ValueHelper::kEmpty;
7371 i::Isolate* i_isolate = context->GetIsolate();
7373 return GetSerializedDataFromFixedArray(i_isolate, list, index);
7381 i::ApiNatives::InstantiateObject(i_isolate, self), &
result);
7388 Utils::ApiCheck(i::IsObjectTemplateInfo(*obj),
"v8::ObjectTemplate::Cast",
7389 "Value is not an ObjectTemplate");
7395 "v8::DictionaryTemplate::Cast",
7396 "Value is not an DictionaryTemplate");
7401 Utils::ApiCheck(i::IsFunctionTemplateInfo(*obj),
"v8::FunctionTemplate::Cast",
7402 "Value is not a FunctionTemplate");
7407 Utils::ApiCheck(i::IsFunctionTemplateInfo(*obj),
"v8::Signature::Cast",
7408 "Value is not a Signature");
7425 i::Isolate* i_isolate = self->GetIsolateChecked();
7429 EnsureConstructor(i_isolate, *InstanceTemplate());
7431 "v8::FunctionTemplate::NewRemoteInstance",
7432 "InstanceTemplate needs to have access checks enabled");
7438 "v8::FunctionTemplate::NewRemoteInstance",
7439 "InstanceTemplate needs to have access check handlers");
7441 if (!i::ApiNatives::InstantiateRemoteObject(
7443 .ToHandle(&
object)) {
7455 if (i::IsJSGlobalProxy(*obj)) {
7473 return self->IsLeafTemplateForApiObject(
object);
7478 i::Isolate* i_isolate = self->GetIsolateChecked();
7479 i::FunctionTemplateInfo::SealAndPrepareForPromotionToReadOnly(i_isolate,
7495 return Utils::ExternalToLocal(external);
7507inline int StringLength(
const char*
string) {
7508 size_t len = strlen(
string);
7510 return static_cast<int>(len);
7513inline int StringLength(
const uint8_t*
string) {
7514 return StringLength(
reinterpret_cast<const char*
>(
string));
7517inline int StringLength(
const uint16_t*
string) {
7519 while (
string[length] !=
'\0') length++;
7521 return static_cast<int>(
length);
7527 base::Vector<const char>
string) {
7537 base::Vector<const uint8_t>
string) {
7547 base::Vector<const uint16_t>
string) {
7559#define NEW_STRING(v8_isolate, class_name, function_name, Char, data, type, \
7561 MaybeLocal<String> result; \
7562 if (length == 0) { \
7563 result = String::Empty(v8_isolate); \
7564 } else if (length > 0 && \
7565 static_cast<uint32_t>(length) > i::String::kMaxLength) { \
7566 result = MaybeLocal<String>(); \
7568 i::Isolate* i_isolate = reinterpret_cast<internal::Isolate*>(v8_isolate); \
7569 ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate); \
7570 API_RCS_SCOPE(i_isolate, class_name, function_name); \
7571 if (length < 0) length = StringLength(data); \
7572 i::DirectHandle<i::String> handle_result = \
7573 NewString(i_isolate->factory(), type, \
7574 base::Vector<const Char>(data, length)) \
7575 .ToHandleChecked(); \
7576 result = Utils::ToLocal(handle_result); \
7582 DCHECK_LE(length, i::String::kMaxLength);
7587 NewString(i_isolate->
factory(), type,
7590 return Utils::ToLocal(handle_result);
7600 const uint8_t* data,
7602 NEW_STRING(v8_isolate,
String, NewFromOneByte, uint8_t, data, type, length);
7607 const uint16_t* data,
7609 NEW_STRING(v8_isolate,
String, NewFromTwoByte, uint16_t, data, type, length);
7622 if (left_string->length() + right_string->length() > i::String::kMaxLength) {
7629 return Utils::ToLocal(
result);
7636 if (resource->
length() >
static_cast<size_t>(i::String::kMaxLength)) {
7642 if (resource->
length() > 0) {
7647 return Utils::ToLocal(
string);
7652 return Utils::ToLocal(i_isolate->
factory()->empty_string());
7660 if (resource->
length() >
static_cast<size_t>(i::String::kMaxLength)) {
7666 if (resource->
length() == 0) {
7670 return Utils::ToLocal(i_isolate->
factory()->empty_string());
7677 return Utils::ToLocal(
string);
7682 return MakeExternal(isolate, resource);
7691 if (i::IsThinString(obj)) {
7695 if (!obj->SupportsExternalization(Encoding::TWO_BYTE_ENCODING)) {
7704 bool result = obj->MakeExternal(i_isolate, resource);
7712 return MakeExternal(isolate, resource);
7721 if (i::IsThinString(obj)) {
7725 if (!obj->SupportsExternalization(Encoding::ONE_BYTE_ENCODING)) {
7734 bool result = obj->MakeExternal(i_isolate, resource);
7742 return obj->SupportsExternalization(encoding);
7748 return self->Equals(*other);
7753 return reinterpret_cast<Isolate*
>(i_isolate);
7762 return Utils::ToLocal(obj);
7771template <
typename T>
7775template <
typename T>
7780template <
typename T>
7784template <
typename T>
7789template <
typename Dictionary>
7790void AddPropertiesAndElementsToObject(
7793 Local<Value>* values,
size_t length) {
7802 if (name->AsArrayIndex(&index)) {
7805 if (!IsNumberDictionary(*elements)) {
7807 i::NumberDictionary::New(i_isolate,
static_cast<int>(length));
7809 elements = i::NumberDictionary::Set(
7817 properties = ToHandle(Dictionary::Add(
7818 i_isolate, properties, name, value, i::PropertyDetails::Empty()));
7821 properties->ValueAtPut(entry, *value);
7837 "v8::Object::New",
"prototype must be null or object")) {
7844 i_isolate->
factory()->empty_fixed_array();
7853 AddPropertiesAndElementsToObject(i_isolate, properties, elements, names,
7857 proto, properties, elements);
7858 return Utils::ToLocal(obj);
7861 i::NameDictionary::New(i_isolate,
static_cast<int>(length));
7862 AddPropertiesAndElementsToObject(i_isolate, properties, elements, names,
7866 proto, properties, elements);
7867 return Utils::ToLocal(obj);
7877 i::Object::ToObject(i_isolate, number).ToHandleChecked();
7878 return Utils::ToLocal(obj);
7885 return i::Object::NumberValue(
7895 i::Object::ToObject(i_isolate, bigint).ToHandleChecked();
7896 return Utils::ToLocal(obj);
7902 i::Isolate* i_isolate = js_primitive_wrapper->GetIsolate();
7914 i::Object::ToObject(i_isolate,
boolean).ToHandleChecked();
7915 return Utils::ToLocal(obj);
7922 i::Isolate* i_isolate = js_primitive_wrapper->GetIsolate();
7924 return i::IsTrue(js_primitive_wrapper->value(), i_isolate);
7934 i::Object::ToObject(i_isolate,
string).ToHandleChecked();
7935 return Utils::ToLocal(obj);
7941 i::Isolate* i_isolate = js_primitive_wrapper->GetIsolate();
7955 return Utils::ToLocal(obj);
7961 i::Isolate* i_isolate = js_primitive_wrapper->GetIsolate();
7968 if (std::isnan(time)) {
7970 time = std::numeric_limits<double>::quiet_NaN();
7976 i_isolate->date_function(), time),
7985 double time = ParseDateTimeString(i_isolate,
string);
7990 i_isolate->date_function(), time),
8000 return jsdate->value();
8006 i::Isolate* i_isolate = jsdate->GetIsolate();
8009 i::ToDateStringMode::kISODateAndTime);
8014 return Utils::ToLocal(str);
8020 i::Isolate* i_isolate = jsdate->GetIsolate();
8023 i::ToDateStringMode::kUTCDateAndTime);
8028 return Utils::ToLocal(str);
8033#define TIME_ZONE_DETECTION_ASSERT_EQ(value) \
8035 static_cast<int>(v8::Isolate::TimeZoneDetection::value) == \
8036 static_cast<int>(base::TimezoneCache::TimeZoneDetection::value));
8039#undef TIME_ZONE_DETECTION_ASSERT_EQ
8047 static_cast<i::JSRegExp::Flags
>(flags)),
8055 uint32_t backtrack_limit) {
8057 "v8::RegExp::NewWithBacktrackLimit",
8058 "backtrack_limit is too large or too small");
8060 "v8::RegExp::NewWithBacktrackLimit",
8061 "Must set backtrack_limit");
8066 static_cast<i::JSRegExp::Flags
>(flags), backtrack_limit),
8079#define REGEXP_FLAG_ASSERT_EQ(flag) \
8080 static_assert(static_cast<int>(v8::RegExp::flag) == \
8081 static_cast<int>(i::JSRegExp::flag))
8091#undef REGEXP_FLAG_ASSERT_EQ
8111 i::RegExpUtils::RegExpExec(i_isolate, regexp, subject_string,
8112 i_isolate->
factory()->undefined_value()),
8123 int real_length = length > 0 ?
length : 0;
8128 obj->set_length(*length_obj);
8129 return Utils::ToLocal(obj);
8138 int len =
static_cast<int>(
length);
8141 for (
int i = 0;
i < len;
i++) {
8146 return Utils::ToLocal(
8160 const int len =
static_cast<int>(
length);
8163 for (
int i = 0;
i < len;
i++) {
8167 if (!maybe_value.
ToLocal(&value)) {
8181 if (
IsSmi(length))
return Smi::ToInt(length);
8182 return static_cast<uint32_t
>(Object::NumberValue(length));
8195 if (array->GetElementsAccessor()->HasAccessors(*array))
return false;
8196 if (!JSObject::PrototypeHasNoElements(isolate, *array))
return false;
8210 void* callback_data) {
8220 DisallowJavascriptExecution no_js(isolate);
8222 if (length == 0)
return FastIterateResult::kFinished;
8223 switch (array->GetElementsKind()) {
8235 reinterpret_cast<Address*
>(&element));
8236 Result
result =
callback(
i, Utils::ToLocal(fake_handle), callback_data);
8237 if (
result != Result::kContinue) {
8242 return FastIterateResult::kFinished;
8256 ? isolate->factory()->undefined_value()
8258 Result
result =
callback(
i, Utils::ToLocal(fake_handle), callback_data);
8259 if (
result != Result::kContinue) {
8264 return FastIterateResult::kFinished;
8270 Cast<FixedDoubleArray>(array->elements()), isolate);
8273 elements->is_the_hole(
i)
8275 : isolate->factory()->NewNumber(elements->get_scalar(
i));
8277 if (
result != Result::kContinue) {
8282 return FastIterateResult::kFinished;
8291 std::vector<Entry> sorted;
8292 sorted.reserve(dict->NumberOfElements());
8296 if (!dict->IsKey(roots,
key))
continue;
8298 static_cast<uint32_t
>(Object::NumberValue(Cast<Number>(
key)));
8299 sorted.push_back({
index,
i});
8302 sorted.begin(), sorted.end(),
8303 [](
const Entry& a,
const Entry& b) { return a.index < b.index; });
8304 for (
const Entry& entry : sorted) {
8310 callback(entry.index, Utils::ToLocal(fake_handle), callback_data);
8311 if (
result != Result::kContinue) {
8316 return FastIterateResult::kFinished;
8319 return FastIterateResult::kFinished;
8323 return FastIterateResult::kSlowPath;
8328#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype) case TYPE##_ELEMENTS:
8331#undef TYPED_ARRAY_CASE
8344 void* callback_data) {
8349 if (fast_result == i::FastIterateResult::kException)
return Nothing<void>();
8351 if (fast_result != i::FastIterateResult::kSlowPath)
return JustVoid();
8358 !i::JSReceiver::GetElement(isolate, array,
i).ToHandle(&element);
8369#ifdef V8_ENABLE_DIRECT_HANDLE
8382#ifdef V8_ENABLE_DIRECT_HANDLE
8401 auto cache = Utils::OpenIndirectHandle(*cached_map_);
8402 cache.PatchValue(map);
8411 return Utils::ToLocal(obj);
8424 i::JSMap::Clear(i_isolate, self);
8433 !
ToLocal<Value>(i::Execution::CallBuiltin(i_isolate, i_isolate->map_get(),
8447 has_exception = !i::Execution::CallBuiltin(i_isolate, i_isolate->map_set(),
8455 auto i_isolate =
reinterpret_cast<i::Isolate*
>(context->GetIsolate());
8460 has_exception = !i::Execution::CallBuiltin(i_isolate, i_isolate->map_has(),
8468 auto i_isolate =
reinterpret_cast<i::Isolate*
>(context->GetIsolate());
8473 has_exception = !i::Execution::CallBuiltin(i_isolate, i_isolate->map_delete(),
8482enum class MapAsArrayKind {
8483 kEntries = i::JS_MAP_KEY_VALUE_ITERATOR_TYPE,
8484 kKeys = i::JS_MAP_KEY_ITERATOR_TYPE,
8485 kValues = i::JS_MAP_VALUE_ITERATOR_TYPE
8488enum class SetAsArrayKind {
8489 kEntries = i::JS_SET_KEY_VALUE_ITERATOR_TYPE,
8490 kValues = i::JS_SET_VALUE_ITERATOR_TYPE
8499 const bool collect_keys =
8500 kind == MapAsArrayKind::kEntries ||
kind == MapAsArrayKind::kKeys;
8501 const bool collect_values =
8502 kind == MapAsArrayKind::kEntries ||
kind == MapAsArrayKind::kValues;
8503 int capacity = table->UsedCapacity();
8505 (capacity -
offset) * ((collect_keys && collect_values) ? 2 : 1);
8507 int result_index = 0;
8512 for (
int i =
offset;
i < capacity; ++
i) {
8515 if (
key == hash_table_hole)
continue;
8516 if (collect_keys)
result->set(result_index++,
key);
8517 if (collect_values)
result->set(result_index++, table->ValueAt(entry));
8521 if (result_index == 0)
return factory->
NewJSArray(0);
8522 result->RightTrim(i_isolate, result_index);
8534 return Utils::ToLocal(
8535 MapAsArray(i_isolate, obj->table(), 0, MapAsArrayKind::kEntries));
8543 return Utils::ToLocal(obj);
8556 i::JSSet::Clear(i_isolate, self);
8564 has_exception = !i::Execution::CallBuiltin(i_isolate, i_isolate->set_add(),
8572 auto i_isolate =
reinterpret_cast<i::Isolate*
>(context->GetIsolate());
8577 has_exception = !i::Execution::CallBuiltin(i_isolate, i_isolate->set_has(),
8585 auto i_isolate =
reinterpret_cast<i::Isolate*
>(context->GetIsolate());
8590 has_exception = !i::Execution::CallBuiltin(i_isolate, i_isolate->set_delete(),
8605 int capacity = table->UsedCapacity();
8606 const bool collect_key_values =
kind == SetAsArrayKind::kEntries;
8607 int max_length = (capacity -
offset) * (collect_key_values ? 2 : 1);
8608 if (max_length == 0)
return factory->
NewJSArray(0);
8610 int result_index = 0;
8615 for (
int i =
offset;
i < capacity; ++
i) {
8618 if (
key == hash_table_hole)
continue;
8620 if (collect_key_values)
result->set(result_index++,
key);
8624 if (result_index == 0)
return factory->
NewJSArray(0);
8625 result->RightTrim(i_isolate, result_index);
8636 return Utils::ToLocal(
8637 SetAsArray(i_isolate, obj->table(), 0, SetAsArrayKind::kValues));
8660 auto i_isolate =
reinterpret_cast<i::Isolate*
>(context->GetIsolate());
8677 auto i_isolate =
reinterpret_cast<i::Isolate*
>(context->GetIsolate());
8703 !i::Execution::CallBuiltin(i_isolate, i_isolate->promise_then(), self,
8717 !i::Execution::CallBuiltin(i_isolate, i_isolate->promise_then(), self,
8733 !i::Execution::CallBuiltin(i_isolate, i_isolate->promise_then(), self,
8742 i::Isolate* i_isolate = promise->GetIsolate();
8745 if (!IsJSPromise(promise))
return false;
8751 i::Isolate* i_isolate = promise->GetIsolate();
8754 Utils::ApiCheck(js_promise->status() != kPending,
"v8_Promise_Result",
8755 "Promise is still pending");
8763 return static_cast<PromiseState>(js_promise->status());
8792 i::JSProxy::Revoke(self);
8808 std::shared_ptr<internal::wasm::NativeModule> native_module,
8809 const char* source_url,
size_t url_length)
8816#if V8_ENABLE_WEBASSEMBLY
8819 size_t buffer_size = wasm_serializer.GetSerializedNativeModuleSize();
8820 std::unique_ptr<uint8_t[]> buffer(
new uint8_t[buffer_size]);
8821 if (!wasm_serializer.SerializeNativeModule({buffer.get(), buffer_size}))
8823 return {std::move(buffer), buffer_size};
8830#if V8_ENABLE_WEBASSEMBLY
8832 return {bytes_vec.
begin(), bytes_vec.
size()};
8839#if V8_ENABLE_WEBASSEMBLY
8849#if V8_ENABLE_WEBASSEMBLY
8854 std::unique_ptr<char[]> cstring = url->ToCString(&length);
8856 cstring.get(), length);
8864#if V8_ENABLE_WEBASSEMBLY
8867 i::wasm::GetWasmEngine()->ImportNativeModule(
8870 return Utils::ToLocal(module_object);
8878#if V8_ENABLE_WEBASSEMBLY
8881 if (!i::wasm::IsWasmCodegenAllowed(i_isolate, i_isolate->
native_context())) {
8886 i::wasm::ErrorThrower thrower(i_isolate,
"WasmModuleObject::Compile()");
8887 auto enabled_features =
8888 i::wasm::WasmEnabledFeatures::FromIsolate(i_isolate);
8890 maybe_compiled = i::wasm::GetWasmEngine()->SyncCompile(
8891 i_isolate, enabled_features, i::wasm::CompileTimeImports{}, &thrower,
8895 if (maybe_compiled.
is_null()) {
8901 "WebAssembly support is not enabled");
8909#if V8_ENABLE_WEBASSEMBLY
8913 i::WasmMemoryMapDescriptor::NewFromFileDescriptor(i_isolate, fd);
8914 return Utils::ToLocal(
result);
8917 "WebAssembly support is not enabled");
8924#ifdef V8_ENABLE_SANDBOX
8925 return new ArrayBufferAllocator(i::IsolateGroup::GetDefault());
8927 return new ArrayBufferAllocator();
8931#if defined(V8_COMPRESS_POINTERS) && \
8932 !defined(V8_COMPRESS_POINTERS_IN_SHARED_CAGE)
8935#ifdef V8_ENABLE_SANDBOX
8938 return new ArrayBufferAllocator();
8954 std::shared_ptr<i::BackingStoreBase> backing_store) {
8955 return std::static_pointer_cast<i::BackingStore>(backing_store);
8963 "Only detachable ArrayBuffers can be detached");
8965 reinterpret_cast<v8::Isolate*
>(i_isolate)->GetCurrentContext();
8968 if (context.IsEmpty()) {
8970 if (
key.IsEmpty()) {
8971 i::JSArrayBuffer::Detach(obj).Check();
8974 constexpr bool kForceForWasmMemory =
false;
8975 i::JSArrayBuffer::Detach(obj, kForceForWasmMemory, i_key).Check();
8980 if (!
key.IsEmpty()) {
8982 constexpr bool kForceForWasmMemory =
false;
8984 i::JSArrayBuffer::Detach(obj, kForceForWasmMemory, i_key).IsNothing();
8986 has_exception = i::JSArrayBuffer::Detach(obj).IsNothing();
8997 obj->set_detach_key(*i_key);
9011 switch (initialization_mode) {
9013 return i::InitializedFlag::kUninitialized;
9015 return i::InitializedFlag::kZeroInitialized;
9022 Isolate* isolate,
size_t byte_length,
9028 if (byte_length > max) {
9034 byte_length, GetInitializedFlag(initialization_mode));
9037 if (!
result.ToHandle(&array_buffer)) {
9041 return Utils::ToLocal(array_buffer);
9045 Isolate* v8_isolate,
size_t byte_length,
9052 byte_length, GetInitializedFlag(initialization_mode));
9055 if (!
result.ToHandle(&array_buffer)) {
9056 i::V8::FatalProcessOutOfMemory(i_isolate,
"v8::ArrayBuffer::New");
9059 return Utils::ToLocal(array_buffer);
9063 Isolate* v8_isolate, std::shared_ptr<BackingStore> backing_store) {
9065 backing_store->Data() !=
nullptr);
9069 std::shared_ptr<i::BackingStore> i_backing_store(
9072 !i_backing_store->is_shared(),
"v8_ArrayBuffer_New",
9073 "Cannot construct ArrayBuffer with a BackingStore of SharedArrayBuffer");
9076 return Utils::ToLocal(obj);
9080 Isolate* v8_isolate,
size_t byte_length,
9086 CHECK_LE(byte_length, i::JSArrayBuffer::kMaxByteLength);
9087 }
else if (byte_length > i::JSArrayBuffer::kMaxByteLength) {
9092 std::unique_ptr<i::BackingStoreBase> backing_store =
9093 i::BackingStore::Allocate(i_isolate, byte_length,
9094 i::SharedFlag::kNotShared,
9095 GetInitializedFlag(initialization_mode));
9096 if (!backing_store) {
9098 i::V8::FatalProcessOutOfMemory(i_isolate,
9099 "v8::ArrayBuffer::NewBackingStore");
9105 return std::unique_ptr<v8::BackingStore>(
9111 void* deleter_data) {
9112 CHECK_LE(byte_length, i::JSArrayBuffer::kMaxByteLength);
9113#ifdef V8_ENABLE_SANDBOX
9115 "v8_ArrayBuffer_NewBackingStore",
9116 "When the V8 Sandbox is enabled, ArrayBuffer backing stores "
9117 "must be allocated inside the sandbox address space. Please "
9118 "use an appropriate ArrayBuffer::Allocator to allocate these "
9119 "buffers, or disable the sandbox.");
9122 std::unique_ptr<i::BackingStoreBase> backing_store =
9123 i::BackingStore::WrapAllocation(data, byte_length, deleter, deleter_data,
9124 i::SharedFlag::kNotShared);
9125 return std::unique_ptr<v8::BackingStore>(
9131 size_t byte_length,
size_t max_byte_length) {
9133 "v8::ArrayBuffer::NewResizableBackingStore",
9134 "Cannot construct resizable ArrayBuffer, byte_length must be "
9135 "<= max_byte_length");
9137 byte_length <= i::JSArrayBuffer::kMaxByteLength,
9138 "v8::ArrayBuffer::NewResizableBackingStore",
9139 "Cannot construct resizable ArrayBuffer, requested length is too big");
9141 size_t page_size, initial_pages, max_pages;
9142 if (i::JSArrayBuffer::GetResizableBackingStorePageConfiguration(
9143 nullptr, byte_length, max_byte_length,
i::kDontThrow, &page_size,
9144 &initial_pages, &max_pages)
9146 i::V8::FatalProcessOutOfMemory(
nullptr,
9147 "v8::ArrayBuffer::NewResizableBackingStore");
9149 std::unique_ptr<i::BackingStoreBase> backing_store =
9150 i::BackingStore::TryAllocateAndPartiallyCommitMemory(
9151 nullptr, byte_length, max_byte_length, page_size, initial_pages,
9152 max_pages, i::WasmMemoryFlag::kNotWasm, i::SharedFlag::kNotShared);
9153 if (!backing_store) {
9154 i::V8::FatalProcessOutOfMemory(
nullptr,
9155 "v8::ArrayBuffer::NewResizableBackingStore");
9157 return std::unique_ptr<v8::BackingStore>(
9164 if (i::IsJSDataView(*obj)) {
9167 DCHECK(IsJSArrayBuffer(data_view->buffer()));
9170 }
else if (i::IsJSRabGsabDataView(*obj)) {
9173 DCHECK(IsJSArrayBuffer(data_view->buffer()));
9177 DCHECK(IsJSTypedArray(*obj));
9184 size_t bytes_to_copy = std::min(byte_length, self->byte_length());
9185 if (bytes_to_copy) {
9188 if (i::IsJSTypedArray(*self)) {
9190 source =
reinterpret_cast<char*
>(array->DataPtr());
9192 DCHECK(i::IsJSDataView(*self) || i::IsJSRabGsabDataView(*self));
9195 source =
reinterpret_cast<char*
>(data_view->data_pointer());
9197 memcpy(dest, source, bytes_to_copy);
9199 return bytes_to_copy;
9206 if (self->WasDetached()) {
9209 if (internal::IsJSTypedArray(*self)) {
9211 if (typed_array->is_on_heap()) {
9214 size_t bytes_to_copy = self->byte_length();
9216 const uint8_t* source =
9217 reinterpret_cast<uint8_t*
>(typed_array->DataPtr());
9218 memcpy(
reinterpret_cast<void*
>(storage.
data()), source, bytes_to_copy);
9219 return {storage.
data(), bytes_to_copy};
9222 return {
reinterpret_cast<uint8_t*
>(typed_array->DataPtr()),
9223 typed_array->GetByteLength()};
9225 if (i::IsJSDataView(*self)) {
9227 return {
reinterpret_cast<uint8_t*
>(data_view->data_pointer()),
9228 data_view->byte_length()};
9231 DCHECK(i::IsJSRabGsabDataView(*self));
9234 return {
reinterpret_cast<uint8_t*
>(data_view->data_pointer()),
9235 data_view->GetByteLength()};
9240 if (!IsJSTypedArray(*self))
return true;
9242 return !typed_array->is_on_heap();
9247 return obj->WasDetached() ? 0 : obj->byte_offset();
9253 if (obj->WasDetached()) {
9256 if (i::IsJSTypedArray(obj)) {
9259 if (i::IsJSDataView(obj)) {
9268 return obj->WasDetached() ? 0 : obj->GetLength();
9272 "v8::TypedArray::kMaxByteLength must match "
9273 "i::JSTypedArray::kMaxByteLength");
9275#define TYPED_ARRAY_NEW(Type, type, TYPE, ctype) \
9276 Local<Type##Array> Type##Array::New(Local<ArrayBuffer> array_buffer, \
9277 size_t byte_offset, size_t length) { \
9278 i::Isolate* i_isolate = \
9279 Utils::OpenDirectHandle(*array_buffer)->GetIsolate(); \
9280 API_RCS_SCOPE(i_isolate, Type##Array, New); \
9281 ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate); \
9282 if (!Utils::ApiCheck(length <= kMaxLength, \
9284 "Array::New(Local<ArrayBuffer>, size_t, size_t)", \
9285 "length exceeds max allowed value")) { \
9286 return Local<Type##Array>(); \
9288 auto buffer = Utils::OpenDirectHandle(*array_buffer); \
9289 i::DirectHandle<i::JSTypedArray> obj = \
9290 i_isolate->factory()->NewJSTypedArray(i::kExternal##Type##Array, \
9291 buffer, byte_offset, length); \
9292 return Utils::ToLocal##Type##Array(obj); \
9294 Local<Type##Array> Type##Array::New( \
9295 Local<SharedArrayBuffer> shared_array_buffer, size_t byte_offset, \
9297 i::Isolate* i_isolate = \
9298 Utils::OpenDirectHandle(*shared_array_buffer)->GetIsolate(); \
9299 API_RCS_SCOPE(i_isolate, Type##Array, New); \
9300 ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate); \
9301 if (!Utils::ApiCheck( \
9302 length <= kMaxLength, \
9304 "Array::New(Local<SharedArrayBuffer>, size_t, size_t)", \
9305 "length exceeds max allowed value")) { \
9306 return Local<Type##Array>(); \
9308 auto buffer = Utils::OpenDirectHandle(*shared_array_buffer); \
9309 i::DirectHandle<i::JSTypedArray> obj = \
9310 i_isolate->factory()->NewJSTypedArray(i::kExternal##Type##Array, \
9311 buffer, byte_offset, length); \
9312 return Utils::ToLocal##Type##Array(obj); \
9316#undef TYPED_ARRAY_NEW
9319 size_t byte_offset,
size_t length) {
9321 "Float16Array is not supported");
9327 "v8::Float16Array::New(Local<ArrayBuffer>, size_t, size_t)",
9328 "length exceeds max allowed value")) {
9334 return Utils::ToLocalFloat16Array(obj);
9340 "Float16Array is not supported");
9347 "v8::Float16Array::New(Local<SharedArrayBuffer>, size_t, size_t)",
9348 "length exceeds max allowed value")) {
9354 return Utils::ToLocalFloat16Array(obj);
9359 size_t byte_offset,
size_t byte_length) {
9361 i::Isolate* i_isolate = buffer->GetIsolate();
9367 return Utils::ToLocal(obj);
9371 size_t byte_offset,
size_t byte_length) {
9373 i::Isolate* i_isolate = buffer->GetIsolate();
9379 return Utils::ToLocal(obj);
9391 Isolate* v8_isolate,
size_t byte_length,
9397 std::unique_ptr<i::BackingStore> backing_store =
9398 i::BackingStore::Allocate(i_isolate, byte_length, i::SharedFlag::kShared,
9399 GetInitializedFlag(initialization_mode));
9401 if (!backing_store) {
9402 i::V8::FatalProcessOutOfMemory(i_isolate,
"v8::SharedArrayBuffer::New");
9407 return Utils::ToLocalShared(obj);
9411 Isolate* v8_isolate,
size_t byte_length,
9417 std::unique_ptr<i::BackingStore> backing_store =
9418 i::BackingStore::Allocate(i_isolate, byte_length, i::SharedFlag::kShared,
9419 GetInitializedFlag(initialization_mode));
9421 if (!backing_store)
return {};
9425 return Utils::ToLocalShared(obj);
9429 Isolate* v8_isolate, std::shared_ptr<BackingStore> backing_store) {
9431 backing_store->Data() !=
nullptr);
9435 std::shared_ptr<i::BackingStore> i_backing_store(
ToInternal(backing_store));
9437 i_backing_store->is_shared(),
"v8::SharedArrayBuffer::New",
9438 "Cannot construct SharedArrayBuffer with BackingStore of ArrayBuffer");
9441 return Utils::ToLocalShared(obj);
9445 Isolate* v8_isolate,
size_t byte_length,
9452 byte_length <= i::JSArrayBuffer::kMaxByteLength,
9453 "v8::SharedArrayBuffer::NewBackingStore",
9454 "Cannot construct SharedArrayBuffer, requested length is too big");
9457 if (byte_length > i::JSArrayBuffer::kMaxByteLength)
return {};
9460 std::unique_ptr<i::BackingStoreBase> backing_store =
9461 i::BackingStore::Allocate(i_isolate, byte_length, i::SharedFlag::kShared,
9462 GetInitializedFlag(initialization_mode));
9463 if (!backing_store) {
9465 i::V8::FatalProcessOutOfMemory(i_isolate,
9466 "v8::SharedArrayBuffer::NewBackingStore");
9472 return std::unique_ptr<v8::BackingStore>(
9478 void* deleter_data) {
9479 CHECK_LE(byte_length, i::JSArrayBuffer::kMaxByteLength);
9480 std::unique_ptr<i::BackingStoreBase> backing_store =
9481 i::BackingStore::WrapAllocation(data, byte_length, deleter, deleter_data,
9482 i::SharedFlag::kShared);
9483 return std::unique_ptr<v8::BackingStore>(
9493 return Utils::ToLocal(
result);
9500 return Utils::ToLocal(
9501 i_isolate->
SymbolFor(i::RootIndex::kPublicSymbolTable, i_name,
false));
9508 return Utils::ToLocal(
9509 i_isolate->
SymbolFor(i::RootIndex::kApiSymbolTable, i_name,
false));
9512#define WELL_KNOWN_SYMBOLS(V) \
9513 V(AsyncIterator, async_iterator) \
9514 V(HasInstance, has_instance) \
9515 V(IsConcatSpreadable, is_concat_spreadable) \
9516 V(Iterator, iterator) \
9518 V(Replace, replace) \
9521 V(ToPrimitive, to_primitive) \
9522 V(ToStringTag, to_string_tag) \
9523 V(Unscopables, unscopables) \
9524 V(Dispose, dispose) \
9525 V(AsyncDispose, async_dispose)
9527#define SYMBOL_GETTER(Name, name) \
9528 Local<Symbol> v8::Symbol::Get##Name(Isolate* v8_isolate) { \
9529 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(v8_isolate); \
9530 return Utils::ToLocal(i_isolate->factory()->name##_symbol()); \
9536#undef WELL_KNOWN_SYMBOLS
9553 i_isolate->
SymbolFor(i::RootIndex::kApiPrivateSymbolTable, i_name,
true));
9560 if (std::isnan(value)) {
9562 value = std::numeric_limits<double>::quiet_NaN();
9565 return Utils::NumberToLocal(
result);
9571 if (i::Smi::IsValid(value)) {
9572 return Utils::IntegerToLocal(
9576 return Utils::IntegerToLocal(
result);
9583 bool fits_into_int32_t = (value & (1 << 31)) == 0;
9584 if (fits_into_int32_t) {
9585 return Integer::New(v8_isolate,
static_cast<int32_t
>(value));
9588 return Utils::IntegerToLocal(
result);
9595 return Utils::ToLocal(
result);
9602 return Utils::ToLocal(
result);
9606 int sign_bit,
int word_count,
9607 const uint64_t* words) {
9612 i::BigInt::FromWords64(i_isolate, sign_bit, word_count, words);
9613 has_exception =
result.is_null();
9631 uint64_t* words)
const {
9634 uint32_t unsigned_word_count = *word_count;
9637 *word_count = base::checked_cast<int>(unsigned_word_count);
9641 int64_t change_in_bytes) {
9643 static constexpr int64_t kMaxReasonableBytes = int64_t(1) << 60;
9644 static constexpr int64_t kMinReasonableBytes = -kMaxReasonableBytes;
9645 static_assert(kMaxReasonableBytes >= i::JSArrayBuffer::kMaxByteLength);
9646 CHECK(kMinReasonableBytes <= change_in_bytes &&
9647 change_in_bytes < kMaxReasonableBytes);
9650 const uint64_t amount =
9653 if (change_in_bytes <= 0) {
9665 if (
heap->gc_state() != i::Heap::NOT_IN_GC)
return;
9666 heap->HandleExternalMemoryInterrupt();
9670 : isolate_group_(isolate_group) {
9675 : isolate_group_(other.isolate_group_) {
9699 return IsolateGroup(i::IsolateGroup::AcquireDefault());
9704 return i::IsolateGroup::CanCreateNewGroups();
9714 other.isolate_group_ =
nullptr;
9718 if (
this == &other) {
9722 if (isolate_group_) {
9723 isolate_group_->Release();
9726 other.isolate_group_ =
nullptr;
9748 return !i_isolate->
context().is_null();
9770 return Utils::ToLocal(last);
9776 return Utils::ToLocal(context);
9799 if (value.IsEmpty()) {
9814 return try_catch_handler && try_catch_handler->
HasCaught();
9847 void* data =
reinterpret_cast<void*
>(
callback);
9852 void* data =
reinterpret_cast<void*
>(
callback);
9857 void* data =
reinterpret_cast<void*
>(
callback);
9862 void* data =
reinterpret_cast<void*
>(
callback);
9890 i_isolate->
stack_guard()->RequestTerminateExecution();
9900 i_isolate->
stack_guard()->ClearTerminateExecution();
9910#if V8_ENABLE_WEBASSEMBLY
9912 return i::wasm::GetWasmEngine()->HasRunningCompileJob(i_isolate);
9920 "v8::Isolate::RequestGarbageCollectionForTesting",
9921 "Must use --expose-gc");
9932 reinterpret_cast<i::Isolate*
>(
this)->
heap()->PreciseCollectAllGarbage(
9933 i::GCFlag::kNoFlags, i::GarbageCollectionReason::kTesting,
9940 std::optional<i::EmbedderStackStateScope> stack_scope;
9943 i::EmbedderStackStateOrigin::kExplicitInvocation,
9950 i::Isolate* i_isolate = i::Isolate::Current();
9951 return reinterpret_cast<Isolate*
>(i_isolate);
9955 i::Isolate* i_isolate = i::Isolate::TryGetCurrent();
9956 return reinterpret_cast<Isolate*
>(i_isolate);
9971 return reinterpret_cast<Isolate*
>(i::Isolate::New(isolate_group));
9989 if (
auto allocator = params.array_buffer_allocator_shared) {
9990 CHECK(params.array_buffer_allocator ==
nullptr ||
9991 params.array_buffer_allocator == allocator.get());
9998 if (params.snapshot_blob !=
nullptr) {
9999 i_isolate->set_snapshot_blob(params.snapshot_blob);
10001 i_isolate->set_snapshot_blob(i::Snapshot::DefaultSnapshotBlob());
10004 if (params.fatal_error_callback) {
10009#pragma clang diagnostic push
10010#pragma clang diagnostic ignored "-Wdeprecated-declarations"
10012 if (params.oom_error_callback) {
10016#pragma clang diagnostic pop
10019 if (params.counter_lookup_callback) {
10023 if (params.create_histogram_callback) {
10027 if (params.add_histogram_sample_callback) {
10029 params.add_histogram_sample_callback);
10032 i_isolate->set_api_external_references(params.external_references);
10035 CppHeap* cpp_heap = params.cpp_heap;
10043 if (params.constraints.stack_limit() !=
nullptr) {
10045 reinterpret_cast<uintptr_t
>(params.constraints.stack_limit());
10052 if (i_isolate->snapshot_blob() ==
nullptr) {
10054 "V8 snapshot blob was not set during initialization. This can mean "
10055 "that the snapshot blob file is corrupted or missing.");
10057 if (!i::Snapshot::Initialize(i_isolate)) {
10061 "Failed to deserialize the V8 snapshot blob. This can mean that the "
10062 "snapshot blob file is corrupted or missing.");
10068 auto code_event_handler = params.code_event_handler;
10069 if (code_event_handler) {
10071 code_event_handler);
10075 i_isolate->set_embedder_wrapper_type_index(
10076 params.embedder_wrapper_type_index);
10077 i_isolate->set_embedder_wrapper_object_index(
10078 params.embedder_wrapper_object_index);
10080 if (!i::V8::GetCurrentPlatform()
10081 ->GetForegroundTaskRunner(v8_isolate)
10082 ->NonNestableTasksEnabled()) {
10084 "The current platform's foreground task runner does not have "
10085 "non-nestable tasks enabled. The embedder must provide one.");
10103 "Disposing the isolate that is entered by a thread")) {
10106 i::Isolate::Delete(i_isolate);
10121 i_isolate->
Enter();
10166 int stack_trace_limit = 0;
10170 return stack_trace_limit;
10176 : v8_isolate_(v8_isolate), on_failure_(on_failure) {
10193 switch (on_failure_) {
10194 case CRASH_ON_FAILURE:
10195 i::DisallowJavascriptExecution::Close(i_isolate, was_execution_allowed_);
10197 case THROW_ON_FAILURE:
10198 i::ThrowOnJavascriptExecution::Close(i_isolate, was_execution_allowed_);
10200 case DUMP_ON_FAILURE:
10201 i::DumpOnJavascriptExecution::Close(i_isolate, was_execution_allowed_);
10208 : v8_isolate_(v8_isolate) {
10211 i::NoThrowOnJavascriptExecution::Open(i_isolate,
10218 i::AllowJavascriptExecution::Close(i_isolate, was_execution_allowed_assert_);
10219 i::NoThrowOnJavascriptExecution::Close(i_isolate,
10220 was_execution_allowed_throws_);
10221 i::NoDumpOnJavascriptExecution::Close(i_isolate, was_execution_allowed_dump_);
10226 : i_isolate_(reinterpret_cast<
i::
Isolate*>(v8_isolate)),
10229 : i_isolate_->default_microtask_queue()) {
10235 microtask_queue_->DecrementMicrotasksSuppressions();
10236 i_isolate_->thread_local_top()->DecrementCallDepth(
this);
10243 return GetSerializedDataFromFixedArray(i_isolate, list, index);
10248#ifdef V8_ENABLE_CONTINUATION_PRESERVED_EMBEDDER_DATA
10250 i_isolate->
isolate_data()->continuation_preserved_embedder_data(),
10258#ifdef V8_ENABLE_CONTINUATION_PRESERVED_EMBEDDER_DATA
10260 if (data.IsEmpty())
10262 i_isolate->
isolate_data()->set_continuation_preserved_embedder_data(
10271 heap->FreeMainThreadLinearAllocationAreas();
10294 heap->CommittedMemoryExecutable();
10306 ?
static_cast<size_t>(i_isolate->
heap()->backing_store_bytes())
10312 heap->NumberOfDetachedContexts();
10315#if V8_ENABLE_WEBASSEMBLY
10317 i::wasm::GetWasmEngine()->allocator()->GetCurrentMemoryUsage();
10319 i::wasm::GetWasmEngine()->allocator()->GetMaxMemoryUsage();
10329 if (!space_statistics)
return false;
10336 heap->FreeMainThreadLinearAllocationAreas();
10349 i::Space* space =
heap->space(
static_cast<int>(index));
10350 space_statistics->
space_size_ = space ? space->CommittedMemory() : 0;
10354 space ? space->CommittedPhysicalMemory() : 0;
10362 return heap->NumberOfTrackedHeapObjectTypes();
10367 if (!object_statistics)
return false;
10368 if (
V8_LIKELY(!i::TracingFlags::is_gc_stats_enabled()))
return false;
10372 if (type_index >=
heap->NumberOfTrackedHeapObjectTypes())
return false;
10374 const char* object_type;
10375 const char* object_sub_type;
10376 size_t object_count =
heap->ObjectCountAtLastGC(type_index);
10377 size_t object_size =
heap->ObjectSizeAtLastGC(type_index);
10378 if (!
heap->GetObjectTypeName(type_index, &object_type, &object_sub_type)) {
10394 if (!code_statistics)
return false;
10400 i_isolate->code_and_metadata_size();
10402 i_isolate->bytecode_and_metadata_size();
10404 i_isolate->external_script_source_size();
10406 i::CpuProfiler::GetAllProfilersMemorySize(i_isolate);
10422 context, promise_resolver, mode);
10426 size_t frames_limit,
SampleInfo* sample_info) {
10429 if (i::TickSample::GetStackSample(i_isolate, ®s,
10430 i::TickSample::kSkipCEntryFrame, frames,
10431 frames_limit, sample_info)) {
10440 int64_t change_in_bytes) {
10446 i_isolate->set_event_logger(that);
10493 i_isolate->default_microtask_queue()->PerformCheckpoint(
this);
10500 if (!i::JSReceiver::GetContextForMicrotask(function).ToHandle(
10509 i_isolate->default_microtask_queue()->EnqueueMicrotask(
this,
callback, data);
10514 i_isolate->default_microtask_queue()->set_microtasks_policy(policy);
10520 return i_isolate->default_microtask_queue()->microtasks_policy();
10527 i_isolate->default_microtask_queue()->AddMicrotasksCompletedCallback(
callback,
10534 i_isolate->default_microtask_queue()->RemoveMicrotasksCompletedCallback(
10556 ->SetAddHistogramSampleFunction(
callback);
10560 const std::shared_ptr<metrics::Recorder>& metrics_recorder) {
10575 i_isolate->
counters()->gc_low_memory_notification());
10578 i::GarbageCollectionReason::kLowMemoryNotification);
10585 i_isolate->PrintWithTimestamp(
"[context-disposal] Disposing %s context\n",
10586 dependant_context ?
"nested" :
"top-level");
10588#if V8_ENABLE_WEBASSEMBLY
10589 if (!dependant_context) {
10590 if (!i_isolate->
context().is_null()) {
10595 i::wasm::GetWasmEngine()->DeleteCompileJobsOnContext(
10629 bool on_isolate_thread =
10632 : i::ThreadId::Current() == i_isolate->
thread_id();
10660 i_isolate->
Freeze(is_frozen);
10683 CHECK(stack_limit);
10691 *
start =
reinterpret_cast<void*
>(code_region.
begin());
10692 *length_in_bytes = code_region.
size();
10696 size_t* length_in_bytes) {
10699 *
start =
reinterpret_cast<const void*
>(d.code());
10700 *length_in_bytes = d.code_size();
10707 std::array<std::pair<i::Builtin, JSEntryStub*>, 3> stubs = {
10710 {i::Builtin::kJSRunMicrotasksEntry,
10712 for (
auto& pair : stubs) {
10714 pair.second->code.start =
10715 reinterpret_cast<const void*
>(js_entry->instruction_start());
10716 pair.second->code.length_in_bytes = js_entry->instruction_size();
10719 return entry_stubs;
10723#if !defined(V8_TARGET_ARCH_64_BIT) && !defined(V8_TARGET_ARCH_ARM)
10729 std::vector<MemoryRange>* code_pages = i_isolate->
GetCodePages();
10737 size_t limit = std::min(capacity, code_pages->size());
10738 for (
size_t i = 0;
i < limit;
i++) {
10739 code_pages_out[
i] = code_pages->at(
i);
10741 return code_pages->size();
10745#define CALLBACK_SETTER(ExternalName, Type, InternalName) \
10746 void Isolate::Set##ExternalName(Type callback) { \
10747 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(this); \
10748 i_isolate->set_##InternalName(callback); \
10755 modify_code_gen_callback)
10763 wasm_streaming_callback)
10767 wasm_async_resolve_promise_callback)
10770 wasm_load_source_map_callback)
10774 wasm_imported_strings_enabled_callback)
10777 wasm_jspi_enabled_callback)
10781 sharedarraybuffer_constructor_enabled_callback)
10787 compile_hints_magic_enabled_callback)
10791 is_js_api_wrapper_native_error_callback)
10800#if V8_ENABLE_WEBASSEMBLY
10801 i::WasmJs::InstallConditionalFeatures(i_isolate,
10813 size_t heap_limit) {
10827 return i_isolate->
IsDead();
10835 int message_levels,
10841 i_isolate->
factory()->message_listeners();
10847 listener->set(0, *foreign);
10848 listener->set(1, data.IsEmpty()
10851 listener->set(2, i::Smi::FromInt(message_levels));
10852 list = i::ArrayList::Add(i_isolate, list, listener);
10863 for (
int i = 0;
i < listeners->length();
i++) {
10864 if (i::IsUndefined(listeners->get(
i), i_isolate)) {
10907#ifdef V8_INTL_SUPPORT
10908 i_isolate->clear_cached_icu_object(
10909 i::Isolate::ICUObjectCacheType::kDefaultSimpleDateFormat);
10910 i_isolate->clear_cached_icu_object(
10911 i::Isolate::ICUObjectCacheType::kDefaultSimpleDateFormatForTime);
10912 i_isolate->clear_cached_icu_object(
10913 i::Isolate::ICUObjectCacheType::kDefaultSimpleDateFormatForDate);
10922#ifdef V8_INTL_SUPPORT
10923 i_isolate->ResetDefaultLocale();
10931#ifdef V8_INTL_SUPPORT
10932 return i_isolate->DefaultLocale();
10934 return std::string();
10940 return HashSeed(i_isolate);
10943#if defined(V8_ENABLE_ETW_STACK_WALKING)
10944void Isolate::SetFilterETWSessionByURLCallback(
10945 FilterETWSessionByURLCallback
callback) {
10947 i_isolate->SetFilterETWSessionByURLCallback(
callback);
10950void Isolate::SetFilterETWSessionByURL2Callback(
10951 FilterETWSessionByURL2Callback
callback) {
10953 i_isolate->SetFilterETWSessionByURL2Callback(
callback);
10969 i::MicrotaskQueue::New(
reinterpret_cast<i::Isolate*
>(v8_isolate));
10977 :
MicrotasksScope(v8_context->GetIsolate(), v8_context->GetMicrotaskQueue(),
10983 : i_isolate_(reinterpret_cast<
i::
Isolate*>(v8_isolate)),
10986 : i_isolate_->default_microtask_queue()),
11033 : str_(nullptr),
length_(0) {
11041 if (!obj->ToString(context).ToLocal(&str))
return;
11042 length_ = str->Utf8LengthV2(v8_isolate);
11047 str->WriteUtf8V2(v8_isolate,
str_,
length_ + 1, flags);
11053 : str_(nullptr),
length_(0) {
11061 if (!
obj->
ToString(context).ToLocal(&str))
return;
11077 flat_str_ = Utils::ToLocal(i_flat_str);
11081 i::String::FlatContent flat_content = i_flat_str->GetFlatContent(*no_gc);
11082 DCHECK(flat_content.IsFlat());
11083 is_one_byte_ = flat_content.IsOneByte();
11084 length_ = flat_content.length();
11085 if (is_one_byte_) {
11086 data8_ = flat_content.ToOneByteVector().data();
11088 data16_ = flat_content.ToUC16Vector().data();
11094 DisallowGarbageCollectionInRelease* no_gc =
11095 reinterpret_cast<DisallowGarbageCollectionInRelease*
>(no_gc_debug_scope_);
11096 no_gc->~DisallowGarbageCollectionInRelease();
11102 "Called the one-byte accessor on a two-byte string view.");
11105 "Called the two-byte accessor on a one-byte string view.");
11109#define DEFINE_ERROR(NAME, name) \
11110 Local<Value> Exception::NAME(v8::Local<v8::String> raw_message, \
11111 v8::Local<v8::Value> raw_options) { \
11112 i::Isolate* i_isolate = i::Isolate::Current(); \
11113 API_RCS_SCOPE(i_isolate, NAME, New); \
11114 ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate); \
11115 i::Tagged<i::Object> error; \
11117 i::HandleScope scope(i_isolate); \
11118 i::DirectHandle<i::Object> options; \
11119 if (!raw_options.IsEmpty()) { \
11120 options = Utils::OpenDirectHandle(*raw_options); \
11122 auto message = Utils::OpenDirectHandle(*raw_message); \
11123 i::DirectHandle<i::JSFunction> constructor = \
11124 i_isolate->name##_function(); \
11125 error = *i_isolate->factory()->NewError(constructor, message, options); \
11127 return Utils::ToLocal(i::direct_handle(error, i_isolate)); \
11148 return Utils::MessageToLocal(
11154 if (!IsJSObject(*obj))
return {};
11156 i::Isolate* i_isolate = js_obj->GetIsolate();
11159 return Utils::StackTraceToLocal(stack_trace);
11164 auto i_isolate =
reinterpret_cast<i::Isolate*
>(context->GetIsolate());
11168 if (!IsJSObject(*obj))
return Just(
false);
11174 auto result = i::ErrorUtils::CaptureStackTrace(i_isolate, js_obj, mode, {});
11177 has_exception = !
result.ToHandle(&handle);
11184 i::Isolate* i_isolate =
object->GetIsolate();
11187 *is_key_value =
true;
11191 *is_key_value =
false;
11197 if (i::IsJSWeakCollection(*
object)) {
11198 *is_key_value = IsJSWeakMap(*
object);
11199 return Utils::ToLocal(i::JSWeakCollection::GetEntries(
11202 if (i::IsJSMapIterator(*
object)) {
11204 MapAsArrayKind
const kind =
11205 static_cast<MapAsArrayKind
>(it->map()->instance_type());
11206 *is_key_value =
kind == MapAsArrayKind::kEntries;
11208 return Utils::ToLocal(
11209 MapAsArray(i_isolate, it->table(), i::Smi::ToInt(it->index()),
kind));
11211 if (i::IsJSSetIterator(*
object)) {
11213 SetAsArrayKind
const kind =
11214 static_cast<SetAsArrayKind
>(it->map()->instance_type());
11215 *is_key_value =
kind == SetAsArrayKind::kEntries;
11217 return Utils::ToLocal(
11218 SetAsArray(i_isolate, it->table(), i::Smi::ToInt(it->index()),
kind));
11247 node->entry()->resource_name()));
11261 return reinterpret_cast<const i::ProfileNode*
>(
this)->line_number();
11276 unsigned int length)
const {
11287 return reinterpret_cast<const i::ProfileNode*
>(
this)->self_ticks();
11295 return reinterpret_cast<const i::ProfileNode*
>(
this)->source_type();
11299 return static_cast<int>(
11324 profiler->DeleteProfile(profile);
11336 return reinterpret_cast<const CpuProfileNode*
>(profile->top_down()->root());
11341 return reinterpret_cast<const CpuProfileNode*
>(profile->sample(index).node);
11349 return profile->
sample(index).timestamp.since_origin().InMicroseconds();
11354 return profile->
sample(index).state_tag;
11359 return profile->
sample(index).embedder_state_tag;
11380 "Unknown serialization format");
11382 "Invalid stream chunk size");
11388 return reinterpret_cast<const i::CpuProfile*
>(
this)->samples_count();
11395 reinterpret_cast<i::Isolate*
>(v8_isolate), naming_mode, logging_mode));
11399 unsigned max_samples,
11400 int sampling_interval_us,
11403 max_samples_(max_samples),
11404 sampling_interval_us_(sampling_interval_us) {
11405 if (!filter_context.
IsEmpty()) {
11406 Local<Context> local_filter_context = filter_context.ToLocalChecked();
11407 filter_context_.Reset(local_filter_context->GetIsolate(),
11408 local_filter_context);
11409 filter_context_.SetWeak();
11414 return reinterpret_cast<void*
>(
11426 const std::optional<uint64_t> trace_id) {
11427 i::CpuProfiler::CollectSample(
reinterpret_cast<i::Isolate*
>(v8_isolate),
11433 return reinterpret_cast<i::CpuProfiler*
>(
this)->set_sampling_interval(
11438 reinterpret_cast<i::CpuProfiler*
>(
this)->set_use_precise_sampling(
11439 use_precise_sampling);
11444 std::unique_ptr<DiscardedSamplesDelegate> delegate) {
11446 std::move(options), std::move(delegate));
11451 std::unique_ptr<DiscardedSamplesDelegate> delegate) {
11454 std::move(delegate));
11458 bool record_samples) {
11468 bool record_samples,
11469 unsigned max_samples) {
11477 std::unique_ptr<DiscardedSamplesDelegate> delegate) {
11478 return Start(title, std::move(options), std::move(delegate)).
status;
11482 bool record_samples) {
11488 bool record_samples,
11489 unsigned max_samples) {
11490 return Start(title, mode, record_samples, max_samples).
status;
11506 ->SetDetailedSourcePositionsForProfiling(
true);
11510 return reinterpret_cast<i::CodeEvent*
>(
this)->code_start_address;
11514 return reinterpret_cast<i::CodeEvent*
>(
this)->code_size;
11519 reinterpret_cast<i::CodeEvent*
>(
this)->function_name);
11528 return reinterpret_cast<i::CodeEvent*
>(
this)->script_line;
11532 return reinterpret_cast<i::CodeEvent*
>(
this)->script_column;
11536 return reinterpret_cast<i::CodeEvent*
>(
this)->code_type;
11540 return reinterpret_cast<i::CodeEvent*
>(
this)->comment;
11544 return reinterpret_cast<i::CodeEvent*
>(
this)->previous_code_start_address;
11548 switch (code_event_type) {
11552 case k##Name##Type: \
11572 ->StartListening(
this);
11592 switch (edge->
type()) {
11593 case i::HeapGraphEdge::kContextVariable:
11594 case i::HeapGraphEdge::kInternal:
11595 case i::HeapGraphEdge::kProperty:
11596 case i::HeapGraphEdge::kShortcut:
11597 case i::HeapGraphEdge::kWeak:
11600 case i::HeapGraphEdge::kElement:
11601 case i::HeapGraphEdge::kHidden:
11674 return static_cast<int>(
ToInternal(
this)->entries().size());
11683 return ToInternal(
this)->max_snapshot_js_object_id();
11689 "Unknown serialization format");
11691 "Invalid stream chunk size");
11701 return reinterpret_cast<i::HeapProfiler*
>(
this)->GetSnapshotsCount();
11709 DCHECK_EQ(isolate, profiler->isolate());
11722 return reinterpret_cast<i::HeapProfiler*
>(
this)->GetSnapshotObjectId(obj);
11726 return reinterpret_cast<i::HeapProfiler*
>(
this)->GetSnapshotObjectId(value);
11733 return Utils::ToLocal(obj);
11748 bool hide_internals,
11749 bool capture_numeric_value) {
11752 options.global_object_name_resolver = resolver;
11755 options.numerics_mode = capture_numeric_value
11768 track_allocations);
11776 int64_t* timestamp_us) {
11785 sample_interval, stack_depth, flags);
11802 CHECK(data->IsValue());
11807 BuildEmbedderGraphCallback
callback,
void* data) {
11813 BuildEmbedderGraphCallback
callback,
void* data) {
11836 : embedder_state_(new internal::EmbedderState(v8_isolate, context, tag)) {}
11844#ifdef V8_HOST_ARCH_64_BIT
11848 *
reinterpret_cast<uint64_t*
>(
slot()));
11853 : address_(address), type_info_(type_info) {
11859 unsigned int arg_count,
const CTypeInfo* arg_info,
11861 : return_info_(return_info),
11863 arg_count_(arg_count),
11864 arg_info_(arg_info) {
11879namespace api_internal {
11884 if (i::IsFunctionTemplateInfo(*target)) {
11888 return Utils::ToLocal(data);
11890 }
else if (i::IsJSFunction(*target)) {
11892 auto shared = target_func->shared();
11893 if (shared->IsApiFunction()) {
11895 shared->api_func_data()->callback_data(
kAcquireLoad), i_isolate);
11896 return Utils::ToLocal(data);
11900 "Target function is not an Api function");
11906 :
pc(nullptr), sp(nullptr), fp(nullptr), lr(nullptr) {}
11912 if (&other !=
this) {
11917 if (other.callee_saved) {
11920 std::make_unique<CalleeSavedRegisters>(*(other.callee_saved));
11929#if !V8_ENABLE_WEBASSEMBLY
11964 FATAL(
"WebAssembly is disabled");
11968namespace internal {
11971 offsetof(HandleScopeImplementer, entered_contexts_);
11978 MemCopy(storage,
this,
sizeof(*
this));
11981 current->Initialize();
11991 MemCopy(
this, storage,
sizeof(*
this));
11998 bool found_block_before_persistent =
false;
12001 for (
int i =
static_cast<int>(
blocks()->
size()) - 2;
i >= 0; --
i) {
12011 reinterpret_cast<Address>(block))) {
12015 DCHECK(!found_block_before_persistent);
12017 found_block_before_persistent =
true;
12027 found_block_before_persistent);
12030 if (!
blocks()->empty()) {
12077 }
while (block_start != first_block);
12084 DCHECK(!ph->blocks_.empty());
12085 std::swap(ph->blocks_.front(), ph->blocks_.back());
12088 block_start = ph->blocks_.back();
12102 RCS_SCOPE(i_isolate, RuntimeCallCounterId::kAccessorGetterCallback);
12112 accessor_info->getter(i_isolate));
12134 CHECK(IsFunctionTemplateInfo(target));
12138inline void InvokeFunctionCallback(
12141 RCS_SCOPE(i_isolate, RuntimeCallCounterId::kFunctionCallback);
12150 handle(fti, i_isolate))) {
12174 info.IsConstructCall()
12195 i::Isolate* i_isolate = finalization_registry->native_context()->GetIsolate();
12197 RuntimeCallCounterId::kFinalizationRegistryCleanupFromTask);
12249 return !std::isnan(d) && d != 0;
12253#undef SET_FIELD_WRAPPED
12255#undef CALLBACK_SETTER
12257template <
typename T>
12263 if (info.Length() > 0) {
12264 CHECK(info[0]->IsValue());
12265 CHECK(info[info.Length() - 1]->IsValue());
12267 auto* i_isolate =
reinterpret_cast<i::Isolate*
>(info.GetIsolate());
12270 CHECK(info.This()->IsObject());
12271 CHECK(!info.Data().IsEmpty());
12272 CHECK(info.GetReturnValue().Get()->IsValue());
12276template <
typename T>
12278 auto* i_isolate =
reinterpret_cast<i::Isolate*
>(info.GetIsolate());
12280 CHECK(info.This()->IsValue());
12281 CHECK(info.HolderV2()->IsObject());
12286 CHECK(info.Holder()->IsObject());
12292 CHECK(info.Data()->IsValue());
12293 USE(info.ShouldThrowOnError());
12294 if (!std::is_same_v<T, void>) {
12295 CHECK(info.GetReturnValue().Get()->IsValue());
12343#ifdef V8_ENABLE_MEMORY_ACCOUNTING_CHECKS
12344 DCHECK_EQ(amount_of_external_memory_, 0U);
12350#if V8_ENABLE_MEMORY_ACCOUNTING_CHECKS
12351 amount_of_external_memory_ =
12352 std::exchange(other.amount_of_external_memory_, 0U);
12353 isolate_ = std::exchange(other.isolate_,
nullptr);
12359#if V8_ENABLE_MEMORY_ACCOUNTING_CHECKS
12360 if (
this == &other) {
12363 DCHECK_EQ(amount_of_external_memory_, 0U);
12364 amount_of_external_memory_ =
12365 std::exchange(other.amount_of_external_memory_, 0U);
12366 isolate_ = std::exchange(other.isolate_,
nullptr);
12372#ifdef V8_ENABLE_MEMORY_ACCOUNTING_CHECKS
12375 amount_of_external_memory_ +=
size;
12377 isolate->AdjustAmountOfExternalAllocatedMemoryImpl(
12378 static_cast<int64_t
>(size));
12382#ifdef V8_ENABLE_MEMORY_ACCOUNTING_CHECKS
12384 DCHECK_GE(
static_cast<int64_t
>(amount_of_external_memory_), -delta);
12386 amount_of_external_memory_ += delta;
12388 isolate->AdjustAmountOfExternalAllocatedMemoryImpl(delta);
12396#ifdef V8_ENABLE_MEMORY_ACCOUNTING_CHECKS
12398 DCHECK_GE(amount_of_external_memory_, size);
12399 amount_of_external_memory_ -=
size;
12414TryToCopyAndConvertArrayToCppBuffer<CTypeInfoBuilder<int32_t>::Build().GetId(),
12416 uint32_t max_length) {
12424TryToCopyAndConvertArrayToCppBuffer<CTypeInfoBuilder<uint32_t>::Build().GetId(),
12425 uint32_t>(Local<Array> src, uint32_t* dst,
12426 uint32_t max_length) {
12434TryToCopyAndConvertArrayToCppBuffer<CTypeInfoBuilder<float>::Build().GetId(),
12435 float>(Local<Array> src,
float* dst,
12436 uint32_t max_length) {
12444TryToCopyAndConvertArrayToCppBuffer<CTypeInfoBuilder<double>::Build().GetId(),
12445 double>(Local<Array> src,
double* dst,
12446 uint32_t max_length) {
12454#ifdef ENABLE_SLOW_DCHECKS
#define INTERCEPTOR_INFO_CALLBACK_LIST(V)
#define PREPARE_FOR_EXECUTION(context, class_name, function_name)
#define RETURN_ON_FAILED_EXECUTION_PRIMITIVE(T)
#define RETURN_ON_FAILED_EXECUTION(T)
#define DCHECK_NO_SCRIPT_NO_EXCEPTION(i_isolate)
#define ENTER_V8_FOR_NEW_CONTEXT(i_isolate)
#define ENTER_V8_BASIC(i_isolate)
#define ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate)
#define API_RCS_SCOPE(i_isolate, class_name, function_name)
#define ENTER_V8_NO_SCRIPT(i_isolate, context, class_name, function_name, HandleScopeClass)
#define RETURN_ESCAPED(value)
#define ENTER_V8(i_isolate, context, class_name, function_name, HandleScopeClass)
#define DEFINE_ERROR(NAME, name)
#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype)
#define VALUE_IS_SPECIFIC_TYPE(Type, Check)
#define SET_FIELD_WRAPPED(i_isolate, obj, setter, cdata, tag)
#define SYMBOL_GETTER(Name, name)
#define CALLBACK_SETTER(ExternalName, Type, InternalName)
#define WELL_KNOWN_SYMBOLS(V)
#define CHECK_TYPED_ARRAY_CAST(Type, typeName, TYPE, ctype)
#define TIME_ZONE_DETECTION_ASSERT_EQ(value)
#define VALUE_IS_TYPED_ARRAY(Type, typeName, TYPE, ctype)
#define NEW_STRING(v8_isolate, class_name, function_name, Char, data, type, length)
#define SET_CALLBACK_FIELD(Name, name)
#define TYPED_ARRAY_NEW(Type, type, TYPE, ctype)
#define REGEXP_FLAG_ASSERT_EQ(flag)
RegisterAllocator * allocator_
uint8_t data_[MAX_STACK_LENGTH]
union v8::internal::@341::BuiltinMetadata::KindSpecificData data
#define SBXCHECK(condition)
#define SLOW_DCHECK(condition)
static bool IsOnStack(const void *slot)
static const int kNoPreviousCharacter
static const int kMaxExtraUtf8BytesForOneUtf16CodeUnit
static bool IsSurrogatePair(int lead, int trail)
static bool IsTrailSurrogate(int code)
static bool IsLeadSurrogate(int code)
static unsigned Length(uchar chr, int previous)
static const unsigned kMaxEncodedSize
static unsigned EncodeOneByte(char *out, uint8_t c)
static unsigned Encode(char *out, uchar c, int previous, bool replace_invalid=false)
Local< ArrayBuffer > Buffer()
v8::MemorySpan< uint8_t > GetContents(v8::MemorySpan< uint8_t > storage)
size_t CopyContents(void *dest, size_t byte_length)
static void CheckCast(Value *obj)
static Allocator * NewDefaultAllocator()
virtual size_t MaxAllocationSize() const
size_t MaxByteLength() const
static MaybeLocal< ArrayBuffer > MaybeNew(Isolate *isolate, size_t byte_length, BackingStoreInitializationMode initialization_mode=BackingStoreInitializationMode::kZeroInitialized)
static std::unique_ptr< BackingStore > NewResizableBackingStore(size_t byte_length, size_t max_byte_length)
static Local< ArrayBuffer > New(Isolate *isolate, size_t byte_length, BackingStoreInitializationMode initialization_mode=BackingStoreInitializationMode::kZeroInitialized)
static std::unique_ptr< BackingStore > NewBackingStore(Isolate *isolate, size_t byte_length, BackingStoreInitializationMode initialization_mode=BackingStoreInitializationMode::kZeroInitialized, BackingStoreOnFailureMode on_failure=BackingStoreOnFailureMode::kOutOfMemory)
V8_WARN_UNUSED_RESULT Maybe< bool > Detach(v8::Local< v8::Value > key)
void SetDetachKey(v8::Local< v8::Value > key)
bool IsDetachable() const
bool IsResizableByUserJavaScript() const
std::shared_ptr< BackingStore > GetBackingStore()
static constexpr size_t kMaxByteLength
static void CheckCast(Value *obj)
size_t ByteLength() const
CallbackResult(*)(uint32_t index, Local< Value > element, void *data) IterationCallback
static Local< Array > New(Isolate *isolate, int length=0)
Maybe< void > Iterate(Local< Context > context, IterationCallback callback, void *callback_data)
static void CheckCast(Value *obj)
void(*)(void *data, size_t length, void *deleter_data) DeleterCallback
size_t MaxByteLength() const
size_t ByteLength() const
bool IsResizableByUserJavaScript() const
static void EmptyDeleter(void *data, size_t length, void *deleter_data)
Local< BigInt > ValueOf() const
static void CheckCast(Value *obj)
static Local< Value > New(Isolate *isolate, int64_t value)
uint64_t Uint64Value(bool *lossless=nullptr) const
static void CheckCast(v8::Data *that)
static Local< BigInt > New(Isolate *isolate, int64_t value)
int64_t Int64Value(bool *lossless=nullptr) const
static Local< BigInt > NewFromUnsigned(Isolate *isolate, uint64_t value)
static MaybeLocal< BigInt > NewFromWords(Local< Context > context, int sign_bit, int word_count, const uint64_t *words)
void ToWordsArray(int *sign_bit, int *word_count, uint64_t *words) const
static void CheckCast(Value *obj)
static Local< Value > New(Isolate *isolate, bool value)
static void CheckCast(v8::Data *that)
const CTypeInfo * arg_info_
const CTypeInfo & ArgumentInfo(unsigned int index) const
const unsigned int arg_count_
unsigned int ArgumentCount() const
CFunctionInfo(const CTypeInfo &return_info, unsigned int arg_count, const CTypeInfo *arg_info, Int64Representation repr=Int64Representation::kNumber)
const void * GetAddress() const
const CFunctionInfo * GetTypeInfo() const
const CFunctionInfo * type_info_
static constexpr Type kCallbackOptionsType
constexpr Identifier GetId() const
virtual ~CodeEventHandler()
void * internal_listener_
CodeEventType GetCodeType()
uintptr_t GetCodeStartAddress()
Local< String > GetFunctionName()
static const char * GetCodeEventTypeName(CodeEventType code_event_type)
uintptr_t GetPreviousCodeStartAddress()
const char * GetComment()
Local< String > GetScriptName()
std::vector< int > GetCompileHints(Isolate *isolate) const
const std::shared_ptr< internal::wasm::NativeModule > native_module_
CompiledWasmModule(std::shared_ptr< internal::wasm::NativeModule >, const char *source_url, size_t url_length)
MemorySpan< const uint8_t > GetWireBytesRef()
const std::string & source_url() const
ContainsOnlyOneByteHelper & operator=(const ContainsOnlyOneByteHelper &)=delete
void VisitOneByteString(const uint8_t *chars, int length)
ContainsOnlyOneByteHelper()
ContainsOnlyOneByteHelper(const ContainsOnlyOneByteHelper &)=delete
void VisitTwoByteString(const uint16_t *chars, int length)
bool CheckCons(i::Tagged< i::ConsString > cons_string)
bool Check(i::Tagged< i::String > string)
BackupIncumbentScope(Local< Context > backup_incumbent_context)
const BackupIncumbentScope * prev_
Local< Context > backup_incumbent_context_
uintptr_t js_stack_comparable_address_
static Local< Context > New(Isolate *isolate, ExtensionConfiguration *extensions=nullptr, MaybeLocal< ObjectTemplate > global_template=MaybeLocal< ObjectTemplate >(), MaybeLocal< Value > global_object=MaybeLocal< Value >(), DeserializeInternalFieldsCallback internal_fields_deserializer=DeserializeInternalFieldsCallback(), MicrotaskQueue *microtask_queue=nullptr, DeserializeContextDataCallback context_data_deserializer=DeserializeContextDataCallback(), DeserializeAPIWrapperCallback api_wrapper_deserializer=DeserializeAPIWrapperCallback())
void SetErrorMessageForWasmCodeGeneration(Local< String > message)
void SetEmbedderData(int index, Local< Value > value)
void SetPromiseHooks(Local< Function > init_hook, Local< Function > before_hook, Local< Function > after_hook, Local< Function > resolve_hook)
void SetSecurityToken(Local< Value > token)
MicrotaskQueue * GetMicrotaskQueue()
static void CheckCast(Data *obj)
bool IsCodeGenerationFromStringsAllowed() const
V8_INLINE void * GetAlignedPointerFromEmbedderData(Isolate *isolate, int index)
void SetAlignedPointerInEmbedderData(int index, void *value)
void * SlowGetAlignedPointerFromEmbedderData(int index)
void(*)(Isolate *isolate, Local< Context > context) AbortScriptExecutionCallback
Local< Value > SlowGetEmbedderData(int index)
void SetAbortScriptExecution(AbortScriptExecutionCallback callback)
Maybe< void > DeepFreeze(DeepFreezeDelegate *delegate=nullptr)
bool HasTemplateLiteralObject(Local< Value > object)
void AllowCodeGenerationFromStrings(bool allow)
Local< Value > GetSecurityToken()
void SetErrorMessageForCodeGenerationFromStrings(Local< String > message)
V8_INLINE MaybeLocal< T > GetDataFromSnapshotOnce(size_t index)
uint32_t GetNumberOfEmbedderDataFields()
V8_INLINE Local< Value > GetEmbedderData(int index)
void SetMicrotaskQueue(MicrotaskQueue *queue)
Local< Object > GetExtrasBindingObject()
void UseDefaultSecurityToken()
static MaybeLocal< Object > NewRemoteContext(Isolate *isolate, Local< ObjectTemplate > global_template, MaybeLocal< Value > global_object=MaybeLocal< Value >())
static MaybeLocal< Context > FromSnapshot(Isolate *isolate, size_t context_snapshot_index, DeserializeInternalFieldsCallback internal_fields_deserializer=DeserializeInternalFieldsCallback(), ExtensionConfiguration *extensions=nullptr, MaybeLocal< Value > global_object=MaybeLocal< Value >(), MicrotaskQueue *microtask_queue=nullptr, DeserializeContextDataCallback context_data_deserializer=DeserializeContextDataCallback(), DeserializeAPIWrapperCallback api_wrapper_deserializer=DeserializeAPIWrapperCallback())
static std::unique_ptr< CppHeap > Create(v8::Platform *platform, const CppHeapCreateParams ¶ms)
const CpuProfileNode * GetChild(int index) const
bool GetLineTicks(LineTick *entries, unsigned int length) const
const CpuProfileNode * GetParent() const
unsigned GetHitCount() const
unsigned int GetHitLineCount() const
int GetLineNumber() const
unsigned GetNodeId() const
const char * GetScriptResourceNameStr() const
const char * GetFunctionNameStr() const
static const int kNoColumnNumberInfo
const std::vector< CpuProfileDeoptInfo > & GetDeoptInfos() const
int GetColumnNumber() const
Local< String > GetFunctionName() const
Local< String > GetScriptResourceName() const
static const int kNoLineNumberInfo
const char * GetBailoutReason() const
SourceType GetSourceType() const
bool IsScriptSharedCrossOrigin() const
int GetChildrenCount() const
const CpuProfileNode * GetTopDownRoot() const
int GetSamplesCount() const
StateTag GetSampleState(int index) const
Local< String > GetTitle() const
int64_t GetEndTime() const
const CpuProfileNode * GetSample(int index) const
int64_t GetSampleTimestamp(int index) const
int64_t GetStartTime() const
EmbedderStateTag GetSampleEmbedderState(int index) const
void Serialize(OutputStream *stream, SerializationFormat format=kJSON) const
CpuProfilingResult Start(CpuProfilingOptions options, std::unique_ptr< DiscardedSamplesDelegate > delegate=nullptr)
CpuProfilingStatus StartProfiling(Local< String > title, CpuProfilingOptions options, std::unique_ptr< DiscardedSamplesDelegate > delegate=nullptr)
void SetUsePreciseSampling(bool)
static CpuProfiler * New(Isolate *isolate, CpuProfilingNamingMode=kDebugNaming, CpuProfilingLoggingMode=kLazyLogging)
static void CollectSample(Isolate *isolate, const std::optional< uint64_t > trace_id=std::nullopt)
CpuProfile * StopProfiling(Local< String > title)
void SetSamplingInterval(int us)
static void UseDetailedSourcePositionsForProfiling(Isolate *isolate)
CpuProfile * Stop(ProfilerId id)
Global< Context > filter_context_
void * raw_filter_context() const
static const unsigned kNoSampleLimit
CpuProfilingOptions(CpuProfilingMode mode=kLeafNodeLineNumbers, unsigned max_samples=kNoSampleLimit, int sampling_interval_us=0, MaybeLocal< Context > filter_context=MaybeLocal< Context >())
static void CheckCast(Value *obj)
static Local< DataView > New(Local< ArrayBuffer > array_buffer, size_t byte_offset, size_t length)
bool IsModuleRequest() const
bool IsFunctionTemplate() const
bool IsFixedArray() const
bool IsObjectTemplate() const
static V8_WARN_UNUSED_RESULT MaybeLocal< Value > New(Local< Context > context, double time)
v8::Local< v8::String > ToISOString() const
v8::Local< v8::String > ToUTCString() const
static V8_WARN_UNUSED_RESULT MaybeLocal< Value > Parse(Local< Context > context, Local< String > date_string)
static void CheckCast(Value *obj)
static void CheckCast(Data *that)
static Local< DictionaryTemplate > New(Isolate *isolate, MemorySpan< const std::string_view > names)
V8_WARN_UNUSED_RESULT Local< Object > NewInstance(Local< Context > context, MemorySpan< MaybeLocal< Value > > property_values)
virtual Node * V8Node(const v8::Local< v8::Value > &value)=0
EmbedderStateScope(Isolate *isolate, Local< v8::Context > context, EmbedderStateTag tag)
internal::Address * EscapeSlot(internal::Address *escape_value)
EscapableHandleScopeBase(Isolate *isolate)
internal::Address * escape_slot_
static Local< Message > CreateMessage(Isolate *isolate, Local< Value > exception)
static Maybe< bool > CaptureStackTrace(Local< Context > context, Local< Object > object)
static Local< StackTrace > GetStackTrace(Local< Value > exception)
static Local< Value > Error(Local< String > message, Local< Value > options={})
String::ExternalOneByteStringResource * source_
Extension(const char *name, const char *source=nullptr, int dep_count=0, const char **deps=nullptr, int source_length=-1)
void Decrease(Isolate *isolate, size_t size)
ExternalMemoryAccounter()=default
void Update(Isolate *isolate, int64_t delta)
static int64_t GetTotalAmountOfExternalAllocatedMemoryForTesting(const Isolate *isolate)
ExternalMemoryAccounter & operator=(ExternalMemoryAccounter &&)
~ExternalMemoryAccounter()
void Increase(Isolate *isolate, size_t size)
static Local< External > New(Isolate *isolate, void *value)
static void CheckCast(v8::Value *obj)
static void CheckCast(Data *obj)
Local< Data > Get(Local< Context > context, int i) const
static constexpr size_t kMaxLength
static void CheckCast(Value *obj)
static Local< Float16Array > New(Local< ArrayBuffer > array_buffer, size_t byte_offset, size_t length)
void SetExceptionContext(ExceptionContext context)
Local< ObjectTemplate > PrototypeTemplate()
V8_WARN_UNUSED_RESULT MaybeLocal< Function > GetFunction(Local< Context > context)
void SetCallHandler(FunctionCallback callback, Local< Value > data=Local< Value >(), SideEffectType side_effect_type=SideEffectType::kHasSideEffect, const MemorySpan< const CFunction > &c_function_overloads={})
static Local< FunctionTemplate > NewWithCache(Isolate *isolate, FunctionCallback callback, Local< Private > cache_property, Local< Value > data=Local< Value >(), Local< Signature > signature=Local< Signature >(), int length=0, SideEffectType side_effect_type=SideEffectType::kHasSideEffect)
static Local< FunctionTemplate > New(Isolate *isolate, FunctionCallback callback=nullptr, Local< Value > data=Local< Value >(), Local< Signature > signature=Local< Signature >(), int length=0, ConstructorBehavior behavior=ConstructorBehavior::kAllow, SideEffectType side_effect_type=SideEffectType::kHasSideEffect, const CFunction *c_function=nullptr, uint16_t instance_type=0, uint16_t allowed_receiver_instance_type_range_start=0, uint16_t allowed_receiver_instance_type_range_end=0)
void SetClassName(Local< String > name)
void SetLength(int length)
void SetAcceptAnyReceiver(bool value)
static Local< FunctionTemplate > NewWithCFunctionOverloads(Isolate *isolate, FunctionCallback callback=nullptr, Local< Value > data=Local< Value >(), Local< Signature > signature=Local< Signature >(), int length=0, ConstructorBehavior behavior=ConstructorBehavior::kAllow, SideEffectType side_effect_type=SideEffectType::kHasSideEffect, const MemorySpan< const CFunction > &c_function_overloads={})
void SealAndPrepareForPromotionToReadOnly()
bool HasInstance(Local< Value > object)
bool IsLeafTemplateForApiObject(v8::Local< v8::Value > value) const
V8_WARN_UNUSED_RESULT MaybeLocal< Object > NewRemoteInstance()
static void CheckCast(Data *that)
void SetPrototypeProviderTemplate(Local< FunctionTemplate > prototype_provider)
void Inherit(Local< FunctionTemplate > parent)
void SetInterfaceName(Local< String > name)
Local< ObjectTemplate > InstanceTemplate()
Local< Value > GetName() const
V8_WARN_UNUSED_RESULT bool Experimental_IsNopFunction() const
static MaybeLocal< Function > New(Local< Context > context, FunctionCallback callback, Local< Value > data=Local< Value >(), int length=0, ConstructorBehavior behavior=ConstructorBehavior::kAllow, SideEffectType side_effect_type=SideEffectType::kHasSideEffect)
Local< Value > GetInferredName() const
V8_WARN_UNUSED_RESULT MaybeLocal< String > FunctionProtoToString(Local< Context > context)
int GetScriptLineNumber() const
ScriptOrigin GetScriptOrigin() const
int GetScriptColumnNumber() const
static void CheckCast(Value *obj)
void SetName(Local< String > name)
Local< Value > GetBoundFunction() const
V8_WARN_UNUSED_RESULT MaybeLocal< Value > Call(v8::Isolate *isolate, Local< Context > context, Local< Value > recv, int argc, Local< Value > argv[])
Location GetScriptLocation() const
static const int kLineOffsetNotFound
V8_WARN_UNUSED_RESULT MaybeLocal< Object > NewInstance(Local< Context > context, int argc, Local< Value > argv[]) const
Local< Value > GetDebugName() const
int GetScriptStartPosition() const
V8_WARN_UNUSED_RESULT MaybeLocal< Object > NewInstanceWithSideEffectType(Local< Context > context, int argc, Local< Value > argv[], SideEffectType side_effect_type=SideEffectType::kHasSideEffect) const
V8_INLINE Isolate * GetIsolate() const
internal::Address * prev_next_
void Initialize(Isolate *isolate)
internal::Isolate * i_isolate_
static int NumberOfHandles(Isolate *isolate)
V8_INLINE HandleScope()=default
internal::Address * prev_limit_
static internal::Address * CreateHandleForCurrentIsolate(internal::Address value)
static internal::Address * CreateHandle(internal::Isolate *i_isolate, internal::Address value)
size_t code_and_metadata_size_
size_t external_script_source_size_
size_t bytecode_and_metadata_size_
size_t cpu_profiler_metadata_size_
const HeapGraphNode * GetToNode() const
const HeapGraphNode * GetFromNode() const
Local< Value > GetName() const
Local< String > GetName() const
SnapshotObjectId GetId() const
const HeapGraphEdge * GetChild(int index) const
size_t GetShallowSize() const
int GetChildrenCount() const
const char * object_type_
const char * object_sub_type_
void StartTrackingHeapObjects(bool track_allocations=false)
void SetGetDetachednessCallback(GetDetachednessCallback callback, void *data)
EmbedderGraph::Node::Detachedness(*)( v8::Isolate *isolate, const v8::Local< v8::Value > &v8_value, uint16_t class_id, void *data) GetDetachednessCallback
Local< Value > FindObjectById(SnapshotObjectId id)
AllocationProfile * GetAllocationProfile()
void RemoveBuildEmbedderGraphCallback(BuildEmbedderGraphCallback callback, void *data)
static const SnapshotObjectId kUnknownObjectId
void AddBuildEmbedderGraphCallback(BuildEmbedderGraphCallback callback, void *data)
std::vector< v8::Local< v8::Value > > GetDetachedJSWrapperObjects()
void DeleteAllHeapSnapshots()
bool StartSamplingHeapProfiler(uint64_t sample_interval=512 *1024, int stack_depth=16, SamplingFlags flags=kSamplingNoFlags)
const char * CopyNameForHeapSnapshot(const char *name)
void QueryObjects(v8::Local< v8::Context > context, QueryObjectPredicate *predicate, std::vector< v8::Global< v8::Object > > *objects)
SnapshotObjectId GetObjectId(Local< Value > value)
void StopSamplingHeapProfiler()
const HeapSnapshot * TakeHeapSnapshot(const HeapSnapshotOptions &options=HeapSnapshotOptions())
const HeapSnapshot * GetHeapSnapshot(int index)
SnapshotObjectId GetHeapStats(OutputStream *stream, int64_t *timestamp_us=nullptr)
void StopTrackingHeapObjects()
const HeapGraphNode * GetNodeById(SnapshotObjectId id) const
int GetNodesCount() const
const HeapGraphNode * GetRoot() const
SnapshotObjectId GetMaxSnapshotJSObjectId() const
const HeapGraphNode * GetNode(int index) const
void Serialize(OutputStream *stream, SerializationFormat format=kJSON) const
size_t physical_space_size_
size_t space_available_size_
size_t total_available_size_
size_t total_heap_size_executable_
size_t number_of_detached_contexts_
size_t peak_malloced_memory_
size_t total_global_handles_size_
size_t total_physical_size_
size_t used_global_handles_size_
size_t number_of_native_contexts_
static void CheckCast(v8::Data *that)
static void CheckCast(v8::Data *that)
static Local< Integer > New(Isolate *isolate, int32_t value)
static Local< Integer > NewFromUnsigned(Isolate *isolate, uint32_t value)
V8_INLINE Local< T > Escape(Local< T > value)
internal::IsolateGroup * isolate_group_
static bool CanCreateNewGroups()
static IsolateGroup Create()
static IsolateGroup GetDefault()
IsolateGroup(IsolateGroup &&other)
IsolateGroup & operator=(IsolateGroup &&other)
bool was_execution_allowed_throws_
~AllowJavascriptExecutionScope()
bool was_execution_allowed_dump_
bool was_execution_allowed_assert_
AllowJavascriptExecutionScope(Isolate *isolate)
const OnFailure on_failure_
~DisallowJavascriptExecutionScope()
bool was_execution_allowed_
DisallowJavascriptExecutionScope(Isolate *isolate, OnFailure on_failure)
SuppressMicrotaskExecutionScope(Isolate *isolate, MicrotaskQueue *microtask_queue=nullptr)
internal::Isolate *const i_isolate_
~SuppressMicrotaskExecutionScope()
internal::MicrotaskQueue *const microtask_queue_
void RemoveMessageListeners(MessageCallback that)
void RemoveGCEpilogueCallback(GCCallback callback)
void SetCaptureStackTraceForUncaughtExceptions(bool capture, int frame_limit=10, StackTrace::StackTraceOptions options=StackTrace::kOverview)
bool GetHeapCodeAndMetadataStatistics(HeapCodeStatistics *object_statistics)
HeapProfiler * GetHeapProfiler()
void SetFatalErrorHandler(FatalErrorCallback that)
bool MeasureMemory(std::unique_ptr< MeasureMemoryDelegate > delegate, MeasureMemoryExecution execution=MeasureMemoryExecution::kDefault)
void IsolateInBackgroundNotification()
size_t NumberOfTrackedHeapObjectTypes()
void LocaleConfigurationChangeNotification()
bool AddMessageListener(MessageCallback that, Local< Value > data=Local< Value >())
void AddBeforeCallEnteredCallback(BeforeCallEnteredCallback callback)
static Isolate * Allocate()
void RemoveMicrotasksCompletedCallback(MicrotasksCompletedCallbackWithData callback, void *data=nullptr)
void(*)(std::unique_ptr< CppHeap >) ReleaseCppHeapCallback
bool GetHeapSpaceStatistics(HeapSpaceStatistics *space_statistics, size_t index)
void SetEventLogger(LogEventCallback that)
void SetExceptionPropagationCallback(ExceptionPropagationCallback callback)
void RemoveNearHeapLimitCallback(NearHeapLimitCallback callback, size_t heap_limit)
V8_INLINE MaybeLocal< T > GetDataFromSnapshotOnce(size_t index)
CppHeap * GetCppHeap() const
size_t(*)() GetExternallyAllocatedMemoryInBytesCallback
void SetAddCrashKeyCallback(AddCrashKeyCallback)
void GetCodeRange(void **start, size_t *length_in_bytes)
void RemoveCallCompletedCallback(CallCompletedCallback callback)
size_t CopyCodePages(size_t capacity, MemoryRange *code_pages_out)
int ContextDisposedNotification(bool dependant_context=true)
bool HasPendingException()
void RequestGarbageCollectionForTesting(GarbageCollectionType type)
void SetMemorySaverMode(bool memory_saver_mode_enabled)
@ kMinorGarbageCollection
void SetHostImportModuleDynamicallyCallback(HostImportModuleDynamicallyCallback callback)
bool GetHeapObjectStatisticsAtLastGC(HeapObjectStatistics *object_statistics, size_t type_index)
void HandleExternalMemoryInterrupt()
void SetMicrotasksPolicy(MicrotasksPolicy policy)
Local< Context > GetIncumbentContext()
bool AddMessageListenerWithErrorLevel(MessageCallback that, int message_levels, Local< Value > data=Local< Value >())
void SetPromiseRejectCallback(PromiseRejectCallback callback)
void SetPromiseHook(PromiseHook hook)
void GetEmbeddedCodeRange(const void **start, size_t *length_in_bytes)
void SetJitCodeEventHandler(JitCodeEventOptions options, JitCodeEventHandler event_handler)
void IncreaseHeapLimitForDebugging()
void CancelTerminateExecution()
void InstallConditionalFeatures(Local< Context > context)
void SetOOMErrorHandler(OOMErrorCallback that)
void SetHostCreateShadowRealmContextCallback(HostCreateShadowRealmContextCallback callback)
void EnqueueMicrotask(Local< Function > microtask)
void SetIsLoading(bool is_loading)
void AddGCPrologueCallback(GCCallback callback, GCType gc_type_filter=kGCTypeAll)
void RemoveGCPrologueCallback(GCCallback callback)
void SetPriority(Priority priority)
void SetBatterySaverMode(bool battery_saver_mode_enabled)
void DateTimeConfigurationChangeNotification(TimeZoneDetection time_zone_detection=TimeZoneDetection::kSkip)
bool IsHeapLimitIncreasedForDebugging()
void AddCallCompletedCallback(CallCompletedCallback callback)
void GetStackSample(const RegisterState &state, void **frames, size_t frames_limit, SampleInfo *sample_info)
void SetEmbedderRootsHandler(EmbedderRootsHandler *handler)
void RemoveBeforeCallEnteredCallback(BeforeCallEnteredCallback callback)
void RequestInterrupt(InterruptCallback callback, void *data)
void SetIdle(bool is_idle)
std::string GetDefaultLocale()
void PerformMicrotaskCheckpoint()
int64_t AdjustAmountOfExternalAllocatedMemoryImpl(int64_t change_in_bytes)
void SetAllowAtomicsWait(bool allow)
static Isolate * TryGetCurrent()
Local< Value > ThrowError(const char(&message)[N])
void SetPrepareStackTraceCallback(PrepareStackTraceCallback callback)
int64_t AdjustAmountOfExternalAllocatedMemory(int64_t change_in_bytes)
void LowMemoryNotification()
Local< Context > GetEnteredOrMicrotaskContext()
void SetCounterFunction(CounterLookupCallback)
MicrotasksPolicy GetMicrotasksPolicy() const
void SetFailedAccessCheckCallbackFunction(FailedAccessCheckCallback)
static Isolate * New(const CreateParams ¶ms)
void RestoreOriginalHeapLimit()
void(*)(Isolate *isolate, GCType type, GCCallbackFlags flags, void *data) GCCallbackWithData
void AddGCEpilogueCallback(GCCallback callback, GCType gc_type_filter=kGCTypeAll)
bool HasPendingBackgroundTasks()
void DiscardThreadSpecificMetadata()
bool(*)(Isolate *) AbortOnUncaughtExceptionCallback
void AddMicrotasksCompletedCallback(MicrotasksCompletedCallbackWithData callback, void *data=nullptr)
void TerminateExecution()
static void Initialize(Isolate *isolate, const CreateParams ¶ms)
void AutomaticallyRestoreInitialHeapLimit(double threshold_percent=0.5)
Local< Value > ThrowException(Local< Value > exception)
void SetHostInitializeImportMetaObjectCallback(HostInitializeImportMetaObjectCallback callback)
void SetUseCounterCallback(UseCounterCallback callback)
Local< Value > GetContinuationPreservedEmbedderData()
size_t NumberOfHeapSpaces()
void GetHeapStatistics(HeapStatistics *heap_statistics)
void SetStackLimit(uintptr_t stack_limit)
void SetContinuationPreservedEmbedderData(Local< Value > data)
void(*)(Isolate *isolate, GCType type, GCCallbackFlags flags) GCCallback
void SetMetricsRecorder(const std::shared_ptr< metrics::Recorder > &metrics_recorder)
void MemoryPressureNotification(MemoryPressureLevel level)
void SetAddHistogramSampleFunction(AddHistogramSampleCallback)
void AddNearHeapLimitCallback(NearHeapLimitCallback callback, void *data)
IsolateGroup GetGroup() const
void SetGetExternallyAllocatedMemoryInBytesCallback(GetExternallyAllocatedMemoryInBytesCallback callback)
JSEntryStubs GetJSEntryStubs()
bool IsExecutionTerminating()
ArrayBuffer::Allocator * GetArrayBufferAllocator()
Local< Context > GetCurrentContext()
void SetReleaseCppHeapCallbackForTesting(ReleaseCppHeapCallback callback)
void IsolateInForegroundNotification()
void SetAbortOnUncaughtExceptionCallback(AbortOnUncaughtExceptionCallback callback)
void ClearCachesForTesting()
void SetHostImportModuleWithPhaseDynamicallyCallback(HostImportModuleWithPhaseDynamicallyCallback callback)
void(*)(Isolate *isolate, UseCounterFeature feature) UseCounterCallback
void SetCreateHistogramFunction(CreateHistogramCallback)
static Isolate * GetCurrent()
void Freeze(bool is_frozen)
MaybeLocal< Data > GetCurrentHostDefinedOptions()
static V8_WARN_UNUSED_RESULT MaybeLocal< String > Stringify(Local< Context > context, Local< Value > json_object, Local< String > gap=Local< String >())
static V8_WARN_UNUSED_RESULT MaybeLocal< Value > Parse(Local< Context > context, Local< String > json_string)
static V8_INLINE Local< T > Cast(Local< S > that)
Local< Array > AsArray() const
static void CheckCast(Value *obj)
static V8_INLINE Map * Cast(Value *value)
static Local< Map > New(Isolate *isolate)
V8_WARN_UNUSED_RESULT Maybe< bool > Delete(Local< Context > context, Local< Value > key)
V8_WARN_UNUSED_RESULT MaybeLocal< Value > Get(Local< Context > context, Local< Value > key)
V8_WARN_UNUSED_RESULT Maybe< bool > Has(Local< Context > context, Local< Value > key)
V8_WARN_UNUSED_RESULT MaybeLocal< Map > Set(Local< Context > context, Local< Value > key, Local< Value > value)
V8_WARN_UNUSED_RESULT V8_INLINE bool ToLocal(Local< S > *out) const
V8_INLINE Local< T > ToLocalChecked()
V8_INLINE bool IsEmpty() const
V8_INLINE T FromJust() const &
V8_INLINE bool IsNothing() const
static std::unique_ptr< MeasureMemoryDelegate > Default(Isolate *isolate, Local< Context > context, Local< Promise::Resolver > promise_resolver, MeasureMemoryMode mode)
constexpr T * data() const
constexpr bool empty() const
constexpr size_t size() const
Local< StackTrace > GetStackTrace() const
ScriptOrigin GetScriptOrigin() const
int GetStartColumn() const
V8_WARN_UNUSED_RESULT MaybeLocal< String > GetSourceLine(Local< Context > context) const
Local< String > Get() const
Isolate * GetIsolate() const
bool IsSharedCrossOrigin() const
int GetWasmFunctionIndex() const
static void PrintCurrentStackTrace(Isolate *isolate, std::ostream &out, PrintCurrentStackTraceFilterCallback should_include_frame_callback=nullptr)
int GetStartPosition() const
int GetEndPosition() const
V8_WARN_UNUSED_RESULT Maybe< int > GetLineNumber(Local< Context > context) const
static const int kNoWasmFunctionIndexInfo
Local< Value > GetScriptResourceName() const
V8_WARN_UNUSED_RESULT MaybeLocal< String > GetSource(Local< Context > context) const
static std::unique_ptr< MicrotaskQueue > New(Isolate *isolate, MicrotasksPolicy policy=MicrotasksPolicy::kAuto)
static bool IsRunningMicrotasks(Isolate *isolate)
MicrotasksScope(Local< Context > context, Type type)
static int GetCurrentDepth(Isolate *isolate)
static void PerformCheckpoint(Isolate *isolate)
internal::MicrotaskQueue *const microtask_queue_
internal::Isolate *const i_isolate_
Local< FixedArray > GetImportAttributes() const
Local< String > GetSpecifier() const
ModuleImportPhase GetPhase() const
static void CheckCast(Data *obj)
int GetSourceOffset() const
Location SourceOffsetToLocation(int offset) const
static void CheckCast(Data *obj)
V8_WARN_UNUSED_RESULT MaybeLocal< Value > Evaluate(Local< Context > context)
Local< Value > GetModuleNamespace()
V8_WARN_UNUSED_RESULT Maybe< bool > SetSyntheticModuleExport(Isolate *isolate, Local< String > export_name, Local< Value > export_value)
static Local< Module > CreateSyntheticModule(Isolate *isolate, Local< String > module_name, const MemorySpan< const Local< String > > &export_names, SyntheticModuleEvaluationSteps evaluation_steps)
Local< FixedArray > GetModuleRequests() const
bool IsGraphAsync() const
bool HasTopLevelAwait() const
bool IsSyntheticModule() const
Local< Value > GetException() const
std::pair< LocalVector< Module >, LocalVector< Message > > GetStalledTopLevelAwaitMessages(Isolate *isolate)
int GetIdentityHash() const
Local< UnboundModuleScript > GetUnboundModuleScript()
V8_WARN_UNUSED_RESULT Maybe< bool > InstantiateModule(Local< Context > context, ResolveModuleCallback module_callback, ResolveSourceCallback source_callback=nullptr)
bool IsSourceTextModule() const
static void CheckCast(Data *that)
static void CheckCast(Value *obj)
static Local< Value > New(Isolate *isolate, double value)
static Local< Number > New(Isolate *isolate, double value)
static void CheckCast(v8::Data *that)
static void CheckCast(v8::Data *that)
static Local< ObjectTemplate > New(Isolate *isolate, Local< FunctionTemplate > constructor=Local< FunctionTemplate >())
void SetCallAsFunctionHandler(FunctionCallback callback, Local< Value > data=Local< Value >())
V8_WARN_UNUSED_RESULT MaybeLocal< Object > NewInstance(Local< Context > context)
int InternalFieldCount() const
void SetHandler(const NamedPropertyHandlerConfiguration &configuration)
void SetAccessCheckCallback(AccessCheckCallback callback, Local< Value > data=Local< Value >())
void MarkAsUndetectable()
bool IsImmutableProto() const
static void CheckCast(Data *that)
void SetInternalFieldCount(int value)
void SetAccessCheckCallbackAndHandler(AccessCheckCallback callback, const NamedPropertyHandlerConfiguration &named_handler, const IndexedPropertyHandlerConfiguration &indexed_handler, Local< Value > data=Local< Value >())
V8_WARN_UNUSED_RESULT Maybe< PropertyAttribute > GetRealNamedPropertyAttributesInPrototypeChain(Local< Context > context, Local< Name > key)
V8_WARN_UNUSED_RESULT Maybe< PropertyAttribute > GetPropertyAttributes(Local< Context > context, Local< Value > key)
void * SlowGetAlignedPointerFromInternalField(int index)
void SetAlignedPointerInInternalField(int index, void *value)
V8_WARN_UNUSED_RESULT MaybeLocal< Value > GetOwnPropertyDescriptor(Local< Context > context, Local< Name > key)
bool HasNamedLookupInterceptor() const
Maybe< bool > SetPrivate(Local< Context > context, Local< Private > key, Local< Value > value)
V8_WARN_UNUSED_RESULT Maybe< bool > HasRealNamedProperty(Local< Context > context, Local< Name > key)
V8_WARN_UNUSED_RESULT MaybeLocal< Array > GetPropertyNames(Local< Context > context)
V8_WARN_UNUSED_RESULT MaybeLocal< Value > GetRealNamedProperty(Local< Context > context, Local< Name > key)
V8_WARN_UNUSED_RESULT Maybe< bool > DefineProperty(Local< Context > context, Local< Name > key, PropertyDescriptor &descriptor)
V8_WARN_UNUSED_RESULT Maybe< bool > Delete(Local< Context > context, Local< Value > key)
static Local< Object > New(Isolate *isolate)
bool IsConstructor() const
bool IsUndetectable() const
V8_WARN_UNUSED_RESULT MaybeLocal< Value > CallAsFunction(Local< Context > context, Local< Value > recv, int argc, Local< Value > argv[])
V8_WARN_UNUSED_RESULT Maybe< bool > DefineOwnProperty(Local< Context > context, Local< Name > key, Local< Value > value, PropertyAttribute attributes=None)
V8_WARN_UNUSED_RESULT Maybe< bool > SetNativeDataProperty(Local< Context > context, Local< Name > name, AccessorNameGetterCallback getter, AccessorNameSetterCallback setter=nullptr, Local< Value > data=Local< Value >(), PropertyAttribute attributes=None, SideEffectType getter_side_effect_type=SideEffectType::kHasSideEffect, SideEffectType setter_side_effect_type=SideEffectType::kHasSideEffect)
void * GetAlignedPointerFromEmbedderDataInCreationContext(v8::Isolate *isolate, int index)
Local< Data > SlowGetInternalField(int index)
V8_WARN_UNUSED_RESULT MaybeLocal< Value > GetRealNamedPropertyInPrototypeChain(Local< Context > context, Local< Name > key)
V8_WARN_UNUSED_RESULT Maybe< bool > Has(Local< Context > context, Local< Value > key)
V8_WARN_UNUSED_RESULT MaybeLocal< Array > GetOwnPropertyNames(Local< Context > context)
bool IsCodeLike(Isolate *isolate) const
V8_WARN_UNUSED_RESULT Maybe< bool > Set(Local< Context > context, Local< Value > key, Local< Value > value)
V8_WARN_UNUSED_RESULT MaybeLocal< Value > CallAsConstructor(Local< Context > context, int argc, Local< Value > argv[])
MaybeLocal< Value > GetPrivate(Local< Context > context, Local< Private > key)
V8_WARN_UNUSED_RESULT Maybe< bool > SetPrototypeV2(Local< Context > context, Local< Value > prototype)
static V8_INLINE void Wrap(v8::Isolate *isolate, const v8::Local< v8::Object > &wrapper, void *wrappable)
void SetAccessorProperty(Local< Name > name, Local< Function > getter, Local< Function > setter=Local< Function >(), PropertyAttribute attributes=None)
V8_WARN_UNUSED_RESULT Maybe< bool > CreateDataProperty(Local< Context > context, Local< Name > key, Local< Value > value)
V8_WARN_UNUSED_RESULT Maybe< bool > HasRealIndexedProperty(Local< Context > context, uint32_t index)
V8_WARN_UNUSED_RESULT MaybeLocal< String > ObjectProtoToString(Local< Context > context)
MaybeLocal< Array > PreviewEntries(bool *is_key_value)
V8_WARN_UNUSED_RESULT Maybe< bool > SetLazyDataProperty(Local< Context > context, Local< Name > name, AccessorNameGetterCallback getter, Local< Value > data=Local< Value >(), PropertyAttribute attributes=None, SideEffectType getter_side_effect_type=SideEffectType::kHasSideEffect, SideEffectType setter_side_effect_type=SideEffectType::kHasSideEffect)
bool IsApiWrapper() const
Maybe< bool > SetIntegrityLevel(Local< Context > context, IntegrityLevel level)
int InternalFieldCount() const
Local< Value > GetPrototypeV2()
V8_WARN_UNUSED_RESULT Maybe< PropertyAttribute > GetRealNamedPropertyAttributes(Local< Context > context, Local< Name > key)
static V8_INLINE T * Unwrap(v8::Isolate *isolate, const v8::Local< v8::Object > &wrapper)
Maybe< bool > HasPrivate(Local< Context > context, Local< Private > key)
Local< Object > FindInstanceInPrototypeChain(Local< FunctionTemplate > tmpl)
V8_WARN_UNUSED_RESULT MaybeLocal< Value > Get(Local< Context > context, Local< Value > key)
Local< Context > GetCreationContextChecked()
void SetInternalField(int index, Local< Data > data)
MaybeLocal< Context > GetCreationContext()
V8_WARN_UNUSED_RESULT Maybe< bool > HasOwnProperty(Local< Context > context, Local< Name > key)
Maybe< bool > DeletePrivate(Local< Context > context, Local< Private > key)
Local< String > GetConstructorName()
static void CheckCast(Value *obj)
void SetAlignedPointerInInternalFields(int argc, int indices[], void *values[])
V8_WARN_UNUSED_RESULT Maybe< bool > HasRealNamedCallbackProperty(Local< Context > context, Local< Name > key)
bool HasIndexedLookupInterceptor() const
virtual int GetChunkSize()
Local< Primitive > Get(Isolate *isolate, int index)
static Local< PrimitiveArray > New(Isolate *isolate, int length)
static void CheckCast(Data *obj)
void Set(Isolate *isolate, int index, Local< Primitive > item)
static void CheckCast(Data *that)
static Local< Private > ForApi(Isolate *isolate, Local< String > name)
Local< Value > Name() const
static Local< Private > New(Isolate *isolate, Local< String > name=Local< String >())
static V8_WARN_UNUSED_RESULT MaybeLocal< Resolver > New(Local< Context > context)
V8_WARN_UNUSED_RESULT Maybe< bool > Resolve(Local< Context > context, Local< Value > value)
Local< Promise > GetPromise()
static void CheckCast(Value *obj)
V8_WARN_UNUSED_RESULT Maybe< bool > Reject(Local< Context > context, Local< Value > value)
V8_WARN_UNUSED_RESULT MaybeLocal< Promise > Catch(Local< Context > context, Local< Function > handler)
static void CheckCast(Value *obj)
V8_WARN_UNUSED_RESULT MaybeLocal< Promise > Then(Local< Context > context, Local< Function > handler)
void set_enumerable(bool enumerable)
bool has_writable() const
Local< Value > get() const
bool has_enumerable() const
PrivateData * get_private() const
Local< Value > value() const
void set_configurable(bool configurable)
bool has_configurable() const
Local< Value > set() const
bool configurable() const
static MaybeLocal< Proxy > New(Local< Context > context, Local< Object > local_target, Local< Object > local_handler)
static void CheckCast(Value *obj)
Local< Value > GetHandler()
Local< Value > GetTarget()
V8_WARN_UNUSED_RESULT MaybeLocal< Object > Exec(Local< Context > context, Local< String > subject)
Local< String > GetSource() const
static V8_WARN_UNUSED_RESULT MaybeLocal< RegExp > New(Local< Context > context, Local< String > pattern, Flags flags)
static V8_WARN_UNUSED_RESULT MaybeLocal< RegExp > NewWithBacktrackLimit(Local< Context > context, Local< String > pattern, Flags flags, uint32_t backtrack_limit)
static void CheckCast(Value *obj)
Extension * extension() const
static void Register(std::unique_ptr< Extension >)
static void UnregisterAll()
RegisteredExtension(Extension *)
RegisteredExtension * next() const
RegisteredExtension * next_
static RegisteredExtension * first_extension_
void set_code_range_size_in_bytes(size_t limit)
void set_initial_old_generation_size_in_bytes(size_t initial_size)
void ConfigureDefaultsFromHeapSize(size_t initial_heap_size_in_bytes, size_t maximum_heap_size_in_bytes)
void set_initial_young_generation_size_in_bytes(size_t initial_size)
void set_max_young_generation_size_in_bytes(size_t limit)
void ConfigureDefaults(uint64_t physical_memory, uint64_t virtual_memory_limit)
void set_max_old_generation_size_in_bytes(size_t limit)
void MergeWithExistingScript()
ConsumeCodeCacheTask(std::unique_ptr< internal::BackgroundDeserializeTask > impl)
bool ShouldMergeWithExistingScript() const
void SourceTextAvailable(Isolate *isolate, Local< String > source_text, const ScriptOrigin &origin)
internal::ScriptStreamingData * impl() const
CompilationDetails & compilation_details()
StreamedSource(std::unique_ptr< ExternalSourceStream > source_stream, Encoding encoding)
static CachedData * CreateCodeCacheForFunction(Local< Function > function)
static CachedData * CreateCodeCache(Local< UnboundScript > unbound_script)
static V8_WARN_UNUSED_RESULT MaybeLocal< Module > CompileModule(Isolate *isolate, Source *source, CompileOptions options=kNoCompileOptions, NoCacheReason no_cache_reason=kNoCacheNoReason)
static V8_WARN_UNUSED_RESULT MaybeLocal< Script > Compile(Local< Context > context, Source *source, CompileOptions options=kNoCompileOptions, NoCacheReason no_cache_reason=kNoCacheNoReason)
static bool CompileOptionsIsValid(CompileOptions compile_options)
static V8_WARN_UNUSED_RESULT MaybeLocal< Function > CompileFunction(Local< Context > context, Source *source, size_t arguments_count=0, Local< String > arguments[]=nullptr, size_t context_extension_count=0, Local< Object > context_extensions[]=nullptr, CompileOptions options=kNoCompileOptions, NoCacheReason no_cache_reason=kNoCacheNoReason)
static V8_WARN_UNUSED_RESULT MaybeLocal< UnboundScript > CompileUnboundScript(Isolate *isolate, Source *source, CompileOptions options=kNoCompileOptions, NoCacheReason no_cache_reason=kNoCacheNoReason)
static ConsumeCodeCacheTask * StartConsumingCodeCache(Isolate *isolate, std::unique_ptr< CachedData > source)
static ConsumeCodeCacheTask * StartConsumingCodeCacheOnBackground(Isolate *isolate, std::unique_ptr< CachedData > source)
static V8_WARN_UNUSED_RESULT MaybeLocal< UnboundScript > CompileUnboundInternal(Isolate *isolate, Source *source, CompileOptions options, NoCacheReason no_cache_reason)
static uint32_t CachedDataVersionTag()
static ScriptStreamingTask * StartStreaming(Isolate *isolate, StreamedSource *source, ScriptType type=ScriptType::kClassic, CompileOptions options=kNoCompileOptions, CompileHintCallback compile_hint_callback=nullptr, void *compile_hint_callback_data=nullptr)
Local< Value > GetResourceName()
Local< Data > HostDefinedOptions()
V8_INLINE int LineOffset() const
void VerifyHostDefinedOptions() const
V8_INLINE int ColumnOffset() const
V8_INLINE ScriptOriginOptions Options() const
Local< Data > host_defined_options_
V8_INLINE Local< Value > ResourceName() const
V8_INLINE Local< Value > SourceMapUrl() const
V8_INLINE Local< Data > GetHostDefinedOptions() const
Local< CompileHintsCollector > GetCompileHintsCollector() const
V8_WARN_UNUSED_RESULT MaybeLocal< Value > Run(Local< Context > context)
Local< UnboundScript > GetUnboundScript()
std::vector< int > GetProducedCompileHints() const
static V8_WARN_UNUSED_RESULT MaybeLocal< Script > Compile(Local< Context > context, Local< String > source, ScriptOrigin *origin=nullptr)
Local< Value > GetResourceName()
internal::Isolate *const i_isolate_
SealHandleScope(Isolate *isolate)
internal::Address * prev_limit_
static void CheckCast(Value *obj)
static Local< Set > New(Isolate *isolate)
V8_WARN_UNUSED_RESULT Maybe< bool > Delete(Local< Context > context, Local< Value > key)
Local< Array > AsArray() const
static V8_INLINE Set * Cast(Value *value)
V8_WARN_UNUSED_RESULT Maybe< bool > Has(Local< Context > context, Local< Value > key)
V8_WARN_UNUSED_RESULT MaybeLocal< Set > Add(Local< Context > context, Local< Value > key)
std::shared_ptr< BackingStore > GetBackingStore()
static MaybeLocal< SharedArrayBuffer > MaybeNew(Isolate *isolate, size_t byte_length, BackingStoreInitializationMode initialization_mode=BackingStoreInitializationMode::kZeroInitialized)
static std::unique_ptr< BackingStore > NewBackingStore(Isolate *isolate, size_t byte_length, BackingStoreInitializationMode initialization_mode=BackingStoreInitializationMode::kZeroInitialized, BackingStoreOnFailureMode on_failure=BackingStoreOnFailureMode::kOutOfMemory)
size_t ByteLength() const
size_t MaxByteLength() const
static void CheckCast(Value *obj)
static Local< SharedArrayBuffer > New(Isolate *isolate, size_t byte_length, BackingStoreInitializationMode initialization_mode=BackingStoreInitializationMode::kZeroInitialized)
SharedValueConveyor & operator=(SharedValueConveyor &&) noexcept
SharedValueConveyor(SharedValueConveyor &&) noexcept
static void CheckCast(Data *that)
static Local< Signature > New(Isolate *isolate, Local< FunctionTemplate > receiver=Local< FunctionTemplate >())
size_t AddContext(Local< Context > context, SerializeInternalFieldsCallback internal_fields_serializer=SerializeInternalFieldsCallback(), SerializeContextDataCallback context_data_serializer=SerializeContextDataCallback(), SerializeAPIWrapperCallback api_wrapper_serializer=SerializeAPIWrapperCallback())
V8_INLINE size_t AddData(Local< Context > context, Local< T > object)
void SetDefaultContext(Local< Context > context, SerializeInternalFieldsCallback internal_fields_serializer=SerializeInternalFieldsCallback(), SerializeContextDataCallback context_data_serializer=SerializeContextDataCallback(), SerializeAPIWrapperCallback api_wrapper_serializer=SerializeAPIWrapperCallback())
StartupData CreateBlob(FunctionCodeHandling function_code_handling)
internal::SnapshotCreatorImpl * impl_
SnapshotCreator(Isolate *isolate, const intptr_t *external_references=nullptr, const StartupData *existing_blob=nullptr, bool owns_isolate=true)
int GetSourcePosition() const
bool IsUserJavaScript() const
Local< String > GetScriptName() const
Local< String > GetScriptNameOrSourceURL() const
Location GetLocation() const
Local< String > GetScriptSourceMappingURL() const
bool IsConstructor() const
Local< String > GetFunctionName() const
Local< String > GetScriptSource() const
Local< StackFrame > GetFrame(Isolate *isolate, uint32_t index) const
static Local< String > CurrentScriptNameOrSourceURL(Isolate *isolate)
static Local< StackTrace > CurrentStackTrace(Isolate *isolate, int frame_limit, StackTraceOptions options=kDetailed)
int GetFrameCount() const
bool CanBeRehashed() const
Local< String > ValueOf() const
static Local< Value > New(Isolate *isolate, Local< String > value)
static void CheckCast(Value *obj)
virtual size_t length() const =0
void CheckCachedDataInvariants() const
virtual const char * data() const =0
virtual void Unaccount(Isolate *isolate)
virtual bool IsCacheable() const
void CheckCachedDataInvariants() const
virtual const uint16_t * data() const =0
const uint16_t * cached_data_
virtual size_t length() const =0
Utf8Value(Isolate *isolate, Local< v8::Value > obj, WriteOptions options=REPLACE_INVALID_UTF8)
void CheckOneByte(bool is_one_byte) const
ValueView(Isolate *isolate, Local< v8::String > str)
Value(const Value &)=delete
static void CheckCast(v8::Data *that)
size_t Utf8LengthV2(Isolate *isolate) const
bool IsExternalTwoByte() const
ExternalStringResource * GetExternalStringResourceSlow() const
bool IsExternalOneByte() const
bool ContainsOnlyOneByte() const
static V8_WARN_UNUSED_RESULT MaybeLocal< String > NewExternalTwoByte(Isolate *isolate, ExternalStringResource *resource)
void WriteOneByteV2(Isolate *isolate, uint32_t offset, uint32_t length, uint8_t *buffer, int flags=WriteFlags::kNone) const
bool StringEquals(Local< String > str) const
bool MakeExternal(ExternalStringResource *resource)
int WriteOneByte(Isolate *isolate, uint8_t *buffer, int start=0, int length=-1, int options=NO_OPTIONS) const
static V8_WARN_UNUSED_RESULT Local< String > NewFromUtf8Literal(Isolate *isolate, const char(&literal)[N], NewStringType type=NewStringType::kNormal)
static constexpr int kMaxLength
static V8_WARN_UNUSED_RESULT MaybeLocal< String > NewFromUtf8(Isolate *isolate, const char *data, NewStringType type=NewStringType::kNormal, int length=-1)
void WriteV2(Isolate *isolate, uint32_t offset, uint32_t length, uint16_t *buffer, int flags=WriteFlags::kNone) const
int Write(Isolate *isolate, uint16_t *buffer, int start=0, int length=-1, int options=NO_OPTIONS) const
ExternalStringResourceBase * GetExternalStringResourceBaseSlow(String::Encoding *encoding_out) const
int WriteUtf8(Isolate *isolate, char *buffer, int length=-1, int *nchars_ref=nullptr, int options=NO_OPTIONS) const
static Local< String > Concat(Isolate *isolate, Local< String > left, Local< String > right)
static V8_WARN_UNUSED_RESULT MaybeLocal< String > NewExternalOneByte(Isolate *isolate, ExternalOneByteStringResource *resource)
size_t WriteUtf8V2(Isolate *isolate, char *buffer, size_t capacity, int flags=WriteFlags::kNone, size_t *processed_characters_return=nullptr) const
Local< String > InternalizeString(Isolate *isolate)
static V8_WARN_UNUSED_RESULT MaybeLocal< String > NewFromTwoByte(Isolate *isolate, const uint16_t *data, NewStringType type=NewStringType::kNormal, int length=-1)
static V8_WARN_UNUSED_RESULT MaybeLocal< String > NewFromOneByte(Isolate *isolate, const uint8_t *data, NewStringType type=NewStringType::kNormal, int length=-1)
bool CanMakeExternal(Encoding encoding) const
const ExternalOneByteStringResource * GetExternalOneByteStringResource() const
void VerifyExternalStringResource(ExternalStringResource *val) const
void VerifyExternalStringResourceBase(ExternalStringResourceBase *v, Encoding encoding) const
int Utf8Length(Isolate *isolate) const
static Local< Value > New(Isolate *isolate, Local< Symbol > value)
static void CheckCast(Value *obj)
Local< Symbol > ValueOf() const
static Local< Symbol > New(Isolate *isolate, Local< String > description=Local< String >())
static Local< Symbol > For(Isolate *isolate, Local< String > description)
static Local< Symbol > ForApi(Isolate *isolate, Local< String > description)
static void CheckCast(Data *that)
Local< Value > Description(Isolate *isolate) const
void SetNativeDataProperty(Local< Name > name, AccessorNameGetterCallback getter, AccessorNameSetterCallback setter=nullptr, Local< Value > data=Local< Value >(), PropertyAttribute attribute=None, SideEffectType getter_side_effect_type=SideEffectType::kHasSideEffect, SideEffectType setter_side_effect_type=SideEffectType::kHasSideEffect)
void Set(Local< Name > name, Local< Data > value, PropertyAttribute attributes=None)
void SetPrivate(Local< Private > name, Local< Data > value, PropertyAttribute attributes=None)
void SetAccessorProperty(Local< Name > name, Local< FunctionTemplate > getter=Local< FunctionTemplate >(), Local< FunctionTemplate > setter=Local< FunctionTemplate >(), PropertyAttribute attribute=None)
void SetLazyDataProperty(Local< Name > name, AccessorNameGetterCallback getter, Local< Value > data=Local< Value >(), PropertyAttribute attribute=None, SideEffectType getter_side_effect_type=SideEffectType::kHasSideEffect, SideEffectType setter_side_effect_type=SideEffectType::kHasSideEffect)
void SetIntrinsicDataProperty(Local< Name > name, Intrinsic intrinsic, PropertyAttribute attribute=None)
V8_EXPORT void CheckValue() const
void SetVerbose(bool value)
Local< v8::Message > Message() const
bool HasTerminated() const
void SetCaptureMessage(bool value)
Local< Value > Exception() const
static V8_WARN_UNUSED_RESULT MaybeLocal< Value > StackTrace(Local< Context > context, Local< Value > exception)
TryCatch(Isolate *isolate)
internal::Address js_stack_comparable_address_
internal::Isolate * i_isolate_
void Update(Local< Value > baseline)
TypecheckWitness(Isolate *isolate)
static void CheckCast(Value *obj)
static constexpr size_t kMaxByteLength
static void CheckCast(v8::Data *that)
Local< Value > GetSourceURL()
Local< Value > GetSourceMappingURL()
static const int kNoScriptId
int GetColumnNumber(int code_pos=0)
Local< Value > GetSourceMappingURL()
Local< Value > GetScriptName()
int GetLineNumber(int code_pos=0)
Local< Value > GetSourceURL()
Local< Script > BindToCurrentContext()
static v8::internal::Handle< To > OpenHandle(v8::Local< From > handle)
static v8::internal::DirectHandle< To > OpenDirectHandle(v8::Local< From > handle)
static v8::internal::Handle< v8::internal::Object > OpenPersistent(const v8::PersistentBase< T > &persistent)
static void ReportOOMFailure(v8::internal::Isolate *isolate, const char *location, const OOMDetails &details)
static V8_INLINE bool ApiCheck(bool condition, const char *location, const char *message)
V8_NOINLINE static V8_PRESERVE_MOST void ReportApiFailure(const char *location, const char *message)
static void DisposePlatform()
static void SetFatalMemoryErrorCallback(OOMErrorCallback callback)
static void SetReturnAddressLocationResolver(ReturnAddressLocationResolver return_address_resolver)
static bool InitializeICU(const char *icu_data_file=nullptr)
static const char * GetVersion()
static void GetSharedMemoryStatistics(SharedMemoryStatistics *statistics)
static void InitializeExternalStartupDataFromFile(const char *snapshot_blob)
static void InitializePlatform(Platform *platform)
static void InitializeExternalStartupData(const char *directory_path)
static bool InitializeICUDefaultLocation(const char *exec_path, const char *icu_data_file=nullptr)
static void SetSnapshotDataBlob(StartupData *startup_blob)
static void SetFlagsFromCommandLine(int *argc, char **argv, bool remove_flags)
static V8_INLINE bool Initialize()
static void SetEntropySource(EntropySource source)
static void SetFatalErrorHandler(V8FatalErrorCallback that)
static void SetFlagsFromString(const char *str)
static void SetDcheckErrorHandler(DcheckErrorCallback that)
static bool EnableWebAssemblyTrapHandler(bool use_v8_signal_handler)
virtual MaybeLocal< WasmModuleObject > GetWasmModuleFromId(Isolate *isolate, uint32_t transfer_id)
virtual MaybeLocal< Object > ReadHostObject(Isolate *isolate)
virtual const SharedValueConveyor * GetSharedValueConveyor(Isolate *isolate)
virtual MaybeLocal< SharedArrayBuffer > GetSharedArrayBufferFromId(Isolate *isolate, uint32_t clone_id)
V8_WARN_UNUSED_RESULT bool ReadUint64(uint64_t *value)
void SetSupportsLegacyWireFormat(bool supports_legacy_wire_format)
void TransferSharedArrayBuffer(uint32_t id, Local< SharedArrayBuffer > shared_array_buffer)
V8_WARN_UNUSED_RESULT bool ReadDouble(double *value)
V8_WARN_UNUSED_RESULT bool ReadUint32(uint32_t *value)
void TransferArrayBuffer(uint32_t transfer_id, Local< ArrayBuffer > array_buffer)
ValueDeserializer(Isolate *isolate, const uint8_t *data, size_t size)
V8_WARN_UNUSED_RESULT Maybe< bool > ReadHeader(Local< Context > context)
V8_WARN_UNUSED_RESULT MaybeLocal< Value > ReadValue(Local< Context > context)
uint32_t GetWireFormatVersion() const
V8_WARN_UNUSED_RESULT bool ReadRawBytes(size_t length, const void **data)
virtual Maybe< uint32_t > GetWasmModuleTransferId(Isolate *isolate, Local< WasmModuleObject > module)
virtual bool AdoptSharedValueConveyor(Isolate *isolate, SharedValueConveyor &&conveyor)
virtual Maybe< bool > IsHostObject(Isolate *isolate, Local< Object > object)
virtual void FreeBufferMemory(void *buffer)
virtual Maybe< bool > WriteHostObject(Isolate *isolate, Local< Object > object)
virtual Maybe< uint32_t > GetSharedArrayBufferId(Isolate *isolate, Local< SharedArrayBuffer > shared_array_buffer)
virtual bool HasCustomHostObject(Isolate *isolate)
virtual void * ReallocateBufferMemory(void *old_buffer, size_t size, size_t *actual_size)
void TransferArrayBuffer(uint32_t transfer_id, Local< ArrayBuffer > array_buffer)
void WriteUint64(uint64_t value)
void WriteDouble(double value)
ValueSerializer(Isolate *isolate)
V8_WARN_UNUSED_RESULT std::pair< uint8_t *, size_t > Release()
void WriteUint32(uint32_t value)
V8_WARN_UNUSED_RESULT Maybe< bool > WriteValue(Local< Context > context, Local< Value > value)
void WriteRawBytes(const void *source, size_t length)
void SetTreatArrayBufferViewsAsHostObjects(bool mode)
V8_WARN_UNUSED_RESULT MaybeLocal< String > ToDetailString(Local< Context > context) const
bool BooleanValue(Isolate *isolate) const
bool IsTypedArray() const
V8_WARN_UNUSED_RESULT Maybe< int32_t > Int32Value(Local< Context > context) const
bool IsSharedArrayBuffer() const
Local< String > TypeOf(Isolate *)
V8_WARN_UNUSED_RESULT MaybeLocal< Int32 > ToInt32(Local< Context > context) const
V8_WARN_UNUSED_RESULT Maybe< double > NumberValue(Local< Context > context) const
V8_WARN_UNUSED_RESULT MaybeLocal< Numeric > ToNumeric(Local< Context > context) const
V8_WARN_UNUSED_RESULT MaybeLocal< BigInt > ToBigInt(Local< Context > context) const
bool FullIsUndefined() const
V8_INLINE bool QuickIsUndefined() const
Local< Boolean > ToBoolean(Isolate *isolate) const
bool IsArrayBuffer() const
V8_WARN_UNUSED_RESULT MaybeLocal< Uint32 > ToArrayIndex(Local< Context > context) const
bool IsMapIterator() const
bool SameValue(Local< Value > that) const
bool IsNativeError() const
V8_WARN_UNUSED_RESULT Maybe< int64_t > IntegerValue(Local< Context > context) const
bool IsSetIterator() const
V8_INLINE bool QuickIsString() const
bool FullIsString() const
V8_WARN_UNUSED_RESULT MaybeLocal< String > ToString(Local< Context > context) const
static V8_INLINE Value * Cast(T *value)
bool IsModuleNamespaceObject() const
V8_WARN_UNUSED_RESULT Maybe< uint32_t > Uint32Value(Local< Context > context) const
bool IsWasmMemoryObject() const
V8_WARN_UNUSED_RESULT Maybe< bool > Equals(Local< Context > context, Local< Value > that) const
bool IsArrayBufferView() const
bool IsWasmModuleObject() const
bool IsGeneratorFunction() const
bool StrictEquals(Local< Value > that) const
V8_INLINE bool QuickIsNull() const
V8_WARN_UNUSED_RESULT MaybeLocal< Uint32 > ToUint32(Local< Context > context) const
bool IsFloat16Array() const
V8_WARN_UNUSED_RESULT MaybeLocal< Primitive > ToPrimitive(Local< Context > context) const
static void CheckCast(Data *that)
V8_WARN_UNUSED_RESULT MaybeLocal< Number > ToNumber(Local< Context > context) const
Maybe< bool > InstanceOf(Local< Context > context, Local< Object > object)
bool IsAsyncFunction() const
V8_WARN_UNUSED_RESULT MaybeLocal< Integer > ToInteger(Local< Context > context) const
V8_WARN_UNUSED_RESULT MaybeLocal< Object > ToObject(Local< Context > context) const
bool IsWasmMemoryMapDescriptor() const
bool IsGeneratorObject() const
int32_t WasmFileDescriptor
static void CheckCast(Value *object)
static Local< WasmMemoryMapDescriptor > New(Isolate *isolate, WasmFileDescriptor fd)
static void CheckCast(Value *object)
Local< ArrayBuffer > Buffer()
static MaybeLocal< WasmModuleObject > Compile(Isolate *isolate, MemorySpan< const uint8_t > wire_bytes)
CompiledWasmModule GetCompiledModule()
static MaybeLocal< WasmModuleObject > FromCompiledModule(Isolate *isolate, const CompiledWasmModule &)
static void CheckCast(Value *obj)
WasmStreaming(std::unique_ptr< WasmStreamingImpl > impl)
void Finish(bool can_use_compiled_module=true)
bool SetCompiledModuleBytes(const uint8_t *bytes, size_t size)
void SetUrl(const char *url, size_t length)
void SetMoreFunctionsCanBeSerializedCallback(std::function< void(CompiledWasmModule)>)
void Abort(MaybeLocal< Value > exception)
void OnBytesReceived(const uint8_t *bytes, size_t size)
static std::shared_ptr< WasmStreaming > Unpack(Isolate *isolate, Local< Value > value)
void(*)(const WeakCallbackInfo< T > &data) Callback
V8_INLINE bool IsEmpty() const
V8_INLINE internal::Address *const & slot() const
V8_INLINE void VerifyOnStack() const
static void SetEntropySource(EntropySource entropy_source)
static StackSlot GetStackStart()
static constexpr TimeDelta FromMicroseconds(int64_t microseconds)
int64_t InMicroseconds() const
constexpr size_t size() const
constexpr T * begin() const
constexpr TimeDelta since_origin() const
size_t GetCurrentMemoryUsage() const
size_t GetMaxMemoryUsage() const
DirectHandle< NativeContext > CreateEnvironment(MaybeDirectHandle< JSGlobalProxy > maybe_global_proxy, v8::Local< v8::ObjectTemplate > global_object_template, v8::ExtensionConfiguration *extensions, size_t context_snapshot_index, DeserializeEmbedderFieldsCallback embedder_fields_deserializer, v8::MicrotaskQueue *microtask_queue)
DirectHandle< JSGlobalProxy > NewRemoteContext(MaybeDirectHandle< JSGlobalProxy > maybe_global_proxy, v8::Local< v8::ObjectTemplate > global_object_template)
V8_EXPORT_PRIVATE Tagged< Code > code(Builtin builtin)
const char * bailout_reason() const
bool is_shared_cross_origin() const
const char * name() const
const char * resource_name() const
void ResetCreateHistogramFunction(CreateHistogramCallback f)
void ResetCounterFunction(CounterLookupCallback f)
void Serialize(v8::OutputStream *stream)
base::TimeTicks start_time() const
base::TimeTicks end_time() const
const SampleInfo & sample(int index) const
CpuProfile * StopProfiling(const char *title)
void ResetDateCache(base::TimezoneCache::TimeZoneDetection time_zone_detection)
bool PerformSideEffectCheckForCallback(Handle< FunctionTemplateInfo > function)
void IgnoreSideEffectsOnNextCallTo(Handle< FunctionTemplateInfo > function)
bool PerformSideEffectCheckForAccessor(DirectHandle< AccessorInfo > accessor_info, DirectHandle< Object > receiver, AccessorComponent component)
V8_INLINE bool is_null() const
V8_INLINE V8_WARN_UNUSED_RESULT bool store_aligned_pointer(IsolateForSandbox isolate, Tagged< HeapObject > host, void *ptr)
IndirectHandle< Object > Get(int index)
V8_EXPORT_PRIVATE void Create(Isolate *isolate, Tagged< Object > object, int *index)
Handle< Boolean > ToBoolean(bool value)
MaybeHandle< String > NewStringFromOneByte(base::Vector< const uint8_t > string, AllocationType allocation=AllocationType::kYoung)
Handle< Number > NewNumberFromInt(int32_t value)
V8_WARN_UNUSED_RESULT HandleType< String >::MaybeType NewConsString(HandleType< String > left, HandleType< String > right, AllocationType allocation=AllocationType::kYoung)
Handle< String > NewStringFromAsciiChecked(const char *str, AllocationType allocation=AllocationType::kYoung)
Handle< SwissNameDictionary > NewSwissNameDictionary(int at_least_space_for=kSwissNameDictionaryInitialCapacity, AllocationType allocation=AllocationType::kYoung)
Handle< Struct > NewStruct(InstanceType type, AllocationType allocation=AllocationType::kYoung)
Handle< Number > NewNumber(double value)
Handle< FixedArray > NewFixedArray(int length, AllocationType allocation=AllocationType::kYoung)
Isolate * isolate() const
Handle< Symbol > NewSymbol(AllocationType allocation=AllocationType::kOld)
Handle< JSArray > NewJSArray(ElementsKind elements_kind, int length, int capacity, ArrayStorageAllocationMode mode=ArrayStorageAllocationMode::DONT_INITIALIZE_ARRAY_ELEMENTS, AllocationType allocation=AllocationType::kYoung)
Handle< Symbol > NewPrivateSymbol(AllocationType allocation=AllocationType::kOld)
DirectHandle< InterceptorInfo > NewInterceptorInfo(AllocationType allocation=AllocationType::kOld)
Handle< JSTypedArray > NewJSTypedArray(ExternalArrayType type, DirectHandle< JSArrayBuffer > buffer, size_t byte_offset, size_t length, bool is_length_tracking=false)
DirectHandle< FunctionTemplateInfo > NewFunctionTemplateInfo(int length, bool do_not_cache)
Handle< JSObject > CopyJSObject(DirectHandle< JSObject > object)
MaybeHandle< JSArrayBuffer > NewJSArrayBufferAndBackingStore(size_t byte_length, InitializedFlag initialized, AllocationType allocation=AllocationType::kYoung)
DirectHandle< AccessorInfo > NewAccessorInfo()
Handle< JSObject > NewJSObject(DirectHandle< JSFunction > constructor, AllocationType allocation=AllocationType::kYoung, NewJSObjectType=NewJSObjectType::kNoAPIWrapper)
DirectHandle< SourceTextModule > NewSourceTextModule(DirectHandle< SharedFunctionInfo > code)
Handle< JSArrayBuffer > NewJSSharedArrayBuffer(std::shared_ptr< BackingStore > backing_store)
V8_WARN_UNUSED_RESULT MaybeHandle< String > NewExternalStringFromTwoByte(const v8::String::ExternalStringResource *resource)
Handle< Name > InternalizeName(Handle< T > name)
V8_WARN_UNUSED_RESULT MaybeHandle< String > NewExternalStringFromOneByte(const v8::String::ExternalOneByteStringResource *resource)
V8_WARN_UNUSED_RESULT MaybeHandle< String > NewStringFromUtf8(base::Vector< const char > str, AllocationType allocation=AllocationType::kYoung)
DirectHandle< JSSet > NewJSSet()
Handle< SyntheticModule > NewSyntheticModule(DirectHandle< String > module_name, DirectHandle< FixedArray > export_names, v8::Module::SyntheticModuleEvaluationSteps evaluation_steps)
Handle< JSDataViewOrRabGsabDataView > NewJSDataViewOrRabGsabDataView(DirectHandle< JSArrayBuffer > buffer, size_t byte_offset, size_t byte_length, bool is_length_tracking=false)
Handle< Foreign > NewForeign(Address addr, AllocationType allocation_type=AllocationType::kYoung)
V8_WARN_UNUSED_RESULT MaybeHandle< String > NewStringFromTwoByte(base::Vector< const base::uc16 > str, AllocationType allocation=AllocationType::kYoung)
DirectHandle< JSMap > NewJSMap()
Handle< JSObject > NewExternal(void *value, AllocationType allocation=AllocationType::kYoung)
Handle< Context > NewWithContext(DirectHandle< Context > previous, DirectHandle< ScopeInfo > scope_info, DirectHandle< JSReceiver > extension)
Handle< JSArray > NewJSArrayWithElements(DirectHandle< FixedArrayBase > elements, ElementsKind elements_kind, int length, AllocationType allocation=AllocationType::kYoung)
Handle< String > InternalizeString(base::Vector< const char > str, bool convert_encoding=false)
Handle< JSPromise > NewJSPromise()
DirectHandle< JSObject > NewSlowJSObjectWithPropertiesAndElements(DirectHandle< JSPrototype > prototype, DirectHandle< HeapObject > properties, DirectHandle< FixedArrayBase > elements)
Handle< JSArrayBuffer > NewJSArrayBuffer(std::shared_ptr< BackingStore > backing_store, AllocationType allocation=AllocationType::kYoung)
Handle< JSObject > NewError(DirectHandle< JSFunction > constructor, DirectHandle< String > message, DirectHandle< Object > options={})
DirectHandle< ObjectTemplateInfo > NewObjectTemplateInfo(DirectHandle< FunctionTemplateInfo > constructor, bool do_not_cache)
Handle< String > InternalizeUtf8String(base::Vector< const char > str)
static Tagged< Object > GetTarget(const FunctionCallbackInfo< T > &info)
IndirectHandle< Object > Create(Tagged< Object > value)
V8_INLINE ValueHelper::InternalRepresentationType repr() const
DetachableVector< Address * > blocks_
DetachableVector< Tagged< NativeContext > > entered_contexts_
void FreeThreadResources()
V8_EXPORT_PRIVATE void Iterate(v8::internal::RootVisitor *v)
static const size_t kEnteredContextsOffset
HandleScopeData handle_scope_data_
char * ArchiveThread(char *to)
HandleScopeImplementer(Isolate *isolate)
bool HasPersistentScope() const
void IterateThis(RootVisitor *v)
Isolate * isolate() const
DirectHandle< NativeContext > LastEnteredContext()
DetachableVector< Address * > * blocks()
DetachableVector< Tagged< Context > > saved_contexts_
char * RestoreThread(char *from)
std::unique_ptr< PersistentHandles > DetachPersistent(Address *first_block)
static int ArchiveSpacePerThread()
std::optional< Address * > last_handle_before_persistent_block_
HandleType< T > CloseAndEscape(HandleType< T > handle_value)
V8_INLINE Isolate * isolate() const
const char * name() const
SnapshotObjectId PushHeapObjectsStats(OutputStream *stream, int64_t *timestamp_us)
int GetSnapshotsCount() const
bool IsTakingSnapshot() const
HeapSnapshot * GetSnapshot(int index)
void DeleteAllSnapshots()
HeapSnapshot * TakeSnapshot(const v8::HeapProfiler::HeapSnapshotOptions options)
void Serialize(v8::OutputStream *stream)
char last_few_messages[Heap::kTraceRingBufferSize+1]
void ConfigureHeap(const v8::ResourceConstraints &constraints, v8::CppHeap *cpp_heap)
V8_INLINE uint64_t external_memory() const
V8_EXPORT_PRIVATE void SetEmbedderRootsHandler(EmbedderRootsHandler *handler)
V8_EXPORT_PRIVATE void AutomaticallyRestoreInitialHeapLimit(double threshold_percent)
void AddGCEpilogueCallback(v8::Isolate::GCCallbackWithData callback, GCType gc_type_filter, void *data)
V8_EXPORT_PRIVATE void CollectAllAvailableGarbage(GarbageCollectionReason gc_reason)
void AddGCPrologueCallback(v8::Isolate::GCCallbackWithData callback, GCType gc_type_filter, void *data)
V8_EXPORT_PRIVATE int NotifyContextDisposed(bool has_dependent_context)
V8_EXPORT_PRIVATE uint64_t external_memory_limit_for_interrupt()
void SetGetExternallyAllocatedMemoryInBytesCallback(GetExternallyAllocatedMemoryInBytesCallback callback)
bool MeasureMemory(std::unique_ptr< v8::MeasureMemoryDelegate > delegate, v8::MeasureMemoryExecution execution)
void RecordStats(HeapStats *stats)
void CollectCodeStatistics()
HeapProfiler * heap_profiler() const
uint64_t UpdateExternalMemory(int64_t delta)
bool HasBeenSetUp() const
const base::AddressRegion & code_region()
void RemoveGCPrologueCallback(v8::Isolate::GCCallbackWithData callback, void *data)
void RemoveGCEpilogueCallback(v8::Isolate::GCCallbackWithData callback, void *data)
std::unique_ptr< v8::MeasureMemoryDelegate > CreateDefaultMeasureMemoryDelegate(v8::Local< v8::Context > context, v8::Local< v8::Promise::Resolver > promise, v8::MeasureMemoryMode mode)
V8_EXPORT_PRIVATE void AddNearHeapLimitCallback(v8::NearHeapLimitCallback, void *data)
uint64_t backing_store_bytes() const
V8_EXPORT_PRIVATE void RemoveNearHeapLimitCallback(v8::NearHeapLimitCallback callback, size_t heap_limit)
V8_EXPORT_PRIVATE void MemoryPressureNotification(v8::MemoryPressureLevel level, bool is_isolate_locked)
V8_INLINE void SetMessageListeners(Tagged< ArrayList > value)
v8::CppHeap * cpp_heap() const
bool is_not_found() const
GlobalHandles * global_handles() const
void set_stack_size(size_t v)
MaybeDirectHandle< Script > CurrentReferrerScript()
void SetHostCreateShadowRealmContextCallback(HostCreateShadowRealmContextCallback callback)
bool serializer_enabled() const
AccountingAllocator * allocator()
void SetHostImportModuleDynamicallyCallback(HostImportModuleDynamicallyCallback callback)
void SetPromiseHook(PromiseHook hook)
static V8_INLINE Isolate * Current()
void RequestInterrupt(InterruptCallback callback, void *data)
CompilationCache * compilation_cache()
DateCache * date_cache() const
const IsolateData * isolate_data() const
void SetPromiseRejectCallback(PromiseRejectCallback callback)
void SetHostImportModuleWithPhaseDynamicallyCallback(HostImportModuleWithPhaseDynamicallyCallback callback)
EternalHandles * eternal_handles() const
const v8::Context::BackupIncumbentScope * top_backup_incumbent_scope() const
std::vector< MemoryRange > * GetCodePages() const
void set_memory_saver_mode_enabled(bool memory_saver_mode_enabled)
void SetFailedAccessCheckCallback(v8::FailedAccessCheckCallback callback)
HandleScopeImplementer * handle_scope_implementer() const
void DiscardPerThreadDataForThisThread()
bool was_locker_ever_used() const
Bootstrapper * bootstrapper()
MaybeLocal< v8::Context > GetContextFromRecorderContextId(v8::metrics::Recorder::ContextId id)
void InstallConditionalFeatures(DirectHandle< NativeContext > context)
Handle< JSMessageObject > CreateMessage(DirectHandle< Object > exception, MessageLocation *location)
Tagged< Context > context() const
Handle< StackTraceInfo > GetDetailedStackTrace(DirectHandle< JSReceiver > error_object)
v8::metrics::LongTaskStats * GetCurrentLongTaskStats()
void RemoveCallCompletedCallback(CallCompletedCallback callback)
v8::metrics::Recorder::ContextId GetOrRegisterRecorderContextId(DirectHandle< NativeContext > context)
void SetReleaseCppHeapCallback(v8::Isolate::ReleaseCppHeapCallback callback)
void set_context(Tagged< Context > context)
Tagged< Object > Throw(Tagged< Object > exception, MessageLocation *location=nullptr)
void CancelTerminateExecution()
bool is_execution_terminating()
DirectHandle< String > CurrentScriptNameOrSourceURL()
void DetachGlobal(DirectHandle< Context > env)
TracedHandles * traced_handles()
void PrintCurrentStackTrace(std::ostream &out, PrintCurrentStackTraceFilterCallback should_include_frame_callback=nullptr)
bool GetStackTraceLimit(Isolate *isolate, int *result)
void SetCaptureStackTraceForUncaughtExceptions(bool capture, int frame_limit, StackTrace::StackTraceOptions options)
void AbortConcurrentOptimization(BlockingBehavior blocking_behavior)
void AddBeforeCallEnteredCallback(BeforeCallEnteredCallback callback)
V8_INLINE HandleScopeData * handle_scope_data()
v8::ArrayBuffer::Allocator * array_buffer_allocator() const
ThreadManager * thread_manager() const
void InitializeLoggingAndCounters()
ThreadId thread_id() const
void SetIdle(bool is_idle)
StringTable * string_table() const
Handle< NativeContext > native_context()
void Freeze(bool is_frozen)
DirectHandle< StackTraceInfo > CaptureDetailedStackTrace(int limit, StackTrace::StackTraceOptions options)
StackGuard * stack_guard()
IsolateGroup * isolate_group() const
void set_array_buffer_allocator_shared(std::shared_ptr< v8::ArrayBuffer::Allocator > allocator)
void AddCallCompletedCallback(CallCompletedCallback callback)
V8FileLogger * v8_file_logger() const
void set_battery_saver_mode_enabled(bool battery_saver_mode_enabled)
v8::internal::Factory * factory()
void set_top_backup_incumbent_scope(const v8::Context::BackupIncumbentScope *top_backup_incumbent_scope)
DirectHandle< NativeContext > GetIncumbentContext()
void RemoveBeforeCallEnteredCallback(BeforeCallEnteredCallback callback)
bool should_check_side_effects() const
Handle< JSGlobalProxy > global_proxy()
void set_allow_atomics_wait(bool set)
LocalIsolate * AsLocalIsolate()
void SetExceptionPropagationCallback(ExceptionPropagationCallback callback)
void SetIsLoading(bool is_loading)
void ReportPendingMessages(bool report=true)
void SetPrepareStackTraceCallback(PrepareStackTraceCallback callback)
void clear_topmost_script_having_context()
void SetPriority(v8::Isolate::Priority priority)
DirectHandle< Symbol > SymbolFor(RootIndex dictionary_index, Handle< String > name, bool private_symbol)
const std::shared_ptr< metrics::Recorder > & metrics_recorder()
void SetAddCrashKeyCallback(AddCrashKeyCallback callback)
void ClearSerializerData()
ThreadLocalTop * thread_local_top()
void set_array_buffer_allocator(v8::ArrayBuffer::Allocator *allocator)
void clear_internal_exception()
void RegisterTryCatchHandler(v8::TryCatch *that)
void SetAbortOnUncaughtExceptionCallback(v8::Isolate::AbortOnUncaughtExceptionCallback callback)
void SetHostInitializeImportMetaObjectCallback(HostInitializeImportMetaObjectCallback callback)
V8_INLINE void SetCppHeapWrappable(IsolateForPointerCompression isolate, void *)
V8_INLINE void * GetCppHeapWrappable(IsolateForPointerCompression isolate) const
static Maybe< bool > Cleanup(Isolate *isolate, DirectHandle< JSFinalizationRegistry > finalization_registry)
Maybe< bool > CollectKeys(DirectHandle< JSReceiver > receiver, DirectHandle< JSReceiver > object)
static MaybeHandle< FixedArray > GetKeys(Isolate *isolate, DirectHandle< JSReceiver > object, KeyCollectionMode mode, PropertyFilter filter, GetKeysConversion keys_conversion=GetKeysConversion::kKeepNumbers, bool is_for_in=false, bool skip_indices=false)
void set_skip_indices(bool value)
V8_INLINE DirectHandle< T > ToHandleChecked() const
V8_WARN_UNUSED_RESULT V8_INLINE bool ToHandle(DirectHandle< S > *out) const
V8_INLINE bool is_null() const
V8_INLINE Handle< T > ToHandleChecked() const
void IncrementMicrotasksScopeDepth()
void DecrementMicrotasksScopeDepth()
v8::MicrotasksPolicy microtasks_policy() const
void IncrementMicrotasksSuppressions()
void PerformCheckpoint(v8::Isolate *isolate) override
unsigned int GetHitLineCount() const
const std::vector< ProfileNode * > * children() const
bool GetLineTicks(v8::CpuProfileNode::LineTick *entries, unsigned int length) const
CodeEntry * entry() const
const std::vector< CpuProfileDeoptInfo > & deopt_infos() const
void set_value(DirectHandle< JSAny > value)
void set_set(DirectHandle< UnionOf< JSAny, FunctionTemplateInfo > > set)
void set_writable(bool writable)
void set_enumerable(bool enumerable)
void set_get(DirectHandle< UnionOf< JSAny, FunctionTemplateInfo > > get)
Tagged< T > GetCurrent() const
virtual void VisitRootPointers(Root root, const char *description, FullObjectSlot start, FullObjectSlot end)=0
void SetDefaultContext(DirectHandle< NativeContext > context, SerializeEmbedderFieldsCallback callback)
size_t AddContext(DirectHandle< NativeContext > context, SerializeEmbedderFieldsCallback callback)
Isolate * isolate() const
size_t AddData(DirectHandle< NativeContext > context, Address object)
StartupData CreateBlob(SnapshotCreator::FunctionCodeHandling function_code_handling, Snapshot::SerializerFlags serializer_flags=Snapshot::kDefaultSerializerFlags)
void SetStackLimit(uintptr_t limit)
V8_INLINE bool IsExternalOneByte() const
V8_INLINE bool IsExternalTwoByte() const
V8_INLINE bool IsExternal() const
size_t GetCurrentMemoryUsage() const
V8_INLINE constexpr StorageType ptr() const
V8_INLINE constexpr bool is_null() const
v8::TryCatch * try_catch_handler_
bool IsLockedByCurrentThread() const
static void Move(Address **from, Address **to)
static void Destroy(Address *location)
V8_INLINE FullObjectSlot Create(Address value, Address *slot, TracedReferenceStoreMode store_mode, TracedReferenceHandling reference_handling)
static void Copy(const Address *const *from, Address **to)
void SetCodeEventHandler(uint32_t options, JitCodeEventHandler event_handler)
Maybe< bool > ReadHeader() V8_WARN_UNUSED_RESULT
bool ReadUint64(uint64_t *value) V8_WARN_UNUSED_RESULT
MaybeDirectHandle< Object > ReadObjectUsingEntireBufferForLegacyFormat() V8_WARN_UNUSED_RESULT
uint32_t GetWireFormatVersion() const
bool ReadRawBytes(size_t length, const void **data) V8_WARN_UNUSED_RESULT
MaybeDirectHandle< Object > ReadObjectWrapper() V8_WARN_UNUSED_RESULT
bool ReadDouble(double *value) V8_WARN_UNUSED_RESULT
bool ReadUint32(uint32_t *value) V8_WARN_UNUSED_RESULT
void TransferArrayBuffer(uint32_t transfer_id, DirectHandle< JSArrayBuffer > array_buffer)
void WriteUint32(uint32_t value)
void SetTreatArrayBufferViewsAsHostObjects(bool mode)
void WriteRawBytes(const void *source, size_t length)
void TransferArrayBuffer(uint32_t transfer_id, DirectHandle< JSArrayBuffer > array_buffer)
Maybe< bool > WriteObject(DirectHandle< Object > object) V8_WARN_UNUSED_RESULT
void WriteDouble(double value)
std::pair< uint8_t *, size_t > Release()
void WriteUint64(uint64_t value)
static ContextId GetContextId(Local< Context > context)
static MaybeLocal< Context > GetContext(Isolate *isolate, ContextId id)
RecordWriteMode const mode_
AlignedCachedData * cached_data_
#define V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL
#define COMPRESS_POINTERS_BOOL
#define V8_ENABLE_SANDBOX_BOOL
base::TemplateHashMapImpl< Handle< HeapObject >, DependentCode::DependencyGroups, HandleValueEqual, ZoneAllocationPolicy > deps_
#define EXPORT_CONTEXTUAL_VARIABLE(VarName)
Handle< SharedFunctionInfo > info
#define RAB_GSAB_TYPED_ARRAYS(V)
#define TYPED_ARRAYS_BASE(V)
#define THROW_NEW_ERROR_RETURN_VALUE(isolate, call, value)
#define ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, dst, call, value)
#define MAYBE_RETURN_ON_EXCEPTION_VALUE(isolate, call, value)
#define FOR_WITH_HANDLE_SCOPE(isolate, loop_var_type, init, loop_var, limit_check, increment, body)
MicrotaskQueue * microtask_queue
base::Vector< const DirectHandle< Object > > args
#define EXPORT_TEMPLATE_DEFINE(export)
std::vector< std::unique_ptr< InstanceTypeTree > > children
SharedFunctionInfoRef shared
DirectHandle< JSReceiver > options
ZoneVector< RpoNumber > & result
LiftoffAssembler::CacheState state
ZoneVector< Entry > entries
FunctionLiteral * literal
std::shared_ptr< NativeModule > native_module_
InstructionOperand source
v8::PageAllocator PageAllocator
void InitializeProcess(PageAllocator *page_allocator, size_t desired_heap_size)
i::Address ConvertToJSGlobalProxyIfNecessary(i::Address holder_ptr)
void * ClearWeak(i::Address *location)
void AnnotateStrongRetainer(i::Address *location, const char *label)
void MoveGlobalReference(internal::Address **from, internal::Address **to)
i::Address * GlobalizeReference(i::Isolate *i_isolate, i::Address value)
void MakeWeak(i::Address *location, void *parameter, WeakCallbackInfo< void >::Callback weak_callback, WeakCallbackType type)
V8_EXPORT v8::Local< v8::Value > GetFunctionTemplateData(v8::Isolate *isolate, v8::Local< v8::Data > raw_target)
i::Address * Eternalize(Isolate *v8_isolate, Value *value)
void InternalFieldOutOfBounds(int index)
i::Address * CopyGlobalReference(i::Address *from)
void DisposeGlobal(i::Address *location)
V8_INLINE size_t hash_combine(size_t seed, size_t hash)
void * Allocate(void *address, size_t size, OS::MemoryPermission access)
void * Realloc(void *memory, size_t size)
void FatalOOM(OOMType type, const char *msg)
void * Calloc(size_t count, size_t size)
constexpr bool IsInRange(T value, U lower_limit, U higher_limit)
constexpr Vector< T > VectorOf(T *start, size_t size)
OwnedVector< T > OwnedCopyOf(const T *data, size_t size)
void * Malloc(size_t size)
void SetDcheckFunction(void(*dcheck_function)(const char *, int, const char *))
void SetFatalFunction(void(*fatal_function)(const char *, int, const char *))
std::pair< Tagged_t, Tagged_t > TaggedAddressRange
bool EnableTrapHandler(bool use_v8_handler)
void SetUnhandledExceptionCallback(v8::UnhandledExceptionCallback unhandled_exception_callback)
void DeleteArray(T *array)
V8_INLINE IndirectHandle< T > handle(Tagged< T > object, Isolate *isolate)
bool CanUseFastIteration(Isolate *isolate, DirectHandle< JSArray > array)
bool TryCast(Tagged< From > value, Tagged< To > *out)
void InvokeFinalizationRegistryCleanupFromTask(DirectHandle< NativeContext > native_context, DirectHandle< JSFinalizationRegistry > finalization_registry)
constexpr const char * ToString(DeoptimizeKind kind)
uint32_t DoubleToUint32(double x)
v8::PageAllocator * GetPlatformPageAllocator()
bool InitializeICU(const char *icu_data_file)
void VerifyHandleIsNonEmpty(bool is_empty)
bool IsNumeric(Tagged< Object > obj)
bool IsNumber(Tagged< Object > obj)
constexpr InstanceType LAST_STRING_TYPE
void DisposeTracedReference(internal::Address *location)
bool ValidateFunctionCallbackInfo(const FunctionCallbackInfo< T > &info)
constexpr int kEmbedderDataSlotSize
unsigned int FastD2UI(double x)
bool IsCustomElementsReceiverMap(Tagged< Map > map)
Tagged(T object) -> Tagged< T >
V8_INLINE IsolateForSandbox GetCurrentIsolateForSandbox()
bool IsGeneratorFunction(FunctionKind kind)
bool IsInt32Double(double value)
void InvokeFunctionCallbackOptimized(const v8::FunctionCallbackInfo< v8::Value > &info)
V8_INLINE Isolate * GetIsolateFromWritableObject(Tagged< HeapObject > object)
V8_INLINE bool GetIsolateFromHeapObject(Tagged< HeapObject > object, Isolate **isolate)
void CopyTracedReference(const internal::Address *const *from, internal::Address **to)
bool ValidatePropertyCallbackInfo(const PropertyCallbackInfo< T > &info)
V8_INLINE constexpr bool IsSmi(TaggedImpl< kRefType, StorageType > obj)
i::Address * GlobalizeTracedReference(i::Isolate *i_isolate, i::Address value, internal::Address *slot, TracedReferenceStoreMode store_mode, TracedReferenceHandling reference_handling)
BUILTIN_FP_CALL BUILTIN_FP_CALL BUILTIN_FP_CALL BUILTIN_FP_CALL BUILTIN_FP_CALL BUILTIN_FP_CALL BUILTIN_FP_CALL BUILTIN_FP_CALL BUILTIN_FP_CALL BUILTIN_FP_CALL int character
bool IsAsyncFunction(FunctionKind kind)
DateBuffer ToDateString(double time_val, DateCache *date_cache, ToDateStringMode mode)
V8_EXPORT internal::Isolate * IsolateFromNeverReadOnlySpaceObject(Address obj)
void VisitObject(Isolate *isolate, Tagged< HeapObject > object, ObjectVisitor *visitor)
@ HOLEY_NONEXTENSIBLE_ELEMENTS
@ SLOW_STRING_WRAPPER_ELEMENTS
@ PACKED_NONEXTENSIBLE_ELEMENTS
@ SLOW_SLOPPY_ARGUMENTS_ELEMENTS
@ FAST_SLOPPY_ARGUMENTS_ELEMENTS
@ FAST_STRING_WRAPPER_ELEMENTS
V8_INLINE DirectHandle< T > direct_handle(Tagged< T > object, Isolate *isolate)
bool IsImmutableLexicalVariableMode(VariableMode mode)
const int kHandleBlockSize
static const int kInvalidEnumCacheSentinel
bool IsModule(FunctionKind kind)
ShouldThrow GetShouldThrow(Isolate *isolate, Maybe< ShouldThrow > should_throw)
bool IsPrimitive(Tagged< Object > obj)
bool V8_EXPORT ValidateCallbackInfo(const FunctionCallbackInfo< void > &info)
int32_t ConvertDouble(double d)
DONT_OVERRIDE DISABLE_ALLOCATION_SITES HOLEY_ELEMENTS
constexpr uint32_t kGlobalHandleZapValue
DONT_OVERRIDE DISABLE_ALLOCATION_SITES DISABLE_ALLOCATION_SITES HOLEY_DOUBLE_ELEMENTS
bool InitializeICUDefaultLocation(const char *exec_path, const char *icu_data_file)
int32_t DoubleToInt32(double x)
void InvokeFunctionCallbackGeneric(const v8::FunctionCallbackInfo< v8::Value > &info)
@ kApiAccessCheckCallbackTag
@ kApiAbortScriptExecutionCallbackTag
constexpr bool kPlatformRequiresCodeRange
V8_EXPORT_PRIVATE FlagValues v8_flags
float DoubleToFloat32(double x)
V8_INLINE bool IsWasmObject(T obj, Isolate *=nullptr)
uint64_t DoubleToWebIDLUint64(double x)
constexpr size_t kMaximalCodeRangeSize
double FastUI2D(unsigned x)
static bool IsMinusZero(double value)
MaybeDirectHandle< Object > JsonStringify(Isolate *isolate, Handle< JSAny > object, Handle< JSAny > replacer, Handle< Object > gap)
bool IsPrivateSymbol(Tagged< Object > obj)
void InitializeExternalStartupData(const char *directory_path)
int64_t DoubleToWebIDLInt64(double x)
void InitializeExternalStartupDataFromFile(const char *snapshot_blob)
void MoveTracedReference(internal::Address **from, internal::Address **to)
void MemCopy(void *dest, const void *src, size_t size)
void InvokeAccessorGetterCallback(v8::Local< v8::Name > property, const v8::PropertyCallbackInfo< v8::Value > &info)
V8_EXPORT bool ShouldThrowOnError(internal::Isolate *isolate)
constexpr uint32_t kMaxUInt32
kInstanceDescriptorsOffset kTransitionsOrPrototypeInfoOffset IsNull(value)||IsJSProxy(value)||IsWasmObject(value)||(IsJSObject(value) &&(HeapLayout
FastIterateResult FastIterateArray(DirectHandle< JSArray > array, Isolate *isolate, v8::Array::IterationCallback callback, void *callback_data)
T * NewArray(size_t size)
uint32_t GetLength(Tagged< JSArray > array)
!IsContextMap !IsContextMap native_context
Tagged< To > Cast(Tagged< From > value, const v8::SourceLocation &loc=INIT_SOURCE_LOCATION_IN_DEBUG)
void(*)( Isolate *isolate, Local< Context > context, Local< Promise::Resolver > resolver, Local< Value > result, WasmAsyncSuccess success) WasmAsyncResolvePromiseCallback
bool(*)(Local< Context > context) WasmJSPIEnabledCallback
@ kJitCodeEventEnumExisting
bool(*)(Isolate *isolate, Local< Object > obj) IsJSApiWrapperNativeErrorCallback
bool(*)(Local< Context > context) JavaScriptCompileHintsMagicEnabledCallback
static constexpr ReleaseStoreTag kReleaseStore
static OOMErrorCallback g_oom_error_callback
void(*)(const JitCodeEvent *event) JitCodeEventHandler
static i::DirectHandle< ObjectType > CreateEnvironment(i::Isolate *i_isolate, v8::ExtensionConfiguration *extensions, v8::MaybeLocal< ObjectTemplate > maybe_global_template, v8::MaybeLocal< Value > maybe_global_proxy, size_t context_snapshot_index, i::DeserializeEmbedderFieldsCallback embedder_fields_deserializer, v8::MicrotaskQueue *microtask_queue)
void(*)(CrashKeyId id, const std::string &value) AddCrashKeyCallback
void(*)(Local< Name > property, const PropertyCallbackInfo< Value > &info) AccessorNameGetterCallback
ModifyCodeGenerationFromStringsResult(*)(Local< Context > context, Local< Value > source) ModifyCodeGenerationFromStringsCallback
V8_EXPORT bool TryHandleWebAssemblyTrapPosix(int sig_code, siginfo_t *info, void *context)
void(*)(ExceptionPropagationMessage message) ExceptionPropagationCallback
bool(*)(const FunctionCallbackInfo< Value > &) ExtensionCallback
static i::CpuProfile * ToInternal(const CpuProfile *profile)
static constexpr int kInternalFieldsInWeakCallback
void(*)(void *histogram, int sample) AddHistogramSampleCallback
void(*)(const char *file, int line, const char *message) DcheckErrorCallback
void(*)(const FunctionCallbackInfo< Value > &) WasmStreamingCallback
bool ToLocal(v8::internal::MaybeDirectHandle< v8::internal::Object > maybe, Local< T > *local)
bool(*)(Local< Context > accessing_context, Local< Object > accessed_object, Local< Value > data) AccessCheckCallback
void(*)(const char *name, int status) LogEventCallback
void(*)(const char *file, int line, const char *message) V8FatalErrorCallback
void(*)(PromiseRejectMessage message) PromiseRejectCallback
static const uintptr_t kAlignmentMask
void(*)(Isolate *) CallCompletedCallback
void(*)(void *data) MicrotaskCallback
void(*)(const char *location, const char *message) FatalErrorCallback
V8_INLINE Local< Primitive > Undefined(Isolate *isolate)
void(*)(Isolate *, void *) MicrotasksCompletedCallbackWithData
v8::internal::DirectHandle< i::UnionOf< i::Smi, i::Foreign > > FromCData(v8::internal::Isolate *isolate, T obj)
BackingStoreInitializationMode
void(*)(Local< Message > message, Local< Value > data) MessageCallback
void(*)(const FunctionCallbackInfo< Value > &info) FunctionCallback
static V8_INLINE bool InternalFieldOK(i::DirectHandle< i::JSReceiver > obj, int index, const char *location)
void(*)(Local< Object > target, AccessType type, Local< Value > data) FailedAccessCheckCallback
static i::DirectHandle< i::EmbedderDataArray > EmbedderDataFor(Context *context, int index, bool can_grow, const char *location)
void(*)(Local< Context > context, Local< Module > module, Local< Object > meta) HostInitializeImportMetaObjectCallback
V8_EXPORT bool TryHandleWebAssemblyTrapWindows(EXCEPTION_POINTERS *exception)
uintptr_t(*)(uintptr_t return_addr_location) ReturnAddressLocationResolver
static const uint16_t * Align(const uint16_t *chars)
void(*)(Isolate *isolate, void *data) InterruptCallback
static void WriteHelperV2(i::Isolate *i_isolate, const String *string, CharType *buffer, uint32_t offset, uint32_t length, int flags)
int *(*)(const char *name) CounterLookupCallback
static ScriptOrigin GetScriptOriginForScript(i::Isolate *i_isolate, i::DirectHandle< i::Script > script)
bool(*)(Local< Context > context) WasmImportedStringsEnabledCallback
static void CallGCCallbackWithoutData(Isolate *v8_isolate, GCType type, GCCallbackFlags flags, void *data)
void *(*)(const char *name, int min, int max, size_t buckets) CreateHistogramCallback
void RegisterExtension(std::unique_ptr< Extension > extension)
void(*)(PromiseHookType type, Local< Promise > promise, Local< Value > parent) PromiseHook
bool(*)(Local< Context > context) SharedArrayBufferConstructorEnabledCallback
v8::Local< T > ToApiHandle(v8::internal::DirectHandle< v8::internal::Object > obj)
bool(*)(unsigned char *buffer, size_t length) EntropySource
static const uintptr_t kOneByteMask
static Maybe< bool > ObjectSetAccessor(Local< Context > context, Object *self, Local< Name > name, Getter getter, Setter setter, Data data, PropertyAttribute attributes, bool replace_on_access, SideEffectType getter_side_effect_type, SideEffectType setter_side_effect_type)
ModifyCodeGenerationFromStringsResult(*)(Local< Context > context, Local< Value > source, bool is_code_like) ModifyCodeGenerationFromStringsCallback2
Local< Context > NewContext(v8::Isolate *external_isolate, v8::ExtensionConfiguration *extensions, v8::MaybeLocal< ObjectTemplate > global_template, v8::MaybeLocal< Value > global_object, size_t context_snapshot_index, i::DeserializeEmbedderFieldsCallback embedder_fields_deserializer, v8::MicrotaskQueue *microtask_queue)
void(*)(Local< Name > property, Local< Value > value, const PropertyCallbackInfo< void > &info) AccessorNameSetterCallback
size_t(*)(void *data, size_t current_heap_limit, size_t initial_heap_limit) NearHeapLimitCallback
bool(*)(Isolate *isolate, Local< String > script_name) PrintCurrentStackTraceFilterCallback
void(*)(Isolate *) BeforeCallEnteredCallback
static int WriteHelper(i::Isolate *i_isolate, const String *string, CharType *buffer, int start, int length, int options)
void(*)(const char *location, const OOMDetails &details) OOMErrorCallback
uint32_t SnapshotObjectId
bool CopyAndConvertArrayToCppBuffer(Local< Array > src, T *dst, uint32_t max_length)
static bool Unaligned(const uint16_t *chars)
BackingStoreOnFailureMode
static constexpr AcquireLoadTag kAcquireLoad
Maybe< T > Just(const T &t)
bool(*)(int, void *) CompileHintCallback
bool(*)(Local< Context > context, Local< String > source) AllowWasmCodeGenerationCallback
#define STATIC_CONST_MEMBER_DEFINITION
#define DCHECK_LE(v1, v2)
#define CHECK_GE(lhs, rhs)
#define CHECK_IMPLIES(lhs, rhs)
#define CHECK_LT(lhs, rhs)
#define CHECK_LE(lhs, rhs)
#define DCHECK_NOT_NULL(val)
#define CHECK_NOT_NULL(val)
#define DCHECK_IMPLIES(v1, v2)
#define DCHECK_NE(v1, v2)
#define CHECK_NE(lhs, rhs)
#define DCHECK_GE(v1, v2)
#define CHECK_EQ(lhs, rhs)
#define DCHECK(condition)
#define DCHECK_LT(v1, v2)
#define DCHECK_EQ(v1, v2)
#define DCHECK_GT(v1, v2)
#define V8_EXPORT_PRIVATE
CppHeapPointerTag lower_bound
CppHeapPointerTag upper_bound
const CpuProfilingStatus status
ActivityControl * control
PropertyHandlerFlags flags
IndexedPropertyQueryCallbackV2 query
IndexedPropertyDeleterCallbackV2 deleter
IndexedPropertyGetterCallbackV2 getter
IndexedPropertyEnumeratorCallback enumerator
IndexedPropertyDescriptorCallbackV2 descriptor
IndexedPropertySetterCallbackV2 setter
IndexedPropertyDefinerCallbackV2 definer
i::DirectHandle< i::JSGlobalProxy > Invoke(i::Isolate *i_isolate, i::MaybeDirectHandle< i::JSGlobalProxy > maybe_global_proxy, v8::Local< v8::ObjectTemplate > global_proxy_template, v8::ExtensionConfiguration *extensions, size_t context_snapshot_index, i::DeserializeEmbedderFieldsCallback embedder_fields_deserializer, v8::MicrotaskQueue *microtask_queue)
i::DirectHandle< i::NativeContext > Invoke(i::Isolate *i_isolate, i::MaybeDirectHandle< i::JSGlobalProxy > maybe_global_proxy, v8::Local< v8::ObjectTemplate > global_proxy_template, v8::ExtensionConfiguration *extensions, size_t context_snapshot_index, i::DeserializeEmbedderFieldsCallback embedder_fields_deserializer, v8::MicrotaskQueue *microtask_queue)
JSEntryStub js_entry_stub
JSEntryStub js_construct_entry_stub
JSEntryStub js_run_microtasks_entry_stub
NamedPropertyDescriptorCallback descriptor
NamedPropertySetterCallback setter
NamedPropertyDeleterCallback deleter
NamedPropertyEnumeratorCallback enumerator
NamedPropertyQueryCallback query
NamedPropertyGetterCallback getter
NamedPropertyDefinerCallback definer
PropertyHandlerFlags flags
RegisterState & operator=(const RegisterState &other)
std::unique_ptr< CalleeSavedRegisters > callee_saved
void * external_callback_entry
CompatibilityCheckResult CompatibilityCheck(Isolate *isolate)
bool supports_legacy_wire_format
i::ValueDeserializer deserializer
PrivateData(i::Isolate *i_isolate, base::Vector< const uint8_t > data, Delegate *delegate)
i::ValueSerializer serializer
PrivateData(i::Isolate *i, ValueSerializer::Delegate *delegate)
MaybeHandle< FixedArray > wrapped_arguments
static LongTaskStats Get(Isolate *isolate)
i::PropertyDescriptor desc
#define TRACE_EVENT0(category_group, name)
#define TRACE_DISABLED_BY_DEFAULT(name)
#define TRACE_EVENT_CALL_STATS_SCOPED(isolate, category_group, name)
#define CODE_EVENTS_LIST(V)
#define END_ALLOW_USE_DEPRECATED()
#define V8_LIKELY(condition)
#define V8_WARN_UNUSED_RESULT
#define V8_UNLIKELY(condition)
#define START_ALLOW_USE_DEPRECATED()
std::unique_ptr< ValueMirror > value
std::unique_ptr< ValueMirror > key
std::shared_ptr< const char[]> source_url_