120#if V8_ENABLE_WEBASSEMBLY
124#ifdef V8_INTL_SUPPORT
143 LanguageMode mode = isolate->context()->scope_info()->language_mode();
148 if (!it.frame()->is_javascript())
continue;
152 std::vector<Tagged<SharedFunctionInfo>> functions;
154 LanguageMode closure_language_mode = functions.back()->language_mode();
155 if (closure_language_mode > mode) {
156 mode = closure_language_mode;
166 case Operation::kLessThan:
168 case Operation::kLessThanOrEqual:
171 case Operation::kGreaterThan:
173 case Operation::kGreaterThanOrEqual:
183 if (InstanceTypeChecker::IsJSApiObject(instance_type)) {
184 std::stringstream ss;
185 ss <<
"[api object] "
186 <<
static_cast<int16_t
>(instance_type) -
187 i::Internals::kFirstJSApiObjectType;
190 switch (instance_type) {
191#define WRITE_TYPE(TYPE) \
198 std::stringstream ss;
199 ss <<
"[unknown instance type " <<
static_cast<int16_t
>(instance_type) <<
"]";
204 return os <<
ToString(instance_type);
210 return os <<
"Undefined";
212 return os <<
"Constant";
214 return os <<
"ConstantType";
216 return os <<
"Mutable";
218 return os <<
"InTransition";
232 if (map->is_stable() && IsJSReceiverMap(*map)) {
243 if (!representation.
IsDouble())
return object;
245 if (IsUninitialized(*
object, isolate)) {
247 }
else if (IsHeapNumber(*
object)) {
256template <AllocationType allocation_type,
typename IsolateT>
259 DCHECK(!IsUninitialized(*
object, isolate));
264 return isolate->factory()->template NewHeapNumberFromBits<allocation_type>(
275 const char* method_name) {
276 DCHECK(!IsJSReceiver(*
object));
279 if (
IsSmi(*
object)) {
282 int constructor_function_index =
285 if (method_name !=
nullptr) {
287 isolate, NewTypeError(MessageTemplate::kCalledOnNullOrUndefined,
288 isolate->factory()->NewStringFromAsciiChecked(
292 NewTypeError(MessageTemplate::kUndefinedOrNullToObject));
309 return isolate->global_proxy();
316template <
template <
typename>
typename HandleType>
319 Isolate* isolate, HandleType<Object> input) {
324 if (IsString(*input)) {
327 if (IsOddball(*input)) {
330 if (IsSymbol(*input)) {
331 THROW_NEW_ERROR(isolate, NewTypeError(MessageTemplate::kSymbolToNumber));
333 if (IsBigInt(*input)) {
334 THROW_NEW_ERROR(isolate, NewTypeError(MessageTemplate::kBigIntToNumber));
349template <
template <
typename>
typename HandleType>
352 Isolate* isolate, HandleType<Object> input) {
357 if (IsString(*input)) {
360 if (IsOddball(*input)) {
363 if (IsSymbol(*input)) {
364 THROW_NEW_ERROR(isolate, NewTypeError(MessageTemplate::kSymbolToNumber));
366 if (IsBigInt(*input)) {
382template <
template <
typename>
typename HandleType>
384typename HandleType<Number>::MaybeType Object::ConvertToInteger(
385 Isolate* isolate, HandleType<Object> input) {
388 return isolate->factory()->NewNumber(
393 Isolate* isolate, DirectHandle<Object> input);
398template <
template <
typename>
typename HandleType>
399 requires(std::is_convertible_v<HandleType<Object>, DirectHandle<Object>>)
401 Isolate* isolate, HandleType<Object> input) {
404 return isolate->factory()->NewNumberFromInt(
414template <
template <
typename>
typename HandleType>
417 Isolate* isolate, HandleType<Object> input) {
420 return typename HandleType<Number>::MaybeType(
422 return isolate->factory()->NewNumberFromUint(
432template <
template <
typename>
typename HandleType>
435 Isolate* isolate, HandleType<Object> input) {
450template <
template <
typename>
typename HandleType>
453 Isolate* isolate, HandleType<Object> value) {
455 typename HandleType<Object>::MaybeType maybe_key =
458 HandleType<Object>
key;
459 if (!maybe_key.ToHandle(&
key))
return key;
461 if (IsSymbol(*
key))
return key;
465 if (IsHeapNumber(*
key)) {
469 return HandleType<Object>(
Smi::FromInt(
static_cast<int>(uint_value)),
482template <
template <
typename>
typename HandleType>
484typename HandleType<String>::MaybeType Object::ConvertToString(
485 Isolate* isolate, HandleType<Object> input) {
487 if (IsOddball(*input)) {
492 return isolate->factory()->NumberToString(input);
494 if (IsSymbol(*input)) {
495 THROW_NEW_ERROR(isolate, NewTypeError(MessageTemplate::kSymbolToString));
497 if (IsBigInt(*input)) {
500#if V8_ENABLE_WEBASSEMBLY
503 if (IsWasmNull(*input)) {
504 return isolate->factory()->null_string();
513 if (IsString(*input)) {
520 Isolate* isolate, DirectHandle<Object> input);
526bool IsErrorObject(Isolate* isolate, DirectHandle<Object>
object) {
527 if (!IsJSObject(*
object))
return false;
532DirectHandle<String> AsStringOrEmpty(Isolate* isolate,
533 DirectHandle<Object>
object) {
535 : isolate->factory()->empty_string();
538DirectHandle<String> NoSideEffectsErrorToString(
539 Isolate* isolate, DirectHandle<JSReceiver> error) {
540 DirectHandle<Name> name_key = isolate->factory()->name_string();
541 DirectHandle<Object> name =
543 DirectHandle<String> name_str = AsStringOrEmpty(isolate, name);
545 DirectHandle<Name> msg_key = isolate->factory()->message_string();
546 DirectHandle<Object> msg =
548 DirectHandle<String> msg_str = AsStringOrEmpty(isolate, msg);
550 if (name_str->length() == 0)
return msg_str;
551 if (msg_str->length() == 0)
return name_str;
553 constexpr const char error_suffix[] =
"<a very large string>";
554 constexpr uint32_t error_suffix_size =
sizeof(error_suffix);
555 uint32_t suffix_size = std::min(error_suffix_size, msg_str->length());
557 IncrementalStringBuilder builder(isolate);
559 constexpr const char connector[] =
"... : ";
560 int connector_size =
sizeof(connector);
561 DirectHandle<String> truncated_name =
562 isolate->factory()->NewProperSubString(
564 name_str->length() - error_suffix_size - connector_size);
565 builder.AppendString(truncated_name);
566 builder.AppendCStringLiteral(connector);
567 builder.AppendCStringLiteral(error_suffix);
569 builder.AppendString(name_str);
570 builder.AppendCStringLiteral(
": ");
572 builder.AppendString(msg_str);
574 builder.AppendCStringLiteral(error_suffix);
578 return builder.Finish().ToHandleChecked();
586 DisallowJavascriptExecution no_js(isolate);
588 if (IsString(*input) ||
IsNumber(*input) || IsOddball(*input)) {
590 }
else if (IsJSProxy(*input)) {
595 }
while (IsJSProxy(*currInput));
597 }
else if (IsBigInt(*input)) {
599 }
else if (IsJSFunctionOrBoundFunctionOrWrappedFunction(*input)) {
602 if (IsJSBoundFunction(*input)) {
604 }
else if (IsJSWrappedFunction(*input)) {
607 DCHECK(IsJSFunction(*input));
611 if (fun_str->length() > 128) {
613 builder.
AppendString(isolate->factory()->NewSubString(fun_str, 0, 111));
616 fun_str, fun_str->length() - 2, fun_str->length()));
618 return builder.
Finish().ToHandleChecked();
621 }
else if (IsSymbol(*input)) {
625 if (symbol->is_private_name()) {
631 if (IsString(symbol->description())) {
634 if (description->length() > 128) {
636 isolate->factory()->NewSubString(description, 0, 56));
639 description, description->length() - 56, description->length()));
646 return builder.
Finish().ToHandleChecked();
647 }
else if (IsJSReceiver(*input)) {
651 isolate,
receiver, isolate->factory()->toString_string());
653 if (IsErrorObject(isolate, input) ||
654 *to_string == *isolate->error_to_string()) {
658 return NoSideEffectsErrorToString(isolate,
receiver);
659 }
else if (*to_string == *isolate->object_to_string()) {
661 isolate,
receiver, isolate->factory()->constructor_string());
662 if (IsJSFunctionOrBoundFunctionOrWrappedFunction(*ctor)) {
664 if (IsJSBoundFunction(*ctor)) {
668 }
else if (IsJSFunction(*ctor)) {
672 if (ctor_name->length() != 0) {
678 return builder.
Finish().ToHandleChecked();
689 DisallowJavascriptExecution no_js(isolate);
695 if (maybe_string.
ToHandle(&string_handle)) {
696 return string_handle;
702 if (IsJSReceiver(*input)) {
707 int constructor_function_index =
710 return isolate->factory()->NewStringFromAsciiChecked(
"[object Unknown]");
719 isolate,
receiver, isolate->factory()->to_string_tag_symbol());
721 IsString(*tag_obj) ?
Cast<String>(tag_obj) : builtin_tag;
728 return builder.
Finish().ToHandleChecked();
745 return isolate->factory()->NewNumber(len);
749template <
template <
typename>
typename HandleType>
751typename HandleType<Number>::MaybeType Object::ConvertToIndex(
753 if (IsUndefined(*input, isolate))
754 return HandleType<Number>(
Smi::zero(), isolate);
758 HandleType<Number> js_len = isolate->factory()->NewNumber(len);
766 Isolate* isolate, DirectHandle<Object> input,
MessageTemplate error_index);
771template <
typename IsolateT>
776 if (IsBoolean(obj))
return IsTrue(obj, isolate);
778#ifdef V8_ENABLE_WEBASSEMBLY
779 if (IsWasmNull(obj))
return false;
781 if (IsUndetectable(obj))
return false;
782 if (IsString(obj))
return Cast<String>(obj)->length() != 0;
784 if (IsBigInt(obj))
return Cast<BigInt>(obj)->ToBoolean();
792 if (IsBoolean(obj))
return obj;
801 if (std::isnan(
x) || std::isnan(
y)) {
814bool StrictNumberEquals(
double x,
double y) {
816 if (std::isnan(
x) || std::isnan(
y))
return false;
824bool StrictNumberEquals(DirectHandle<Number>
x, DirectHandle<Number>
y) {
825 return StrictNumberEquals(*
x, *
y);
849 if (IsString(*
x) && IsString(*
y)) {
853 if (IsBigInt(*
x) && IsString(*
y)) {
856 if (IsString(*
x) && IsBigInt(*
y)) {
874 if (x_is_number && y_is_number) {
877 }
else if (!x_is_number && !y_is_number) {
879 }
else if (x_is_number) {
894 }
else if (IsBoolean(*
y)) {
897 }
else if (IsString(*
y)) {
898 return Just(StrictNumberEquals(
900 }
else if (IsBigInt(*
y)) {
902 }
else if (IsJSReceiver(*
y)) {
910 }
else if (IsString(*
x)) {
916 }
else if (IsBoolean(*
y)) {
920 }
else if (IsBigInt(*
y)) {
922 }
else if (IsJSReceiver(*
y)) {
930 }
else if (IsBoolean(*
x)) {
932 return Just(
x.is_identical_to(
y));
936 }
else if (IsString(*
y)) {
940 }
else if (IsBigInt(*
y)) {
943 }
else if (IsJSReceiver(*
y)) {
952 }
else if (IsSymbol(*
x)) {
954 return Just(
x.is_identical_to(
y));
955 }
else if (IsJSReceiver(*
y)) {
963 }
else if (IsBigInt(*
x)) {
968 }
else if (IsJSReceiver(*
x)) {
969 if (IsJSReceiver(*
y)) {
970 return Just(
x.is_identical_to(
y));
971 }
else if (IsUndetectable(*
y)) {
972 return Just(IsUndetectable(*
x));
973 }
else if (IsBoolean(*
y)) {
980 return Just(IsUndetectable(*
x) && IsUndetectable(*
y));
990 }
else if (IsString(obj)) {
991 if (!IsString(that))
return false;
993 }
else if (IsBigInt(obj)) {
994 if (!IsBigInt(that))
return false;
1002 if (
IsNumber(*
object))
return isolate->factory()->number_string();
1003 if (IsOddball(*
object))
1005 if (IsUndetectable(*
object)) {
1006 return isolate->factory()->undefined_string();
1008 if (IsString(*
object))
return isolate->factory()->string_string();
1009 if (IsSymbol(*
object))
return isolate->factory()->symbol_string();
1010 if (IsBigInt(*
object))
return isolate->factory()->bigint_string();
1011 if (IsCallable(*
object))
return isolate->factory()->function_string();
1012 return isolate->factory()->object_string();
1019 return isolate->factory()->NewNumber(
1022 }
else if (IsString(*lhs) && IsString(*rhs)) {
1023 return isolate->factory()->NewConsString(
Cast<String>(lhs),
1028 if (IsString(*lhs) || IsString(*rhs)) {
1031 return isolate->factory()->NewConsString(
Cast<String>(lhs),
1049 if (!IsCallable(*callable))
return isolate->factory()->false_value();
1053 if (IsJSBoundFunction(*callable)) {
1063 if (!IsJSReceiver(*
object))
return isolate->factory()->false_value();
1070 isolate->factory()->prototype_string()));
1071 if (!IsJSReceiver(*prototype)) {
1074 NewTypeError(MessageTemplate::kInstanceofNonobjectProto, prototype));
1081 return isolate->factory()->ToBoolean(
result.FromJust());
1089 if (!IsJSReceiver(*callable)) {
1091 NewTypeError(MessageTemplate::kNonObjectInInstanceOfCheck));
1097 isolate, inst_of_handler,
1099 isolate->factory()->has_instance_symbol()));
1100 if (!IsUndefined(*inst_of_handler, isolate)) {
1107 return isolate->factory()->ToBoolean(
1112 if (!IsCallable(*callable)) {
1114 isolate, NewTypeError(MessageTemplate::kNonCallableInInstanceOfCheck));
1132 return isolate->factory()->undefined_value();
1134 if (!IsCallable(*func)) {
1135 THROW_NEW_ERROR(isolate, NewTypeError(MessageTemplate::kPropertyNotFunction,
1146 if (IsJSArray(*
object)) {
1149 if (!array->HasArrayPrototype(isolate) ||
1151 !array->HasFastElements() ||
1155 return array->GetElementsAccessor()->CreateListFromArrayLike(
1156 isolate, array, length);
1157 }
else if (IsJSTypedArray(*
object)) {
1159 size_t length = array->GetLength();
1160 if (array->IsDetachedOrOutOfBounds() ||
1162 return MaybeDirectHandle<FixedArray>();
1165 std::numeric_limits<uint32_t>::max());
1166 return array->GetElementsAccessor()->CreateListFromArrayLike(
1167 isolate, array,
static_cast<uint32_t
>(length));
1170 return MaybeDirectHandle<FixedArray>();
1180 CreateListFromArrayLikeFastPath(isolate,
object, element_types);
1181 if (!fast_result.
is_null())
return fast_result;
1185 if (!IsJSReceiver(*
object)) {
1187 NewTypeError(MessageTemplate::kCalledOnNonObject,
1188 isolate->factory()->NewStringFromAsciiChecked(
1189 "CreateListFromArrayLike")));
1201 NewRangeError(MessageTemplate::kInvalidArrayLength));
1207 for (uint32_t index = 0; index < len; ++
index) {
1213 switch (element_types) {
1220 if (!IsName(*next)) {
1222 isolate, NewTypeError(MessageTemplate::kNotPropertyName, next));
1226 next = isolate->factory()->InternalizeName(
Cast<Name>(next));
1230 list->set(index, *next);
1249 bool is_global_reference) {
1250 for (;; it->Next()) {
1251 switch (it->state()) {
1263 if (is_global_reference) {
1265 it->isolate(), it->GetHolder<
JSProxy>(), it->GetName());
1269 return it->isolate()->factory()->undefined_value();
1274 it->GetName(),
receiver, &was_found);
1275 if (!was_found && !is_global_reference) it->NotFound();
1290 if (it->HasAccess())
continue;
1295 return it->isolate()->factory()->undefined_value();
1297 return it->GetDataValue();
1299 if (it->IsPrivateName()) {
1302 Cast<String>(private_symbol->description()), it->isolate());
1303 if (private_symbol->is_private_brand()) {
1305 name_string->length() == 0
1306 ? it->isolate()->factory()->anonymous_string()
1310 NewTypeError(MessageTemplate::kInvalidPrivateBrandInstance,
1315 NewTypeError(MessageTemplate::kInvalidPrivateMemberRead,
1319 return it->isolate()->factory()->undefined_value();
1333 DCHECK(!name->IsPrivate());
1341 if (proxy->IsRevoked()) {
1343 NewTypeError(MessageTemplate::kProxyRevoked, trap_name));
1353 if (IsUndefined(*
trap, isolate)) {
1358 *was_found = it.IsFound();
1365 isolate, trap_result,
1398 if (access_kind ==
kGet) {
1400 isolate, NewTypeError(MessageTemplate::kProxyGetNonConfigurableData,
1401 name, target_desc.
value(), trap_result));
1403 isolate->Throw(*isolate->factory()->NewTypeError(
1404 MessageTemplate::kProxySetFrozenData, name));
1411 if (access_kind ==
kGet) {
1414 IsUndefined(*target_desc.
get(), isolate) &&
1415 !IsUndefined(*trap_result, isolate);
1419 IsUndefined(*target_desc.
set(), isolate);
1422 if (access_kind ==
kGet) {
1425 NewTypeError(MessageTemplate::kProxyGetNonConfigurableAccessor,
1426 name, trap_result));
1428 isolate->Throw(*isolate->factory()->NewTypeError(
1429 MessageTemplate::kProxySetFrozenAccessor, name));
1434 return isolate->factory()->undefined_value();
1443 if (IsHeapNumber(obj)) {
1458 Isolate* isolate = proxy->GetIsolate();
1467 if (proxy->IsRevoked()) {
1469 NewTypeError(MessageTemplate::kProxyRevoked, trap_name));
1479 if (IsUndefined(*
trap, isolate)) {
1486 isolate, handler_proto_result,
1490 if (!
TryCast(handler_proto_result, &handler_proto)) {
1492 NewTypeError(MessageTemplate::kProxyGetPrototypeOfInvalid));
1507 NewTypeError(MessageTemplate::kProxyGetPrototypeOfNonExtensible));
1510 return handler_proto;
1526 DCHECK(!IsForeign(*structure));
1530 if (IsAccessorInfo(*structure)) {
1534 if (!info->has_getter(isolate)) {
1535 return isolate->factory()->undefined_value();
1538 if (info->is_sloppy() && !IsJSReceiver(*
receiver)) {
1548 if (info->replace_on_access() && IsJSReceiver(*
receiver)) {
1553 return reboxed_result;
1558 if (it->TryLookupCachedProperty(accessor_pair)) {
1564 if (IsFunctionTemplateInfo(*
getter)) {
1568 isolate->factory()->undefined_value()));
1569 }
else if (IsCallable(*
getter)) {
1575 return isolate->factory()->undefined_value();
1593 DCHECK(!IsForeign(*structure));
1597 if (IsAccessorInfo(*structure)) {
1601 if (!info->has_setter(isolate)) {
1608 if (info->is_sloppy() && !IsJSReceiver(*
receiver)) {
1615 maybe_should_throw);
1616 bool result =
args.CallAccessorSetter(info, name, value);
1628 if (IsFunctionTemplateInfo(*
setter)) {
1638 }
else if (IsCallable(*
setter)) {
1641 value, maybe_should_throw);
1645 NewTypeError(MessageTemplate::kNoSetterInCallback,
1646 it->GetName(), it->GetHolder<
JSObject>()));
1662 if (check.JsHasOverflowed()) {
1663 isolate->StackOverflow();
1692 return heap_object->map()->GetPrototypeChainRootMap(isolate);
1701 DCHECK(IsJSReceiver(obj));
1707 if (other == obj)
return true;
1713 if (IsString(obj) && IsString(other)) {
1716 if (IsBigInt(obj) && IsBigInt(other)) {
1724 if (other == obj)
return true;
1730 return this_value == other_value ||
1731 (std::isnan(this_value) && std::isnan(other_value));
1733 if (IsString(obj) && IsString(other)) {
1736 if (IsBigInt(obj) && IsBigInt(other)) {
1745 if (!
v8_flags.builtin_subclassing)
return default_species;
1746 if (IsJSArray(*original_array) &&
1747 Cast<JSArray>(original_array)->HasArrayPrototype(isolate) &&
1748 Protectors::IsArraySpeciesLookupChainIntact(isolate)) {
1749 return default_species;
1756 isolate, constructor,
1758 isolate->factory()->constructor_string()));
1759 if (IsConstructor(*constructor)) {
1762 isolate, constructor_context,
1764 if (*constructor_context != *isolate->native_context() &&
1765 *constructor == constructor_context->array_function()) {
1766 constructor = isolate->factory()->undefined_value();
1769 if (IsJSReceiver(*constructor)) {
1771 isolate, constructor,
1773 isolate->factory()->species_symbol()));
1774 if (
IsNull(*constructor, isolate)) {
1775 constructor = isolate->factory()->undefined_value();
1779 if (IsUndefined(*constructor, isolate)) {
1780 return default_species;
1782 if (!IsConstructor(*constructor)) {
1784 NewTypeError(MessageTemplate::kSpeciesNotConstructor));
1797 JSObject::GetProperty(isolate, recv,
1798 isolate->factory()->constructor_string()));
1800 if (IsUndefined(*ctor_obj, isolate))
return default_ctor;
1802 if (!IsJSReceiver(*ctor_obj)) {
1804 NewTypeError(MessageTemplate::kConstructorNotReceiver));
1812 JSObject::GetProperty(isolate, ctor,
1813 isolate->factory()->species_symbol()));
1816 return default_ctor;
1819 if (IsConstructor(*species))
return species;
1822 NewTypeError(MessageTemplate::kSpeciesNotConstructor));
1829 if (!IsJSArray(obj))
return true;
1834 if (!IsJSObject(array_proto))
return true;
1836 auto initial_array_prototype =
native_context->initial_array_prototype();
1837 if (initial_array_prototype != array_proto)
return true;
1839 Isolate* isolate = array->GetIsolate();
1842 if (!Protectors::IsArrayIteratorLookupChainIntact(isolate))
return true;
1853 Protectors::IsNoElementsIntact(isolate)) {
1871 std::ostringstream os;
1873 accumulator->
Add(os.str().c_str());
1886 return os <<
"ToNumber";
1888 return os <<
"ToNumeric";
1897 if (maybe_object.
ToSmi(&smi)) {
1903 heap_object->HeapObjectShortPrint(os);
1905 heap_object->HeapObjectShortPrint(os);
1928 os <<
" " <<
start() <<
", " <<
end();
1932 os <<
" callable=" <<
Brief(callable());
1940 int instance_size = map->instance_size();
1945 LAST_FIXED_ARRAY_TYPE)) {
1948#define CASE(TypeCamelCase, TYPE_UPPER_CASE) \
1949 if (instance_type == TYPE_UPPER_CASE##_TYPE) { \
1950 return UncheckedCast<TypeCamelCase>(*this)->AllocatedSize(); \
1954 if (instance_type == SLOPPY_ARGUMENTS_ELEMENTS_TYPE) {
1957 if (
base::IsInRange(instance_type, FIRST_CONTEXT_TYPE, LAST_CONTEXT_TYPE)) {
1958 if (instance_type == NATIVE_CONTEXT_TYPE)
return NativeContext::kSize;
1969 if (instance_type == BYTECODE_ARRAY_TYPE) {
1973 if (instance_type == FREE_SPACE_TYPE) {
1984 if (instance_type == FIXED_DOUBLE_ARRAY_TYPE) {
1987 if (instance_type == TRUSTED_FIXED_ARRAY_TYPE) {
1990 if (instance_type == PROTECTED_FIXED_ARRAY_TYPE) {
1993 if (instance_type == PROTECTED_WEAK_FIXED_ARRAY_TYPE) {
1996 if (instance_type == TRUSTED_WEAK_FIXED_ARRAY_TYPE) {
1999 if (instance_type == TRUSTED_BYTE_ARRAY_TYPE) {
2002 if (instance_type == FEEDBACK_METADATA_TYPE) {
2006 LAST_DESCRIPTOR_ARRAY_TYPE)) {
2011 LAST_WEAK_FIXED_ARRAY_TYPE)) {
2014 if (instance_type == WEAK_ARRAY_LIST_TYPE) {
2018 if (instance_type == SMALL_ORDERED_HASH_SET_TYPE) {
2022 if (instance_type == SMALL_ORDERED_HASH_MAP_TYPE) {
2026 if (instance_type == SMALL_ORDERED_NAME_DICTIONARY_TYPE) {
2030 if (instance_type == SWISS_NAME_DICTIONARY_TYPE) {
2034 if (instance_type == PROPERTY_ARRAY_TYPE) {
2038 if (instance_type == FEEDBACK_VECTOR_TYPE) {
2039 return FeedbackVector::SizeFor(
2045 if (instance_type == PREPARSE_DATA_TYPE) {
2049#define MAKE_TORQUE_SIZE_FOR(TYPE, TypeName) \
2050 if (instance_type == TYPE) { \
2051 return UncheckedCast<TypeName>(*this)->AllocatedSize(); \
2054#undef MAKE_TORQUE_SIZE_FOR
2056 if (instance_type == INSTRUCTION_STREAM_TYPE) {
2059 if (instance_type == COVERAGE_INFO_TYPE) {
2063#if V8_ENABLE_WEBASSEMBLY
2064 if (instance_type == WASM_TYPE_INFO_TYPE) {
2065 return WasmTypeInfo::SizeFor(
2068 if (instance_type == WASM_STRUCT_TYPE) {
2071 if (instance_type == WASM_ARRAY_TYPE) {
2074 if (instance_type == WASM_NULL_TYPE) {
2077 if (instance_type == WASM_DISPATCH_TABLE_TYPE) {
2082 DCHECK_EQ(instance_type, EMBEDDER_DATA_ARRAY_TYPE);
2096 instance_type ==
map()->instance_type());
2100 switch (instance_type) {
2101 case DESCRIPTOR_ARRAY_TYPE:
2102 case STRONG_DESCRIPTOR_ARRAY_TYPE:
2104 case TRANSITION_ARRAY_TYPE:
2106 case ORDERED_HASH_MAP_TYPE:
2107 case ORDERED_HASH_SET_TYPE:
2109 case NAME_DICTIONARY_TYPE:
2110 case NAME_TO_INDEX_HASH_TABLE_TYPE:
2111 case REGISTERED_SYMBOL_TABLE_TYPE:
2112 case GLOBAL_DICTIONARY_TYPE:
2113 case NUMBER_DICTIONARY_TYPE:
2114 case SIMPLE_NUMBER_DICTIONARY_TYPE:
2115 case HASH_TABLE_TYPE:
2116 case SMALL_ORDERED_HASH_MAP_TYPE:
2117 case SMALL_ORDERED_HASH_SET_TYPE:
2118 case SMALL_ORDERED_NAME_DICTIONARY_TYPE:
2119 case SWISS_NAME_DICTIONARY_TYPE:
2131 switch (
map(cage_base)->instance_type()) {
2135 case ORDERED_HASH_MAP_TYPE:
2136 case ORDERED_HASH_SET_TYPE:
2138 case ORDERED_NAME_DICTIONARY_TYPE:
2140 case NAME_DICTIONARY_TYPE:
2141 case NAME_TO_INDEX_HASH_TABLE_TYPE:
2142 case REGISTERED_SYMBOL_TABLE_TYPE:
2143 case GLOBAL_DICTIONARY_TYPE:
2144 case NUMBER_DICTIONARY_TYPE:
2145 case SIMPLE_NUMBER_DICTIONARY_TYPE:
2146 case SWISS_NAME_DICTIONARY_TYPE:
2148 case DESCRIPTOR_ARRAY_TYPE:
2149 case STRONG_DESCRIPTOR_ARRAY_TYPE:
2151 case TRANSITION_ARRAY_TYPE:
2153 case SMALL_ORDERED_HASH_MAP_TYPE:
2155 case SMALL_ORDERED_HASH_SET_TYPE:
2157 case SMALL_ORDERED_NAME_DICTIONARY_TYPE:
2165template <
typename IsolateT>
2167 switch (
map(isolate)->instance_type()) {
2168 case HASH_TABLE_TYPE:
2171 case NAME_DICTIONARY_TYPE:
2174 case NAME_TO_INDEX_HASH_TABLE_TYPE:
2177 case REGISTERED_SYMBOL_TABLE_TYPE:
2180 case SWISS_NAME_DICTIONARY_TYPE:
2183 case GLOBAL_DICTIONARY_TYPE:
2186 case NUMBER_DICTIONARY_TYPE:
2189 case SIMPLE_NUMBER_DICTIONARY_TYPE:
2192 case DESCRIPTOR_ARRAY_TYPE:
2193 case STRONG_DESCRIPTOR_ARRAY_TYPE:
2197 case TRANSITION_ARRAY_TYPE:
2200 case SMALL_ORDERED_HASH_MAP_TYPE:
2203 case SMALL_ORDERED_HASH_SET_TYPE:
2206 case ORDERED_HASH_MAP_TYPE:
2207 case ORDERED_HASH_SET_TYPE:
2217 case SMALL_ORDERED_NAME_DICTIONARY_TYPE:
2228 isolate->AsIsolate()->PushParamsAndDie(
2229 reinterpret_cast<void*
>(
ptr()),
reinterpret_cast<void*
>(
map().
ptr()),
2230 reinterpret_cast<void*
>(
2231 static_cast<uintptr_t
>(
map()->instance_type())));
2246 if (clear_constness) {
2271 it->UpdateProtector();
2278 for (;; it->Next()) {
2279 switch (it->state()) {
2281 if (it->HasAccess())
continue;
2301 NewTypeError(MessageTemplate::kWasmObjectsAreOpaque));
2304 if (it->HolderIsReceiverOrHiddenPrototype()) {
2351 if (it->IsReadOnly()) {
2355 if (IsAccessorInfo(*accessors) &&
2356 !it->HolderIsReceiverOrHiddenPrototype()) {
2372 it->isolate(), converted_value,
2376 it->isolate(), converted_value,
2383 it->RecheckTypedArrayBounds();
2398 value = converted_value;
2403 if (it->IsReadOnly()) {
2406 if (it->HolderIsReceiverOrHiddenPrototype()) {
2423 if (IsJSGlobalObject(*it->GetReceiver(), isolate) &&
2430 it->transition_cell()->ClearAndInvalidate(isolate);
2432 isolate->Throw(*isolate->factory()->NewReferenceError(
2433 MessageTemplate::kNotDefined, it->GetName()));
2442 if (it->IsFound()) {
2446 if (found)
return result;
2461 if (it->IsFound()) {
2465 if (found)
return result;
2468 it->UpdateProtector();
2473 if (!IsJSReceiver(*it->GetReceiver())) {
2482 for (;; own_lookup.
Next()) {
2483 switch (own_lookup.
state()) {
2527 value, should_throw);
2538 &value_desc, should_throw);
2550 NewTypeError(MessageTemplate::kWasmObjectsAreOpaque));
2566 NewTypeError(MessageTemplate::kStrictCannotCreateProperty, name,
2574 if (it->IsFound() && !it->HolderIsReceiver()) {
2581 it->isolate()->CountUsage(feature);
2584 it->GetName(), value, should_throw);
2593 NewTypeError(MessageTemplate::kStrictReadOnlyProperty, name,
2601 NewTypeError(MessageTemplate::kRedefineDisallowed, name));
2608 it->GetName()->IsPrivateName());
2609 DCHECK_IMPLIES(!it->IsElement() && it->GetName()->IsPrivateName(),
2614 DCHECK(it->HolderIsReceiverOrHiddenPrototype());
2618 if (it->IsElement() && IsJSObject(*
receiver, isolate) &&
2619 Cast<JSObject>(*receiver)->HasTypedArrayOrRabGsabTypedArrayElements(
2625 BigInt::FromObject(isolate, value),
2627 if (
V8_UNLIKELY(receiver_ta->IsDetachedOrOutOfBounds() ||
2628 it->index() >= receiver_ta->GetLength())) {
2631 }
else if (!
IsNumber(*value) && !IsUndefined(*value, isolate)) {
2635 if (
V8_UNLIKELY(receiver_ta->IsDetachedOrOutOfBounds() ||
2636 it->index() >= receiver_ta->GetLength())) {
2644 IsJSSharedArray(*
receiver, isolate))) {
2649 it->WriteDataValue(to_assign,
false);
2653 it->PrepareForDataProperty(to_assign);
2656 it->WriteDataValue(to_assign,
false);
2661 receiver->HeapObjectVerify(isolate);
2673 if (!IsJSReceiver(*it->GetReceiver())) {
2675 value, should_throw);
2680 if (IsJSProxy(*it->GetReceiver()) && it->GetName()->IsPrivate() &&
2681 !it->GetName()->IsPrivateName()) {
2683 NewTypeError(MessageTemplate::kProxyPrivate));
2699 if (it->ExtendingNonExtensible(
receiver)) {
2700 bool is_shared_object = IsAlwaysSharedSpaceJSObject(*
receiver);
2706 ? MessageTemplate::kDefineDisallowedFixedLayout
2707 : MessageTemplate::kDefineDisallowed)
2708 : (is_shared_object ? MessageTemplate::kObjectFixedLayout
2709 : MessageTemplate::kObjectNotExtensible),
2718 NewTypeError(MessageTemplate::kStrictReadOnlyProperty,
2719 isolate->factory()->length_string(),
2733 should_throw, store_origin);
2742 it->UpdateProtector();
2745 it->PrepareTransitionToDataProperty(
receiver, value, attributes,
2748 it->ApplyTransitionToDataProperty(
receiver);
2751 it->WriteDataValue(value,
true);
2755 receiver->HeapObjectVerify(it->isolate());
2763template <
template <
typename>
typename HandleType>
2766 Isolate* isolate, HandleType<HeapObject> value,
2773 if (IsString(*value)) {
2777 if (IsHeapNumber(*value)) {
2779 return isolate->factory()
2785 NewTypeError(MessageTemplate::kCannotBeShared, value));
2802 int valid_descriptors) {
2803 int nof_callbacks = callbacks->length();
2808 for (
int i = nof_callbacks - 1;
i >= 0;
i--) {
2814 if (!T::Contains(
key, entry, valid_descriptors, array)) {
2815 T::Insert(
key, entry, valid_descriptors, array);
2816 valid_descriptors++;
2820 return valid_descriptors;
2823struct FixedArrayAppender {
2825 static bool Contains(DirectHandle<Name>
key, DirectHandle<AccessorInfo> entry,
2826 int valid_descriptors, DirectHandle<FixedArray> array) {
2827 for (
int i = 0;
i < valid_descriptors;
i++) {
2832 static void Insert(DirectHandle<Name>
key, DirectHandle<AccessorInfo> entry,
2833 int valid_descriptors, DirectHandle<FixedArray> array) {
2835 array->set(valid_descriptors, *entry);
2844 int valid_descriptors) {
2846 DCHECK_GE(array->length(), callbacks->length() + valid_descriptors);
2847 return AppendUniqueCallbacks<FixedArrayAppender>(isolate, callbacks, array,
2852 Isolate* isolate = proxy->GetIsolate();
2854 if (!proxy->IsRevoked()) {
2860 DCHECK(proxy->IsRevoked());
2865 Isolate* isolate = proxy->GetIsolate();
2869 if (proxy->IsRevoked()) {
2870 isolate->Throw(*isolate->factory()->NewTypeError(
2871 MessageTemplate::kProxyRevoked,
2872 isolate->factory()->NewStringFromAsciiChecked(
"IsArray")));
2876 if (IsJSArray(*
object))
return Just(
true);
2877 if (!IsJSProxy(*
object))
return Just(
false);
2881 isolate->StackOverflow();
2887 DCHECK(!name->IsPrivate());
2894 if (proxy->IsRevoked()) {
2895 isolate->Throw(*isolate->factory()->NewTypeError(
2896 MessageTemplate::kProxyRevoked, isolate->factory()->has_string()));
2906 isolate->factory()->has_string()),
2909 if (IsUndefined(*
trap, isolate)) {
2917 isolate, trap_result_obj,
2922 if (!boolean_trap_result) {
2926 return Just(boolean_trap_result);
2941 isolate->Throw(*isolate->factory()->NewTypeError(
2942 MessageTemplate::kProxyHasNonConfigurable, name));
2949 if (!extensible_target.
FromJust()) {
2950 isolate->Throw(*isolate->factory()->NewTypeError(
2951 MessageTemplate::kProxyHasNonExtensible, name));
2963 DCHECK(!name->IsPrivate());
2964 Isolate* isolate = proxy->GetIsolate();
2966 Factory* factory = isolate->factory();
2969 if (proxy->IsRevoked()) {
2971 *factory->NewTypeError(MessageTemplate::kProxyRevoked, trap_name));
2981 if (IsUndefined(*
trap, isolate)) {
2992 isolate, trap_result,
2997 NewTypeError(MessageTemplate::kProxyTrapReturnedFalsishFor,
3013 DCHECK(!name->IsPrivate());
3016 Isolate* isolate = proxy->GetIsolate();
3018 Factory* factory = isolate->factory();
3021 if (proxy->IsRevoked()) {
3023 *factory->NewTypeError(MessageTemplate::kProxyRevoked, trap_name));
3033 if (IsUndefined(*
trap, isolate)) {
3041 isolate, trap_result,
3046 NewTypeError(MessageTemplate::kProxyTrapReturnedFalsishFor,
3065 isolate->Throw(*isolate->factory()->NewTypeError(
3066 MessageTemplate::kProxyDeletePropertyNonConfigurable, name));
3073 if (!extensible_target.
FromJust()) {
3074 isolate->Throw(*isolate->factory()->NewTypeError(
3075 MessageTemplate::kProxyDeletePropertyNonExtensible, name));
3086 if (!IsJSReceiver(*target)) {
3087 THROW_NEW_ERROR(isolate, NewTypeError(MessageTemplate::kProxyNonObject));
3089 if (!IsJSReceiver(*handler)) {
3090 THROW_NEW_ERROR(isolate, NewTypeError(MessageTemplate::kProxyNonObject));
3099 it->isolate(), it->GetHolder<
JSProxy>(), it->GetName(), &desc);
3102 return Just(desc.ToAttributes());
3110 if (IsString(*value))
return Cast<String>(*value)->AsArrayIndex(length);
3125 if (IsName(*name)) {
3126 name = isolate->factory()->InternalizeName(
Cast<Name>(name));
3141 isolate, o, isolate->factory()->length_string(), &old_len_desc);
3146 uint32_t old_len = 0;
3156 NewTypeError(MessageTemplate::kDefineDisallowed, name));
3160 OrdinaryDefineOwnProperty(isolate, o, name, desc, should_throw);
3166 if (index >= old_len) {
3168 old_len_desc.
set_value(isolate->factory()->NewNumberFromUint(index + 1));
3171 succeeded = OrdinaryDefineOwnProperty(isolate, o,
3172 isolate->factory()->length_string(),
3173 &old_len_desc, should_throw);
3183 return OrdinaryDefineOwnProperty(isolate, o, name, desc, should_throw);
3194 if (IsString(*length_object) &&
3214 isolate->factory()->NewRangeError(MessageTemplate::kInvalidArrayLength);
3215 isolate->Throw(*exception);
3228 if (!desc->has_value()) {
3230 return OrdinaryDefineOwnProperty(
3231 isolate, a, isolate->factory()->length_string(), desc, should_throw);
3237 uint32_t new_len = 0;
3239 DCHECK(isolate->has_exception());
3247 isolate, a, isolate->factory()->length_string(), &old_len_desc);
3252 uint32_t old_len = 0;
3255 if (new_len >= old_len) {
3258 new_len_desc->
set_value(isolate->factory()->NewNumberFromUint(new_len));
3259 return OrdinaryDefineOwnProperty(isolate, a,
3260 isolate->factory()->length_string(),
3261 new_len_desc, should_throw);
3273 NewTypeError(MessageTemplate::kRedefineDisallowed,
3274 isolate->factory()->length_string()));
3278 bool new_writable =
false;
3280 new_writable =
true;
3292 if (!new_writable) {
3295 success = OrdinaryDefineOwnProperty(isolate, a,
3296 isolate->factory()->length_string(),
3297 &readonly, should_throw);
3301 uint32_t actual_new_len = 0;
3304 bool result = actual_new_len == new_len;
3308 NewTypeError(MessageTemplate::kStrictDeleteProperty,
3309 isolate->factory()->NewNumberFromUint(actual_new_len - 1),
3335 if (proxy->IsRevoked()) {
3336 isolate->Throw(*isolate->factory()->NewTypeError(
3337 MessageTemplate::kProxyRevoked, trap_name));
3349 if (IsUndefined(*
trap, isolate)) {
3362 DCHECK(!property_name->IsPrivate());
3366 isolate, trap_result_obj,
3372 NewTypeError(MessageTemplate::kProxyTrapReturnedFalsishFor,
3373 trap_name, property_name));
3383 bool extensible_target = maybe_extensible.
FromJust();
3388 bool setting_config_false = desc->has_configurable() && !desc->configurable();
3392 if (!extensible_target) {
3393 isolate->Throw(*isolate->factory()->NewTypeError(
3394 MessageTemplate::kProxyDefinePropertyNonExtensible, property_name));
3398 if (setting_config_false) {
3399 isolate->Throw(*isolate->factory()->NewTypeError(
3400 MessageTemplate::kProxyDefinePropertyNonConfigurable, property_name));
3407 Maybe<bool> valid = IsCompatiblePropertyDescriptor(
3408 isolate, extensible_target, desc, &target_desc, property_name,
3411 if (!valid.FromJust()) {
3412 isolate->Throw(*isolate->factory()->NewTypeError(
3413 MessageTemplate::kProxyDefinePropertyIncompatible, property_name));
3418 if (setting_config_false && target_desc.
configurable()) {
3419 isolate->Throw(*isolate->factory()->NewTypeError(
3420 MessageTemplate::kProxyDefinePropertyNonConfigurable, property_name));
3430 if (desc->has_writable() && !desc->writable()) {
3431 isolate->Throw(*isolate->factory()->NewTypeError(
3432 MessageTemplate::kProxyDefinePropertyNonConfigurableWritable,
3452 NewTypeError(MessageTemplate::kProxyPrivate));
3454 DCHECK(proxy->map()->is_dictionary_map());
3456 desc->has_value() ? desc->value()
3467 it.WriteDataValue(value,
false);
3482 NameDictionary::Add(isolate, dict, private_name, value, details);
3494 DCHECK(!name->IsPrivate());
3498 isolate->factory()->getOwnPropertyDescriptor_string();
3504 if (proxy->IsRevoked()) {
3505 isolate->Throw(*isolate->factory()->NewTypeError(
3506 MessageTemplate::kProxyRevoked, trap_name));
3518 if (IsUndefined(*
trap, isolate)) {
3526 isolate, trap_result_obj,
3532 if (!IsJSReceiver(*trap_result_obj) &&
3533 !IsUndefined(*trap_result_obj, isolate)) {
3534 isolate->Throw(*isolate->factory()->NewTypeError(
3535 MessageTemplate::kProxyGetOwnPropertyDescriptorInvalid, name));
3544 if (IsUndefined(*trap_result_obj, isolate)) {
3550 isolate->Throw(*isolate->factory()->NewTypeError(
3551 MessageTemplate::kProxyGetOwnPropertyDescriptorUndefined, name));
3559 if (!extensible_target.
FromJust()) {
3560 isolate->Throw(*isolate->factory()->NewTypeError(
3561 MessageTemplate::kProxyGetOwnPropertyDescriptorNonExtensible, name));
3573 DCHECK(isolate->has_exception());
3580 Maybe<bool> valid = IsCompatiblePropertyDescriptor(
3581 isolate, extensible_target.
FromJust(), desc, &target_desc, name,
3585 if (!valid.FromJust()) {
3586 isolate->Throw(*isolate->factory()->NewTypeError(
3587 MessageTemplate::kProxyGetOwnPropertyDescriptorIncompatible, name));
3591 if (!desc->configurable()) {
3595 isolate->Throw(*isolate->factory()->NewTypeError(
3596 MessageTemplate::kProxyGetOwnPropertyDescriptorNonConfigurable,
3602 if (desc->has_writable() && !desc->writable()) {
3605 isolate->Throw(*isolate->factory()->NewTypeError(
3607 kProxyGetOwnPropertyDescriptorNonConfigurableWritable,
3619 Isolate* isolate = proxy->GetIsolate();
3621 Factory* factory = isolate->factory();
3624 if (proxy->IsRevoked()) {
3626 *factory->NewTypeError(MessageTemplate::kProxyRevoked, trap_name));
3636 if (IsUndefined(*
trap, isolate)) {
3643 isolate, trap_result,
3648 isolate, should_throw,
3649 NewTypeError(MessageTemplate::kProxyTrapReturnedFalsish, trap_name));
3656 isolate->Throw(*factory->NewTypeError(
3657 MessageTemplate::kProxyPreventExtensionsExtensible));
3664 Isolate* isolate = proxy->GetIsolate();
3666 Factory* factory = isolate->factory();
3669 if (proxy->IsRevoked()) {
3671 *factory->NewTypeError(MessageTemplate::kProxyRevoked, trap_name));
3681 if (IsUndefined(*
trap, isolate)) {
3688 isolate, trap_result,
3697 *factory->NewTypeError(MessageTemplate::kProxyIsExtensibleInconsistent,
3701 return target_result;
3708 enumeration_index,
NONE, slack);
3714 if (enumeration_index + slack == 0) {
3715 return isolate->factory()->empty_descriptor_array();
3718 int size = enumeration_index;
3726 if (attributes !=
NONE) {
3732 if (!
key->IsPrivate()) {
3738 IsAccessorPair(heap_object))) {
3744 copy->Set(
i,
key, value_or_field_type, details);
3748 copy->CopyFrom(
i, source);
3752 if (source->number_of_descriptors() != enumeration_index) copy->Sort();
3758 int nof_descriptors) {
3765 if (details.
kind() != other_details.
kind() ||
3778 int* assigned_index) {
3779 int length = array->length();
3786 if (assigned_index !=
nullptr) *assigned_index =
kFirstIndex;
3791 if (!array->IsFull()) {
3792 array->Set(length,
MakeWeak(*value));
3793 array->set_length(length + 1);
3794 if (assigned_index !=
nullptr) *assigned_index =
length;
3809 CHECK_LT(empty_slot, array->length());
3810 int next_empty_slot = array->Get(empty_slot).ToSmi().value();
3812 array->Set(empty_slot,
MakeWeak(*value));
3813 if (assigned_index !=
nullptr) *assigned_index = empty_slot;
3823 array->Set(length,
MakeWeak(*value));
3824 array->set_length(length + 1);
3825 if (assigned_index !=
nullptr) *assigned_index =
length;
3832 if (array->Get(
i).IsCleared()) {
3842 if (array->length() == 0) {
3862 new_array->Set(copy_to++, element);
3867 new_array->set_length(copy_to);
3872template <
typename IsolateT>
3874 int nof_descriptors,
3877 return nof_descriptors + slack == 0
3878 ? isolate->factory()->empty_descriptor_array()
3879 : isolate->factory()->NewDescriptorArray(nof_descriptors, slack,
3883 Isolate* isolate,
int nof_descriptors,
int slack,
3891 int nof_descriptors,
int slack,
3892 uint32_t raw_gc_state) {
3896 set_number_of_all_descriptors(nof_descriptors + slack);
3897 set_number_of_descriptors(nof_descriptors);
3910 Set(index, descriptor);
3919 if (enum_cache ==
ReadOnlyRoots(isolate).empty_enum_cache()) {
3920 enum_cache = *isolate->factory()->NewEnumCache(keys, indices,
3921 allocation_if_initialize);
3922 descriptors->set_enum_cache(enum_cache);
3924 enum_cache->set_keys(*keys);
3925 enum_cache->set_indices(*indices);
3932 Set(index, src->GetKey(index), src->GetValue(index), details);
3942 int max_parent_index = (len / 2) - 1;
3943 for (
int i = max_parent_index;
i >= 0; --
i) {
3944 int parent_index =
i;
3946 while (parent_index <= max_parent_index) {
3947 int child_index = 2 * parent_index + 1;
3948 uint32_t child_hash =
GetSortedKey(child_index)->hash();
3949 if (child_index + 1 < len) {
3950 uint32_t right_child_hash =
GetSortedKey(child_index + 1)->hash();
3951 if (right_child_hash > child_hash) {
3953 child_hash = right_child_hash;
3956 if (child_hash <= parent_hash)
break;
3959 parent_index = child_index;
3964 for (
int i = len - 1;
i > 0; --
i) {
3968 int parent_index = 0;
3969 const uint32_t parent_hash =
GetSortedKey(parent_index)->hash();
3970 max_parent_index = (
i / 2) - 1;
3971 while (parent_index <= max_parent_index) {
3972 int child_index = parent_index * 2 + 1;
3973 uint32_t child_hash =
GetSortedKey(child_index)->hash();
3974 if (child_index + 1 <
i) {
3975 uint32_t right_child_hash =
GetSortedKey(child_index + 1)->hash();
3976 if (right_child_hash > child_hash) {
3978 child_hash = right_child_hash;
3981 if (child_hash <= parent_hash)
break;
3983 parent_index = child_index;
3986 DCHECK(IsSortedNoDuplicates());
3991 int insertion_index) {
3993 DCHECK_LE(insertion_index, number_of_all_descriptors());
3995 if (insertion_index <= 0)
return;
3997 for (
int i = insertion_index;
i > 0; --
i) {
3999 if (current_key->hash() != desc_hash)
return;
4000 CHECK(current_key != *desc->GetKey());
4010 raw_copy->set_getter(raw_src->getter());
4011 raw_copy->set_setter(raw_src->setter());
4019 if (IsFunctionTemplateInfo(*accessor)) {
4028 if (
IsNull(*accessor, isolate)) {
4029 return isolate->factory()->undefined_value();
4036 if (number_of_all_descriptors() != other->number_of_all_descriptors()) {
4040 if (
GetKey(
i) != other->GetKey(
i))
return false;
4042 if (
GetValue(
i) != other->GetValue(
i))
return false;
4054 if (IsUndefined(*description, isolate)) {
4055 return isolate->factory()->empty_string();
4079 Relocatable* current = isolate->relocatable_top();
4080 while (current !=
nullptr) {
4081 current->PostGarbageCollection();
4082 current = current->prev_;
4091 *
reinterpret_cast<Relocatable**
>(
to) = isolate->relocatable_top();
4092 isolate->set_relocatable_top(
nullptr);
4098 isolate->set_relocatable_top(*
reinterpret_cast<Relocatable**
>(from));
4109 Iterate(v, isolate->relocatable_top());
4114 while (current !=
nullptr) {
4115 current->IterateInstance(v);
4116 current = current->prev_;
4122template <
typename sink
char>
4128 CHECK_LE(length, fixed_array->length());
4130 sinkchar* sink_end = sink + sink_length;
4133 const int separator_length =
separator->length();
4134 const bool use_one_byte_separator_fast_path =
4135 separator_length == 1 &&
sizeof(sinkchar) == 1 &&
4137 uint8_t separator_one_char;
4138 if (use_one_byte_separator_fast_path) {
4144 uint32_t num_separators = 0;
4145 uint32_t repeat_last = 0;
4148 const bool element_is_special =
IsSmi(element);
4157 num_separators =
count;
4165 DCHECK(
i == 0 ||
i == length - 1 || num_separators > 1);
4167 repeat_last = -
count;
4170 DCHECK(IsString(fixed_array->get(
i - 1)));
4175 if (num_separators > 0 && separator_length > 0) {
4179 if (use_one_byte_separator_fast_path) {
4180 DCHECK_LE(sink + num_separators, sink_end);
4181 memset(sink, separator_one_char, num_separators);
4183 sink += num_separators;
4185 for (uint32_t j = 0; j < num_separators; j++) {
4186 DCHECK_LE(sink + separator_length, sink_end);
4188 sink += separator_length;
4198 int string_length =
Cast<String>(last_element)->length();
4203 int length_with_sep = string_length + separator_length;
4205 sinkchar* copy_end =
4206 sink + (length_with_sep * repeat_last) - separator_length;
4207 int copy_length = length_with_sep;
4208 while (sink < copy_end - copy_length) {
4209 DCHECK_LE(sink + copy_length, sink_end);
4210 memcpy(sink, sink - copy_length, copy_length *
sizeof(sinkchar));
4211 sink += copy_length;
4214 int remaining =
static_cast<int>(copy_end - sink);
4215 if (remaining > 0) {
4217 memcpy(sink, sink - remaining - separator_length,
4218 remaining *
sizeof(sinkchar));
4226 DCHECK(IsString(element));
4228 const int string_length =
string->length();
4230 DCHECK(string_length == 0 || sink < sink_end);
4232 sink += string_length;
4252 DisallowJavascriptExecution no_js(isolate);
4257 DCHECK(IsFixedArray(fixed_array));
4262 WriteFixedArrayToFlat(fixed_array,
static_cast<int>(length),
separator,
4267 WriteFixedArrayToFlat(fixed_array,
static_cast<int>(length),
separator,
4276 const char* type_of, uint8_t
kind) {
4278 isolate->factory()->InternalizeUtf8String(
to_string);
4280 isolate->factory()->InternalizeUtf8String(
type_of);
4282 oddball->set_to_number_raw_as_bits(
4288 oddball->set_to_string(*internalized_to_string);
4289 oddball->set_type_of(*internalized_type_of);
4290 oddball->set_kind(
kind);
4296 int position = script->eval_from_position();
4301 if (!script->has_eval_from_shared()) {
4308 shared->abstract_code(isolate)->SourcePosition(isolate, -
position);
4311 script->set_eval_from_position(
position);
4318 DCHECK(!script->has_line_ends());
4320 if (IsString(src_obj)) {
4328template <
typename IsolateT>
4332 DCHECK(!script->has_line_ends());
4333 DCHECK(script->CanHaveLineEnds());
4335 if (!IsString(src_obj)) {
4336 DCHECK(IsUndefined(src_obj, isolate));
4337 script->set_line_ends(
ReadOnlyRoots(isolate).empty_fixed_array());
4339 DCHECK(IsString(src_obj));
4343 script->set_line_ends(*array);
4345 DCHECK(IsFixedArray(script->line_ends()));
4346 DCHECK(script->has_line_ends());
4351 script->set_source(*source);
4352 if (isolate->NeedsSourcePositions()) {
4354 }
else if (script->line_ends() ==
4356 DCHECK(script->has_line_ends());
4358 DCHECK(!script->has_line_ends());
4369#if V8_ENABLE_WEBASSEMBLY
4373 if (script->type() == Type::kWasm) {
4374 DCHECK(script->has_line_ends());
4380 return script->GetPositionInfo(
position, info, offset_flag);
4386#if V8_ENABLE_WEBASSEMBLY
4402#if V8_ENABLE_WEBASSEMBLY
4403bool Script::ContainsAsmModule() {
4407 sfi = iter.Next()) {
4408 if (sfi->HasAsmWasmData())
return true;
4416 Isolate* isolate = this->GetIsolate();
4417 Tagged<Object> context_value = isolate->native_context()->debug_context_id();
4418 int contextId = (
IsSmi(context_value)) ?
Smi::ToInt(context_value) : 0;
4420 value->SetInteger(
"scriptId", this->
id());
4421 value->SetInteger(
"executionContextId", contextId);
4422 value->SetUnsignedInteger(
"isolate", isolate->debug()->IsolateId());
4427 value->SetString(
"sourceUrl",
4433 Cast<String>(this->source_mapping_url())->ToCString().get());
4436 if (IsString(this->
name())) {
4440 "ScriptCatchup",
"data", std::move(value));
4445 Isolate* isolate = this->GetIsolate();
4446 if (!IsString(this->
source()))
return;
4448 auto script_id = this->id();
4449 int32_t source_length = source->length();
4450 const int32_t kSplitMaxLength = 1000000;
4451 if (source_length <= kSplitMaxLength) {
4453 value->SetUnsignedInteger(
"isolate", isolate->debug()->IsolateId());
4454 value->SetInteger(
"scriptId", script_id);
4455 value->SetInteger(
"length", source_length);
4456 value->SetString(
"sourceText", source->ToCString().get());
4459 "ScriptCatchup",
"data", std::move(value));
4461 int32_t split_count = source_length / kSplitMaxLength + 1;
4462 std::unique_ptr<char[]> source_ptr = source->ToCString();
4463 for (int32_t
i = 0;
i < split_count;
i++) {
4464 int32_t begin =
i * kSplitMaxLength;
4465 int32_t
end = std::min(begin + kSplitMaxLength, source_length);
4467 split_trace_value->SetInteger(
"splitIndex",
i);
4468 split_trace_value->SetInteger(
"splitCount", split_count);
4469 split_trace_value->SetUnsignedInteger(
"isolate",
4470 isolate->debug()->IsolateId());
4471 split_trace_value->SetInteger(
"scriptId", script_id);
4472 split_trace_value->SetString(
4473 "sourceText", std::string(source_ptr.get() + begin,
end - begin));
4476 "LargeScriptCatchup",
"data", std::move(split_trace_value));
4483template <
typename Char>
4486 DCHECK(DisallowPositionInfoSlow::IsAllowed());
4491 const auto begin = std::cbegin(source);
4492 const auto end = std::cend(source);
4493 for (
auto line_begin = begin; line_begin <
end;) {
4494 const auto line_end = std::find(line_begin,
end,
'\n');
4495 if (
position <= (line_end - begin)) {
4497 info->column =
static_cast<int>((begin +
position) - line_begin);
4498 info->line_start =
static_cast<int>(line_begin - begin);
4499 info->line_end =
static_cast<int>(line_end - begin);
4503 line_begin = line_end + 1;
4509 Script::PositionInfo* info) {
4510 if (!IsString(script->source())) {
4514 const auto flat = source->GetFlatContent(no_gc);
4515 return flat.IsOneByte()
4516 ? GetPositionInfoSlowImpl(flat.ToOneByteVector(),
position, info)
4517 : GetPositionInfoSlowImpl(flat.ToUC16Vector(),
position, info);
4521 return vector[line];
4529 return static_cast<int>(vector.size());
4534template <
typename LineEndsContainer>
4535bool GetLineEndsContainerPositionInfo(
const LineEndsContainer& ends,
4536 int position, Script::PositionInfo* info,
4539 if (ends_len == 0)
return false;
4545 }
else if (
position > GetLineEnd(ends, ends_len - 1)) {
4550 if (GetLineEnd(ends, 0) >=
position) {
4552 info->line_start = 0;
4556 int right = ends_len - 1;
4560 const int mid = left + (right - left) / 2;
4561 if (
position > GetLineEnd(ends, mid)) {
4563 }
else if (
position <= GetLineEnd(ends, mid - 1)) {
4571 GetLineEnd(ends, info->line - 1) <
position);
4572 info->line_start = GetLineEnd(ends, info->line - 1) + 1;
4573 info->column =
position - info->line_start;
4585 if (info->line == 0) {
4586 info->column += column_offset();
4588 info->line += line_offset();
4594template <
typename LineEndsContainer>
4598 if (!GetLineEndsContainerPositionInfo(ends,
position, info, no_gc))
4602 info->line_end = GetLineEnd(ends, info->line);
4603 if (info->line_end > 0) {
4606 if (src->length() >=
static_cast<uint32_t
>(info->line_end) &&
4607 src->Get(info->line_end - 1) ==
'\r') {
4615template bool Script::GetPositionInfoInternal<String::LineEndsVector>(
4626#if V8_ENABLE_WEBASSEMBLY
4628 if (
type() == Script::Type::kWasm) {
4632 if (module->
functions.empty())
return false;
4635 info->line_start =
module->functions[0].code.offset();
4636 info->line_end =
module->functions.back().code.end_offset();
4643 if (!GetPositionInfoSlow(*
this,
position, no_gc, info)) {
4670 int position,
int& line,
int& column,
4674 if (!GetLineEndsContainerPositionInfo(line_ends,
position, &info, no_gc)) {
4681 column = info.column;
4712 if (!IsUndefined(source_url()))
return source_url();
4719 bool forceForInspector) {
4720 if (script->origin_options().IsOpaque() && !forceForInspector) {
4721 return isolate->factory()->empty_string();
4726 Tagged<Object> maybe_source_hash = script->source_hash(cage_base);
4727 if (IsString(maybe_source_hash, cage_base)) {
4730 if (precomputed->length() > 0) {
4740 if (!IsString(maybe_script_source, cage_base)) {
4741 return isolate->factory()->empty_string();
4748 std::unique_ptr<char[]> string_val = src_text->ToCString();
4749 size_t len = strlen(string_val.get());
4757 isolate->factory()->NewStringFromAsciiChecked(formatted_hash);
4758 script->set_source_hash(*
result);
4762template <
typename IsolateT>
4773 CHECK_LT(function_literal_id, script->infos()->length());
4776 if (!shared.GetHeapObject(&heap_object) ||
4777 IsUndefined(heap_object, isolate)) {
4793 : iterator_(isolate->
heap()->script_list()) {}
4807 array->GetIsolate()->factory()->NewJSArrayStorage(
4808 array, length, capacity,
4814 if (array->SetLengthWouldNormalize(
new_length)) {
4817 return array->GetElementsAccessor()->SetLength(array,
new_length);
4824 bool from_javascript,
4829 DCHECK(IsJSReceiver(*value) ||
IsNull(*value, isolate));
4834 if (proxy->IsRevoked()) {
4835 isolate->Throw(*isolate->factory()->NewTypeError(
4836 MessageTemplate::kProxyRevoked, trap_name));
4848 if (IsUndefined(*
trap, isolate)) {
4856 isolate, trap_result,
4861 if (!bool_trap_result) {
4863 isolate, should_throw,
4864 NewTypeError(MessageTemplate::kProxyTrapReturnedFalsish, trap_name));
4871 if (bool_trap_result)
return Just(
true);
4873 isolate, should_throw,
4874 NewTypeError(MessageTemplate::kProxyTrapReturnedFalsish, trap_name));
4883 isolate->Throw(*isolate->factory()->NewTypeError(
4884 MessageTemplate::kProxySetPrototypeOfNonExtensible));
4892 if (!HasFastElements())
return false;
4893 uint32_t capacity =
static_cast<uint32_t
>(elements()->length());
4894 uint32_t new_capacity;
4901 set_pretenure_decision(kUndecided);
4902 set_memento_found_count(0);
4903 set_memento_create_count(0);
4914 Tagged<Object> current = boilerplate()->GetHeap()->allocation_sites_list();
4915 while (IsAllocationSite(current)) {
4918 if (current_site->nested_site() ==
this) {
4921 current = current_site->weak_next();
4936 return "don't tenure";
4938 return "maybe tenure";
4950 DCHECK(IsJSArrayMap(js_array_map));
4951 if (js_array_map->is_dictionary_map())
return true;
4957 DCHECK(js_array_map->instance_descriptors()->GetKey(first) ==
4959 return js_array_map->instance_descriptors()->GetDetails(first).IsReadOnly();
4966 if (!MayHaveReadOnlyLength(map))
return false;
4969 Isolate* isolate = array->GetIsolate();
4970 LookupIterator it(isolate, array, isolate->factory()->length_string(), array,
4973 return it.IsReadOnly();
4978 uint32_t length = 0;
4980 if (length <= index)
return HasReadOnlyLength(array);
4986#define SYMBOL_CHECK_AND_PRINT(_, name) \
4987 if (this == roots.name()) return #name;
4989#undef SYMBOL_CHECK_AND_PRINT
4994 int value =
flags() & StatusBits::kMask;
4995 DCHECK(value == 0 || value == 1 || value == 2);
5000 int value =
flags() & ~StatusBits::kMask;
5020 Isolate*
const isolate = promise->GetIsolate();
5022#ifdef V8_ENABLE_JAVASCRIPT_PROMISE_HOOKS
5023 if (isolate->HasContextPromiseHooks()) {
5024 isolate->raw_native_context()->RunPromiseHook(
5026 isolate->factory()->undefined_value());
5039 promise->set_reactions_or_result(
Cast<JSAny>(*value));
5045 return TriggerPromiseReactions(isolate, reactions, value,
5051 if (!isolate->has_pending_message())
return;
5053 if (isolate->debug()->is_active()) {
5056 isolate->factory()->promise_debug_message_symbol();
5065 isolate->clear_pending_message();
5072 Isolate*
const isolate = promise->GetIsolate();
5074 !
reinterpret_cast<v8::Isolate*
>(isolate)->GetCurrentContext().IsEmpty());
5078 if (debug_event) isolate->debug()->OnPromiseReject(promise, reason);
5080 isolate->factory()->undefined_value());
5091 promise->set_reactions_or_result(
Cast<JSAny>(*reason));
5098 if (!promise->has_handler()) {
5103 return TriggerPromiseReactions(isolate, reactions, reason,
5111 Isolate*
const isolate = promise->GetIsolate();
5113 !
reinterpret_cast<v8::Isolate*
>(isolate)->GetCurrentContext().IsEmpty());
5116 isolate->factory()->undefined_value());
5122 isolate->factory()->NewTypeError(MessageTemplate::kPromiseCyclic,
5125 return Reject(promise, self_resolution_error);
5132 return Fulfill(promise, resolution_obj);
5143 if (IsJSPromise(*resolution_recv) &&
5144 resolution_recv->map()->prototype()->map()->instance_type() ==
5145 JS_PROMISE_PROTOTYPE_TYPE &&
5146 Protectors::IsPromiseThenLookupChainIntact(isolate)) {
5151 then = isolate->promise_then();
5154 isolate->factory()->then_string());
5159 if (!then.
ToHandle(&then_action)) {
5161 if (!isolate->is_catchable_by_javascript(isolate->exception())) {
5167 isolate->clear_exception();
5168 return Reject(promise, reason,
false);
5173 if (!IsCallable(*then_action)) {
5175 return Fulfill(promise, resolution_recv);
5182 .ToHandle(&then_context)) {
5183 then_context = isolate->native_context();
5187 isolate->factory()->NewPromiseResolveThenableJobTask(
5190 if (isolate->debug()->is_active() && IsJSPromise(*resolution_recv)) {
5193 isolate->factory()->promise_handled_by_symbol(),
5201 return isolate->factory()->undefined_value();
5208 CHECK(
IsSmi(*reactions) || IsPromiseReaction(*reactions));
5217 while (!
IsSmi(current)) {
5229 while (!
IsSmi(*reactions)) {
5242 primary_handler =
direct_handle(reaction->fulfill_handler(), isolate);
5243 secondary_handler =
direct_handle(reaction->reject_handler(), isolate);
5245 primary_handler =
direct_handle(reaction->reject_handler(), isolate);
5246 secondary_handler =
direct_handle(reaction->fulfill_handler(), isolate);
5249 bool has_handler_context =
false;
5250 if (IsJSReceiver(*primary_handler)) {
5251 has_handler_context =
5253 .ToHandle(&handler_context);
5255 if (!has_handler_context && IsJSReceiver(*secondary_handler)) {
5258 .ToHandle(&handler_context);
5260 if (!has_handler_context) handler_context = isolate->native_context();
5263 static_cast<int>(PromiseReaction::kSize) ==
5269 ReadOnlyRoots(isolate).promise_fulfill_reaction_job_task_map(),
5274 static_cast<int>(PromiseReaction::kFulfillHandlerOffset) ==
5275 static_cast<int>(PromiseFulfillReactionJobTask::kHandlerOffset));
5277 static_cast<int>(PromiseReaction::kPromiseOrCapabilityOffset) ==
5279 PromiseFulfillReactionJobTask::kPromiseOrCapabilityOffset));
5280#ifdef V8_ENABLE_CONTINUATION_PRESERVED_EMBEDDER_DATA
5283 PromiseReaction::kContinuationPreservedEmbedderDataOffset) ==
5284 static_cast<int>(PromiseFulfillReactionJobTask::
5285 kContinuationPreservedEmbedderDataOffset));
5291 ReadOnlyRoots(isolate).promise_reject_reaction_job_task_map(),
5297 static_cast<int>(PromiseReaction::kPromiseOrCapabilityOffset) ==
5299 PromiseRejectReactionJobTask::kPromiseOrCapabilityOffset));
5300#ifdef V8_ENABLE_CONTINUATION_PRESERVED_EMBEDDER_DATA
5303 PromiseReaction::kContinuationPreservedEmbedderDataOffset) ==
5304 static_cast<int>(PromiseRejectReactionJobTask::
5305 kContinuationPreservedEmbedderDataOffset));
5315 return isolate->factory()->undefined_value();
5318#ifdef V8_LOWER_LIMITS_MODE
5325template <
typename Derived,
typename Shape>
5326void HashTable<Derived, Shape>::IteratePrefix(
ObjectVisitor* v) {
5330template <
typename Derived,
typename Shape>
5331void HashTable<Derived, Shape>::IterateElements(ObjectVisitor* v) {
5336template <
typename Derived,
typename Shape>
5337template <
typename IsolateT>
5339 IsolateT* isolate,
int at_least_space_for,
AllocationType allocation,
5346 ? at_least_space_for
5347 : ComputeCapacity(at_least_space_for);
5348 if (capacity > HashTable::kMaxCapacity) {
5349 isolate->FatalProcessOutOfHeapMemory(
"invalid table size");
5351 return NewInternal(isolate, capacity, allocation);
5354template <
typename Derived,
typename Shape>
5355template <
typename IsolateT>
5358 auto* factory = isolate->factory();
5359 int length = EntryToIndex(InternalIndex(capacity));
5361 Derived::GetMap(isolate->roots_table()), length, allocation);
5365 raw_table->SetNumberOfElements(0);
5366 raw_table->SetNumberOfDeletedElements(0);
5367 raw_table->SetCapacity(capacity);
5371template <
typename Derived,
typename Shape>
5372void HashTable<Derived, Shape>::Rehash(PtrComprCageBase cage_base,
5377 DCHECK_LT(NumberOfElements(), new_table->Capacity());
5380 for (
int i = kPrefixStartIndex;
i < kElementsStartIndex;
i++) {
5381 new_table->set(
i, get(
i), mode);
5386 for (InternalIndex
i : this->IterateEntries()) {
5387 uint32_t from_index = EntryToIndex(
i);
5389 if (!IsKey(roots, k))
continue;
5390 uint32_t hash = TodoShape::HashForObject(roots, k);
5391 uint32_t insertion_index =
5392 EntryToIndex(new_table->FindInsertionEntry(cage_base, roots, hash));
5393 new_table->set_key(insertion_index, get(from_index), mode);
5394 for (
int j = 1; j < TodoShape::kEntrySize; j++) {
5395 new_table->set(insertion_index + j, get(from_index + j), mode);
5398 new_table->SetNumberOfElements(NumberOfElements());
5399 new_table->SetNumberOfDeletedElements(0);
5402template <
typename Derived,
typename Shape>
5403InternalIndex HashTable<Derived, Shape>::EntryForProbe(ReadOnlyRoots roots,
5406 InternalIndex expected) {
5407 uint32_t hash = TodoShape::HashForObject(roots, k);
5408 uint32_t capacity = this->Capacity();
5409 InternalIndex entry = FirstProbe(hash, capacity);
5410 for (
int i = 1;
i < probe;
i++) {
5411 if (entry == expected)
return expected;
5412 entry = NextProbe(entry,
i, capacity);
5417template <
typename Derived,
typename Shape>
5418void HashTable<Derived, Shape>::Swap(InternalIndex entry1, InternalIndex entry2,
5420 int index1 = EntryToIndex(entry1);
5421 int index2 = EntryToIndex(entry2);
5423 Derived* self =
static_cast<Derived*
>(
this);
5424 for (
int j = 0; j < TodoShape::kEntrySize; j++) {
5425 temp[j] = get(index1 + j);
5427 self->set_key(index1, get(index2), mode);
5428 for (
int j = 1; j < TodoShape::kEntrySize; j++) {
5429 set(index1 + j, get(index2 + j), mode);
5431 self->set_key(index2, temp[0], mode);
5432 for (
int j = 1; j < TodoShape::kEntrySize; j++) {
5433 set(index2 + j, temp[j], mode);
5437template <
typename Derived,
typename Shape>
5438void HashTable<Derived, Shape>::Rehash(PtrComprCageBase cage_base) {
5441 ReadOnlyRoots roots = EarlyGetReadOnlyRoots();
5442 uint32_t capacity = Capacity();
5444 for (
int probe = 1; !done; probe++) {
5448 for (InternalIndex
current(0); current.raw_value() < capacity;
5451 if (!IsKey(roots, current_key)) {
5455 InternalIndex target = EntryForProbe(roots, current_key, probe, current);
5456 if (current == target) {
5461 if (!IsKey(roots, target_key) ||
5462 EntryForProbe(roots, target_key, probe, target) != target) {
5464 Swap(current, target, mode);
5478 Derived* self =
static_cast<Derived*
>(
this);
5479 for (InternalIndex current : InternalIndex::Range(capacity)) {
5480 if (KeyAt(cage_base, current) == the_hole) {
5481 self->set_key(EntryToIndex(current) + kEntryKeyIndex, undefined,
5485 SetNumberOfDeletedElements(0);
5488template <
typename Derived,
typename Shape>
5489template <
typename IsolateT,
template <
typename>
typename HandleType>
5490 requires(std::is_convertible_v<HandleType<Derived>, DirectHandle<Derived>>)
5491HandleType<Derived> HashTable<Derived, Shape>::EnsureCapacity(
5492 IsolateT* isolate, HandleType<Derived> table,
int n,
5494 if (table->HasSufficientCapacityToAdd(n))
return table;
5496 int capacity = table->Capacity();
5497 int new_nof = table->NumberOfElements() +
n;
5500 ((capacity > kMinCapacityForPretenure) &&
5502 HandleType<Derived> new_table = HashTable::New(
5506 table->Rehash(isolate, *new_table);
5510template <
typename Derived,
typename Shape>
5511bool HashTable<Derived, Shape>::HasSufficientCapacityToAdd(
5512 int number_of_additional_elements) {
5513 return HasSufficientCapacityToAdd(Capacity(), NumberOfElements(),
5514 NumberOfDeletedElements(),
5515 number_of_additional_elements);
5519template <
typename Derived,
typename Shape>
5520bool HashTable<Derived, Shape>::HasSufficientCapacityToAdd(
5521 int capacity,
int number_of_elements,
int number_of_deleted_elements,
5522 int number_of_additional_elements) {
5523 int nof = number_of_elements + number_of_additional_elements;
5527 if ((nof < capacity) &&
5528 ((number_of_deleted_elements <= (capacity - nof) / 2))) {
5529 int needed_free = nof / 2;
5530 if (nof + needed_free <= capacity)
return true;
5536template <
typename Derived,
typename Shape>
5537int HashTable<Derived, Shape>::ComputeCapacityWithShrink(
5538 int current_capacity,
int at_least_room_for) {
5541 if (at_least_room_for > (current_capacity / 4))
return current_capacity;
5543 int new_capacity = ComputeCapacity(at_least_room_for);
5544 DCHECK_GE(new_capacity, at_least_room_for);
5546 if (new_capacity < Derived::kMinShrinkCapacity)
return current_capacity;
5547 return new_capacity;
5551template <
typename Derived,
typename Shape>
5552template <
template <
typename>
typename HandleType>
5553 requires(std::is_convertible_v<HandleType<Derived>, DirectHandle<Derived>>)
5554HandleType<Derived> HashTable<Derived, Shape>::Shrink(Isolate* isolate,
5555 HandleType<Derived> table,
5556 int additional_capacity) {
5557 int new_capacity = ComputeCapacityWithShrink(
5558 table->Capacity(), table->NumberOfElements() + additional_capacity);
5559 if (new_capacity == table->Capacity())
return table;
5560 DCHECK_GE(new_capacity, Derived::kMinShrinkCapacity);
5562 bool pretenure = (new_capacity > kMinCapacityForPretenure) &&
5564 HandleType<Derived> new_table =
5565 HashTable::New(isolate, new_capacity,
5569 table->Rehash(isolate, *new_table);
5573template <
typename Derived,
typename Shape>
5574InternalIndex HashTable<Derived, Shape>::FindInsertionEntry(
5575 PtrComprCageBase cage_base, ReadOnlyRoots roots, uint32_t hash) {
5576 uint32_t capacity = Capacity();
5579 for (InternalIndex entry = FirstProbe(hash, capacity);;
5580 entry = NextProbe(entry, count++, capacity)) {
5581 if (!IsKey(roots, KeyAt(cage_base, entry)))
return entry;
5585std::optional<Tagged<PropertyCell>>
5597 const int32_t hash = TodoShape::Hash(roots, name);
5598 const uint32_t capacity = Capacity();
5604 entry = NextProbe(entry,
count++, capacity)) {
5606 if (isolate->heap()->IsPendingAllocation(element))
return {};
5607 if (element == undefined)
return {};
5608 if (TodoShape::kMatchNeedsHoleCheck && element == the_hole)
continue;
5609 if (!TodoShape::IsMatch(name, element))
continue;
5610 CHECK(IsPropertyCell(element, cage_base));
5616 return HashTable::New(isolate, 0);
5621 if (!stringset->Has(isolate, name)) {
5622 stringset = EnsureCapacity(isolate, stringset);
5623 uint32_t hash = TodoShape::Hash(
ReadOnlyRoots(isolate), *name);
5624 InternalIndex entry = stringset->FindInsertionEntry(isolate, hash);
5625 stringset->set(EntryToIndex(entry), *name);
5626 stringset->ElementAdded();
5632 return FindEntry(isolate, *name).is_found();
5641 table = EnsureCapacity(isolate, table);
5643 InternalIndex entry = table->FindInsertionEntry(isolate, hash);
5644 table->set(EntryToIndex(entry), *
key);
5645 table->set(EntryToValueIndex(entry), *symbol);
5646 table->ElementAdded();
5650template <
typename Derived,
typename Shape>
5651template <
typename IsolateT>
5653 IsolateT* isolate,
int at_least_space_for,
AllocationType allocation,
5657 isolate, at_least_space_for, allocation, capacity_option);
5663template <
typename IsolateT>
5665 int at_least_space_for,
5669 BaseNameDictionary<NameDictionary, NameDictionaryShape>::New(
5670 isolate, at_least_space_for, allocation, capacity_option);
5671 dict->set_flags(kFlagsDefault);
5675template <
typename Derived,
typename Shape>
5676int BaseNameDictionary<Derived, Shape>::NextEnumerationIndex(
5678 int index = dictionary->next_enumeration_index();
5683 IterationIndices(isolate, dictionary);
5684 int length = iteration_order->length();
5685 DCHECK_LE(length, dictionary->NumberOfElements());
5692 dictionary->KeyAt(isolate, internal_index)));
5698 dictionary->DetailsAtPut(internal_index, new_details);
5709template <
typename Derived,
typename Shape>
5710template <
template <
typename>
typename HandleType>
5711 requires(std::is_convertible_v<HandleType<Derived>, DirectHandle<Derived>>)
5712HandleType<Derived> Dictionary<Derived, Shape>::DeleteEntry(
5713 Isolate* isolate, HandleType<Derived> dictionary, InternalIndex entry) {
5714 DCHECK(TodoShape::kEntrySize != 3 ||
5715 dictionary->DetailsAt(entry).IsConfigurable());
5716 dictionary->ClearEntry(entry);
5717 dictionary->ElementRemoved();
5718 return Shrink(isolate, dictionary);
5721template <
typename Derived,
typename Shape>
5722template <
template <
typename>
typename HandleType>
5723 requires(std::is_convertible_v<HandleType<Derived>, DirectHandle<Derived>>)
5724HandleType<Derived> Dictionary<Derived, Shape>::AtPut(
5725 Isolate* isolate, HandleType<Derived> dictionary, Key
key,
5726 DirectHandle<Object> value, PropertyDetails details) {
5727 InternalIndex entry = dictionary->FindEntry(isolate,
key);
5730 if (entry.is_not_found()) {
5731 return Derived::Add(isolate, dictionary,
key, value, details);
5735 dictionary->ValueAtPut(entry, *value);
5736 if (TodoShape::kEntrySize == 3) dictionary->DetailsAtPut(entry, details);
5740template <
typename Derived,
typename Shape>
5741void Dictionary<Derived, Shape>::UncheckedAtPut(
5742 Isolate* isolate, DirectHandle<Derived> dictionary, Key
key,
5743 DirectHandle<Object> value, PropertyDetails details) {
5744 InternalIndex entry = dictionary->FindEntry(isolate,
key);
5747 if (entry.is_not_found()) {
5748 Derived::UncheckedAdd(isolate, dictionary,
key, value, details);
5751 dictionary->ValueAtPut(entry, *value);
5752 if (TodoShape::kEntrySize == 3) dictionary->DetailsAtPut(entry, details);
5756template <
typename Derived,
typename Shape>
5757template <
typename IsolateT,
template <
typename>
typename HandleType>
5758 requires(std::is_convertible_v<HandleType<Derived>, DirectHandle<Derived>>)
5760BaseNameDictionary<Derived, Shape>::AddNoUpdateNextEnumerationIndex(
5761 IsolateT* isolate, HandleType<Derived> dictionary, Key
key,
5762 DirectHandle<Object> value, PropertyDetails details,
5763 InternalIndex* entry_out) {
5765 return Dictionary<Derived, Shape>::Add(isolate, dictionary,
key, value,
5766 details, entry_out);
5769template <
typename Derived,
typename Shape>
5770template <
template <
typename>
typename HandleType>
5771 requires(std::is_convertible_v<HandleType<Derived>, DirectHandle<Derived>>)
5772HandleType<Derived> BaseNameDictionary<Derived, Shape>::Add(
5773 Isolate* isolate, HandleType<Derived> dictionary, Key
key,
5774 DirectHandle<Object> value, PropertyDetails details,
5775 InternalIndex* entry_out) {
5777 DCHECK_EQ(0, details.dictionary_index());
5780 int index = Derived::NextEnumerationIndex(isolate, dictionary);
5781 details = details.set_index(index);
5782 dictionary = AddNoUpdateNextEnumerationIndex(isolate, dictionary,
key, value,
5783 details, entry_out);
5786 dictionary->set_next_enumeration_index(index + 1);
5790template <
typename Derived,
typename Shape>
5791template <
typename IsolateT,
template <
typename>
typename HandleType,
5793 requires(std::is_convertible_v<HandleType<Derived>, DirectHandle<Derived>>)
5794HandleType<Derived> Dictionary<Derived, Shape>::Add(
5795 IsolateT* isolate, HandleType<Derived> dictionary, Key
key,
5796 DirectHandle<Object> value, PropertyDetails details,
5797 InternalIndex* entry_out) {
5798 ReadOnlyRoots roots(isolate);
5799 uint32_t hash = TodoShape::Hash(roots,
key);
5803 dictionary = Derived::EnsureCapacity(isolate, dictionary);
5806 DirectHandle<Object> k =
5807 TodoShape::template AsHandle<key_allocation>(isolate,
key);
5809 InternalIndex entry = dictionary->FindInsertionEntry(isolate, roots, hash);
5810 dictionary->SetEntry(entry, *k, *value, details);
5812 IsUniqueName(TodoShape::Unwrap(dictionary->KeyAt(isolate, entry))));
5813 dictionary->ElementAdded();
5814 if (entry_out) *entry_out = entry;
5818template <
typename Derived,
typename Shape>
5819template <
typename IsolateT,
template <
typename>
typename HandleType,
5821 requires(std::is_convertible_v<HandleType<Derived>, DirectHandle<Derived>>)
5822void Dictionary<Derived, Shape>::UncheckedAdd(IsolateT* isolate,
5823 HandleType<Derived> dictionary,
5825 DirectHandle<Object> value,
5826 PropertyDetails details) {
5827 ReadOnlyRoots roots(isolate);
5828 uint32_t hash = TodoShape::Hash(roots,
key);
5831 DCHECK(dictionary->HasSufficientCapacityToAdd(1));
5834 DirectHandle<Object> k =
5835 TodoShape::template AsHandle<key_allocation>(isolate,
key);
5837 InternalIndex entry = dictionary->FindInsertionEntry(isolate, roots, hash);
5838 dictionary->SetEntry(entry, *k, *value, details);
5840 IsUniqueName(TodoShape::Unwrap(dictionary->KeyAt(isolate, entry))));
5843template <
typename Derived,
typename Shape>
5845 Isolate* isolate, DirectHandle<Derived> dictionary,
5847 return Cast<Derived>(isolate->factory()->CopyFixedArrayWithMap(
5848 dictionary, Derived::GetMap(isolate->roots_table()), allocation));
5863 if (requires_slow_elements())
return;
5866 if (
key > kRequiresSlowElementsLimit) {
5867 if (!dictionary_holder.
is_null()) {
5868 dictionary_holder->RequireSlowElements(
this);
5870 set_requires_slow_elements();
5875 if (!
IsSmi(max_index_object) || max_number_key() <
key) {
5881template <
template <
typename>
typename HandleType>
5882 requires(std::is_convertible_v<HandleType<NumberDictionary>,
5885 Isolate* isolate, HandleType<NumberDictionary> dictionary, uint32_t
key,
5891 HandleType<NumberDictionary> new_dictionary =
5892 AtPut(isolate, dictionary,
key, value, details);
5893 new_dictionary->UpdateMaxNumberKey(
key, dictionary_holder);
5894 return new_dictionary;
5920 if (this->ToKey(roots,
i, &k)) {
5921 elements->set(
pos++, this->ValueAt(
i), mode);
5927template <
typename Derived,
typename Shape>
5928int Dictionary<Derived, Shape>::NumberOfEnumerableProperties() {
5933 if (!this->ToKey(roots,
i, &k))
continue;
5942template <
typename Derived,
typename Shape>
5943DirectHandle<FixedArray> BaseNameDictionary<Derived, Shape>::IterationIndices(
5944 Isolate* isolate, DirectHandle<Derived> dictionary) {
5945 DirectHandle<FixedArray> array =
5946 isolate->factory()->NewFixedArray(dictionary->NumberOfElements());
5947 ReadOnlyRoots roots(isolate);
5952 for (InternalIndex
i : dictionary->IterateEntries()) {
5954 if (!raw_dictionary->ToKey(roots,
i, &k))
continue;
5960 if (std::is_same_v<Derived, GlobalDictionary>) {
5961 DCHECK_LE(array_size, dictionary->NumberOfElements());
5963 DCHECK_EQ(array_size, dictionary->NumberOfElements());
5966 EnumIndexComparator<Derived> cmp(raw_dictionary);
5969 AtomicSlot
start(array->RawFieldOfFirstElement());
5976template <
typename Derived,
typename Shape>
5981 for (InternalIndex
i : dictionary->IterateEntries()) {
5983 if (!dictionary->ToKey(roots,
i, &k))
continue;
5985 if (e == value)
return k;
5987 return roots.undefined_value();
5990template <
typename Derived,
typename Shape>
5991void ObjectHashTableBase<Derived, Shape>::FillEntriesWithHoles(
5992 DirectHandle<Derived> table) {
5994 int length = table->length();
5995 for (
int i = Derived::EntryToIndex(InternalIndex(0));
i <
length;
i++) {
5996 table->set_the_hole(roots,
i);
6000template <
typename Derived,
typename Shape>
6002 PtrComprCageBase cage_base, DirectHandle<Object>
key, int32_t hash) {
6007 InternalIndex entry = this->FindEntry(cage_base, roots,
key, hash);
6008 if (entry.is_not_found())
return roots.the_hole_value();
6009 return this->get(Derived::EntryToIndex(entry) + 1);
6021 return Cast<Smi>(this->get(EntryToValueIndex(entry))).value();
6024template <
typename Derived,
typename Shape>
6035 if (IsUndefined(hash, roots)) {
6036 return roots.the_hole_value();
6041template <
typename Derived,
typename Shape>
6043 DirectHandle<Object>
key, int32_t hash) {
6047template <
typename Derived,
typename Shape>
6049 InternalIndex entry) {
6050 return this->get(EntryToValueIndex(entry));
6054 return this->get(EntryToValueIndex(entry));
6058 return this->get(EntryToValueIndex(entry));
6071template <
typename Derived,
typename Shape>
6075 Isolate* isolate = Heap::FromWritableHeapObject(*table)->
isolate();
6082 return ObjectHashTableBase<Derived, Shape>::Put(isolate, table,
key, value,
6088template <
typename T,
template <
typename>
typename HandleType>
6089void RehashObjectHashTableAndGCIfNeeded(
Isolate* isolate, HandleType<T> table) {
6092 if ((table->NumberOfDeletedElements() << 1) > table->NumberOfElements()) {
6093 table->Rehash(isolate);
6097 if (!table->HasSufficientCapacityToAdd(1)) {
6098 int nof = table->NumberOfElements() + 1;
6099 int capacity = T::ComputeCapacity(nof);
6100 if (capacity > T::kMaxCapacity) {
6101 for (
size_t i = 0;
i < 2; ++
i) {
6102 isolate->heap()->CollectAllGarbage(
6105 table->Rehash(isolate);
6112template <
typename Derived,
typename Shape>
6115 DirectHandle<Object> value, int32_t hash) {
6116 ReadOnlyRoots roots(isolate);
6118 DCHECK(!IsTheHole(*value, roots));
6120 InternalIndex entry = table->FindEntry(isolate, roots,
key, hash);
6123 if (entry.is_found()) {
6124 table->set(Derived::EntryToValueIndex(entry), *value);
6128 RehashObjectHashTableAndGCIfNeeded(isolate, table);
6131 table = Derived::EnsureCapacity(isolate, table);
6132 table->AddEntry(table->FindInsertionEntry(isolate, hash), *
key, *value);
6136template <
typename Derived,
typename Shape>
6139 bool* was_present) {
6143 if (IsUndefined(hash)) {
6144 *was_present =
false;
6148 return Remove(isolate, table,
key, was_present,
Smi::ToInt(hash));
6151template <
typename Derived,
typename Shape>
6154 bool* was_present, int32_t hash) {
6158 InternalIndex entry = table->FindEntry(isolate, roots,
key, hash);
6159 if (entry.is_not_found()) {
6160 *was_present =
false;
6164 *was_present =
true;
6165 table->RemoveEntry(entry);
6166 return Derived::Shrink(isolate, table);
6169template <
typename Derived,
typename Shape>
6170void ObjectHashTableBase<Derived, Shape>::AddEntry(InternalIndex entry,
6173 Derived* self =
static_cast<Derived*
>(
this);
6174 self->set_key(Derived::EntryToIndex(entry),
key);
6175 self->set(Derived::EntryToValueIndex(entry), value);
6176 self->ElementAdded();
6179template <
typename Derived,
typename Shape>
6180void ObjectHashTableBase<Derived, Shape>::RemoveEntry(InternalIndex entry) {
6182 this->set_the_hole(roots, Derived::EntryToIndex(entry));
6183 this->set_the_hole(roots, Derived::EntryToValueIndex(entry));
6184 this->ElementRemoved();
6187template <
typename Derived,
int N>
6193template <
typename Derived,
int N>
6202 if (IsUndefined(hash_obj, roots)) {
6203 return {roots.the_hole_value(), roots.the_hole_value()};
6209 return {roots.the_hole_value(), roots.the_hole_value()};
6212 int start_index = this->EntryToIndex(entry) +
6214 std::array<Tagged<Object>,
N> values;
6215 for (
int i = 0;
i <
N;
i++) {
6216 values[
i] = this->get(start_index +
i);
6217 DCHECK(!IsTheHole(values[
i]));
6223template <
typename Derived,
int N>
6235 table->SetEntryValues(entry, values);
6239 RehashObjectHashTableAndGCIfNeeded(isolate, table);
6242 table = Derived::EnsureCapacity(isolate, table);
6243 entry = table->FindInsertionEntry(isolate, hash);
6244 table->set(Derived::EntryToIndex(entry), *
key);
6245 table->SetEntryValues(entry, values);
6249template <
typename Derived,
int N>
6252 int start_index = EntryToValueIndexStart(entry);
6253 for (
int i = 0;
i <
N;
i++) {
6254 this->set(start_index +
i, *values[
i]);
6262 if (!set->Has(isolate,
key, hash)) {
6263 set = EnsureCapacity(isolate, set);
6264 InternalIndex entry = set->FindInsertionEntry(isolate, hash);
6265 set->set(EntryToIndex(entry), *
key);
6266 set->ElementAdded();
6273 set->set_table(*table);
6279 set->set_table(*table);
6286 set_table(*new_table);
6291 map->set_table(*table);
6297 map->set_table(*table);
6304 set_table(*new_table);
6310 weak_collection->set_table(*table);
6319 weak_collection->GetIsolate());
6322 weak_collection->GetIsolate(), table,
key, value, hash);
6323 weak_collection->set_table(*new_table);
6324 if (*table != *new_table) {
6326 EphemeronHashTable::FillEntriesWithHoles(table);
6335 weak_collection->GetIsolate());
6337 bool was_present =
false;
6339 weak_collection->GetIsolate(), table,
key, &was_present, hash);
6340 weak_collection->set_table(*new_table);
6341 if (*table != *new_table) {
6343 EphemeronHashTable::FillEntriesWithHoles(table);
6350 Isolate* isolate = holder->GetIsolate();
6353 if (max_entries == 0 || max_entries > table->NumberOfElements()) {
6354 max_entries = table->NumberOfElements();
6356 int values_per_entry = IsJSWeakMap(*holder) ? 2 : 1;
6358 isolate->factory()->NewFixedArray(max_entries * values_per_entry);
6360 if (max_entries > table->NumberOfElements()) {
6361 max_entries = table->NumberOfElements();
6369 count / values_per_entry < max_entries &&
i < table->Capacity();
i++) {
6373 if (values_per_entry > 1) {
6381 return isolate->factory()->NewJSArrayWithElements(
entries);
6387 disposable_stack->set_stack(*array);
6388 disposable_stack->set_needs_await(
false);
6389 disposable_stack->set_has_awaited(
false);
6390 disposable_stack->set_suppressed_error_created(
false);
6391 disposable_stack->set_length(0);
6393 disposable_stack->set_error(*(isolate->factory()->uninitialized_value()));
6394 disposable_stack->set_error_message(
6395 *(isolate->factory()->uninitialized_value()));
6402 Transition(details, isolate->factory()->property_cell_hole_value());
6414 DCHECK(cell->property_details().IsConfigurable());
6419 isolate->factory()->NewPropertyCell(name, new_details, new_value);
6420 dictionary->ValueAtPut(entry, *new_cell);
6422 cell->ClearAndInvalidate(isolate);
6479 const PropertyDetails original_details = raw_cell->property_details();
6488 UpdatedType(isolate, raw_cell, *value, original_details);
6497 cell->Transition(details, value);
6503 if (original_details.
cell_type() != new_type ||
6530 if (IsPropertyCellHole(value)) {
6533 CHECK_EQ(IsAccessorInfo(value) || IsAccessorPair(value),
6536 IsUndefined(value));
6547 DCHECK(CheckDataIsCompatible(new_details, new_value));
6548 switch (property_details().cell_type()) {
6552 return !IsPropertyCellHole(
value()) &&
6558 IsPropertyCellHole(new_value));
6562 IsPropertyCellHole(new_value));
6572 int code_offset =
Smi::ToInt(input_or_debug_pos());
6581 CHECK(is_suspended());
6583 Isolate* isolate = GetIsolate();
6586 ->GetBytecodeArray(isolate)
6587 ->HasSourcePositionTable());
6589 function()->shared()->GetBytecodeArray(isolate);
6590 return bytecode->SourcePosition(code_offset());
6599 if (IsFunctionTemplateInfo(maybe_constructor)) {
6609 if (!constructor->shared()->IsApiFunction())
return AccessCheckInfo();
6612 constructor->shared()->api_func_data()->GetAccessCheckInfo();
6621 DisallowJavascriptExecution no_js(isolate);
6631 if (x_value == 0 || y_value == 0) {
6641 uint32_t x_scaled = x_value;
6642 uint32_t y_scaled = y_value;
6650 }
else if (y_value < 0) {
6655 static const uint32_t kPowersOf10[] = {
6657 10 * 1000, 100 * 1000, 1000 * 1000, 10 * 1000 * 1000,
6658 100 * 1000 * 1000, 1000 * 1000 * 1000};
6670 int x_log10 = ((x_log2 + 1) * 1233) >> 12;
6671 x_log10 -= x_scaled < kPowersOf10[x_log10];
6674 int y_log10 = ((y_log2 + 1) * 1233) >> 12;
6675 y_log10 -= y_scaled < kPowersOf10[y_log10];
6679 if (x_log10 < y_log10) {
6686 x_scaled *= kPowersOf10[y_log10 - x_log10 - 1];
6689 }
else if (y_log10 < x_log10) {
6690 y_scaled *= kPowersOf10[x_log10 - y_log10 - 1];
6709 return InstanceTypeChecker::IsMap(map_word.
ToMap()->instance_type());
6716#define EXTERN_DEFINE_HASH_TABLE(DERIVED, SHAPE) \
6717 template class EXPORT_TEMPLATE_DEFINE(V8_EXPORT_PRIVATE) \
6718 HashTable<DERIVED, SHAPE>; \
6720 template EXPORT_TEMPLATE_DEFINE(V8_EXPORT_PRIVATE) Handle<DERIVED> \
6721 HashTable<DERIVED, SHAPE>::New(Isolate*, int, AllocationType, \
6723 template EXPORT_TEMPLATE_DEFINE(V8_EXPORT_PRIVATE) Handle<DERIVED> \
6724 HashTable<DERIVED, SHAPE>::New(LocalIsolate*, int, AllocationType, \
6727 template EXPORT_TEMPLATE_DEFINE(V8_EXPORT_PRIVATE) Handle<DERIVED> \
6728 HashTable<DERIVED, SHAPE>::EnsureCapacity(Isolate*, Handle<DERIVED>, int, \
6730 template EXPORT_TEMPLATE_DEFINE(V8_EXPORT_PRIVATE) Handle<DERIVED> \
6731 HashTable<DERIVED, SHAPE>::EnsureCapacity(LocalIsolate*, Handle<DERIVED>, \
6732 int, AllocationType); \
6733 template EXPORT_TEMPLATE_DEFINE(V8_EXPORT_PRIVATE) DirectHandle<DERIVED> \
6734 HashTable<DERIVED, SHAPE>::EnsureCapacity(Isolate*, DirectHandle<DERIVED>, \
6735 int, AllocationType); \
6736 template EXPORT_TEMPLATE_DEFINE(V8_EXPORT_PRIVATE) DirectHandle<DERIVED> \
6737 HashTable<DERIVED, SHAPE>::EnsureCapacity( \
6738 LocalIsolate*, DirectHandle<DERIVED>, int, AllocationType); \
6740 template EXPORT_TEMPLATE_DEFINE(V8_EXPORT_PRIVATE) Handle<DERIVED> \
6741 HashTable<DERIVED, SHAPE>::Shrink(Isolate*, Handle<DERIVED>, int); \
6742 template EXPORT_TEMPLATE_DEFINE(V8_EXPORT_PRIVATE) DirectHandle<DERIVED> \
6743 HashTable<DERIVED, SHAPE>::Shrink(Isolate*, DirectHandle<DERIVED>, int);
6745#define EXTERN_DEFINE_OBJECT_BASE_HASH_TABLE(DERIVED, SHAPE) \
6746 EXTERN_DEFINE_HASH_TABLE(DERIVED, SHAPE) \
6747 template class EXPORT_TEMPLATE_DEFINE(V8_EXPORT_PRIVATE) \
6748 ObjectHashTableBase<DERIVED, SHAPE>;
6750#define EXTERN_DEFINE_MULTI_OBJECT_BASE_HASH_TABLE(DERIVED, N) \
6751 EXTERN_DEFINE_HASH_TABLE(DERIVED, ObjectMultiHashTableShape<N>) \
6752 template class EXPORT_TEMPLATE_DEFINE(V8_EXPORT_PRIVATE) \
6753 ObjectMultiHashTableBase<DERIVED, N>;
6755#define EXTERN_DEFINE_DICTIONARY(DERIVED, SHAPE) \
6756 EXTERN_DEFINE_HASH_TABLE(DERIVED, SHAPE) \
6757 template class EXPORT_TEMPLATE_DEFINE(V8_EXPORT_PRIVATE) \
6758 Dictionary<DERIVED, SHAPE>; \
6760 template V8_EXPORT_PRIVATE DirectHandle<DERIVED> \
6761 Dictionary<DERIVED, SHAPE>::Add(Isolate* isolate, DirectHandle<DERIVED>, \
6762 Key, DirectHandle<Object>, PropertyDetails, \
6764 template V8_EXPORT_PRIVATE DirectHandle<DERIVED> \
6765 Dictionary<DERIVED, SHAPE>::Add( \
6766 LocalIsolate* isolate, DirectHandle<DERIVED>, Key, DirectHandle<Object>, \
6767 PropertyDetails, InternalIndex*); \
6768 template V8_EXPORT_PRIVATE IndirectHandle<DERIVED> \
6769 Dictionary<DERIVED, SHAPE>::Add(Isolate* isolate, IndirectHandle<DERIVED>, \
6770 Key, DirectHandle<Object>, PropertyDetails, \
6772 template V8_EXPORT_PRIVATE IndirectHandle<DERIVED> \
6773 Dictionary<DERIVED, SHAPE>::Add( \
6774 LocalIsolate* isolate, IndirectHandle<DERIVED>, Key, \
6775 DirectHandle<Object>, PropertyDetails, InternalIndex*); \
6776 template V8_EXPORT_PRIVATE DirectHandle<DERIVED> \
6777 Dictionary<DERIVED, SHAPE>::DeleteEntry( \
6778 Isolate* isolate, DirectHandle<DERIVED>, InternalIndex); \
6779 template V8_EXPORT_PRIVATE IndirectHandle<DERIVED> \
6780 Dictionary<DERIVED, SHAPE>::DeleteEntry( \
6781 Isolate* isolate, IndirectHandle<DERIVED>, InternalIndex); \
6782 template V8_EXPORT_PRIVATE DirectHandle<DERIVED> \
6783 Dictionary<DERIVED, SHAPE>::Shrink(Isolate* isolate, DirectHandle<DERIVED>); \
6784 template V8_EXPORT_PRIVATE IndirectHandle<DERIVED> \
6785 Dictionary<DERIVED, SHAPE>::Shrink(Isolate* isolate, \
6786 IndirectHandle<DERIVED>);
6788#define EXTERN_DEFINE_BASE_NAME_DICTIONARY(DERIVED, SHAPE) \
6789 EXTERN_DEFINE_DICTIONARY(DERIVED, SHAPE) \
6790 template class EXPORT_TEMPLATE_DEFINE(V8_EXPORT_PRIVATE) \
6791 BaseNameDictionary<DERIVED, SHAPE>; \
6793 template V8_EXPORT_PRIVATE Handle<DERIVED> \
6794 BaseNameDictionary<DERIVED, SHAPE>::New(Isolate*, int, AllocationType, \
6796 template V8_EXPORT_PRIVATE Handle<DERIVED> \
6797 BaseNameDictionary<DERIVED, SHAPE>::New(LocalIsolate*, int, AllocationType, \
6800 template V8_EXPORT_PRIVATE DirectHandle<DERIVED> \
6801 BaseNameDictionary<DERIVED, SHAPE>::Add( \
6802 Isolate* isolate, DirectHandle<DERIVED>, Key, DirectHandle<Object>, \
6803 PropertyDetails, InternalIndex*); \
6804 template V8_EXPORT_PRIVATE IndirectHandle<DERIVED> \
6805 BaseNameDictionary<DERIVED, SHAPE>::Add( \
6806 Isolate* isolate, IndirectHandle<DERIVED>, Key, DirectHandle<Object>, \
6807 PropertyDetails, InternalIndex*); \
6809 template DirectHandle<DERIVED> \
6810 BaseNameDictionary<DERIVED, SHAPE>::AddNoUpdateNextEnumerationIndex( \
6811 Isolate* isolate, DirectHandle<DERIVED>, Key, DirectHandle<Object>, \
6812 PropertyDetails, InternalIndex*); \
6813 template DirectHandle<DERIVED> \
6814 BaseNameDictionary<DERIVED, SHAPE>::AddNoUpdateNextEnumerationIndex( \
6815 LocalIsolate* isolate, DirectHandle<DERIVED>, Key, DirectHandle<Object>, \
6816 PropertyDetails, InternalIndex*); \
6817 template IndirectHandle<DERIVED> \
6818 BaseNameDictionary<DERIVED, SHAPE>::AddNoUpdateNextEnumerationIndex( \
6819 Isolate* isolate, IndirectHandle<DERIVED>, Key, DirectHandle<Object>, \
6820 PropertyDetails, InternalIndex*); \
6821 template IndirectHandle<DERIVED> \
6822 BaseNameDictionary<DERIVED, SHAPE>::AddNoUpdateNextEnumerationIndex( \
6823 LocalIsolate* isolate, IndirectHandle<DERIVED>, Key, \
6824 DirectHandle<Object>, PropertyDetails, InternalIndex*);
6861#undef EXTERN_DEFINE_HASH_TABLE
6862#undef EXTERN_DEFINE_OBJECT_BASE_HASH_TABLE
6863#undef EXTERN_DEFINE_DICTIONARY
6864#undef EXTERN_DEFINE_BASE_NAME_DICTIONARY
#define SLOW_DCHECK(condition)
@ kAttemptOverrideReadOnlyOnPrototypeSloppy
@ kAttemptOverrideReadOnlyOnPrototypeStrict
V8_WARN_UNUSED_RESULT V8_INLINE bool To(T *out) const
V8_INLINE bool IsJust() const
V8_INLINE T FromJust() const &
V8_INLINE bool IsNothing() const
static constexpr int kSize
static Tagged< AccessCheckInfo > Get(Isolate *isolate, DirectHandle< JSObject > receiver)
static int AppendUnique(Isolate *isolate, DirectHandle< Object > descriptors, DirectHandle< FixedArray > array, int valid_descriptors)
static Handle< JSAny > GetComponent(Isolate *isolate, DirectHandle< NativeContext > native_context, DirectHandle< AccessorPair > accessor_pair, AccessorComponent component)
static NEVER_READ_ONLY_SPACE DirectHandle< AccessorPair > Copy(Isolate *isolate, DirectHandle< AccessorPair > pair)
static MaybeDirectHandle< Object > ReplaceAccessorWithDataProperty(Isolate *isolate, DirectHandle< JSAny > receiver, DirectHandle< JSObject > holder, DirectHandle< Name > name, DirectHandle< Object > value)
const char * PretenureDecisionName(PretenureDecision decision)
static bool ShouldTrack(ElementsKind boilerplate_elements_kind)
void ResetPretenureDecision()
AllocationType GetAllocationType() const
static V8_WARN_UNUSED_RESULT MaybeHandle< JSFunction > InstantiateFunction(Isolate *isolate, DirectHandle< NativeContext > native_context, DirectHandle< FunctionTemplateInfo > data, MaybeDirectHandle< Name > maybe_name={})
static Maybe< ComparisonResult > CompareToString(Isolate *isolate, DirectHandle< BigInt > x, DirectHandle< String > y)
static Maybe< bool > EqualToString(Isolate *isolate, DirectHandle< BigInt > x, DirectHandle< String > y)
static ComparisonResult CompareToBigInt(DirectHandle< BigInt > x, DirectHandle< BigInt > y)
static uint32_t SizeFor(uint32_t length)
static MaybeHandle< String > ToString(Isolate *isolate, DirectHandle< BigInt > bigint, int radix=10, ShouldThrow should_throw=kThrowOnError)
static bool EqualToBigInt(Tagged< BigInt > x, Tagged< BigInt > y)
static bool EqualToNumber(DirectHandle< BigInt > x, DirectHandle< Object > y)
static DirectHandle< String > NoSideEffectsToString(Isolate *isolate, DirectHandle< BigInt > bigint)
static ComparisonResult CompareToNumber(DirectHandle< BigInt > x, DirectHandle< Object > y)
static void IteratePointers(Tagged< HeapObject > obj, int start_offset, int end_offset, ObjectVisitor *v)
static V8_WARN_UNUSED_RESULT MaybeHandle< Object > InvokeApiFunction(Isolate *isolate, bool is_construct, DirectHandle< FunctionTemplateInfo > function, DirectHandle< Object > receiver, base::Vector< const DirectHandle< Object > > args, DirectHandle< HeapObject > new_target)
static constexpr int SizeFor(int length)
void BriefPrintDetails(std::ostream &os)
void BriefPrintDetails(std::ostream &os)
static V8_INLINE constexpr int SizeFor(int length)
static int SizeFor(int slot_count)
@ kPropertyCellChangedGroup
static void DeoptimizeDependencyGroups(Isolate *isolate, ObjectT object, DependencyGroups groups)
PropertyDetails GetDetails(InternalIndex descriptor_number)
bool IsEqualUpTo(Tagged< DescriptorArray > desc, int nof_descriptors)
void Replace(InternalIndex descriptor_number, Descriptor *descriptor)
void CopyFrom(InternalIndex index, Tagged< DescriptorArray > src)
void Set(InternalIndex descriptor_number, Descriptor *desc)
static void InitializeOrChangeEnumCache(DirectHandle< DescriptorArray > descriptors, Isolate *isolate, DirectHandle< FixedArray > keys, DirectHandle< FixedArray > indices, AllocationType allocation_if_initialize)
int GetSortedKeyIndex(int descriptor_number)
static DirectHandle< DescriptorArray > CopyUpToAddAttributes(Isolate *isolate, DirectHandle< DescriptorArray > desc, int enumeration_index, PropertyAttributes attributes, int slack=0)
ObjectSlot GetDescriptorSlot(int descriptor)
void Initialize(Tagged< EnumCache > enum_cache, Tagged< HeapObject > undefined_value, int nof_descriptors, int slack, uint32_t raw_gc_state)
Tagged< Name > GetKey(InternalIndex descriptor_number) const
V8_EXPORT_PRIVATE void Sort()
void SetSortedKey(int pointer, int descriptor_number)
static V8_EXPORT_PRIVATE Handle< DescriptorArray > Allocate(IsolateT *isolate, int nof_descriptors, int slack, AllocationType allocation=AllocationType::kYoung)
Tagged< MaybeObject > GetValue(InternalIndex descriptor_number)
static constexpr int SizeFor(int number_of_all_descriptors)
void SwapSortedKeys(int first, int second)
void SetDetails(InternalIndex descriptor_number, PropertyDetails details)
void GeneralizeAllFields(bool clear_constness)
Tagged< Name > GetSortedKey(int descriptor_number)
static const int kEntrySize
V8_EXPORT_PRIVATE void CheckNameCollisionDuringInsertion(Descriptor *desc, uint32_t descriptor_hash, int insertion_index)
static DirectHandle< DescriptorArray > CopyUpTo(Isolate *isolate, DirectHandle< DescriptorArray > desc, int enumeration_index, int slack=0)
void SetValue(InternalIndex descriptor_number, Tagged< MaybeObject > value)
void SetSortedKeyIndex(int index)
V8_INLINE bool is_null() const
V8_INLINE bool is_identical_to(Handle< S > other) const
static constexpr int SizeFor(int length)
static const uint32_t kHashBits
static bool HasErrorStackSymbolOwnProperty(Isolate *isolate, DirectHandle< JSObject > object)
V8_EXPORT_PRIVATE static V8_WARN_UNUSED_RESULT MaybeHandle< Object > Call(Isolate *isolate, DirectHandle< Object > callable, DirectHandle< Object > receiver, base::Vector< const DirectHandle< Object > > args)
Handle< Boolean > ToBoolean(bool value)
Isolate * isolate() const
static V8_EXPORT_PRIVATE Tagged< FieldType > Class(Tagged< Map > map)
static V8_EXPORT_PRIVATE Tagged< FieldType > Any()
static V8_EXPORT_PRIVATE Tagged< FieldType > None()
static constexpr int kMaxLength
static HandleType< FixedArray > RightTrimOrEmpty(Isolate *isolate, HandleType< FixedArray > array, int new_length)
int function_literal_id() const
Handle< SharedFunctionInfo > shared_function_info() const
void set_shared_function_info(Handle< SharedFunctionInfo > shared_function_info)
std::optional< Tagged< PropertyCell > > TryFindPropertyCellForConcurrentLookupIterator(Isolate *isolate, DirectHandle< Name > name, RelaxedLoadTag tag)
static V8_INLINE bool InYoungGeneration(Tagged< Object > object)
V8_EXPORT_PRIVATE int SizeFromMap(Tagged< Map > map) const
static constexpr int kHeaderSize
bool CanBeRehashed(PtrComprCageBase cage_base) const
V8_EXPORT_PRIVATE int SizeFromMap(Tagged< Map > map) const
bool NeedsRehashing(InstanceType instance_type) const
void RehashBasedOnMap(IsolateT *isolate)
MaybeDirectHandle< String > Finish()
V8_INLINE void AppendCharacter(uint8_t c)
V8_INLINE void AppendString(std::string_view str)
V8_INLINE void AppendCStringLiteral(const char(&literal)[N])
bool is_not_found() const
bool SetLengthWouldNormalize(uint32_t new_length)
static bool AnythingToArrayLength(Isolate *isolate, DirectHandle< Object > length_object, uint32_t *output)
static V8_EXPORT_PRIVATE Maybe< bool > SetLength(DirectHandle< JSArray > array, uint32_t length)
static V8_EXPORT_PRIVATE void Initialize(DirectHandle< JSArray > array, int capacity, int length=0)
static bool MayHaveReadOnlyLength(Tagged< Map > js_array_map)
static bool WouldChangeReadOnlyLength(DirectHandle< JSArray > array, uint32_t index)
static Address ArrayJoinConcatToSequentialString(Isolate *isolate, Address raw_fixed_array, intptr_t length, Address raw_separator, Address raw_dest)
static bool HasReadOnlyLength(DirectHandle< JSArray > array)
static V8_WARN_UNUSED_RESULT Maybe< bool > ArraySetLength(Isolate *isolate, DirectHandle< JSArray > a, PropertyDescriptor *desc, Maybe< ShouldThrow > should_throw)
static V8_WARN_UNUSED_RESULT Maybe< bool > DefineOwnProperty(Isolate *isolate, DirectHandle< JSArray > o, DirectHandle< Object > name, PropertyDescriptor *desc, Maybe< ShouldThrow > should_throw)
static MaybeHandle< String > GetName(Isolate *isolate, DirectHandle< JSBoundFunction > function)
static DirectHandle< String > ToString(DirectHandle< JSBoundFunction > function)
static void InitializeJSDisposableStackBase(Isolate *isolate, DirectHandle< JSDisposableStackBase > stack)
static Handle< String > GetName(Isolate *isolate, DirectHandle< JSFunction > function)
static DirectHandle< String > ToString(DirectHandle< JSFunction > function)
int source_position() const
void Rehash(Isolate *isolate)
static void Clear(Isolate *isolate, DirectHandle< JSMap > map)
static void Initialize(DirectHandle< JSMap > map, Isolate *isolate)
static V8_EXPORT_PRIVATE DirectHandle< NumberDictionary > NormalizeElements(DirectHandle< JSObject > object)
static bool PrototypeHasNoElements(Isolate *isolate, Tagged< JSObject > object)
static V8_WARN_UNUSED_RESULT MaybeHandle< JSAny > GetPropertyWithInterceptor(LookupIterator *it, bool *done)
static V8_WARN_UNUSED_RESULT Maybe< InterceptorResult > SetPropertyWithInterceptor(LookupIterator *it, Maybe< ShouldThrow > should_throw, DirectHandle< Object > value)
static void ValidateElements(Tagged< JSObject > object)
static V8_WARN_UNUSED_RESULT Maybe< PropertyAttributes > GetPropertyAttributesWithInterceptor(LookupIterator *it)
static V8_EXPORT_PRIVATE Maybe< bool > AddDataElement(DirectHandle< JSObject > receiver, uint32_t index, DirectHandle< Object > value, PropertyAttributes attributes)
static V8_WARN_UNUSED_RESULT MaybeHandle< JSAny > GetPropertyWithFailedAccessCheck(LookupIterator *it)
static V8_WARN_UNUSED_RESULT Maybe< bool > SetPropertyWithFailedAccessCheck(LookupIterator *it, DirectHandle< Object > value, Maybe< ShouldThrow > should_throw)
static const char * Status(Promise::PromiseState status)
static Handle< Object > Reject(DirectHandle< JSPromise > promise, DirectHandle< Object > reason, bool debug_event=true)
void set_status(Promise::PromiseState status)
static Handle< Object > TriggerPromiseReactions(Isolate *isolate, DirectHandle< Object > reactions, DirectHandle< Object > argument, PromiseReaction::Type type)
static V8_WARN_UNUSED_RESULT MaybeHandle< Object > Resolve(DirectHandle< JSPromise > promise, DirectHandle< Object > resolution)
static V8_EXPORT_PRIVATE Handle< Object > Fulfill(DirectHandle< JSPromise > promise, DirectHandle< Object > value)
V8_EXPORT_PRIVATE Promise::PromiseState status() const
static V8_WARN_UNUSED_RESULT Maybe< bool > HasProperty(Isolate *isolate, DirectHandle< JSProxy > proxy, DirectHandle< Name > name)
static V8_WARN_UNUSED_RESULT Maybe< bool > IsArray(DirectHandle< JSProxy > proxy)
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< JSProxy > New(Isolate *isolate, DirectHandle< Object >, DirectHandle< Object >)
static V8_WARN_UNUSED_RESULT MaybeHandle< JSAny > GetProperty(Isolate *isolate, DirectHandle< JSProxy > proxy, DirectHandle< Name > name, DirectHandle< JSAny > receiver, bool *was_found)
static void Revoke(DirectHandle< JSProxy > proxy)
static Maybe< bool > SetPrivateSymbol(Isolate *isolate, DirectHandle< JSProxy > proxy, DirectHandle< Symbol > private_name, PropertyDescriptor *desc, Maybe< ShouldThrow > should_throw)
static V8_WARN_UNUSED_RESULT Maybe< bool > SetProperty(DirectHandle< JSProxy > proxy, DirectHandle< Name > name, DirectHandle< Object > value, DirectHandle< JSAny > receiver, Maybe< ShouldThrow > should_throw)
static MaybeHandle< JSAny > CheckGetSetTrapResult(Isolate *isolate, DirectHandle< Name > name, DirectHandle< JSReceiver > target, DirectHandle< Object > trap_result, AccessKind access_kind)
static const int kMaxIterationLimit
static V8_WARN_UNUSED_RESULT Maybe< bool > GetOwnPropertyDescriptor(Isolate *isolate, DirectHandle< JSProxy > proxy, DirectHandle< Name > name, PropertyDescriptor *desc)
static V8_WARN_UNUSED_RESULT Maybe< bool > SetPrototype(Isolate *isolate, DirectHandle< JSProxy > proxy, DirectHandle< Object > value, bool from_javascript, ShouldThrow should_throw)
static V8_WARN_UNUSED_RESULT Maybe< bool > IsExtensible(DirectHandle< JSProxy > proxy)
static V8_WARN_UNUSED_RESULT Maybe< bool > DeletePropertyOrElement(DirectHandle< JSProxy > proxy, DirectHandle< Name > name, LanguageMode language_mode)
static V8_WARN_UNUSED_RESULT Maybe< bool > CheckHasTrap(Isolate *isolate, DirectHandle< Name > name, DirectHandle< JSReceiver > target)
static V8_WARN_UNUSED_RESULT Maybe< bool > PreventExtensions(DirectHandle< JSProxy > proxy, ShouldThrow should_throw)
static V8_WARN_UNUSED_RESULT Maybe< bool > CheckDeleteTrap(Isolate *isolate, DirectHandle< Name > name, DirectHandle< JSReceiver > target)
static V8_WARN_UNUSED_RESULT Maybe< PropertyAttributes > GetPropertyAttributes(LookupIterator *it)
static V8_WARN_UNUSED_RESULT Maybe< bool > DefineOwnProperty(Isolate *isolate, DirectHandle< JSProxy > object, DirectHandle< Object > key, PropertyDescriptor *desc, Maybe< ShouldThrow > should_throw)
static MaybeDirectHandle< JSPrototype > GetPrototype(DirectHandle< JSProxy > receiver)
V8_EXPORT_PRIVATE static V8_WARN_UNUSED_RESULT Maybe< bool > GetOwnPropertyDescriptor(Isolate *isolate, DirectHandle< JSReceiver > object, DirectHandle< Object > key, PropertyDescriptor *desc)
V8_EXPORT_PRIVATE static V8_WARN_UNUSED_RESULT Maybe< bool > DeletePropertyOrElement(Isolate *isolate, DirectHandle< JSReceiver > object, DirectHandle< Name > name, LanguageMode language_mode=LanguageMode::kSloppy)
V8_EXPORT_PRIVATE static V8_WARN_UNUSED_RESULT Maybe< bool > SetPrototype(Isolate *isolate, DirectHandle< JSReceiver > object, DirectHandle< Object > value, bool from_javascript, ShouldThrow should_throw)
static V8_WARN_UNUSED_RESULT MaybeHandle< Object > GetElement(Isolate *isolate, DirectHandle< JSReceiver > receiver, uint32_t index)
static MaybeDirectHandle< NativeContext > GetFunctionRealm(DirectHandle< JSReceiver > receiver)
static V8_WARN_UNUSED_RESULT Maybe< bool > PreventExtensions(Isolate *isolate, DirectHandle< JSReceiver > object, ShouldThrow should_throw)
static V8_WARN_UNUSED_RESULT Maybe< bool > HasInPrototypeChain(Isolate *isolate, DirectHandle< JSReceiver > object, DirectHandle< Object > proto)
static V8_WARN_UNUSED_RESULT HandleType< Object >::MaybeType ToPrimitive(Isolate *isolate, HandleType< JSReceiver > receiver, ToPrimitiveHint hint=ToPrimitiveHint::kDefault)
static MaybeDirectHandle< JSPrototype > GetPrototype(Isolate *isolate, DirectHandle< JSReceiver > receiver)
static V8_WARN_UNUSED_RESULT Maybe< bool > CreateDataProperty(Isolate *isolate, DirectHandle< JSReceiver > object, DirectHandle< Name > key, DirectHandle< Object > value, Maybe< ShouldThrow > should_throw)
static Handle< Object > GetDataProperty(Isolate *isolate, DirectHandle< JSReceiver > object, DirectHandle< Name > name)
static V8_WARN_UNUSED_RESULT Maybe< bool > IsExtensible(Isolate *isolate, DirectHandle< JSReceiver > object)
static V8_WARN_UNUSED_RESULT MaybeHandle< Object > GetProperty(Isolate *isolate, DirectHandle< JSReceiver > receiver, const char *key)
static V8_WARN_UNUSED_RESULT Maybe< bool > DefineOwnProperty(Isolate *isolate, DirectHandle< JSReceiver > object, DirectHandle< Object > key, PropertyDescriptor *desc, Maybe< ShouldThrow > should_throw)
static V8_EXPORT_PRIVATE MaybeHandle< NativeContext > GetContextForMicrotask(DirectHandle< JSReceiver > receiver)
V8_EXPORT_PRIVATE static V8_WARN_UNUSED_RESULT Maybe< bool > HasProperty(LookupIterator *it)
void Rehash(Isolate *isolate)
static void Clear(Isolate *isolate, DirectHandle< JSSet > set)
static void Initialize(DirectHandle< JSSet > set, Isolate *isolate)
static bool Delete(DirectHandle< JSWeakCollection > collection, DirectHandle< Object > key, int32_t hash)
static DirectHandle< JSArray > GetEntries(DirectHandle< JSWeakCollection > holder, int max_entries)
static V8_EXPORT_PRIVATE void Set(DirectHandle< JSWeakCollection > collection, DirectHandle< Object > key, DirectHandle< Object > value, int32_t hash)
static void Initialize(DirectHandle< JSWeakCollection > collection, Isolate *isolate)
static DirectHandle< String > ToString(DirectHandle< JSWrappedFunction > function)
virtual void GetFunctions(std::vector< Tagged< SharedFunctionInfo > > *functions) const
DirectHandle< Object > GetAccessors() const
@ TYPED_ARRAY_INDEX_NOT_FOUND
Tagged< Map > ToMap() const
bool IsForwardingAddress() const
static V8_EXPORT_PRIVATE bool IsMapOrForwarded(Tagged< Map > map)
static const int kNoConstructorFunctionIndex
V8_WARN_UNUSED_RESULT V8_INLINE bool ToHandle(DirectHandle< S > *out) const
V8_INLINE bool is_null() const
void BriefPrintDetails(std::ostream &os)
static V8_WARN_UNUSED_RESULT Handle< NameDictionary > New(IsolateT *isolate, int at_least_space_for, AllocationType allocation=AllocationType::kYoung, MinimumCapacity capacity_option=USE_DEFAULT_MINIMUM_CAPACITY)
int Lookup(DirectHandle< Name > key)
int IndexAt(InternalIndex entry)
Tagged< Object > ValueAt(InternalIndex entry)
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< String > ToFunctionName(Isolate *isolate, DirectHandle< Name > name)
void UpdateMaxNumberKey(uint32_t key, DirectHandle< JSObject > dictionary_holder)
static void UncheckedSet(Isolate *isolate, DirectHandle< NumberDictionary > dictionary, uint32_t key, DirectHandle< Object > value)
static V8_WARN_UNUSED_RESULT HandleType< NumberDictionary > Set(Isolate *isolate, HandleType< NumberDictionary > dictionary, uint32_t key, DirectHandle< Object > value, DirectHandle< JSObject > dictionary_holder=DirectHandle< JSObject >::null(), PropertyDetails details=PropertyDetails::Empty())
void CopyValuesTo(Tagged< FixedArray > elements)
static Handle< ObjectHashSet > Add(Isolate *isolate, Handle< ObjectHashSet > set, DirectHandle< Object > key)
void SetEntryValues(InternalIndex entry, const std::array< DirectHandle< Object >, N > &values)
static Handle< Derived > Put(Isolate *isolate, Handle< Derived > table, DirectHandle< Object > key, const std::array< DirectHandle< Object >, N > &values)
std::array< Tagged< Object >, N > Lookup(DirectHandle< Object > key)
static V8_EXPORT_PRIVATE DirectHandle< String > NoSideEffectsToString(Isolate *isolate, DirectHandle< Object > input)
static V8_WARN_UNUSED_RESULT MaybeHandle< Object > ToLength(Isolate *isolate, DirectHandle< Object > input)
static V8_WARN_UNUSED_RESULT MaybeHandle< JSAny > GetPropertyWithAccessor(LookupIterator *it)
V8_EXPORT_PRIVATE static V8_WARN_UNUSED_RESULT MaybeHandle< Number > ConvertToLength(Isolate *isolate, DirectHandle< Object > input)
static Tagged< Map > GetPrototypeChainRootMap(Tagged< Object > obj, Isolate *isolate)
static V8_WARN_UNUSED_RESULT Maybe< bool > RedefineIncompatibleProperty(Isolate *isolate, DirectHandle< Object > name, DirectHandle< Object > value, Maybe< ShouldThrow > should_throw)
static bool ToArrayLength(Tagged< Object > obj, uint32_t *index)
static V8_WARN_UNUSED_RESULT HandleType< String >::MaybeType ToString(Isolate *isolate, HandleType< T > input)
static V8_EXPORT_PRIVATE Handle< UnionOf< JSAny, Hole > > NewStorageFor(Isolate *isolate, Handle< UnionOf< JSAny, Hole > > object, Representation representation)
V8_EXPORT_PRIVATE static V8_WARN_UNUSED_RESULT Maybe< bool > AddDataProperty(LookupIterator *it, DirectHandle< Object > value, PropertyAttributes attributes, Maybe< ShouldThrow > should_throw, StoreOrigin store_origin, EnforceDefineSemantics semantics=EnforceDefineSemantics::kSet)
EXPORT_TEMPLATE_DECLARE(V8_EXPORT_PRIVATE) V8_WARN_UNUSED_RESULT static typename HandleType< Number > static V8_WARN_UNUSED_RESULT HandleType< Number >::MaybeType ConvertToInt32(Isolate *isolate, HandleType< Object > input)
V8_EXPORT_PRIVATE static V8_WARN_UNUSED_RESULT Maybe< bool > SetProperty(LookupIterator *it, DirectHandle< Object > value, StoreOrigin store_origin, Maybe< ShouldThrow > should_throw=Nothing< ShouldThrow >())
static V8_WARN_UNUSED_RESULT HandleType< Name >::MaybeType ConvertToName(Isolate *isolate, HandleType< Object > input)
static V8_WARN_UNUSED_RESULT Maybe< bool > SetPropertyWithDefinedSetter(DirectHandle< JSAny > receiver, DirectHandle< JSReceiver > setter, DirectHandle< Object > value, Maybe< ShouldThrow > should_throw)
static V8_WARN_UNUSED_RESULT HandleType< Number >::MaybeType ToNumber(Isolate *isolate, HandleType< T > input)
static bool SameNumberValue(double number1, double number2)
static V8_WARN_UNUSED_RESULT MaybeHandle< JSAny > GetPropertyWithDefinedGetter(DirectHandle< JSAny > receiver, DirectHandle< JSReceiver > getter)
static bool SameValueZero(Tagged< Object > obj, Tagged< Object > other)
static DirectHandle< FieldType > OptimalType(Tagged< Object > obj, Isolate *isolate, Representation representation)
static V8_WARN_UNUSED_RESULT MaybeHandle< Object > OrdinaryHasInstance(Isolate *isolate, DirectHandle< JSAny > callable, DirectHandle< JSAny > object)
static V8_WARN_UNUSED_RESULT HandleType< Number >::MaybeType ConvertToUint32(Isolate *isolate, HandleType< Object > input)
static Handle< String > TypeOf(Isolate *isolate, DirectHandle< Object > object)
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< FixedArray > CreateListFromArrayLike(Isolate *isolate, DirectHandle< Object > object, ElementTypes element_types)
static V8_EXPORT_PRIVATE bool BooleanValue(Tagged< Object > obj, IsolateT *isolate)
static V8_WARN_UNUSED_RESULT HandleType< JSReceiver >::MaybeType ToObject(Isolate *isolate, HandleType< T > object, const char *method_name=nullptr)
V8_INLINE static V8_WARN_UNUSED_RESULT Maybe< bool > IsArray(DirectHandle< Object > object)
static V8_EXPORT_PRIVATE Tagged< Smi > GetOrCreateHash(Tagged< Object > obj, Isolate *isolate)
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< Object > Add(Isolate *isolate, Handle< Object > lhs, Handle< Object > rhs)
static bool FilterKey(Tagged< Object > obj, PropertyFilter filter)
V8_EXPORT_PRIVATE static V8_WARN_UNUSED_RESULT Maybe< bool > Equals(Isolate *isolate, DirectHandle< Object > x, DirectHandle< Object > y)
static V8_WARN_UNUSED_RESULT Maybe< bool > SetSuperProperty(LookupIterator *it, DirectHandle< Object > value, StoreOrigin store_origin, Maybe< ShouldThrow > should_throw=Nothing< ShouldThrow >())
static V8_WARN_UNUSED_RESULT MaybeHandle< Object > InstanceOf(Isolate *isolate, DirectHandle< JSAny > object, DirectHandle< JSAny > callable)
static double NumberValue(Tagged< Number > obj)
static V8_WARN_UNUSED_RESULT Maybe< bool > SetPropertyWithAccessor(LookupIterator *it, DirectHandle< Object > value, Maybe< ShouldThrow > should_throw)
static V8_WARN_UNUSED_RESULT Maybe< bool > TransitionAndWriteDataProperty(LookupIterator *it, DirectHandle< Object > value, PropertyAttributes attributes, Maybe< ShouldThrow > should_throw, StoreOrigin store_origin)
static bool CheckContextualStoreToJSGlobalObject(LookupIterator *it, Maybe< ShouldThrow > should_throw)
static V8_EXPORT_PRIVATE MaybeDirectHandle< String > NoSideEffectsToMaybeString(Isolate *isolate, DirectHandle< Object > input)
static Handle< JSAny > WrapForRead(IsolateT *isolate, Handle< JSAny > object, Representation representation)
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< Object > GetLengthFromArrayLike(Isolate *isolate, DirectHandle< JSReceiver > object)
EXPORT_TEMPLATE_DECLARE(V8_EXPORT_PRIVATE) V8_WARN_UNUSED_RESULT static typename HandleType< String > static V8_WARN_UNUSED_RESULT HandleType< Number >::MaybeType ConvertToNumber(Isolate *isolate, HandleType< Object > input)
static V8_EXPORT_PRIVATE bool SameValue(Tagged< Object > obj, Tagged< Object > other)
static V8_EXPORT_PRIVATE bool ToInt32(Tagged< Object > obj, int32_t *value)
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< JSReceiver > ConvertReceiver(Isolate *isolate, DirectHandle< Object > object)
static V8_WARN_UNUSED_RESULT HandleType< Object >::MaybeType ToPrimitive(Isolate *isolate, HandleType< T > input, ToPrimitiveHint hint=ToPrimitiveHint::kDefault)
static V8_WARN_UNUSED_RESULT Maybe< bool > CannotCreateProperty(Isolate *isolate, DirectHandle< JSAny > receiver, DirectHandle< Object > name, DirectHandle< Object > value, Maybe< ShouldThrow > should_throw)
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< Object > SpeciesConstructor(Isolate *isolate, DirectHandle< JSReceiver > recv, DirectHandle< JSFunction > default_ctor)
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< Object > GetMethod(Isolate *isolate, DirectHandle< JSReceiver > receiver, DirectHandle< Name > name)
static V8_EXPORT_PRIVATE bool StrictEquals(Tagged< Object > obj, Tagged< Object > that)
static Tagged< Object > ToBoolean(Tagged< Object > obj, Isolate *isolate)
static V8_EXPORT_PRIVATE bool IterationHasObservableEffects(Tagged< Object > obj)
V8_EXPORT_PRIVATE static V8_WARN_UNUSED_RESULT MaybeHandle< Object > GetProperty(LookupIterator *it, bool is_global_reference=false)
static bool ToUint32(Tagged< Object > obj, uint32_t *value)
static V8_WARN_UNUSED_RESULT Maybe< bool > WriteToReadOnlyProperty(LookupIterator *it, DirectHandle< Object > value, Maybe< ShouldThrow > should_throw)
static HandleType< Object >::MaybeType ShareSlow(Isolate *isolate, HandleType< HeapObject > value, ShouldThrow throw_if_cannot_be_shared)
static V8_WARN_UNUSED_RESULT HandleType< Numeric >::MaybeType ConvertToNumeric(Isolate *isolate, HandleType< Object > input)
static V8_WARN_UNUSED_RESULT Maybe< bool > SetDataProperty(LookupIterator *it, DirectHandle< Object > value)
static bool FitsRepresentation(Tagged< Object > obj, Representation representation, bool allow_coercion=true)
static V8_WARN_UNUSED_RESULT HandleType< Object >::MaybeType ConvertToPropertyKey(Isolate *isolate, HandleType< Object > value)
static V8_WARN_UNUSED_RESULT Maybe< bool > SetPropertyInternal(LookupIterator *it, DirectHandle< Object > value, Maybe< ShouldThrow > should_throw, StoreOrigin store_origin, bool *found)
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< Object > ArraySpeciesConstructor(Isolate *isolate, DirectHandle< JSAny > original_array)
static Tagged< Object > GetSimpleHash(Tagged< Object > object)
static bool IsCodeLike(Tagged< Object > obj, Isolate *isolate)
V8_EXPORT_PRIVATE static V8_WARN_UNUSED_RESULT Maybe< ComparisonResult > Compare(Isolate *isolate, DirectHandle< Object > x, DirectHandle< Object > y)
static HandleType< Object >::MaybeType Share(Isolate *isolate, HandleType< T > value, ShouldThrow throw_if_cannot_be_shared)
static V8_WARN_UNUSED_RESULT MaybeHandle< JSReceiver > ToObjectImpl(Isolate *isolate, DirectHandle< Object > object, const char *method_name=nullptr)
static V8_WARN_UNUSED_RESULT HandleType< Object >::MaybeType ToNumeric(Isolate *isolate, HandleType< T > input)
static V8_WARN_UNUSED_RESULT Handle< Number > ToNumber(Isolate *isolate, DirectHandle< Oddball > input)
Tagged< String > type_of() const
Tagged< String > to_string() const
Tagged< Number > to_number() const
static void Initialize(Isolate *isolate, DirectHandle< Oddball > oddball, const char *to_string, DirectHandle< Number > to_number, const char *type_of, uint8_t kind)
static HandleType< OrderedHashMap >::MaybeType Rehash(Isolate *isolate, HandleType< OrderedHashMap > table)
static HandleType< OrderedHashSet >::MaybeType Rehash(Isolate *isolate, HandleType< OrderedHashSet > table)
static Handle< OrderedHashSet > Clear(Isolate *isolate, Handle< OrderedHashSet > table)
static int SizeFor(int data_length, int children_length)
static const int kSizeOfAllPromiseReactionJobTasks
static constexpr int SizeFor(int length)
static const int kNoHashSentinel
void InvalidateProtector()
static PropertyCellType InitialType(Isolate *isolate, Tagged< Object > value)
void ClearAndInvalidate(Isolate *isolate)
static Handle< PropertyCell > PrepareForAndSetValue(Isolate *isolate, DirectHandle< GlobalDictionary > dictionary, InternalIndex entry, DirectHandle< Object > value, PropertyDetails details)
static bool CheckDataIsCompatible(PropertyDetails details, Tagged< Object > value)
static Handle< PropertyCell > InvalidateAndReplaceEntry(Isolate *isolate, DirectHandle< GlobalDictionary > dictionary, InternalIndex entry, PropertyDetails new_details, DirectHandle< Object > new_value)
static PropertyCellType UpdatedType(Isolate *isolate, Tagged< PropertyCell > cell, Tagged< Object > value, PropertyDetails details)
void set_value(DirectHandle< JSAny > value)
bool has_writable() const
static bool IsAccessorDescriptor(PropertyDescriptor *desc)
Handle< JSAny > value() const
Handle< UnionOf< JSAny, FunctionTemplateInfo > > get() const
void set_writable(bool writable)
static void CompletePropertyDescriptor(Isolate *isolate, PropertyDescriptor *desc)
static bool ToPropertyDescriptor(Isolate *isolate, Handle< JSAny > obj, PropertyDescriptor *desc)
bool configurable() const
Handle< UnionOf< JSAny, FunctionTemplateInfo > > set() const
static bool IsDataDescriptor(PropertyDescriptor *desc)
bool has_enumerable() const
PropertyAttributes attributes() const
PropertyDetails CopyWithConstness(PropertyConstness constness) const
PropertyLocation location() const
Representation representation() const
PropertyCellType cell_type() const
int dictionary_index() const
static const int kInitialIndex
PropertyKind kind() const
PropertyDetails set_index(int index) const
static bool IsValidIndex(int index)
static constexpr PropertyDetails Empty(PropertyCellType cell_type=PropertyCellType::kNoCell)
PropertyDetails CopyAddAttributes(PropertyAttributes new_attributes) const
PropertyDetails set_cell_type(PropertyCellType type) const
Tagged< Smi > AsSmi() const
PropertyDetails CopyWithRepresentation(Representation representation) const
static const int kProtectorValid
static const int kProtectorInvalid
static Handle< WeakArrayList > Add(Isolate *isolate, Handle< WeakArrayList > array, DirectHandle< Map > value, int *assigned_index)
static Tagged< WeakArrayList > Compact(DirectHandle< WeakArrayList > array, Heap *heap, CompactionCallback callback, AllocationType allocation=AllocationType::kYoung)
void(*)(Tagged< HeapObject > object, int from_index, int to_index) CompactionCallback
static void set_empty_slot_index(Tagged< WeakArrayList > array, int index)
static void ScanForEmptySlots(Tagged< WeakArrayList > array)
static const int kFirstIndex
static const int kNoEmptySlotsMarker
static void MarkSlotEmpty(Tagged< WeakArrayList > array, int index)
static Tagged< Smi > empty_slot_index(Tagged< WeakArrayList > array)
static V8_EXPORT_PRIVATE bool Contains(Address address)
Tagged< Object > ValueAt(InternalIndex entry)
static Handle< RegisteredSymbolTable > Add(Isolate *isolate, Handle< RegisteredSymbolTable > table, DirectHandle< String > key, DirectHandle< Symbol >)
static char * RestoreState(Isolate *isolate, char *from)
static void Iterate(Isolate *isolate, RootVisitor *v)
static int ArchiveSpacePerThread()
static void PostGarbageCollectionProcessing(Isolate *isolate)
static char * ArchiveState(Isolate *isolate, char *to)
constexpr bool IsHeapObject() const
constexpr bool IsNone() const
bool Equals(const Representation &other) const
static constexpr Representation Tagged()
constexpr bool IsDouble() const
Iterator(Isolate *isolate)
V8_EXPORT_PRIVATE bool GetPositionInfoWithLineEnds(int position, PositionInfo *info, const String::LineEndsVector &line_ends, OffsetFlag offset_flag=OffsetFlag::kWithOffset) const
static void InitLineEnds(Isolate *isolate, DirectHandle< Script > script)
static V8_EXPORT_PRIVATE String::LineEndsVector GetLineEnds(Isolate *isolate, DirectHandle< Script > script)
static DirectHandle< String > GetScriptHash(Isolate *isolate, DirectHandle< Script > script, bool forceForInspector)
V8_EXPORT_PRIVATE void AddPositionInfoOffset(PositionInfo *info, OffsetFlag offset_flag=OffsetFlag::kWithOffset) const
bool IsSubjectToDebugging() const
bool GetPositionInfoInternal(const LineEndsContainer &ends, int position, Script::PositionInfo *info, const DisallowGarbageCollection &no_gc) const
static V8_EXPORT_PRIVATE int GetLineNumber(DirectHandle< Script > script, int code_offset)
void TraceScriptRundownSources()
bool has_line_ends() const
bool HasSourceURLComment() const
static MaybeHandle< SharedFunctionInfo > FindSharedFunctionInfo(DirectHandle< Script > script, IsolateT *isolate, FunctionLiteral *function_literal)
static void SetSource(Isolate *isolate, DirectHandle< Script > script, DirectHandle< String > source)
static void V8_PRESERVE_MOST InitLineEndsInternal(IsolateT *isolate, DirectHandle< Script > script)
Tagged< Object > GetNameOrSourceURL()
void set_flags(uint32_t new_flags)
v8::ScriptOriginOptions origin_options()
bool IsUserJavaScript() const
static bool GetPositionInfo(DirectHandle< Script > script, int position, PositionInfo *info, OffsetFlag offset_flag=OffsetFlag::kWithOffset)
void TraceScriptRundown()
bool HasSourceMappingURLComment() const
static int GetColumnNumber(DirectHandle< Script > script, int code_offset)
static int GetEvalPosition(Isolate *isolate, DirectHandle< Script > script)
static bool GetLineColumnWithLineEnds(int position, int &line, int &column, const String::LineEndsVector &line_ends)
static V8_INLINE constexpr int32_t SizeFor(int32_t length)
static V8_INLINE constexpr int32_t SizeFor(int32_t length)
static void EnsureSourcePositionsAvailable(Isolate *isolate, DirectHandle< SharedFunctionInfo > shared_info)
V8_EXPORT_PRIVATE static V8_WARN_UNUSED_RESULT Handle< SimpleNumberDictionary > Set(Isolate *isolate, Handle< SimpleNumberDictionary > dictionary, uint32_t key, DirectHandle< Object > value)
static int SizeFor(int capacity)
static constexpr int ToInt(const Tagged< Object > object)
static constexpr Tagged< Smi > FromInt(int value)
static constexpr Tagged< Smi > ToUint32Smi(Tagged< Smi > smi)
static V8_EXPORT_PRIVATE Address LexicographicCompare(Isolate *isolate, Tagged< Smi > x, Tagged< Smi > y)
static constexpr Tagged< Smi > zero()
static V8_EXPORT_PRIVATE void SmiPrint(Tagged< Smi > smi, std::ostream &os)
static constexpr int kMaxValue
V8_EXPORT_PRIVATE bool Has(Isolate *isolate, DirectHandle< String > name)
static V8_EXPORT_PRIVATE Handle< StringSet > New(Isolate *isolate)
static V8_EXPORT_PRIVATE Handle< StringSet > Add(Isolate *isolate, Handle< StringSet > stringset, DirectHandle< String > name)
V8_INLINE bool IsSequentialOneByte() const
void Add(const char *format)
static void WriteToFlat(Tagged< String > source, SinkCharT *sink, uint32_t start, uint32_t length)
static const uint32_t kMaxLength
static LineEndsVector CalculateLineEndsVector(IsolateT *isolate, DirectHandle< String > string, bool include_ending_line)
static V8_WARN_UNUSED_RESULT ComparisonResult Compare(Isolate *isolate, DirectHandle< String > x, DirectHandle< String > y)
static HandleType< String > Share(Isolate *isolate, HandleType< T > string)
base::SmallVector< int32_t, kInlineLineEndsSize > LineEndsVector
static Handle< FixedArray > CalculateLineEnds(IsolateT *isolate, DirectHandle< String > string, bool include_ending_line)
static HandleType< Number > ToNumber(Isolate *isolate, HandleType< String > subject)
bool Equals(Tagged< String > other) const
void BriefPrintDetails(std::ostream &os)
void BriefPrintDetails(std::ostream &os)
static constexpr int SizeFor(int capacity)
static HandleType< SwissNameDictionary > Add(IsolateT *isolate, HandleType< SwissNameDictionary > table, DirectHandle< Name > key, DirectHandle< Object > value, PropertyDetails details, InternalIndex *entry_out=nullptr)
const char * PrivateSymbolToName() const
void set(int index, Tagged< ElementT > value, WriteBarrierMode mode=kDefaultMode)
V8_INLINE constexpr Address ptr() const
bool GetHeapObjectIfStrong(Tagged< HeapObject > *result) const
constexpr bool IsCleared() const
bool GetHeapObjectIfWeak(Tagged< HeapObject > *result) const
bool ToSmi(Tagged< Smi > *value) const
V8_INLINE constexpr bool is_null() const
constexpr V8_INLINE bool IsSmi() const
V8_INLINE constexpr int32_t value() const
void BriefPrintDetails(std::ostream &os)
Tagged< Object > value1() const
Tagged< Object > value2() const
static int SizeFor(Tagged< Map > map, int length)
static constexpr int SizeFor(int length)
static constexpr int kSize
static int GcSafeSize(Tagged< Map > map)
static Handle< WeakArrayList > EnsureSpace(Isolate *isolate, Handle< WeakArrayList > array, int length, AllocationType allocation=AllocationType::kYoung)
static constexpr int SizeForCapacity(int capacity)
const WasmModule * module() const
static std::unique_ptr< TracedValue > Create()
#define V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL
#define V8_EXTERNAL_CODE_SPACE_BOOL
Handle< SharedFunctionInfo > info
#define RETURN_ON_EXCEPTION(isolate, call)
#define ASSIGN_RETURN_ON_EXCEPTION(isolate, dst, call)
#define RETURN_FAILURE(isolate, should_throw, call)
#define THROW_NEW_ERROR(isolate, call)
#define ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, dst, call, value)
#define RETURN_VALUE_IF_EXCEPTION(isolate, value)
#define RETURN_EXCEPTION_IF_EXCEPTION(isolate)
#define STACK_CHECK(isolate, result_value)
#define MAYBE_RETURN_NULL(call)
#define MAYBE_RETURN(call, value)
#define RETURN_ON_EXCEPTION_VALUE(isolate, call, value)
MicrotaskQueue * microtask_queue
base::Vector< const DirectHandle< Object > > args
#define V8_ALLOCATION_SITE_TRACKING_BOOL
#define PRIVATE_SYMBOL_LIST_GENERATOR(V, _)
SharedFunctionInfoRef shared
ZoneVector< RpoNumber > & result
ZoneVector< Entry > entries
std::optional< OolTrapLabel > trap
InstructionOperand source
constexpr unsigned CountLeadingZeros(T value)
constexpr bool IsPowerOfTwo(T value)
signed_type NegateWithWraparound(signed_type a)
constexpr bool IsInRange(T value, U lower_limit, U higher_limit)
constexpr Vector< T > VectorOf(T *start, size_t size)
V8_INLINE IndirectHandle< T > handle(Tagged< T > object, Isolate *isolate)
bool TryCast(Tagged< From > value, Tagged< To > *out)
constexpr const char * ToString(DeoptimizeKind kind)
uint32_t DoubleToUint32(double x)
constexpr NullMaybeHandleType kNullMaybeHandle
constexpr double kMaxSafeInteger
PerThreadAssertScopeDebugOnly< false, SAFEPOINTS_ASSERT, HEAP_ALLOCATION_ASSERT > DisallowGarbageCollection
bool is_sloppy(LanguageMode language_mode)
constexpr bool IsHoleyElementsKind(ElementsKind kind)
bool ComparisonResultToBool(Operation op, ComparisonResult result)
bool PropertyKeyToArrayIndex(DirectHandle< Object > index_obj, uint32_t *output)
bool IsMoreGeneralElementsKindTransition(ElementsKind from_kind, ElementsKind to_kind)
bool IsNumber(Tagged< Object > obj)
ReadOnlyRoots GetReadOnlyRoots()
bool IsAnyHole(Tagged< Object > obj, PtrComprCageBase cage_base)
bool DoubleToBoolean(double d)
@ USE_CUSTOM_MINIMUM_CAPACITY
Tagged(T object) -> Tagged< T >
void FormatBytesToHex(char *formatted, size_t size_of_formatted, const uint8_t *val, size_t size_of_val)
double DoubleToInteger(double x)
MaybeHandle< T > MaybeIndirectHandle
UnionOf< Undefined, FunctionTemplateInfo > UnionOf< Undefined, InterceptorInfo > UnionOf< Undefined, ObjectTemplateInfo > AccessCheckInfo
V8_INLINE Isolate * GetIsolateFromWritableObject(Tagged< HeapObject > object)
V8_INLINE constexpr bool IsSmi(TaggedImpl< kRefType, StorageType > obj)
V8_INLINE IndirectHandle< T > indirect_handle(DirectHandle< T > handle)
constexpr uint64_t kHoleNanInt64
kInterpreterTrampolineOffset Tagged< HeapObject >
int ToNumber(Register reg)
kStaticElementsTemplateOffset kInstancePropertiesTemplateOffset Tagged< FixedArray >
void MemsetTagged(Tagged_t *start, Tagged< MaybeObject > value, size_t counter)
V8_INLINE DirectHandle< T > direct_handle(Tagged< T > object, Isolate *isolate)
too high values may cause the compiler to set high thresholds for inlining to as much as possible avoid inlined allocation of objects that cannot escape trace load stores from virtual maglev objects use TurboFan fast string builder analyze liveness of environment slots and zap dead values trace TurboFan load elimination emit data about basic block usage in builtins to this enable builtin reordering when run mksnapshot flag for emit warnings when applying builtin profile data verify register allocation in TurboFan randomly schedule instructions to stress dependency tracking enable store store elimination in TurboFan rewrite far to near simulate GC compiler thread race related to allow float parameters to be passed in simulator mode JS Wasm Run additional turbo_optimize_inlined_js_wasm_wrappers enable experimental feedback collection in generic lowering enable Turboshaft s WasmLoadElimination enable Turboshaft s low level load elimination for JS enable Turboshaft s escape analysis for string concatenation use enable Turbolev features that we want to ship in the not too far future trace individual Turboshaft reduction steps trace intermediate Turboshaft reduction steps invocation count threshold for early optimization Enables optimizations which favor memory size over execution speed Enables sampling allocation profiler with X as a sample interval min size of a semi the new space consists of two semi spaces max size of the Collect garbage after Collect garbage after keeps maps alive for< n > old space garbage collections print one detailed trace line in name
return Cast< NumberDictionary >(elements(cage_base))
std::ostream & operator<<(std::ostream &os, AtomicMemoryOrder order)
const int kVariableSizeSentinel
constexpr int kInvalidInfoId
bool IsNullOrUndefined(Tagged< Object > obj, Isolate *isolate)
Handle< To > UncheckedCast(Handle< From > value)
bool IsFastPackedElementsKind(ElementsKind kind)
static void MoveMessageToPromise(Isolate *isolate, DirectHandle< JSPromise > promise)
V8_INLINE PtrComprCageBase GetPtrComprCageBase()
const uint8_t * SHA256_hash(const void *data, size_t len, uint8_t *digest)
Handle< T > IndirectHandle
bool IsModule(FunctionKind kind)
ShouldThrow GetShouldThrow(Isolate *isolate, Maybe< ShouldThrow > should_throw)
bool IsShared(Tagged< Object > obj)
void ShortPrint(Tagged< Object > obj, FILE *out)
typename detail::FlattenUnionHelper< Union<>, Ts... >::type UnionOf
bool IsBigIntTypedArrayElementsKind(ElementsKind kind)
static bool RemainsConstantType(Tagged< PropertyCell > cell, Tagged< Object > value)
@ SHARED_SEQ_ONE_BYTE_STRING_TYPE
@ SEQ_ONE_BYTE_STRING_TYPE
@ SHARED_SEQ_TWO_BYTE_STRING_TYPE
@ SEQ_TWO_BYTE_STRING_TYPE
@ INTERNALIZED_ONE_BYTE_STRING_TYPE
@ INTERNALIZED_TWO_BYTE_STRING_TYPE
Tagged< MaybeWeak< T > > MakeWeak(Tagged< T > value)
static const int kMaxNumberOfDescriptors
int32_t DoubleToInt32(double x)
V8_INLINE constexpr bool IsHeapObject(TaggedImpl< kRefType, StorageType > obj)
V8_EXPORT_PRIVATE FlagValues v8_flags
bool IsUniqueName(Tagged< Name > obj)
V8_INLINE bool IsWasmObject(T obj, Isolate *=nullptr)
bool PropertyKeyToArrayLength(DirectHandle< Object > value, uint32_t *length)
@ kExternalBigUint64Array
static bool ShouldConvertToSlowElements(uint32_t used_elements, uint32_t new_capacity)
Map::Bits1::HasPrototypeSlotBit Map::Bits1::HasNamedInterceptorBit Map::Bits1::IsUndetectableBit Map::Bits1::IsConstructorBit Map::Bits2::IsImmutablePrototypeBit Map::Bits3::IsDeprecatedBit Map::Bits3::IsPrototypeMapBit is_extensible
constexpr uint32_t kMaxUInt32
kInstanceDescriptorsOffset kTransitionsOrPrototypeInfoOffset IsNull(value)||IsJSProxy(value)||IsWasmObject(value)||(IsJSObject(value) &&(HeapLayout
uint32_t GetLength(Tagged< JSArray > array)
@ INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE
kInstanceDescriptorsOffset kTransitionsOrPrototypeInfoOffset prototype
!IsContextMap !IsContextMap native_context
Tagged< To > Cast(Tagged< From > value, const v8::SourceLocation &loc=INIT_SOURCE_LOCATION_IN_DEBUG)
static constexpr ReleaseStoreTag kReleaseStore
@ kPromiseRejectWithNoHandler
static constexpr RelaxedLoadTag kRelaxedLoad
static constexpr RelaxedStoreTag kRelaxedStore
static constexpr AcquireLoadTag kAcquireLoad
Maybe< T > Just(const T &t)
#define SIMPLE_HEAP_OBJECT_LIST2(V)
#define INSTANCE_TYPE_LIST(V)
#define EXTERN_DEFINE_DICTIONARY(DERIVED, SHAPE)
#define EXTERN_DEFINE_MULTI_OBJECT_BASE_HASH_TABLE(DERIVED, N)
#define MAKE_TORQUE_SIZE_FOR(TYPE, TypeName)
#define EXTERN_DEFINE_HASH_TABLE(DERIVED, SHAPE)
#define EXTERN_DEFINE_BASE_NAME_DICTIONARY(DERIVED, SHAPE)
#define SYMBOL_CHECK_AND_PRINT(_, name)
#define EXTERN_DEFINE_OBJECT_BASE_HASH_TABLE(DERIVED, SHAPE)
const size_t kSizeOfFormattedSha256Digest
const size_t kSizeOfSha256Digest
#define DCHECK_LE(v1, v2)
#define CHECK_GT(lhs, rhs)
#define CHECK_LT(lhs, rhs)
#define CHECK_LE(lhs, rhs)
#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
std::vector< WasmFunction > functions
#define TRACE_DISABLED_BY_DEFAULT(name)
#define TRACE_EVENT1(category_group, name, arg1_name, arg1_val)
#define V8_LIKELY(condition)
#define V8_WARN_UNUSED_RESULT
#define V8_UNLIKELY(condition)