46#if V8_ENABLE_WEBASSEMBLY
121 const char* modifier =
"";
126 modifier = GetModifier(mode);
130 modifier = GetModifier(mode);
137 LOG(
isolate(), ICEvent(type, keyed_prefix, map, name,
152 ic_info.
type = keyed_prefix ?
"Keyed" :
"";
162 ic_info.
state.reserve(17);
165 ic_info.
state +=
"->";
167 ic_info.
state += modifier;
168 ic_info.
state +=
")";
169 if (!map.is_null()) {
170 ic_info.
map =
reinterpret_cast<void*
>(map->ptr());
173 ic_info.
instance_type = std::to_string(map->instance_type());
175 ic_info.
map =
nullptr;
186 target_maps_(isolate),
187 target_maps_set_(false),
188 slow_stub_reason_(nullptr),
189 nexus_(isolate, vector, slot) {
196 for (;; it->Next()) {
197 switch (it->state()) {
209 if (interceptor->has_getter()) {
212 if (is_has_property && interceptor->has_query()) {
220 if (it->GetHolder<
JSObject>().is_identical_to(
221 it->isolate()->global_proxy()) &&
222 !it->isolate()->global_object()->IsDetached()) {
254 if (first_map.
is_null())
return false;
256 if (old_map->is_deprecated())
return true;
267 if (!IsName(*name))
return false;
269 if (*name != stub_name)
return false;
279 if (!IsString(*name))
return;
301 NewReferenceError(MessageTemplate::kNotDefined, name));
314#ifdef V8_TRACE_FEEDBACK_UPDATES
315 if (
v8_flags.trace_feedback_updates) {
316 FeedbackVector::TraceFeedbackChange(isolate, vector, slot, reason);
320 isolate->tiering_manager()->NotifyICChanged(vector);
326 if (!IsJSObject(*
object))
return false;
328 if (!
receiver->map()->is_deprecated())
return false;
338 bool changed =
nexus()->ConfigureMegamorphic(
354 nexus()->ConfigureHandlerMode(handler);
358 nexus()->ConfigureMonomorphic(name, map, handler);
368 maps_and_handlers.
reserve(maps.size());
369 DCHECK_EQ(maps.size(), handlers->size());
370 for (
size_t i = 0;
i < maps.
size();
i++) {
381 nexus()->ConfigurePolymorphic(name, maps_and_handlers);
387 bool update_feedback,
397 if (
IsAnyHas() ? !IsJSReceiver(*
object)
408 return TypeError(MessageTemplate::kInvalidInOperatorUse,
object, name);
420 if (MigrateDeprecated(
isolate(),
object)) {
465 bool update_feedback) {
468 if (IsString(*name)) {
472 global->native_context()->script_context_table(), isolate());
475 if (script_contexts->Lookup(str_name, &lookup_result)) {
477 script_contexts->get(lookup_result.
context_index), isolate());
486 NewReferenceError(MessageTemplate::kAccessedUninitializedVariable,
495 if (
nexus()->ConfigureLexicalVarMode(
509 if (
v8_flags.script_context_mutable_heap_number) {
523bool AddOneReceiverMapIfMissing(
MapHandles* receiver_maps,
527 if (!map.is_null() && map.is_identical_to(new_receiver_map)) {
531 receiver_maps->push_back(new_receiver_map);
535bool AddOneReceiverMapIfMissing(MapsAndHandlers* receiver_maps_and_handlers,
537 DCHECK(!new_receiver_map.is_null());
538 if (new_receiver_map->is_deprecated())
return false;
539 for (DirectHandle<Map> map : receiver_maps_and_handlers->maps()) {
540 if (!map.is_null() && map.is_identical_to(new_receiver_map)) {
544 receiver_maps_and_handlers->emplace_back(new_receiver_map, {});
548DirectHandle<NativeContext> GetAccessorContext(
549 const CallOptimization& call_optimization, Tagged<Map> holder_map,
551 std::optional<Tagged<NativeContext>> maybe_context =
552 call_optimization.GetAccessorContext(holder_map);
555 CHECK(maybe_context.has_value());
563 if (!
v8_flags.mega_dom_ic)
return false;
572 if (!Protectors::IsMegaDOMIntact(
isolate()))
return false;
576 if (!InstanceTypeChecker::IsJSApiObject(map->instance_type()))
return false;
581 if (!
accessor().ToHandle(&accessor_obj))
return false;
602 GetAccessorContext(call_optimization, *map,
isolate());
605 if (IsJSFunction(*accessor_obj)) {
624 if (
nexus()->GetName() != *name)
return false;
630 int deprecated_maps = 0;
631 int handler_to_overwrite = -1;
637 if (it.handler().IsCleared())
continue;
641 maps_and_handlers.
emplace_back(existing_map, existing_handler);
643 if (existing_map->is_deprecated()) {
646 }
else if (map.is_identical_to(existing_map)) {
652 if (handler.is_identical_to(existing_handler) &&
660 handler_to_overwrite =
i;
661 }
else if (handler_to_overwrite == -1 &&
663 handler_to_overwrite =
i;
671 int number_of_maps =
static_cast<int>(maps_and_handlers.
size());
672 int number_of_valid_maps =
673 number_of_maps - deprecated_maps - (handler_to_overwrite != -1);
675 if (number_of_valid_maps >=
v8_flags.max_valid_polymorphic_map_count) {
678 if (deprecated_maps >=
v8_flags.max_valid_polymorphic_map_count) {
685 number_of_valid_maps++;
686 if (number_of_valid_maps == 1) {
690 if (handler_to_overwrite >= 0) {
691 maps_and_handlers.
set_handler(handler_to_overwrite, handler);
692 if (!map.is_identical_to(
693 maps_and_handlers.
maps()[handler_to_overwrite])) {
694 maps_and_handlers.
set_map(handler_to_overwrite, map);
714 nexus()->ExtractMapsAndHandlers(&maps_and_handlers);
715 for (
auto [map, handler] : maps_and_handlers) {
722 if (source_map.
is_null())
return true;
723 if (target_map.
is_null())
return false;
724 if (source_map->is_abandoned_prototype_map())
return false;
725 ElementsKind target_elements_kind = target_map->elements_kind();
727 source_map->elements_kind(), target_elements_kind);
729 if (more_general_transition) {
731 transitioned_map = source_map->FindElementsKindTransitionedMap(
734 return transitioned_map == target_map;
782 }
else if (!lookup->
IsFound()) {
816 IsJSPrimitiveWrapper(*holder));
855 if (IsString(*lookup_start_object) &&
856 *lookup->
name() == roots.length_string()) {
861 if (IsStringWrapper(*lookup_start_object) &&
862 *lookup->
name() == roots.length_string()) {
869 if (IsJSFunction(*lookup_start_object) &&
870 *lookup->
name() == roots.prototype_string() &&
872 ->PrototypeRequiresRuntimeLookup()) {
880 bool holder_is_lookup_start_object =
883 switch (lookup->
state()) {
888 if (holder->GetNamedInterceptor()->non_masking()) {
895 isolate(), map, holder_ref, smi_handler));
898 if (holder_is_lookup_start_object) {
899 DCHECK(map->has_named_interceptor());
922 if (IsJSModuleNamespace(*holder)) {
926 exports->FindEntry(
isolate(), roots, lookup->
name(),
930 int value_index = ObjectHashTable::EntryToValueIndex(entry);
933 if (holder_is_lookup_start_object) {
937 isolate(), map, holder, *smi_handler));
941 if (IsAccessorPair(*accessors)) {
950 if (!IsCallableJSFunction(*
getter) &&
951 !IsFunctionTemplateInfo(*
getter)) {
958 if ((IsFunctionTemplateInfo(*
getter) &&
978 !holder->HasFastProperties()) {
986 GetAccessorContext(call_optimization, holder->map(), isolate());
990 isolate(), map, holder, *smi_handler,
995 if (holder->HasFastProperties()) {
997 if (holder_is_lookup_start_object) {
1009 if (IsJSGlobalObject(*holder)) {
1013 isolate(), map, holder, *smi_handler,
1018 if (holder_is_lookup_start_object)
1024 isolate(), map, holder, *smi_handler));
1029 if (info->replace_on_access()) {
1031 "getter needs to be reconfigured to data property");
1036 if (!info->has_getter(isolate()) || !holder->HasFastProperties() ||
1037 (info->is_sloppy() && !IsJSReceiver(*
receiver))) {
1047 LoadIC_LoadNativeDataPropertyFromPrototypeDH);
1057 if (IsJSGlobalObject(*holder,
isolate())) {
1063 isolate(), map, holder, *smi_handler,
1068 if (holder_is_lookup_start_object)
1071 }
else if (lookup->
IsElement(*holder)) {
1081 if (holder_is_lookup_start_object)
1086 !holder_is_lookup_start_object) {
1092 if (IsThinString(*value)) {
1101 if (!IsString(*value) ||
1102 (IsString(*value) && IsInternalizedString(*value))) {
1110 isolate(), map, holder, *smi_handler, weak_value));
1122 if (lookup->
name()->IsPrivate()) {
1130 isolate(), map, holder_proxy, *smi_handler));
1146 nexus()->FindHandlerForMap(receiver_map);
1156 using T = std::underlying_type_t<KeyedAccessLoadMode>;
1157 return ((
static_cast<T
>(old_mode) ^
1165 DCHECK(receiver_map->instance_type() !=
1166 JS_PRIMITIVE_WRAPPER_TYPE);
1170 if (target_receiver_maps.
empty()) {
1177 if (map.is_null())
continue;
1178 if (map->instance_type() == JS_PRIMITIVE_WRAPPER_TYPE) {
1182 if (map->instance_type() == JS_PROXY_TYPE) {
1198 target_receiver_maps.
at(0)->elements_kind(),
1212 if (!AddOneReceiverMapIfMissing(&target_receiver_maps, receiver_map)) {
1222 if (
static_cast<int>(target_receiver_maps.
size()) >
1223 v8_flags.max_valid_polymorphic_map_count) {
1229 handlers.reserve(target_receiver_maps.
size());
1233 if (target_receiver_maps.
empty()) {
1237 }
else if (target_receiver_maps.
size() == 1) {
1243 target_receiver_maps.
end()),
1250bool AllowConvertHoleElementToUndefined(
Isolate* isolate,
1252 if (IsJSTypedArrayMap(*receiver_map)) {
1258 if (Protectors::IsNoElementsIntact(isolate)) {
1259 if (IsStringMap(*receiver_map)) {
1262 if (IsJSObjectMap(*receiver_map)) {
1267 DirectHandle<HeapObject> receiver_prototype(receiver_map->prototype(),
1269 InstanceType prototype_type = receiver_prototype->map()->instance_type();
1270 if (prototype_type == JS_OBJECT_PROTOTYPE_TYPE ||
1271 (prototype_type == JS_ARRAY_TYPE &&
1272 isolate->IsInCreationContext(
1274 Context::INITIAL_ARRAY_PROTOTYPE_INDEX))) {
1283bool IsOutOfBoundsAccess(DirectHandle<Object>
receiver,
size_t index) {
1287 }
else if (IsJSTypedArray(*
receiver)) {
1289 }
else if (IsJSObject(*
receiver)) {
1299bool AllowReadingHoleElement(
ElementsKind elements_kind) {
1305 size_t index,
bool is_found) {
1307 if (!AllowConvertHoleElementToUndefined(isolate, receiver_map)) {
1315 ElementsKind elements_kind = receiver_map->elements_kind();
1325 bool is_oob_access = IsOutOfBoundsAccess(
receiver, index);
1326 if (is_oob_access) {
1332 DCHECK(!is_found && !is_oob_access);
1333 bool handle_hole = AllowReadingHoleElement(elements_kind);
1340 DirectHandle<Map> map,
1344 if (!AllowConvertHoleElementToUndefined(isolate, map)) {
1348 bool allow_reading_hole_element =
1349 AllowReadingHoleElement(map->elements_kind());
1350 switch (load_mode) {
1358 return allow_reading_hole_element
1369 if (receiver_map->has_indexed_interceptor() &&
1370 (receiver_map->GetIndexedInterceptor()->has_getter() ||
1371 (
IsAnyHas() && receiver_map->GetIndexedInterceptor()->has_query())) &&
1372 !receiver_map->GetIndexedInterceptor()->non_masking()) {
1379 InstanceType instance_type = receiver_map->instance_type();
1385 if (instance_type < FIRST_JS_RECEIVER_TYPE) {
1389 if (instance_type == JS_PROXY_TYPE) {
1392#if V8_ENABLE_WEBASSEMBLY
1393 if (InstanceTypeChecker::IsWasmObject(instance_type)) {
1400 ElementsKind elements_kind = receiver_map->elements_kind();
1407 bool is_js_array = instance_type == JS_ARRAY_TYPE;
1418 AllowReadingHoleElement(elements_kind) &&
1419 AllowConvertHoleElementToUndefined(
isolate(), receiver_map));
1429 receiver_maps->
erase(std::remove_if(
1430 receiver_maps->
begin(), receiver_maps->
end(),
1437 if (receiver_map->is_stable()) {
1438 Tagged<Map> tmap = receiver_map->FindElementsKindTransitionedMap(
1443 receiver_map->NotifyLeafMapLayoutChange(
isolate());
1448 GetUpdatedLoadModeForMap(
isolate(), receiver_map, new_load_mode))));
1454enum KeyType { kIntPtr, kName, kBailout };
1464 if (IsHeapNumber(*
key)) {
1468 *index_out =
static_cast<intptr_t
>(num);
1469 if (*index_out != num)
return kBailout;
1472 if (IsString(*
key)) {
1474 uint32_t maybe_array_index;
1475 if (
Cast<String>(*key)->AsArrayIndex(&maybe_array_index)) {
1476 if (maybe_array_index <= INT_MAX) {
1477 *index_out =
static_cast<intptr_t
>(maybe_array_index);
1487 if (IsSymbol(*
key)) {
1494bool IntPtrKeyToSize(intptr_t index, DirectHandle<HeapObject>
receiver,
1502 *out = std::numeric_limits<size_t>::max();
1507#if V8_HOST_ARCH_64_BIT
1514 static_cast<double>(std::numeric_limits<
decltype(
index)>::max()) <=
1517 *out =
static_cast<size_t>(
index);
1524 return !IsAccessCheckNeeded(*
receiver) && !IsJSPrimitiveWrapper(*
receiver);
1565 if (MigrateDeprecated(
isolate(),
object)) {
1569 intptr_t maybe_index;
1571 KeyType key_type = TryConvertKey(
key,
isolate(), &maybe_index, &maybe_name);
1573 if (key_type == kName)
return LoadName(
object,
key, maybe_name);
1575 bool is_found =
false;
1579 if (key_type == kIntPtr && CanCache(
object,
state()) &&
1602 if (IsJSProxy(*
object))
return true;
1603 if (!IsJSObject(*
object))
return false;
1607 for (;; it->Next()) {
1608 switch (it->state()) {
1618 if (it->HolderIsReceiverOrHiddenPrototype() || info->has_getter() ||
1619 info->has_query()) {
1625 if (IsAccessCheckNeeded(*it->GetHolder<
JSObject>()))
return false;
1628 return !it->IsReadOnly();
1632 if (it->IsReadOnly())
return false;
1639 if (
receiver.is_identical_to(holder)) {
1640 it->PrepareForDataProperty(value);
1650 return it->GetHolder<
Object>().is_identical_to(
1654 if (it->HolderIsReceiverOrHiddenPrototype())
return false;
1656 if (it->ExtendingNonExtensible(
receiver))
return false;
1657 it->PrepareTransitionToDataProperty(
receiver, value,
NONE,
1659 return it->IsCacheableTransition();
1686 if (it->ExtendingNonExtensible(
receiver))
return false;
1687 it->PrepareTransitionToDataProperty(
receiver, value,
NONE,
1689 return it->IsCacheableTransition();
1703 global->native_context()->script_context_table(), isolate());
1706 if (script_contexts->Lookup(str_name, &lookup_result)) {
1713 return TypeError(MessageTemplate::kConstAssign, global, name);
1717 script_context->get(lookup_result.
slot_index);
1719 if (IsTheHole(previous_value,
isolate())) {
1725 NewReferenceError(MessageTemplate::kAccessedUninitializedVariable,
1731 if (
nexus()->ConfigureLexicalVarMode(
1740 TraceIC(
"StoreGlobalIC", name);
1742 TraceIC(
"StoreGlobalIC", name);
1744 if (
v8_flags.script_context_mutable_heap_number ||
1751 script_context->set(lookup_result.
slot_index, *value);
1767 DCHECK(!IsJSGlobalObject(*it->GetReceiver(), it->isolate()));
1771 switch (it->state()) {
1782 it->GetName(), &new_desc, should_throw);
1786 NewTypeError(MessageTemplate::kWasmObjectsAreOpaque));
1790 switch (original_state) {
1800 DCHECK(!IsAccessCheckNeeded(*it->GetHolder<JSObject>()));
1833 if (MigrateDeprecated(
isolate(),
object)) {
1837 DCHECK(!name->IsPrivateName());
1861 return TypeError(MessageTemplate::kNonObjectPropertyStoreWithProperty, name,
1871 if (name->IsPrivate()) {
1872 if (name->IsPrivateName()) {
1884 if (IsJSProxy(*
object)) {
1898 if (
IsAnyDefineOwn() && !name->IsPrivateName() && IsJSObject(*
object) &&
1908 if (use_ic && IsAccessCheckNeeded(*
object)) {
1927 if (name->IsPrivateName()) {
1934 DefineOwnDataProperty(&it, original_state,
Cast<JSAny>(value),
1970 switch (lookup->
state()) {
1973 if (IsJSGlobalObject(*store_target)) {
2034 DCHECK(info->has_getter() || info->has_query());
2053 if (!holder->HasFastProperties()) {
2061 if (IsAccessorInfo(*accessors)) {
2063 if (!info->has_setter(isolate())) {
2077 if (
receiver.is_identical_to(holder)) {
2081 StoreIC_StoreNativeDataPropertyOnPrototypeDH);
2085 }
else if (IsAccessorPair(*accessors)) {
2089 if (!IsCallableJSFunction(*
setter) &&
2090 !IsFunctionTemplateInfo(*
setter)) {
2096 if ((IsFunctionTemplateInfo(*
setter) &&
2098 (IsJSFunction(*
setter) &&
2117 GetAccessorContext(call_optimization, holder->map(), isolate());
2129 }
else if (IsFunctionTemplateInfo(*
setter)) {
2136 if (
receiver.is_identical_to(holder)) {
2161 if (IsJSGlobalObject(*holder)) {
2241 nexus()->ExtractMapsAndHandlers(
2242 &target_maps_and_handlers,
2244 if (target_maps_and_handlers.
empty()) {
2249 monomorphic_map = new_receiver_map;
2257 if (!map.is_null() && map->instance_type() == JS_PRIMITIVE_WRAPPER_TYPE) {
2273 *transitioned_receiver_map)) {
2289 if (IsJSArrayMap(*receiver_map) &&
2292 "can't generalize store mode (potentially read-only length)");
2307 AddOneReceiverMapIfMissing(&target_maps_and_handlers, receiver_map);
2311 AddOneReceiverMapIfMissing(&target_maps_and_handlers, new_receiver_map);
2323 if (
static_cast<int>(target_maps_and_handlers.
size()) >
2324 v8_flags.max_valid_polymorphic_map_count) {
2332 store_mode = old_store_mode;
2333 }
else if (store_mode != old_store_mode) {
2343 size_t external_arrays = 0;
2347 "unsupported combination of arrays (potentially read-only length)");
2350 }
else if (map->has_typed_array_or_rab_gsab_typed_array_elements()) {
2355 if (external_arrays != 0 &&
2356 external_arrays != target_maps_and_handlers.
size()) {
2359 "unsupported combination of external and normal arrays");
2365 if (target_maps_and_handlers.
empty()) {
2369 }
else if (target_maps_and_handlers.
size() == 1) {
2370 auto [
map,
handler] = target_maps_and_handlers[0];
2384 !receiver_map->has_dictionary_elements() &&
2385 receiver_map->ShouldCheckForReadOnlyElementsInPrototypeChain(
2389 if (!IsJSObjectMap(*receiver_map)) {
2403 if (receiver_map->has_sloppy_arguments_elements()) {
2407 }
else if (receiver_map->has_fast_elements() ||
2408 receiver_map->has_sealed_elements() ||
2409 receiver_map->has_nonextensible_elements() ||
2410 receiver_map->has_typed_array_or_rab_gsab_typed_array_elements()) {
2413 if (IsJSArgumentsObjectMap(*receiver_map) &&
2414 receiver_map->has_fast_packed_elements()) {
2421 if (receiver_map->has_typed_array_or_rab_gsab_typed_array_elements()) {
2433 receiver_map->has_frozen_elements());
2439 if (!prev_validity_cell.ToHandle(&validity_cell)) {
2443 if (
IsSmi(*validity_cell)) {
2448 handler->set_validity_cell(*validity_cell);
2449 handler->set_smi_handler(*code);
2457 receiver_maps.
reserve(receiver_maps_and_handlers->
size());
2461 for (
size_t i = 0;
i < receiver_maps_and_handlers->
size();
i++) {
2462 auto [receiver_map, old_handler] = (*receiver_maps_and_handlers)[
i];
2463 DCHECK(!receiver_map->is_deprecated());
2467 if (receiver_map->instance_type() < FIRST_JS_RECEIVER_TYPE ||
2468 receiver_map->ShouldCheckForReadOnlyElementsInPrototypeChain(
2477 Tagged<Map> tmap = receiver_map->FindElementsKindTransitionedMap(
2482 if (receiver_map->is_stable()) {
2483 receiver_map->NotifyLeafMapLayoutChange(
isolate());
2491 if (!old_handler.is_null() &&
2492 (*old_handler).GetHeapObject(&old_handler_obj) &&
2493 IsDataHandler(old_handler_obj)) {
2506 KeyedStoreIC_ElementsTransitionAndStoreStub);
2508 isolate(), receiver_map, transition, store_mode, validity_cell);
2513 DCHECK(!handler.is_null());
2514 receiver_maps_and_handlers->
set_map(
i, receiver_map);
2522bool MayHaveTypedArrayInPrototypeChain(
Isolate* isolate,
2527 if (IsJSProxy(iter.GetCurrent()))
return true;
2528 if (IsJSTypedArray(iter.GetCurrent()))
return true;
2535 bool oob_access = IsOutOfBoundsAccess(
receiver, index);
2540 !
receiver->WouldConvertToSlowElements(
static_cast<uint32_t
>(index));
2544 if (
receiver->map()->has_typed_array_or_rab_gsab_typed_array_elements() &&
2559 if (MigrateDeprecated(
isolate(),
object)) {
2575 intptr_t maybe_index;
2577 KeyType key_type = TryConvertKey(
key,
isolate(), &maybe_index, &maybe_name);
2579 if (key_type == kName) {
2589 return store_handle;
2596 !IsStringWrapper(*
object) && !IsAccessCheckNeeded(*
object) &&
2597 !IsJSGlobalProxy(*
object);
2598 if (use_ic && !
IsSmi(*
object)) {
2603 if (heap_object->map()->IsMapInArrayPrototypeChain(isolate())) {
2607#if V8_ENABLE_WEBASSEMBLY
2608 if (IsWasmObjectMap(heap_object->map())) {
2616 bool is_arguments =
false;
2617 bool key_is_valid_index = (key_type == kIntPtr);
2619 if (use_ic && IsJSReceiver(*
object) && key_is_valid_index) {
2622 is_arguments = IsJSArgumentsObject(*
receiver);
2623 bool is_jsobject = IsJSObject(*
receiver);
2625 key_is_valid_index = IntPtrKeyToSize(maybe_index,
receiver, &index);
2626 if (is_jsobject && !is_arguments && key_is_valid_index) {
2628 store_mode = GetStoreMode(receiver_object, index);
2647 if (!old_receiver_map.
is_null()) {
2653 }
else if (IsJSObject(*
object) &&
2654 MayHaveTypedArrayInPrototypeChain(
isolate(),
2661 }
else if (key_is_valid_index) {
2662 if (old_receiver_map->is_abandoned_prototype_map()) {
2664 }
else if (old_receiver_map->has_dictionary_elements() ||
2666 ->ShouldCheckForReadOnlyElementsInPrototypeChain(
2711 DCHECK(!array->map()->IsMapInArrayPrototypeChain(isolate()));
2715 MigrateDeprecated(
isolate(), array)) {
2717 TraceIC(
"StoreInArrayLiteralIC", index);
2724 if (
IsSmi(*index)) {
2726 uint32_t index32 =
static_cast<uint32_t
>(
Smi::ToInt(*index));
2727 store_mode = GetStoreMode(array, index32);
2730 Handle<Map> old_array_map(array->map(), isolate());
2733 if (
IsSmi(*index)) {
2734 DCHECK(!old_array_map->is_abandoned_prototype_map());
2736 handle(array->map(), isolate()));
2744 TraceIC(
"StoreInArrayLiteralIC", index);
2758 int slot =
args.tagged_index_value_at(2);
2767 LoadIC ic(isolate, vector, vector_slot,
kind);
2773 receiver = isolate->global_object();
2792 int slot_kind =
args.smi_value_at(2);
2799 LoadIC ic(isolate, vector, vector_slot,
kind);
2815 ic.UpdateState(
object,
key);
2825 int slot =
args.tagged_index_value_at(1);
2827 int typeof_value =
args.smi_value_at(3);
2832 if (!IsUndefined(*maybe_vector, isolate)) {
2833 DCHECK(IsFeedbackVector(*maybe_vector));
2841 ic.UpdateState(global, name);
2853 int slot =
args.tagged_index_value_at(1);
2871 int slot =
args.tagged_index_value_at(3);
2877 ic.UpdateState(
object,
key);
2887 int slot =
args.tagged_index_value_at(2);
2891 if (!IsUndefined(*maybe_vector, isolate)) {
2892 DCHECK(IsFeedbackVector(*maybe_vector));
2906 int slot =
args.tagged_index_value_at(1);
2919 if (!IsUndefined(*maybe_vector, isolate)) {
2920 DCHECK(IsFeedbackVector(*maybe_vector));
2921 DCHECK(!vector_slot.IsInvalid());
2923 kind = vector->GetKind(vector_slot);
2937 int slot =
args.tagged_index_value_at(1);
2948 if (!IsUndefined(*maybe_vector, isolate)) {
2949 DCHECK(IsFeedbackVector(*maybe_vector));
2950 DCHECK(!vector_slot.IsInvalid());
2952 kind = vector->GetKind(vector_slot);
2989 int slot =
args.tagged_index_value_at(1);
2997 ic.UpdateState(global,
key);
3025 int slot =
args.tagged_index_value_at(1);
3041 if (script_contexts->Lookup(name, &lookup_result)) {
3043 script_contexts->get(lookup_result.
context_index), isolate);
3046 isolate, NewTypeError(MessageTemplate::kConstAssign, global, name));
3052 script_context->get(lookup_result.
slot_index);
3054 if (IsTheHole(previous_value, isolate)) {
3058 NewReferenceError(MessageTemplate::kAccessedUninitializedVariable,
3062 if (
v8_flags.script_context_mutable_heap_number ||
3065 script_context, lookup_result.
slot_index, value, isolate);
3067 script_context->set(lookup_result.
slot_index, *value);
3095 if (!IsUndefined(*maybe_vector, isolate)) {
3096 DCHECK(IsFeedbackVector(*maybe_vector));
3098 int slot =
args.tagged_index_value_at(1);
3100 kind = vector->GetKind(vector_slot);
3127 int slot =
args.tagged_index_value_at(1);
3135 if (!IsUndefined(*maybe_vector, isolate)) {
3136 DCHECK(IsFeedbackVector(*maybe_vector));
3138 kind = vector->GetKind(vector_slot);
3154 int slot =
args.tagged_index_value_at(1);
3159 if (!IsUndefined(*maybe_vector, isolate)) {
3160 DCHECK(IsFeedbackVector(*maybe_vector));
3202 StoreOwnElement(isolate,
Cast<JSArray>(array), index, value);
3214 int slot =
args.tagged_index_value_at(4);
3219 if (IsJSObject(*
object)) {
3221 map->elements_kind());
3241enum class FastCloneObjectMode {
3254FastCloneObjectMode GetCloneModeForMapPreCheck(DirectHandle<Map> map,
3255 bool null_proto_literal,
3258 if (!IsJSObjectMap(*map)) {
3261 if (null_proto_literal)
return FastCloneObjectMode::kNotSupported;
3263 IsHeapNumberMap(*map)
3264 ? FastCloneObjectMode::kEmptyObject
3265 : FastCloneObjectMode::kNotSupported;
3270 return FastCloneObjectMode::kNotSupported;
3272 if (!map->OnlyHasSimpleProperties()) {
3273 return FastCloneObjectMode::kNotSupported;
3277 if (!map->BelongsToSameNativeContextAs(isolate->context())) {
3278 return FastCloneObjectMode::kNotSupported;
3281 return FastCloneObjectMode::kMaybeSupported;
3284FastCloneObjectMode GetCloneModeForMap(DirectHandle<Map> map,
3285 bool null_proto_literal,
3287 FastCloneObjectMode pre_check =
3288 GetCloneModeForMapPreCheck(map, null_proto_literal, isolate);
3289 if (pre_check != FastCloneObjectMode::kMaybeSupported) {
3297 FastCloneObjectMode mode =
3298 map->instance_type() == JS_OBJECT_TYPE &&
3300 map->GetConstructor() == *isolate->object_function() &&
3301 map->prototype() == *isolate->object_function_prototype() &&
3302 !map->is_prototype_map()
3303 ? FastCloneObjectMode::kIdenticalMap
3304 : FastCloneObjectMode::kDifferentMap;
3306 if (null_proto_literal ||
IsNull(map->prototype())) {
3307 mode = FastCloneObjectMode::kDifferentMap;
3311 for (InternalIndex
i : map->IterateOwnDescriptors()) {
3312 PropertyDetails details = descriptors->GetDetails(
i);
3315 key->IsPrivateName()) {
3316 return FastCloneObjectMode::kNotSupported;
3318 if (!details.IsConfigurable() || details.IsReadOnly()) {
3319 mode = FastCloneObjectMode::kDifferentMap;
3324 !map->is_prototype_map());
3329bool CanCacheCloneTargetMapTransition(
3330 DirectHandle<Map> source_map, std::optional<DirectHandle<Map>> target_map,
3331 bool null_proto_literal, Isolate* isolate) {
3332 if (!
v8_flags.clone_object_sidestep_transitions || null_proto_literal) {
3342 source_map->is_prototype_map()) {
3349 return !(*target_map)->is_deprecated();
3357bool CanFastCloneObjectToObjectLiteral(DirectHandle<Map> source_map,
3358 DirectHandle<Map> target_map,
3359 DirectHandle<Map> override_map,
3360 bool null_proto_literal,
3363 DCHECK(!target_map->is_deprecated());
3364 DCHECK(source_map->OnlyHasSimpleProperties());
3365 DCHECK(!source_map->IsInobjectSlackTrackingInProgress());
3366 DCHECK(!target_map->IsInobjectSlackTrackingInProgress());
3367 DCHECK_EQ(*target_map->map(), *source_map->map());
3368 DCHECK_EQ(target_map->GetConstructor(), *isolate->object_function());
3370 !null_proto_literal,
3371 *target_map->prototype() == *isolate->object_function_prototype());
3376 if (source_map->instance_type() != JS_OBJECT_TYPE ||
3377 target_map->instance_type() != JS_OBJECT_TYPE ||
3378 !target_map->OnlyHasSimpleProperties() ||
3379 !target_map->has_fast_elements()) {
3382 if (!override_map.is_null()) {
3384 if (target_map->map() != override_map->map()) {
3392 DCHECK_EQ(*override_map, isolate->object_function()->initial_map());
3393 DCHECK(override_map->instance_type() == JS_OBJECT_TYPE);
3394 DCHECK_EQ(override_map->NumberOfOwnDescriptors(), 0);
3395 DCHECK(!override_map->IsInobjectSlackTrackingInProgress());
3396 if (override_map->instance_size() != target_map->instance_size() ||
3397 override_map->GetInObjectPropertiesStartInWords() !=
3398 target_map->GetInObjectPropertiesStartInWords()) {
3403 ElementsKind source_elements_kind = source_map->elements_kind();
3404 ElementsKind target_elements_kind = target_map->elements_kind();
3412 if (source_map->is_prototype_map() || target_map->is_prototype_map()) {
3416 if (source_map->NumberOfOwnDescriptors() !=
3417 target_map->NumberOfOwnDescriptors()) {
3421 int source_used_inobj_properties = source_map->GetInObjectProperties() -
3422 source_map->UnusedInObjectProperties();
3423 int target_used_inobj_properties = target_map->GetInObjectProperties() -
3424 target_map->UnusedInObjectProperties();
3425 if (source_used_inobj_properties != target_used_inobj_properties) {
3430 if (source_map->HasOutOfObjectProperties() !=
3431 target_map->HasOutOfObjectProperties() ||
3432 (target_map->HasOutOfObjectProperties() &&
3433 source_map->UnusedPropertyFields() !=
3434 target_map->UnusedPropertyFields())) {
3439 target_map->instance_descriptors();
3440 for (InternalIndex
i : target_map->IterateOwnDescriptors()) {
3441 if (descriptors->GetKey(
i) != target_descriptors->GetKey(
i)) {
3444 PropertyDetails details = descriptors->GetDetails(
i);
3445 PropertyDetails target_details = target_descriptors->GetDetails(
i);
3466 bool prototype_transition_is_shortcutted =
3467 v8_flags.move_prototype_transitions_first &&
3468 source_map->prototype() != target_map->prototype();
3469 if (!prototype_transition_is_shortcutted &&
3470 CanCacheCloneTargetMapTransition(source_map, target_map,
3471 null_proto_literal, isolate)) {
3472 if (!details.representation().fits_into(
3473 target_details.representation()) ||
3474 (target_details.representation().IsDouble() &&
3475 details.representation().IsSmi())) {
3486 if (!details.representation().MostGenericInPlaceChange().Equals(
3487 target_details.representation()) ||
3488 !
IsAny(target_type)) {
3502 new_object = isolate->factory()->NewJSObjectWithNullProto();
3503 }
else if (IsJSObject(*source) &&
3509 int properties = source_map->GetInObjectProperties() -
3510 source_map->UnusedInObjectProperties();
3512 isolate->native_context(), properties);
3513 new_object = isolate->factory()->NewFastOrSlowJSObjectFromMap(map);
3516 isolate->native_context()->object_function(), isolate);
3517 new_object = isolate->factory()->NewJSObject(constructor);
3526 isolate, new_object, source,
3536 int flags =
args.smi_value_at(1);
3543template <S
ideStepTransition::Kind kind>
3545 DirectHandle<Map> override_map) {
3548 if (!
v8_flags.clone_object_sidestep_transitions) {
3553 if (!source_map->BelongsToSameNativeContextAs(isolate->context())) {
3557 TransitionsAccessor transitions(isolate, *source_map);
3558 if (transitions.HasSideStepTransitions()) {
3559 result = transitions.GetSideStepTransition(
kind);
3560 if (
result.IsHeapObject()) {
3563 bool is_valid = !map->is_deprecated();
3570 DCHECK_EQ(*override_map, isolate->object_function()->initial_map());
3571 Tagged<Object> validity_cell = transitions.GetSideStepTransition(
3573 is_valid = validity_cell.IsHeapObject() &&
3574 Cast<Cell>(validity_cell)->value().ToSmi().value() ==
3579 if (
result.IsHeapObject()) {
3580 CHECK_EQ(GetCloneModeForMapPreCheck(source_map,
false, isolate),
3581 FastCloneObjectMode::kMaybeSupported);
3589 FastCloneObjectMode clone_mode =
3590 GetCloneModeForMap(source_map,
false, isolate);
3592 switch (clone_mode) {
3593 case FastCloneObjectMode::kNotSupported:
3594 case FastCloneObjectMode::kDifferentMap:
3596 case FastCloneObjectMode::kEmptyObject:
3597 case FastCloneObjectMode::kIdenticalMap:
3600 case FastCloneObjectMode::kMaybeSupported:
3605 switch (clone_mode) {
3606 case FastCloneObjectMode::kIdenticalMap:
3613 case FastCloneObjectMode::kDifferentMap:
3614 DCHECK(CanFastCloneObjectToObjectLiteral(source_map,
3616 override_map,
false, isolate));
3628template <S
ideStepTransition::Kind kind>
3629void SetCloneTargetMap(Isolate* isolate, DirectHandle<Map> source_map,
3630 DirectHandle<Map> new_target_map,
3631 DirectHandle<Map> override_map) {
3632 if (!
v8_flags.clone_object_sidestep_transitions)
return;
3633 DCHECK(CanCacheCloneTargetMapTransition(source_map, new_target_map,
false,
3635 DCHECK_EQ(GetCloneTargetMap<kind>(isolate, source_map, override_map),
3637 DCHECK(!new_target_map->is_deprecated());
3643 constexpr bool need_validity_cell =
3645 DirectHandle<Cell> validity_cell;
3646 if constexpr (need_validity_cell) {
3649 DCHECK_EQ(*override_map, isolate->object_function()->initial_map());
3654 TransitionsAccessor transitions(isolate, *source_map);
3655 transitions.SetSideStepTransition(
kind, *new_target_map);
3656 if constexpr (need_validity_cell) {
3657 transitions.SetSideStepTransition(
3660 DCHECK_EQ(GetCloneTargetMap<kind>(isolate, source_map, override_map),
3664template <S
ideStepTransition::Kind kind>
3665void SetCloneTargetMapUnsupported(Isolate* isolate,
3666 DirectHandle<Map> source_map,
3667 DirectHandle<Map> override_map) {
3668 if (!
v8_flags.clone_object_sidestep_transitions)
return;
3669 DCHECK_EQ(GetCloneTargetMap<kind>(isolate, source_map, override_map),
3671 DCHECK(CanCacheCloneTargetMapTransition(source_map, {},
false,
isolate));
3675 TransitionsAccessor(isolate, *source_map)
3677 DCHECK_EQ(GetCloneTargetMap<kind>(isolate, source_map, override_map),
3687 int flags =
args.smi_value_at(1);
3689 if (!MigrateDeprecated(isolate, source)) {
3691 std::optional<FeedbackNexus> nexus;
3692 if (IsFeedbackVector(*maybe_vector)) {
3693 int index =
args.tagged_index_value_at(2);
3697 if (!
IsSmi(*source) && (!nexus || !nexus->IsMegamorphic())) {
3703 if (!source_map->IsInobjectSlackTrackingInProgress()) {
3706 nexus->ConfigureCloneObject(source_map,
3710 bool unsupported =
false;
3711 if (!null_proto_literal) {
3713 GetCloneTargetMap<SideStepTransition::Kind::kCloneObject>(
3714 isolate, source_map, {});
3720 UpdateNexus(target);
3725 FastCloneObjectMode clone_mode =
3727 ? FastCloneObjectMode::kNotSupported
3728 : GetCloneModeForMap(source_map, null_proto_literal, isolate);
3730 UpdateNexus(target_map);
3731 if (CanCacheCloneTargetMapTransition(source_map, target_map,
3732 null_proto_literal, isolate)) {
3733 SetCloneTargetMap<SideStepTransition::Kind::kCloneObject>(
3734 isolate, source_map, target_map, {});
3737 switch (clone_mode) {
3738 case FastCloneObjectMode::kIdenticalMap: {
3739 UpdateState(source_map);
3743 case FastCloneObjectMode::kEmptyObject: {
3748 case FastCloneObjectMode::kDifferentMap: {
3753 if (result_map->IsInobjectSlackTrackingInProgress()) {
3756 if (CanFastCloneObjectToObjectLiteral(
3757 source_map, result_map, {}, null_proto_literal,
isolate)) {
3758 DCHECK(result_map->OnlyHasSimpleProperties());
3759 DCHECK_EQ(source_map->GetInObjectProperties() -
3760 source_map->UnusedInObjectProperties(),
3761 result_map->GetInObjectProperties() -
3762 result_map->UnusedInObjectProperties());
3763 UpdateState(result_map);
3765 if (CanCacheCloneTargetMapTransition(
3766 source_map, {}, null_proto_literal,
isolate)) {
3767 SetCloneTargetMapUnsupported<
3772 nexus->ConfigureMegamorphic();
3777 case FastCloneObjectMode::kNotSupported: {
3780 case FastCloneObjectMode::kMaybeSupported:
3783 DCHECK(clone_mode == FastCloneObjectMode::kNotSupported);
3785 nexus->ConfigureMegamorphic();
3803#ifdef V8_RUNTIME_CALL_STATS
3804 if (
V8_UNLIKELY(TracingFlags::is_runtime_stats_enabled())) {
3813 std::ignore = arguments.CallAccessorSetter(info, name, value);
3820bool MaybeCanCloneObjectForObjectAssign(DirectHandle<JSReceiver> source,
3821 DirectHandle<Map> source_map,
3822 DirectHandle<JSReceiver> target,
3824 FastCloneObjectMode clone_mode =
3825 GetCloneModeForMap(source_map,
false, isolate);
3826 switch (clone_mode) {
3827 case FastCloneObjectMode::kIdenticalMap:
3828 case FastCloneObjectMode::kDifferentMap:
3830 case FastCloneObjectMode::kNotSupported:
3832 case FastCloneObjectMode::kEmptyObject:
3833 case FastCloneObjectMode::kMaybeSupported:
3840 DirectHandle<FixedArray> keys;
3844 CHECK(res.ToHandle(&keys));
3845 for (
int i = 0;
i < keys->
length(); ++
i) {
3846 Handle<Object> next_key(keys->get(
i), isolate);
3847 PropertyKey
key(isolate, next_key);
3848 LookupIterator it(isolate, target,
key);
3849 switch (it.state()) {
3875 DCHECK(IsJSObject(*source));
3876 DCHECK(IsJSObject(*target));
3881 DCHECK_EQ(target_map->NumberOfOwnDescriptors(), 0);
3882 DCHECK(!source_map->is_dictionary_map());
3883 DCHECK(!target_map->is_dictionary_map());
3884 DCHECK(!source_map->is_deprecated());
3885 DCHECK(!target_map->is_deprecated());
3886 DCHECK(target_map->is_extensible());
3887 DCHECK(!IsUndefined(*source, isolate) && !
IsNull(*source, isolate));
3888 DCHECK(source_map->BelongsToSameNativeContextAs(isolate->context()));
3893 GetCloneTargetMap<SideStepTransition::Kind::kObjectAssign>(
3894 isolate, source_map, target_map);
3896 return roots.undefined_value();
3902 auto UpdateCache = [&](
Handle<Map> clone_target_map) {
3903 if (CanCacheCloneTargetMapTransition(source_map, clone_target_map,
false,
3905 SetCloneTargetMap<SideStepTransition::Kind::kObjectAssign>(
3906 isolate, source_map, clone_target_map, target_map);
3909 auto UpdateCacheNotClonable = [&]() {
3910 if (CanCacheCloneTargetMapTransition(source_map, {},
false,
isolate)) {
3911 SetCloneTargetMapUnsupported<SideStepTransition::Kind::kObjectAssign>(
3912 isolate, source_map, target_map);
3918 if (source_map->IsInobjectSlackTrackingInProgress() ||
3919 target_map->IsInobjectSlackTrackingInProgress()) {
3920 return roots.undefined_value();
3923 if (MaybeCanCloneObjectForObjectAssign(source, source_map, target, isolate)) {
3924 CHECK(target->map()->OnlyHasSimpleProperties());
3930 if (clone_target_map->IsInobjectSlackTrackingInProgress()) {
3931 return roots.true_value();
3933 if (CanFastCloneObjectToObjectLiteral(source_map, clone_target_map,
3934 target_map,
false, isolate)) {
3935 CHECK(target->map()->OnlyHasSimpleProperties());
3936 UpdateCache(clone_target_map);
3938 UpdateCacheNotClonable();
3942 return roots.true_value();
3944 UpdateCacheNotClonable();
3945 return roots.undefined_value();
3976 arguments.AcceptSideEffects();
3986 !it.GetHolder<
JSObject>().is_identical_to(holder)) {
3995 if (it.IsFound())
return *
result;
3997 int slot =
args.tagged_index_value_at(3);
4009 isolate, NewReferenceError(MessageTemplate::kNotDefined, it.name()));
4024 (!
receiver->HasNamedInterceptor() ||
4025 receiver->GetNamedInterceptor()->non_masking())) {
4026 interceptor_holder =
4029 DCHECK(interceptor_holder->HasNamedInterceptor());
4032 interceptor_holder->GetNamedInterceptor(), isolate);
4034 DCHECK(!interceptor->non_masking());
4045 constexpr bool ignore_return_value =
true;
4050 ignore_return_value));
4083 uint32_t index =
args.smi_value_at(1);
4110 int slot =
args.tagged_index_value_at(2);
4114 if (!IsUndefined(*maybe_vector, isolate)) {
4115 DCHECK(IsFeedbackVector(*maybe_vector));
4128 uint32_t index =
args.smi_value_at(1);
4136 if (interceptor->has_query()) {
4138 arguments.CallIndexedQuery(interceptor, index);
4147 arguments.AcceptSideEffects();
4150 }
else if (interceptor->has_getter()) {
4152 arguments.CallIndexedGetter(interceptor, index);
4156 arguments.AcceptSideEffects();
#define BUILTIN_CODE(isolate, name)
V8_INLINE T FromJust() const &
V8_INLINE bool IsNothing() const
static bool IsJSObjectFieldAccessor(Isolate *isolate, DirectHandle< Map > map, DirectHandle< Name > name, FieldIndex *field_index)
bool accept_any_receiver() const
bool is_simple_api_call() const
bool IsCompatibleReceiverMap(DirectHandle< JSObject > api_holder, Handle< JSObject > holder, HolderLookup) const
DirectHandle< FunctionTemplateInfo > api_call_info() const
Handle< JSObject > LookupHolderOfExpectedType(IsolateT *isolate, DirectHandle< Map > receiver_map, HolderLookup *holder_lookup) const
bool requires_signature_check() const
static DirectHandle< Object > LoadScriptContextElement(DirectHandle< Context > script_context, int index, DirectHandle< Object > new_value, Isolate *isolate)
static void StoreScriptContextAndUpdateSlotProperty(DirectHandle< Context > script_context, int index, DirectHandle< Object > new_value, Isolate *isolate)
iterator begin() noexcept
size_t size() const noexcept
bool empty() const noexcept
void erase(iterator erase_start)
iterator begin() noexcept
void push_back(const DirectHandle< T > &x)
V8_INLINE bool is_null() const
V8_INLINE bool is_identical_to(Handle< S > other) const
static Tagged< Object > ThrowLoadFromNullOrUndefined(Isolate *isolate, DirectHandle< Object > object, MaybeDirectHandle< Object > key)
Handle< Boolean > ToBoolean(bool value)
DirectHandle< MegaDomHandler > NewMegaDomHandler(MaybeObjectDirectHandle accessor, MaybeObjectDirectHandle context)
Handle< StoreHandler > NewStoreHandler(int data_count)
FeedbackSlotKind kind() const
InlineCacheState ic_state() const
static FeedbackSlot Invalid()
static FeedbackSlot ToSlot(intptr_t index)
static bool NowIs(Tagged< FieldType > type, Tagged< FieldType > other)
V8_INLINE bool is_null() const
V8_INLINE bool is_identical_to(const HandleBase &that) const
static V8_INLINE bool InReadOnlySpace(Tagged< HeapObject > object)
static V8_INLINE ICStats * instance()
V8_INLINE ICInfo & Current()
bool UpdatePolymorphicIC(DirectHandle< Name > name, const MaybeObjectDirectHandle &handler)
void TraceIC(const char *type, DirectHandle< Object > name)
bool IsDefineNamedOwnIC() const
void set_slow_stub_reason(const char *reason)
bool IsStoreInArrayLiteralIC() const
bool IsDefineKeyedOwnIC() const
Handle< Map > lookup_start_object_map()
void update_lookup_start_object_map(DirectHandle< Object > object)
bool vector_needs_update()
bool IsStoreGlobalIC() const
const char * slow_stub_reason_
static bool IsHandler(Tagged< MaybeObject > object)
void set_accessor(Handle< Object > accessor)
bool IsKeyedHasIC() const
MaybeDirectHandle< Object > ReferenceError(Handle< Name > name)
bool ShouldRecomputeHandler(DirectHandle< String > name)
void MarkRecomputeHandler(DirectHandle< Object > name)
bool IsLoadGlobalIC() const
bool IsTransitionOfMonomorphicTarget(Tagged< Map > source_map, Tagged< Map > target_map)
Isolate * isolate() const
Tagged< Map > FirstTargetMap()
MaybeHandle< Object > accessor() const
FeedbackSlotKind kind() const
MaybeDirectHandle< Object > TypeError(MessageTemplate, Handle< Object > object, Handle< Object > key)
void UpdateState(DirectHandle< Object > lookup_start_object, DirectHandle< Object > name)
void TargetMaps(MapHandles *list)
bool ConfigureVectorState(IC::State new_state, DirectHandle< Object > key)
void CopyICToMegamorphicCache(DirectHandle< Name > name)
bool IsKeyedLoadIC() const
bool RecomputeHandlerForName(DirectHandle< Object > name)
char TransitionMarkFromState(IC::State state)
void UpdateMegamorphicCache(DirectHandle< Map > map, DirectHandle< Name > name, const MaybeObjectDirectHandle &handler)
bool IsAnyDefineOwn() const
bool UpdateMegaDOMIC(const MaybeObjectDirectHandle &handler, DirectHandle< Name > name)
void UpdateMonomorphicIC(const MaybeObjectDirectHandle &handler, DirectHandle< Name > name)
IC(Isolate *isolate, Handle< FeedbackVector > vector, FeedbackSlot slot, FeedbackSlotKind kind)
bool IsKeyedStoreIC() const
const FeedbackNexus * nexus() const
static void OnFeedbackChanged(Isolate *isolate, Tagged< FeedbackVector > vector, FeedbackSlot slot, const char *reason)
void SetCache(DirectHandle< Name > name, Handle< Object > handler)
Handle< JSGlobalObject > global_object()
StubCache * load_stub_cache() const
StubCache * store_stub_cache() const
StubCache * define_own_stub_cache() const
v8::internal::Factory * factory()
static constexpr uint32_t kMaxArrayIndex
static bool MayHaveReadOnlyLength(Tagged< Map > js_array_map)
static bool HasReadOnlyLength(DirectHandle< JSArray > array)
static V8_WARN_UNUSED_RESULT HandleType< Object >::MaybeType DefineOwnPropertyIgnoreAttributes(LookupIterator *it, HandleType< T > value, PropertyAttributes attributes, AccessorInfoHandling handling=DONT_FORCE_FIELD, EnforceDefineSemantics semantics=EnforceDefineSemantics::kSet)
static constexpr uint32_t kMaxElementIndex
static V8_WARN_UNUSED_RESULT Maybe< bool > CheckIfCanDefineAsConfigurable(Isolate *isolate, LookupIterator *it, DirectHandle< Object > value, Maybe< ShouldThrow > should_throw)
static void MakePrototypesFast(DirectHandle< Object > receiver, WhereToStart where_to_start, Isolate *isolate)
static V8_EXPORT_PRIVATE void TransitionElementsKind(DirectHandle< JSObject > object, ElementsKind to_kind)
static void MigrateInstance(Isolate *isolate, DirectHandle< JSObject > instance)
static V8_WARN_UNUSED_RESULT Maybe< bool > DefineOwnProperty(Isolate *isolate, DirectHandle< JSProxy > object, DirectHandle< Object > key, PropertyDescriptor *desc, Maybe< ShouldThrow > should_throw)
static V8_WARN_UNUSED_RESULT Maybe< bool > CreateDataProperty(Isolate *isolate, DirectHandle< JSReceiver > object, DirectHandle< Name > key, DirectHandle< Object > value, Maybe< ShouldThrow > should_throw)
static V8_WARN_UNUSED_RESULT Maybe< bool > CheckPrivateNameStore(LookupIterator *it, bool is_define)
static V8_WARN_UNUSED_RESULT Maybe< bool > SetOrCopyDataProperties(Isolate *isolate, DirectHandle< JSReceiver > target, DirectHandle< Object > source, PropertiesEnumerationMode mode, base::Vector< DirectHandle< Object > > excluded_properties={}, bool use_set=true)
V8_EXPORT_PRIVATE static V8_WARN_UNUSED_RESULT Maybe< bool > HasProperty(LookupIterator *it)
static V8_WARN_UNUSED_RESULT Maybe< bool > AddPrivateField(LookupIterator *it, DirectHandle< Object > value, Maybe< ShouldThrow > should_throw)
Tagged< JSFunction > function() const override
static void CollectFunctionAndOffsetForICStats(Isolate *isolate, Tagged< JSFunction > function, Tagged< AbstractCode > code, int code_offset)
std::tuple< Tagged< AbstractCode >, int > GetActiveCodeAndOffset() const
static MaybeHandle< FixedArray > GetKeys(Isolate *isolate, DirectHandle< JSReceiver > object, KeyCollectionMode mode, PropertyFilter filter, GetKeysConversion keys_conversion=GetKeysConversion::kKeepNumbers, bool is_for_in=false, bool skip_indices=false)
Handle< Object > LoadElementHandler(DirectHandle< Map > receiver_map, KeyedAccessLoadMode new_load_mode)
V8_WARN_UNUSED_RESULT MaybeDirectHandle< Object > RuntimeLoad(DirectHandle< JSAny > object, DirectHandle< Object > key, bool *is_found=nullptr)
void LoadElementPolymorphicHandlers(MapHandles *receiver_maps, MaybeObjectHandles *handlers, KeyedAccessLoadMode new_load_mode)
V8_WARN_UNUSED_RESULT MaybeDirectHandle< Object > Load(Handle< JSAny > object, Handle< Object > key)
KeyedAccessLoadMode GetKeyedAccessLoadModeFor(DirectHandle< Map > receiver_map) const
V8_WARN_UNUSED_RESULT MaybeDirectHandle< Object > LoadName(Handle< JSAny > object, DirectHandle< Object > key, Handle< Name > name)
void UpdateLoadElement(DirectHandle< HeapObject > receiver, KeyedAccessLoadMode new_load_mode)
KeyedAccessStoreMode GetKeyedAccessStoreMode()
Handle< Object > StoreElementHandler(DirectHandle< Map > receiver_map, KeyedAccessStoreMode store_mode, MaybeDirectHandle< UnionOf< Smi, Cell > > prev_validity_cell=kNullMaybeHandle)
V8_WARN_UNUSED_RESULT MaybeDirectHandle< Object > Store(Handle< JSAny > object, Handle< Object > name, DirectHandle< Object > value)
void UpdateStoreElement(Handle< Map > receiver_map, KeyedAccessStoreMode store_mode, Handle< Map > new_receiver_map)
void StoreElementPolymorphicHandlers(MapsAndHandlers *receiver_maps_and_handlers, KeyedAccessStoreMode store_mode)
V8_WARN_UNUSED_RESULT MaybeDirectHandle< Object > Load(Handle< Name > name, bool update_feedback=true)
static Handle< Smi > LoadSlow(Isolate *isolate)
static DirectHandle< Smi > LoadAccessorFromPrototype(Isolate *isolate)
static Handle< Smi > LoadNativeDataProperty(Isolate *isolate, int descriptor)
static Handle< Smi > LoadConstantFromPrototype(Isolate *isolate)
static Handle< Smi > LoadProxy(Isolate *isolate)
static Handle< Smi > LoadNormal(Isolate *isolate)
static Handle< Smi > LoadField(Isolate *isolate, FieldIndex field_index)
static Handle< Smi > LoadNonExistent(Isolate *isolate)
static bool CanHandleHolderNotLookupStart(Tagged< Object > handler)
static Handle< Smi > LoadInterceptor(Isolate *isolate)
static KeyedAccessLoadMode GetKeyedAccessLoadMode(Tagged< MaybeObject > handler)
static Handle< Object > LoadFromPrototype(Isolate *isolate, DirectHandle< Map > receiver_map, DirectHandle< JSReceiver > holder, Tagged< Smi > smi_handler, MaybeObjectDirectHandle maybe_data1=MaybeObjectDirectHandle(), MaybeObjectDirectHandle maybe_data2=MaybeObjectDirectHandle())
static Handle< Smi > LoadModuleExport(Isolate *isolate, int index)
static Handle< Smi > LoadIndexedString(Isolate *isolate, KeyedAccessLoadMode load_mode)
static Handle< Smi > LoadApiGetter(Isolate *isolate)
static Handle< Smi > LoadElement(Isolate *isolate, ElementsKind elements_kind, bool is_js_array, KeyedAccessLoadMode load_mode)
static Handle< Smi > LoadGlobal(Isolate *isolate)
static Handle< Object > LoadFullChain(Isolate *isolate, DirectHandle< Map > receiver_map, const MaybeObjectDirectHandle &holder, Handle< Smi > smi_handler)
void UpdateCaches(LookupIterator *lookup)
MaybeObjectHandle ComputeHandler(LookupIterator *lookup)
V8_WARN_UNUSED_RESULT MaybeDirectHandle< Object > Load(Handle< JSAny > object, Handle< Name > name, bool update_feedback=true, DirectHandle< JSAny > receiver=DirectHandle< JSAny >())
bool ShouldThrowReferenceError() const
PropertyDetails property_details() const
int GetFieldDescriptorIndex() const
int GetAccessorIndex() const
bool TryLookupCachedProperty(DirectHandle< AccessorPair > accessor)
FieldIndex GetFieldIndex() const
DirectHandle< T > GetStoreTarget() const
DirectHandle< Object > GetAccessors() const
DirectHandle< JSAny > GetReceiver() const
DirectHandle< PropertyCell > transition_cell() const
bool IsCacheableTransition()
DirectHandle< T > GetHolder() const
Handle< Object > GetDataValue(AllocationPolicy allocation_policy=AllocationPolicy::kAllocationAllowed) const
DirectHandle< JSAny > lookup_start_object() const
bool is_dictionary_holder() const
DirectHandle< Name > GetName()
@ TYPED_ARRAY_INDEX_NOT_FOUND
bool HolderIsReceiverOrHiddenPrototype() const
DirectHandle< Name > name() const
Representation representation() const
bool IsPrivateName() const
PropertyConstness constness() const
DirectHandle< Map > transition_map() const
DirectHandle< PropertyCell > GetPropertyCell() const
static Handle< UnionOf< Smi, Cell > > GetOrCreatePrototypeChainValidityCell(DirectHandle< Map > map, Isolate *isolate)
static V8_EXPORT_PRIVATE MaybeHandle< Map > TryUpdate(Isolate *isolate, Handle< Map > map) V8_WARN_UNUSED_RESULT
static constexpr int kPrototypeChainValid
void emplace_back(DirectHandle< Map > map, MaybeObjectDirectHandle handler)
base::Vector< DirectHandle< Map > > maps()
void set_handler(size_t i, MaybeObjectDirectHandle handler)
void reserve(size_t capacity)
void set_map(size_t i, DirectHandle< Map > map)
static MaybeObjectDirectHandle Weak(Tagged< Object > object, Isolate *isolate)
static MaybeObjectHandle Weak(Tagged< Object > object, Isolate *isolate)
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)
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 double NumberValue(Tagged< Number > obj)
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)
V8_EXPORT_PRIVATE static V8_WARN_UNUSED_RESULT MaybeHandle< Object > GetProperty(LookupIterator *it, bool is_global_reference=false)
Maybe< InterceptorResult > GetBooleanReturnValue(v8::Intercepted intercepted, const char *callback_kind_for_error_message, bool ignore_return_value=false)
v8::Intercepted CallNamedSetter(DirectHandle< InterceptorInfo > interceptor, DirectHandle< Name > name, DirectHandle< Object > value)
void set_value(DirectHandle< JSAny > value)
void set_configurable(bool configurable)
void set_writable(bool writable)
void set_enumerable(bool enumerable)
PropertyLocation location() const
PropertyKind kind() const
Tagged< T > GetCurrent() const
V8_INLINE Tagged< Boolean > boolean_value(bool value) const
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< Object > HasProperty(Isolate *isolate, DirectHandle< Object > object, DirectHandle< Object > key)
V8_EXPORT_PRIVATE static V8_WARN_UNUSED_RESULT MaybeDirectHandle< Object > SetObjectProperty(Isolate *isolate, DirectHandle< JSAny > object, DirectHandle< Object > key, DirectHandle< Object > value, MaybeDirectHandle< JSAny > receiver, StoreOrigin store_origin, Maybe< ShouldThrow > should_throw=Nothing< ShouldThrow >())
V8_EXPORT_PRIVATE static V8_WARN_UNUSED_RESULT MaybeDirectHandle< Object > GetObjectProperty(Isolate *isolate, DirectHandle< JSAny > lookup_start_object, DirectHandle< Object > key, DirectHandle< JSAny > receiver={}, bool *is_found=nullptr)
V8_EXPORT_PRIVATE static V8_WARN_UNUSED_RESULT MaybeDirectHandle< Object > DefineObjectOwnProperty(Isolate *isolate, DirectHandle< JSAny > object, DirectHandle< Object > key, DirectHandle< Object > value, StoreOrigin store_origin)
static constexpr int ToInt(const Tagged< Object > object)
static constexpr Tagged< Smi > zero()
V8_WARN_UNUSED_RESULT MaybeDirectHandle< Object > Store(Handle< Name > name, DirectHandle< Object > value)
static Handle< Smi > StoreNormal(Isolate *isolate)
static Handle< Object > StoreThroughPrototype(Isolate *isolate, DirectHandle< Map > receiver_map, DirectHandle< JSReceiver > holder, Tagged< Smi > smi_handler, MaybeObjectDirectHandle maybe_data1=MaybeObjectDirectHandle(), MaybeObjectDirectHandle maybe_data2=MaybeObjectDirectHandle())
static Handle< Smi > StoreSlow(Isolate *isolate, KeyedAccessStoreMode store_mode=KeyedAccessStoreMode::kInBounds)
static Handle< Smi > StoreSharedStructField(Isolate *isolate, int descriptor, FieldIndex field_index, Representation representation)
static Handle< Smi > StoreNativeDataProperty(Isolate *isolate, int descriptor)
static Handle< Smi > StoreField(Isolate *isolate, int descriptor, FieldIndex field_index, PropertyConstness constness, Representation representation)
static DirectHandle< Smi > StoreGlobalProxy(Isolate *isolate)
static Handle< Code > StoreFastElementBuiltin(Isolate *isolate, KeyedAccessStoreMode mode)
static DirectHandle< Smi > StoreApiSetter(Isolate *isolate)
static MaybeObjectHandle StoreGlobal(Handle< PropertyCell > cell)
static DirectHandle< Smi > StoreAccessorFromPrototype(Isolate *isolate)
static MaybeObjectHandle StoreTransition(Isolate *isolate, Handle< Map > transition_map)
static Handle< Smi > StoreInterceptor(Isolate *isolate)
static Handle< Code > StoreSloppyArgumentsBuiltin(Isolate *isolate, KeyedAccessStoreMode mode)
static Tagged< Smi > StoreProxy()
static MaybeObjectHandle StoreOwnTransition(Isolate *isolate, Handle< Map > transition_map)
static Handle< Object > StoreElementTransition(Isolate *isolate, DirectHandle< Map > receiver_map, DirectHandle< Map > transition, KeyedAccessStoreMode store_mode, MaybeDirectHandle< UnionOf< Smi, Cell > > prev_validity_cell=kNullMaybeHandle)
bool LookupForWrite(LookupIterator *it, DirectHandle< Object > value, StoreOrigin store_origin)
MaybeObjectHandle ComputeHandler(LookupIterator *lookup)
void UpdateCaches(LookupIterator *lookup, DirectHandle< Object > value, StoreOrigin store_origin)
V8_WARN_UNUSED_RESULT MaybeDirectHandle< Object > Store(Handle< JSAny > object, Handle< Name > name, DirectHandle< Object > value, StoreOrigin store_origin=StoreOrigin::kNamed)
MaybeDirectHandle< Object > Store(DirectHandle< JSArray > array, Handle< Object > index, DirectHandle< Object > value)
void Set(Tagged< Name > name, Tagged< Map > map, Tagged< MaybeObject > handler)
bool GetHeapObject(Tagged< HeapObject > *result) const
V8_INLINE constexpr bool is_null() const
static void EnsureHasSideStepTransitions(Isolate *isolate, DirectHandle< Map > map)
#define V8_DICT_PROPERTY_CONST_TRACKING_BOOL
#define RUNTIME_FUNCTION(Name)
#define RETURN_FAILURE_IF_EXCEPTION(isolate)
#define ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, dst, call)
#define ASSIGN_RETURN_ON_EXCEPTION(isolate, dst, call)
#define RETURN_FAILURE(isolate, should_throw, call)
#define THROW_NEW_ERROR(isolate, call)
#define RETURN_FAILURE_IF_EXCEPTION_DETECTOR(isolate, detector)
#define THROW_NEW_ERROR_RETURN_FAILURE(isolate, call)
#define MAYBE_RETURN_NULL(call)
#define MAYBE_RETURN(call, value)
#define RETURN_RESULT_OR_FAILURE(isolate, call)
#define MAYBE_ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, dst, call)
base::Vector< const DirectHandle< Object > > args
ZoneVector< RpoNumber > & result
#define LOG(isolate, Call)
V8_INLINE IndirectHandle< T > handle(Tagged< T > object, Isolate *isolate)
bool IsStoreGlobalICKind(FeedbackSlotKind kind)
bool TryCast(Tagged< From > value, Tagged< To > *out)
bool StoreModeIsInBounds(KeyedAccessStoreMode store_mode)
bool StoreModeCanGrow(KeyedAccessStoreMode store_mode)
constexpr double kMaxSafeInteger
static MaybeDirectHandle< JSObject > CloneObjectSlowPath(Isolate *isolate, DirectHandle< Object > source, int flags)
bool IsDefineNamedOwnICKind(FeedbackSlotKind kind)
bool IsNone(Tagged< FieldType > obj)
PerThreadAssertScopeDebugOnly< false, SAFEPOINTS_ASSERT, HEAP_ALLOCATION_ASSERT > DisallowGarbageCollection
constexpr bool IsHoleyElementsKind(ElementsKind kind)
bool IsMoreGeneralElementsKindTransition(ElementsKind from_kind, ElementsKind to_kind)
bool IsNumber(Tagged< Object > obj)
bool IsSetNamedICKind(FeedbackSlotKind kind)
Tagged< DescriptorArray >
Tagged(T object) -> Tagged< T >
v8::MemorySpan< DirectHandle< Map > > MapHandlesSpan
V8_INLINE constexpr bool IsSmi(TaggedImpl< kRefType, StorageType > obj)
V8_INLINE IndirectHandle< T > indirect_handle(DirectHandle< T > handle)
@ kLoadGlobalNotInsideTypeof
@ kLoadGlobalInsideTypeof
bool IsAnyNonextensibleElementsKind(ElementsKind kind)
bool IsLoadICKind(FeedbackSlotKind kind)
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 allocation gc speed threshold for starting incremental marking via a task in percent of available threshold for starting incremental marking immediately in percent of available Use a single schedule for determining a marking schedule between JS and C objects schedules the minor GC task with kUserVisible priority max worker number of concurrent for NumberOfWorkerThreads start background threads that allocate memory concurrent_array_buffer_sweeping use parallel threads to clear weak refs in the atomic pause trace progress of the incremental marking trace object counts and memory usage report a tick only when allocated zone memory changes by this amount TracingFlags::gc_stats TracingFlags::gc_stats track native contexts that are expected to be garbage collected verify heap pointers before and after GC memory reducer runs GC with ReduceMemoryFootprint flag Maximum number of memory reducer GCs scheduled Old gen GC speed is computed directly from gc tracer counters Perform compaction on full GCs based on V8 s default heuristics Perform compaction on every full GC Perform code space compaction when finalizing a full GC with stack Stress GC compaction to flush out bugs with moving objects flush of baseline code when it has not been executed recently Use time base code flushing instead of age Use a progress bar to scan large objects in increments when incremental marking is active force incremental marking for small heaps and run it more often force marking at random points between and force scavenge at random points between and reclaim otherwise unreachable unmodified wrapper objects when possible less compaction in non memory reducing mode use high priority threads for concurrent Marking Test mode only flag It allows an unit test to select evacuation candidates use incremental marking for CppHeap cppheap_concurrent_marking c value for membalancer A special constant to balance between memory and space tradeoff The smaller the more memory it uses enable use of SSE4 instructions if available enable use of AVX VNNI instructions if available enable use of POPCNT instruction if available force all emitted branches to be in long mode(MIPS/PPC only)") DEFINE_BOOL(partial_constant_pool
bool IsImmutableLexicalVariableMode(VariableMode mode)
bool IsHoleyElementsKindForRead(ElementsKind kind)
bool IsNullOrUndefined(Tagged< Object > obj, Isolate *isolate)
KeyedAccessLoadMode GeneralizeKeyedAccessLoadMode(KeyedAccessLoadMode mode1, KeyedAccessLoadMode mode2)
static void LookupForRead(LookupIterator *it, bool is_has_property)
bool IsSmiOrObjectElementsKind(ElementsKind kind)
ShouldThrow GetShouldThrow(Isolate *isolate, Maybe< ShouldThrow > should_throw)
bool IsSloppyArgumentsElementsKind(ElementsKind kind)
bool AllowedHandlerChange(KeyedAccessLoadMode old_mode, KeyedAccessLoadMode new_mode)
DONT_OVERRIDE DISABLE_ALLOCATION_SITES HOLEY_ELEMENTS
bool IsBooleanMap(Tagged< Map > map)
bool IsStoreInArrayLiteralICKind(FeedbackSlotKind kind)
bool IsNullOrUndefinedMap(Tagged< Map > map)
typename detail::FlattenUnionHelper< Union<>, Ts... >::type UnionOf
bool IsFastElementsKind(ElementsKind kind)
V8_EXPORT_PRIVATE FlagValues v8_flags
bool IsAny(Tagged< FieldType > obj)
bool IsKeyedLoadICKind(FeedbackSlotKind kind)
V8_INLINE bool IsWasmObject(T obj, Isolate *=nullptr)
bool IsDefineKeyedOwnICKind(FeedbackSlotKind kind)
bool IsLoadGlobalICKind(FeedbackSlotKind kind)
bool IsTypedArrayOrRabGsabTypedArrayElementsKind(ElementsKind kind)
bool LoadModeHandlesHoles(KeyedAccessLoadMode load_mode)
kInstanceDescriptorsOffset kTransitionsOrPrototypeInfoOffset IsNull(value)||IsJSProxy(value)||IsWasmObject(value)||(IsJSObject(value) &&(HeapLayout
std::vector< MaybeObjectHandle > MaybeObjectHandles
bool IsKeyedStoreICKind(FeedbackSlotKind kind)
!IsContextMap !IsContextMap native_context
Tagged< To > Cast(Tagged< From > value, const v8::SourceLocation &loc=INIT_SOURCE_LOCATION_IN_DEBUG)
Maybe< T > Just(const T &t)
#define TRACE_HANDLER_STATS(...)
#define DCHECK_LE(v1, v2)
#define DCHECK_IMPLIES(v1, v2)
#define DCHECK_GE(v1, v2)
#define CHECK_EQ(lhs, rhs)
#define DCHECK(condition)
#define DCHECK_EQ(v1, v2)
unsigned number_of_own_descriptors
std::string instance_type
static constexpr Tagged< Smi > Empty
@ kObjectAssignValidityCell
static constexpr Tagged< Smi > Unreachable
static bool is_ic_stats_enabled()
static V8_EXPORT_PRIVATE std::atomic_uint ic_stats
#define V8_LIKELY(condition)
#define V8_UNLIKELY(condition)