39FrameState GetArgumentsFrameState(FrameState frame_state) {
41 return outer_state.frame_state_info().type() ==
49const int kElementLoopUnrollLimit = 16;
52const int kFunctionContextAllocationLimit = 16;
53const int kBlockContextAllocationLimit = 16;
58 switch (node->opcode()) {
59 case IrOpcode::kJSCreate:
61 case IrOpcode::kJSCreateArguments:
63 case IrOpcode::kJSCreateArray:
65 case IrOpcode::kJSCreateArrayIterator:
67 case IrOpcode::kJSCreateAsyncFunctionObject:
69 case IrOpcode::kJSCreateBoundFunction:
71 case IrOpcode::kJSCreateClosure:
73 case IrOpcode::kJSCreateCollectionIterator:
75 case IrOpcode::kJSCreateIterResultObject:
77 case IrOpcode::kJSCreateStringIterator:
79 case IrOpcode::kJSCreateKeyValueArray:
81 case IrOpcode::kJSCreatePromise:
83 case IrOpcode::kJSCreateLiteralArray:
84 case IrOpcode::kJSCreateLiteralObject:
86 case IrOpcode::kJSCreateLiteralRegExp:
88 case IrOpcode::kJSGetTemplateObject:
90 case IrOpcode::kJSCreateEmptyLiteralArray:
92 case IrOpcode::kJSCreateEmptyLiteralObject:
94 case IrOpcode::kJSCreateFunctionContext:
96 case IrOpcode::kJSCreateWithContext:
98 case IrOpcode::kJSCreateCatchContext:
100 case IrOpcode::kJSCreateBlockContext:
102 case IrOpcode::kJSCreateGeneratorObject:
104 case IrOpcode::kJSCreateObject:
106 case IrOpcode::kJSCreateStringWrapper:
115 DCHECK_EQ(IrOpcode::kJSCreate, node->opcode());
127 original_constructor);
135 jsgraph()->EmptyFixedArrayConstant());
137 jsgraph()->EmptyFixedArrayConstant());
141 jsgraph()->UndefinedConstant());
145 a.FinishAndChange(node);
146 return Changed(node);
150 DCHECK_EQ(IrOpcode::kJSCreateArguments, node->opcode());
160 if (frame_state.outer_frame_state()->opcode() != IrOpcode::kFrameState) {
164 if (shared.has_duplicate_parameters())
return NoChange();
168 Node*
const arguments_length =
171 bool has_aliased_arguments =
false;
173 effect, control, context, arguments_length, shared,
174 &has_aliased_arguments);
175 if (elements ==
nullptr)
return NoChange();
179 has_aliased_arguments
185 static_assert(JSSloppyArgumentsObject::kSize == 5 *
kTaggedSize);
186 a.Allocate(JSSloppyArgumentsObject::kSize);
189 jsgraph()->EmptyFixedArrayConstant());
194 a.FinishAndChange(node);
195 return Changed(node);
199 Node*
const arguments_length =
205 shared.internal_formal_parameter_count_without_receiver()),
206 arguments_length, effect);
212 static_assert(JSStrictArgumentsObject::kSize == 4 *
kTaggedSize);
213 a.Allocate(JSStrictArgumentsObject::kSize);
216 jsgraph()->EmptyFixedArrayConstant());
220 a.FinishAndChange(node);
221 return Changed(node);
225 Node*
const arguments_length =
228 shared.internal_formal_parameter_count_without_receiver()));
233 shared.internal_formal_parameter_count_without_receiver()),
234 arguments_length, effect);
240 static_assert(JSArray::kHeaderSize == 4 *
kTaggedSize);
241 a.Allocate(JSArray::kHeaderSize);
244 jsgraph()->EmptyFixedArrayConstant());
248 a.FinishAndChange(node);
249 return Changed(node);
256 DCHECK_EQ(frame_state.outer_frame_state()->opcode(), IrOpcode::kFrameState);
263 if (shared.has_duplicate_parameters())
return NoChange();
267 FrameState args_state = GetArgumentsFrameState(frame_state);
277 bool has_aliased_arguments =
false;
279 effect, control, args_state, context, shared, &has_aliased_arguments);
280 if (elements ==
nullptr)
return NoChange();
281 effect = elements->
op()->EffectOutputCount() > 0 ? elements : effect;
284 has_aliased_arguments
290 static_assert(JSSloppyArgumentsObject::kSize == 5 *
kTaggedSize);
291 a.Allocate(JSSloppyArgumentsObject::kSize);
294 jsgraph()->EmptyFixedArrayConstant());
297 jsgraph()->ConstantNoHole(length));
300 a.FinishAndChange(node);
301 return Changed(node);
310 FrameState args_state = GetArgumentsFrameState(frame_state);
321 if (elements ==
nullptr)
return NoChange();
322 effect = elements->
op()->EffectOutputCount() > 0 ? elements : effect;
328 static_assert(JSStrictArgumentsObject::kSize == 4 *
kTaggedSize);
329 a.Allocate(JSStrictArgumentsObject::kSize);
332 jsgraph()->EmptyFixedArrayConstant());
335 jsgraph()->ConstantNoHole(length));
337 a.FinishAndChange(node);
338 return Changed(node);
342 shared.internal_formal_parameter_count_without_receiver();
349 FrameState args_state = GetArgumentsFrameState(frame_state);
358 Node*
const elements =
360 if (elements ==
nullptr)
return NoChange();
361 effect = elements->
op()->EffectOutputCount() > 0 ? elements : effect;
370 int length = std::max(0, argument_count - start_index);
371 static_assert(JSArray::kHeaderSize == 4 *
kTaggedSize);
375 jsgraph()->EmptyFixedArrayConstant());
378 jsgraph()->ConstantNoHole(length));
380 a.FinishAndChange(node);
381 return Changed(node);
388 DCHECK_EQ(IrOpcode::kJSCreateGeneratorObject, node->opcode());
406 initial_map.instance_type() == JS_ASYNC_GENERATOR_OBJECT_TYPE);
410 DCHECK(shared.HasBytecodeArray());
411 int parameter_count_no_receiver =
412 shared.internal_formal_parameter_count_without_receiver();
413 int length = parameter_count_no_receiver +
414 shared.GetBytecodeArray(
broker()).register_count();
423 jsgraph()->UndefinedConstant());
425 Node* parameters_and_registers = effect = ab.
Finish();
433 jsgraph()->EmptyFixedArrayConstant());
435 jsgraph()->EmptyFixedArrayConstant());
445 parameters_and_registers);
447 if (
initial_map.instance_type() == JS_ASYNC_GENERATOR_OBJECT_TYPE) {
459 a.FinishAndChange(node);
460 return Changed(node);
471 DCHECK_EQ(IrOpcode::kJSCreateArray, node->opcode());
477 OptionalMapRef maybe_initial_map =
479 if (!maybe_initial_map.has_value())
return NoChange();
497 Node* elements = effect =
499 ? simplified()->NewDoubleElements(allocation)
500 :
simplified()->NewSmiOrObjectElements(allocation),
501 length, effect, control);
505 a.Allocate(slack_tracking_prediction.
instance_size(), allocation);
508 jsgraph()->EmptyFixedArrayConstant());
514 jsgraph()->UndefinedConstant());
517 a.FinishAndChange(node);
518 return Changed(node);
527 DCHECK(node->opcode() == IrOpcode::kJSCreateArray ||
528 node->opcode() == IrOpcode::kJSCreateEmptyLiteralArray);
538 OptionalMapRef maybe_initial_map =
540 if (!maybe_initial_map.has_value())
return NoChange();
548 elements =
jsgraph()->EmptyFixedArrayConstant();
556 a.Allocate(slack_tracking_prediction.
instance_size(), allocation);
559 jsgraph()->EmptyFixedArrayConstant());
565 jsgraph()->UndefinedConstant());
568 a.FinishAndChange(node);
569 return Changed(node);
576 DCHECK_EQ(IrOpcode::kJSCreateArray, node->opcode());
583 OptionalMapRef maybe_initial_map =
585 if (!maybe_initial_map.has_value())
return NoChange();
592 for (
auto& value : values) {
599 for (
auto& value : values) {
611 Node* elements = effect =
617 a.Allocate(slack_tracking_prediction.
instance_size(), allocation);
620 jsgraph()->EmptyFixedArrayConstant());
626 jsgraph()->UndefinedConstant());
629 a.FinishAndChange(node);
630 return Changed(node);
634 DCHECK_EQ(IrOpcode::kJSCreateArray, node->opcode());
636 int const arity =
static_cast<int>(p.
arity());
637 OptionalAllocationSiteRef site_ref = p.
site();
648 original_constructor);
652 bool can_inline_call =
false;
657 elements_kind = site_ref->GetElementsKind();
658 can_inline_call = site_ref->CanInlineCall();
665 can_inline_call = array_constructor_protector.
value(
broker()).AsSmi() ==
673 allocation, slack_tracking_prediction);
674 }
else if (arity == 1) {
677 if (!length_type.
Maybe(Type::Number())) {
684 elements_kind, allocation,
685 slack_tracking_prediction);
688 length_type.
Max() <= kElementLoopUnrollLimit &&
689 length_type.
Min() == length_type.
Max()) {
690 int capacity =
static_cast<int>(length_type.
Max());
695 allocation, slack_tracking_prediction);
699 allocation, slack_tracking_prediction);
703 bool values_all_smis =
true, values_all_numbers =
true,
704 values_any_nonnumber =
false;
705 std::vector<Node*> values;
706 values.reserve(p.
arity());
707 for (
int i = 0;
i < arity; ++
i) {
711 values_all_smis =
false;
713 if (!value_type.
Is(Type::Number())) {
714 values_all_numbers =
false;
716 if (!value_type.
Maybe(Type::Number())) {
717 values_any_nonnumber =
true;
719 values.push_back(value);
723 if (values_all_smis) {
725 }
else if (values_all_numbers) {
730 }
else if (values_any_nonnumber) {
734 }
else if (!can_inline_call) {
743 slack_tracking_prediction);
749 DCHECK_EQ(IrOpcode::kJSCreateArrayIterator, node->opcode());
759 Type::OtherObject());
763 jsgraph()->EmptyFixedArrayConstant());
765 jsgraph()->EmptyFixedArrayConstant());
770 jsgraph()->ConstantNoHole(
static_cast<int>(p.
kind())));
772 a.FinishAndChange(node);
773 return Changed(node);
777 DCHECK_EQ(IrOpcode::kJSCreateAsyncFunctionObject, node->opcode());
791 for (
int i = 0;
i < register_count; ++
i) {
793 jsgraph()->UndefinedConstant());
795 Node* parameters_and_registers = effect = ab.
Finish();
799 a.Allocate(JSAsyncFunctionObject::kHeaderSize);
803 jsgraph()->EmptyFixedArrayConstant());
805 jsgraph()->EmptyFixedArrayConstant());
810 jsgraph()->UndefinedConstant());
816 parameters_and_registers);
818 a.FinishAndChange(node);
819 return Changed(node);
828 switch (collection_kind) {
830 switch (iteration_kind) {
840 switch (iteration_kind) {
856 DCHECK_EQ(IrOpcode::kJSCreateCollectionIterator, node->opcode());
866 iterated_object, effect, control);
871 Type::OtherObject());
877 jsgraph()->EmptyFixedArrayConstant());
879 jsgraph()->EmptyFixedArrayConstant());
884 a.FinishAndChange(node);
885 return Changed(node);
889 DCHECK_EQ(IrOpcode::kJSCreateBoundFunction, node->opcode());
892 int const arity =
static_cast<int>(p.
arity());
900 Node* bound_arguments =
jsgraph()->EmptyFixedArrayConstant();
906 for (
int i = 0;
i < arity; ++
i) {
910 bound_arguments = effect = ab.
Finish();
916 Type::BoundFunction());
919 jsgraph()->EmptyFixedArrayConstant());
921 jsgraph()->EmptyFixedArrayConstant());
923 bound_target_function);
927 a.FinishAndChange(node);
928 return Changed(node);
936#ifndef V8_ENABLE_LEAPTIERING
939 Effect effect = n.effect();
941 Node* context = n.context();
954 broker(), shared.function_map_index());
955 DCHECK(!function_map.IsInobjectSlackTrackingInProgress());
956 DCHECK(!function_map.is_dictionary_map());
958#ifdef V8_ENABLE_LEAPTIERING
963 Node* dispatch_handle;
964 if (shared.HasBuiltinId()) {
972 ->builtin_dispatch_handle(shared.builtin_id())
978 AccessBuilder::ForFeedbackCellDispatchHandleNoWriteBarrier()),
979 feedback_cell_node, effect, control);
997 a.Allocate(function_map.instance_size(), allocation,
998 Type::CallableFunction());
1001 jsgraph()->EmptyFixedArrayConstant());
1003 jsgraph()->EmptyFixedArrayConstant());
1007#ifdef V8_ENABLE_LEAPTIERING
1008 a.Store(AccessBuilder::ForJSFunctionDispatchHandleNoWriteBarrier(),
1014 if (function_map.has_prototype_slot()) {
1016 jsgraph()->TheHoleConstant());
1019 for (
int i = 0;
i < function_map.GetInObjectProperties();
i++) {
1021 jsgraph()->UndefinedConstant());
1023 RelaxControls(node);
1024 a.FinishAndChange(node);
1025 return Changed(node);
1029 DCHECK_EQ(IrOpcode::kJSCreateIterResultObject, node->opcode());
1039 a.Allocate(JSIteratorResult::kSize);
1042 jsgraph()->EmptyFixedArrayConstant());
1044 jsgraph()->EmptyFixedArrayConstant());
1047 static_assert(JSIteratorResult::kSize == 5 *
kTaggedSize);
1048 a.FinishAndChange(node);
1049 return Changed(node);
1053 DCHECK_EQ(IrOpcode::kJSCreateStringIterator, node->opcode());
1062 Type::OtherObject());
1065 jsgraph()->EmptyFixedArrayConstant());
1067 jsgraph()->EmptyFixedArrayConstant());
1070 static_assert(JSIteratorResult::kSize == 5 *
kTaggedSize);
1071 a.FinishAndChange(node);
1072 return Changed(node);
1076 DCHECK_EQ(IrOpcode::kJSCreateKeyValueArray, node->opcode());
1090 jsgraph()->OneConstant(), value);
1097 jsgraph()->EmptyFixedArrayConstant());
1100 static_assert(JSArray::kHeaderSize == 4 *
kTaggedSize);
1101 a.FinishAndChange(node);
1102 return Changed(node);
1106 DCHECK_EQ(IrOpcode::kJSCreatePromise, node->opcode());
1116 jsgraph()->EmptyFixedArrayConstant());
1118 jsgraph()->EmptyFixedArrayConstant());
1124 static_assert(JSPromise::kHeaderSize == 5 *
kTaggedSize);
1125 for (
int offset = JSPromise::kHeaderSize;
1130 a.FinishAndChange(node);
1131 return Changed(node);
1135 DCHECK(node->opcode() == IrOpcode::kJSCreateLiteralArray ||
1136 node->opcode() == IrOpcode::kJSCreateLiteralObject);
1139 Effect effect = n.effect();
1140 Control control = n.control();
1143 if (!feedback.IsInsufficient()) {
1145 if (!site.boilerplate(
broker()).has_value())
return NoChange();
1149 effect, control, *site.boilerplate(
broker()), allocation,
1151 if (!maybe_value.has_value())
return NoChange();
1153 Node* value = effect = maybe_value.value();
1154 ReplaceWithValue(node, value, effect, control);
1155 return Replace(value);
1165 if (!feedback.IsInsufficient()) {
1167 DCHECK(!site.PointsToLiteral());
1179 slack_tracking_prediction);
1185 DCHECK_EQ(IrOpcode::kJSCreateEmptyLiteralObject, node->opcode());
1191 DCHECK(!map.is_dictionary_map());
1192 DCHECK(!map.IsInobjectSlackTrackingInProgress());
1196 Node* elements =
jsgraph()->EmptyFixedArrayConstant();
1200 a.Allocate(map.instance_size());
1203 jsgraph()->EmptyFixedArrayConstant());
1205 for (
int i = 0;
i < map.GetInObjectProperties();
i++) {
1207 jsgraph()->UndefinedConstant());
1210 RelaxControls(node);
1211 a.FinishAndChange(node);
1212 return Changed(node);
1218 Effect effect = n.effect();
1219 Control control = n.control();
1222 if (!feedback.IsInsufficient()) {
1224 feedback.AsRegExpLiteral().value();
1226 ReplaceWithValue(node, value, effect, control);
1227 return Replace(value);
1241 if (feedback.IsInsufficient())
return NoChange();
1243 JSArrayRef template_object = feedback.AsTemplateObject().value();
1245 ReplaceWithValue(node, value);
1246 return Replace(value);
1250 DCHECK_EQ(IrOpcode::kJSCreateFunctionContext, node->opcode());
1258 if (slot_count < kFunctionContextAllocationLimit) {
1266 switch (scope_type) {
1268 a.AllocateContext(context_length,
1272 a.AllocateContext(context_length,
1284 RelaxControls(node);
1285 a.FinishAndChange(node);
1286 return Changed(node);
1293 DCHECK_EQ(IrOpcode::kJSCreateWithContext, node->opcode());
1308 RelaxControls(node);
1309 a.FinishAndChange(node);
1310 return Changed(node);
1314 DCHECK_EQ(IrOpcode::kJSCreateCatchContext, node->opcode());
1329 RelaxControls(node);
1330 a.FinishAndChange(node);
1331 return Changed(node);
1335 DCHECK_EQ(IrOpcode::kJSCreateBlockContext, node->opcode());
1340 if (context_length < kBlockContextAllocationLimit) {
1348 a.AllocateContext(context_length,
1356 RelaxControls(node);
1357 a.FinishAndChange(node);
1358 return Changed(node);
1372 return standard_map;
1378 if (prototype.IsJSObject()) {
1379 return prototype.AsJSObject().GetObjectCreateMap(
broker);
1381 return OptionalMapRef();
1387 DCHECK_EQ(IrOpcode::kJSCreateObject, node->opcode());
1395 auto maybe_instance_map = GetObjectCreateMap(
broker(), prototype_const);
1396 if (!maybe_instance_map)
return NoChange();
1397 MapRef instance_map = maybe_instance_map.value();
1399 Node* properties =
jsgraph()->EmptyFixedArrayConstant();
1408 int length = NameDictionary::EntryToIndex(
InternalIndex(capacity));
1409 int size = NameDictionary::SizeFor(length);
1416 jsgraph()->SmiConstant(length));
1423 jsgraph()->SmiConstant(capacity));
1434 static_assert(NameDictionary::kElementsStartIndex ==
1436 for (
int index = NameDictionary::kElementsStartIndex; index <
length;
1441 properties = effect = a.Finish();
1455 jsgraph()->EmptyFixedArrayConstant());
1458 for (
int offset = JSObject::kHeaderSize;
offset < instance_size;
1463 Node* value = effect = a.Finish();
1465 ReplaceWithValue(node, value, effect, control);
1466 return Replace(value);
1470 DCHECK_EQ(IrOpcode::kJSCreateStringWrapper, node->opcode());
1475 DCHECK_EQ(map.instance_size(), JSPrimitiveWrapper::kHeaderSize);
1476 CHECK(!map.IsInobjectSlackTrackingInProgress());
1481 Type::StringWrapper());
1484 jsgraph()->EmptyFixedArrayConstant());
1486 jsgraph()->EmptyFixedArrayConstant());
1488 a.FinishAndChange(node);
1489 return Changed(node);
1498 if (argument_count == 0)
return jsgraph()->EmptyFixedArrayConstant();
1512 for (
int i = 0;
i < argument_count; ++
i, ++parameters_it) {
1515 jsgraph()->ConstantNoHole(
i), parameters_it.node());
1527 int num_elements = std::max(0, argument_count - start_index);
1528 if (num_elements == 0)
return jsgraph()->EmptyFixedArrayConstant();
1533 auto parameters_it =
1543 for (
int i = 0;
i < num_elements; ++
i, ++parameters_it) {
1546 jsgraph()->ConstantNoHole(
i), parameters_it.node());
1559 if (argument_count == 0)
return jsgraph()->EmptyFixedArrayConstant();
1564 shared.internal_formal_parameter_count_without_receiver();
1571 *has_aliased_arguments =
true;
1573 MapRef sloppy_arguments_elements_map =
1574 broker()->sloppy_arguments_elements_map();
1578 sloppy_arguments_elements_map)) {
1590 auto parameters_it =
1597 for (
int i = 0;
i < mapped_count; ++
i) {
1601 for (
int i = mapped_count;
i < argument_count; ++
i, ++parameters_it) {
1604 jsgraph()->ConstantNoHole(
i), parameters_it.node());
1610 a.AllocateSloppyArgumentElements(mapped_count, sloppy_arguments_elements_map);
1613 for (
int i = 0;
i < mapped_count; ++
i) {
1631 shared.internal_formal_parameter_count_without_receiver();
1636 arguments_length, effect);
1640 MapRef sloppy_arguments_elements_map =
1641 broker()->sloppy_arguments_elements_map();
1646 sloppy_arguments_elements_map)) {
1655 *has_aliased_arguments =
true;
1660 Node* arguments = effect =
1663 arguments_length, effect);
1667 a.AllocateSloppyArgumentElements(mapped_count, sloppy_arguments_elements_map);
1670 for (
int i = 0;
i < mapped_count; ++
i) {
1675 jsgraph()->ConstantNoHole(
i), arguments_length),
1678 jsgraph()->ConstantNoHole(
i), value);
1691 ?
factory()->fixed_double_array_map()
1692 :
factory()->fixed_array_map();
1700 a.AllocateArray(capacity,
MakeRef(
broker(), elements_map), allocation);
1701 for (
int i = 0;
i < capacity; ++
i) {
1703 a.Store(access, index, value);
1710 std::vector<Node*>
const& values,
1712 int const capacity =
static_cast<int>(values.size());
1717 ?
factory()->fixed_double_array_map()
1718 :
factory()->fixed_array_map();
1725 a.AllocateArray(capacity,
MakeRef(
broker(), elements_map), allocation);
1726 for (
int i = 0;
i < capacity; ++
i) {
1728 a.Store(access, index, values[
i]);
1739 if (max_depth == 0)
return {};
1752 OptionalMapRef current_boilerplate_map =
1754 if (!current_boilerplate_map.has_value() ||
1755 !current_boilerplate_map->equals(boilerplate_map)) {
1768 boilerplate.
map(
broker()).is_dictionary_map() ||
1774 bool const empty = properties.IsSmi() ||
1775 properties.equals(
broker()->empty_fixed_array()) ||
1776 properties.equals(
broker()->empty_property_array());
1777 if (!empty)
return {};
1789 if ((*max_properties)-- == 0)
return {};
1802 "TryAllocateFastLiteral",
1809 OptionalObjectRef maybe_boilerplate_value =
1811 if (!maybe_boilerplate_value.has_value())
return {};
1818 ObjectRef boilerplate_value = maybe_boilerplate_value.value();
1828 ObjectRef uninitialized_marker =
broker()->uninitialized_value();
1829 if (boilerplate_value.equals(uninitialized_marker) ||
1830 (boilerplate_value.IsHeapNumber() &&
1831 boilerplate_value.AsHeapNumber().value_as_bits() ==
kHoleNanInt64)) {
1836 if (boilerplate_value.IsJSObject()) {
1837 JSObjectRef boilerplate_object = boilerplate_value.AsJSObject();
1838 std::optional<Node*> maybe_value =
1840 allocation, max_depth - 1, max_properties);
1841 if (!maybe_value.has_value())
return {};
1842 value = effect = maybe_value.value();
1844 double number = boilerplate_value.AsHeapNumber().value();
1850 jsgraph()->ConstantMaybeHole(number));
1851 value = effect = builder.
Finish();
1857 !boilerplate_value.IsSmi(),
1858 boilerplate_value.equals(uninitialized_marker));
1861 inobject_fields.
push_back(std::make_pair(access, value));
1866 for (
int index =
static_cast<int>(inobject_fields.
size());
1867 index < boilerplate_length; ++index) {
1875 inobject_fields.
push_back(std::make_pair(access, value));
1880 effect, control, boilerplate, allocation, max_depth, max_properties);
1881 if (!maybe_elements.has_value())
return {};
1882 Node* elements = maybe_elements.value();
1883 if (elements->
op()->EffectOutputCount() > 0) effect = elements;
1891 jsgraph()->EmptyFixedArrayConstant());
1893 if (boilerplate.IsJSArray()) {
1894 JSArrayRef boilerplate_array = boilerplate.AsJSArray();
1896 boilerplate_array.
map(
broker()).elements_kind()),
1899 for (
auto const& inobject_field : inobject_fields) {
1900 builder.
Store(inobject_field.first, inobject_field.second);
1911 OptionalFixedArrayBaseRef maybe_boilerplate_elements =
1913 if (!maybe_boilerplate_elements.has_value())
return {};
1918 boilerplate, JSObject::kElementsOffset, boilerplate_elements);
1921 const uint32_t elements_length = boilerplate_elements.
length();
1927 if (boilerplate_elements.
length() == 0 ||
1938 if (boilerplate_elements.IsFixedDoubleArray()) {
1939 uint32_t
const size =
1944 for (uint32_t
i = 0;
i < elements_length; ++
i) {
1946 elements_values[
i] = value.is_hole_nan()
1947 ?
jsgraph()->TheHoleConstant()
1951 FixedArrayRef elements = boilerplate_elements.AsFixedArray();
1952 for (uint32_t
i = 0;
i < elements_length; ++
i) {
1953 if ((*max_properties)-- == 0)
return {};
1954 OptionalObjectRef element_value = elements.
TryGet(
broker(),
i);
1955 if (!element_value.has_value())
return {};
1956 if (element_value->IsJSObject()) {
1957 std::optional<Node*>
object =
1959 allocation, max_depth - 1, max_properties);
1960 if (!
object.has_value())
return {};
1961 elements_values[
i] = effect = *object;
1963 elements_values[
i] =
1972 ab.
AllocateArray(elements_length, elements_map, allocation);
1973 ElementAccess const access = boilerplate_elements.IsFixedDoubleArray()
1976 for (uint32_t
i = 0;
i < elements_length; ++
i) {
1977 ab.
Store(access,
jsgraph()->ConstantNoHole(
i), elements_values[
i]);
1988 static_assert(JSRegExp::kDataOffset == JSObject::kHeaderSize);
1989 static_assert(JSRegExp::kSourceOffset == JSRegExp::kDataOffset +
kTaggedSize);
1990 static_assert(JSRegExp::kFlagsOffset ==
1992 static_assert(JSRegExp::kHeaderSize == JSRegExp::kFlagsOffset +
kTaggedSize);
2001 jsgraph()->EmptyFixedArrayConstant());
2003 jsgraph()->EmptyFixedArrayConstant());
@ MIN_CONTEXT_EXTENDED_SLOTS
static FieldIndex ForDetails(Tagged< Map > map, PropertyDetails details)
static constexpr int kMapOffset
v8::internal::Factory * factory()
static const int kInitialMaxFastElementArray
static const int kPreallocatedArrayElements
static constexpr int kSizeWithPrototype
static constexpr int kSizeWithoutPrototype
static const int kGeneratorExecuting
static const int kSizeWithEmbedderFields
static constexpr int Size()
static constexpr int kLastIndexOffset
static constexpr int kInitialLastIndexValue
static constexpr MachineType AnyTagged()
static constexpr int kFlagsDefault
static const int kFlagsIndex
static const int kInitialCapacity
static constexpr int SizeFor(int length)
static const int kNoHashSentinel
PropertyLocation location() const
Representation representation() const
static const int kInitialIndex
PropertyKind kind() const
static const int kProtectorValid
constexpr bool IsSmi() const
constexpr bool IsDouble() const
void reserve(size_t new_cap)
void push_back(const T &value)
static ElementAccess ForFixedArrayElement()
static ElementAccess ForSloppyArgumentsElementsMappedEntry()
static FieldAccess ForJSCollectionIteratorTable()
static FieldAccess ForMap(WriteBarrierKind write_barrier=kMapWriteBarrier)
static FieldAccess ForHeapNumberValue()
static FieldAccess ForJSCollectionTable()
static FieldAccess ForJSBoundFunctionBoundTargetFunction()
static FieldAccess ForJSStringIteratorString()
static FieldAccess ForArgumentsLength()
static FieldAccess ForJSBoundFunctionBoundArguments()
static FieldAccess ForJSObjectOffset(int offset, WriteBarrierKind write_barrier_kind=kFullWriteBarrier)
static FieldAccess ForSloppyArgumentsElementsArguments()
static FieldAccess ForFixedArraySlot(size_t index, WriteBarrierKind write_barrier_kind=kFullWriteBarrier)
static FieldAccess ForJSArrayIteratorNextIndex()
static FieldAccess ForJSObjectPropertiesOrHashKnownPointer()
static FieldAccess ForJSArrayIteratorIteratedObject()
static FieldAccess ForJSStringIteratorIndex()
static FieldAccess ForHashTableBaseNumberOfElements()
static FieldAccess ForJSBoundFunctionBoundThis()
static FieldAccess ForJSCollectionIteratorIndex()
static FieldAccess ForJSObjectInObjectProperty(MapRef map, int index, MachineType machine_type=MachineType::AnyTagged())
static FieldAccess ForJSGeneratorObjectContext()
static FieldAccess ForFixedArrayLength()
static FieldAccess ForHashTableBaseCapacity()
static FieldAccess ForJSFunctionSharedFunctionInfo()
static FieldAccess ForJSGeneratorObjectInputOrDebugPos()
static FieldAccess ForArgumentsCallee()
static FieldAccess ForJSArrayLength(ElementsKind elements_kind)
static FieldAccess ForJSIteratorResultValue()
static FieldAccess ForJSPrimitiveWrapperValue()
static FieldAccess ForJSAsyncFunctionObjectPromise()
static FieldAccess ForContextSlot(size_t index)
static FieldAccess ForJSFunctionContext()
static FieldAccess ForJSObjectPropertiesOrHash()
static FieldAccess ForJSFunctionFeedbackCell()
static FieldAccess ForJSIteratorResultDone()
static ElementAccess ForFixedDoubleArrayElement()
static FieldAccess ForJSRegExpLastIndex()
static FieldAccess ForJSGeneratorObjectReceiver()
static FieldAccess ForHashTableBaseNumberOfDeletedElement()
static FieldAccess ForNameDictionaryFlagsIndex()
static FieldAccess ForJSRegExpData()
static FieldAccess ForJSArrayIteratorKind()
static FieldAccess ForJSGeneratorObjectFunction()
static FieldAccess ForDictionaryNextEnumerationIndex()
static FieldAccess ForJSGeneratorObjectResumeMode()
static FieldAccess ForSloppyArgumentsElementsContext()
static FieldAccess ForJSAsyncGeneratorObjectQueue()
static FieldAccess ForJSAsyncGeneratorObjectIsAwaiting()
static FieldAccess ForJSGeneratorObjectContinuation()
static FieldAccess ForJSRegExpFlags()
static FieldAccess ForJSFunctionPrototypeOrInitialMap()
static FieldAccess ForJSFunctionCode()
static FieldAccess ForDictionaryObjectHashIndex()
static FieldAccess ForJSRegExpSource()
static FieldAccess ForJSObjectElements()
static FieldAccess ForJSGeneratorObjectParametersAndRegisters()
void AllocateArray(int length, MapRef map, AllocationType allocation=AllocationType::kYoung)
void Allocate(int size, AllocationType allocation=AllocationType::kYoung, Type type=Type::Any())
bool CanAllocateArray(int length, MapRef map, AllocationType allocation=AllocationType::kYoung)
bool CanAllocateSloppyArgumentElements(int length, MapRef map, AllocationType allocation=AllocationType::kYoung)
void Store(const FieldAccess &access, Node *value)
void DependOnElementsKind(AllocationSiteRef site)
void DependOnElementsKinds(AllocationSiteRef site)
SlackTrackingPrediction DependOnInitialMapInstanceSizePrediction(JSFunctionRef function)
void DependOnObjectSlotValue(HeapObjectRef object, int offset, ObjectRef value)
AllocationType DependOnPretenureMode(AllocationSiteRef site)
IterationKind kind() const
OptionalAllocationSiteRef site() const
SharedFunctionInfoRef shared_info() const
IterationKind iteration_kind() const
CollectionKind collection_kind() const
ScopeType scope_type() const
ScopeInfoRef scope_info() const
FeedbackSource const & feedback() const
IndirectHandle< FeedbackCell > object() const
FeedbackSource const & feedback() const
OptionalObjectRef TryGet(JSHeapBroker *broker, int i) const
Float64 GetFromImmutableFixedDoubleArray(int i) const
MaybeIndirectHandle< SharedFunctionInfo > shared_info() const
uint16_t parameter_count() const
const FrameStateInfo & frame_state_info() const
Node * parameters() const
FeedbackSource const & feedback() const
OptionalMapRef map_direct_read(JSHeapBroker *broker) const
V8_EXPORT_PRIVATE MapRef map(JSHeapBroker *broker) const
ObjectRef GetBoilerplateLength(JSHeapBroker *broker) const
Node * TryAllocateArguments(Node *effect, Node *control, FrameState frame_state)
Reduction ReduceJSCreateArguments(Node *node)
Node * AllocateLiteralRegExp(Node *effect, Node *control, RegExpBoilerplateDescriptionRef boilerplate)
Reduction ReduceNewArray(Node *node, Node *length, MapRef initial_map, ElementsKind elements_kind, AllocationType allocation, const SlackTrackingPrediction &slack_tracking_prediction)
Reduction ReduceJSCreatePromise(Node *node)
Reduction ReduceJSCreateWithContext(Node *node)
Reduction ReduceJSCreateCollectionIterator(Node *node)
Reduction ReduceJSCreateStringWrapper(Node *node)
Reduction ReduceJSCreateGeneratorObject(Node *node)
std::optional< Node * > TryAllocateFastLiteralElements(Node *effect, Node *control, JSObjectRef boilerplate, AllocationType allocation, int max_depth, int *max_properties)
Reduction ReduceJSCreateEmptyLiteralObject(Node *node)
Reduction ReduceJSCreateLiteralArrayOrObject(Node *node)
CommonOperatorBuilder * common() const
Reduction ReduceJSCreateKeyValueArray(Node *node)
Reduction Reduce(Node *node) final
Factory * factory() const
JSGraph * jsgraph() const
Reduction ReduceJSCreateBoundFunction(Node *node)
Node * TryAllocateRestArguments(Node *effect, Node *control, FrameState frame_state, int start_index)
SimplifiedOperatorBuilder * simplified() const
CompilationDependencies * dependencies() const
Reduction ReduceJSCreate(Node *node)
Reduction ReduceJSCreateFunctionContext(Node *node)
Reduction ReduceJSCreateArrayIterator(Node *node)
Reduction ReduceJSCreateEmptyLiteralArray(Node *node)
Reduction ReduceJSCreateAsyncFunctionObject(Node *node)
Reduction ReduceJSCreateStringIterator(Node *node)
NativeContextRef native_context() const
Node * TryAllocateAliasedArguments(Node *effect, Node *control, FrameState frame_state, Node *context, SharedFunctionInfoRef shared, bool *has_aliased_arguments)
Reduction ReduceJSCreateBlockContext(Node *node)
std::optional< Node * > TryAllocateFastLiteral(Node *effect, Node *control, JSObjectRef boilerplate, AllocationType allocation, int max_depth, int *max_properties)
Node * AllocateElements(Node *effect, Node *control, ElementsKind elements_kind, int capacity, AllocationType allocation)
Reduction ReduceJSCreateIterResultObject(Node *node)
Reduction ReduceJSGetTemplateObject(Node *node)
Reduction ReduceJSCreateArray(Node *node)
Reduction ReduceJSCreateObject(Node *node)
Reduction ReduceJSCreateLiteralRegExp(Node *node)
Reduction ReduceJSCreateCatchContext(Node *node)
JSHeapBroker * broker() const
Reduction ReduceJSCreateClosure(Node *node)
SharedFunctionInfoRef shared(JSHeapBroker *broker) const
bool has_initial_map(JSHeapBroker *broker) const
MapRef initial_map(JSHeapBroker *broker) const
Node * ConstantMaybeHole(ObjectRef ref, JSHeapBroker *broker)
SimplifiedOperatorBuilder * simplified() const
Node * HeapConstantNoHole(Handle< HeapObject > value)
Isolate * isolate() const
Node * ConstantNoHole(ObjectRef ref, JSHeapBroker *broker)
Node * SmiConstant(int32_t immediate)
CompilationDependencies * dependencies() const
ProcessedFeedback const & GetFeedbackForArrayOrObjectLiteral(FeedbackSource const &source)
NativeContextRef target_native_context() const
ProcessedFeedback const & GetFeedbackForTemplateObject(FeedbackSource const &source)
ProcessedFeedback const & GetFeedbackForRegExpLiteral(FeedbackSource const &source)
OptionalFixedArrayBaseRef elements(JSHeapBroker *broker, RelaxedLoadTag) const
OptionalObjectRef RawInobjectPropertyAt(JSHeapBroker *broker, FieldIndex index) const
OptionalObjectRef raw_properties_or_hash(JSHeapBroker *broker) const
bool IsElementsTenured(FixedArrayBaseRef elements)
CommonOperatorBuilder * common() const
NameRef GetPropertyKey(JSHeapBroker *broker, InternalIndex descriptor_index) const
PropertyDetails GetPropertyDetails(JSHeapBroker *broker, InternalIndex descriptor_index) const
IndirectHandle< Map > object() const
bool is_deprecated() const
bool IsFixedCowArrayMap(JSHeapBroker *broker) const
HeapObjectRef prototype(JSHeapBroker *broker) const
int instance_size() const
int NumberOfOwnDescriptors() const
bool is_dictionary_map() const
bool IsInobjectSlackTrackingInProgress() const
int GetInObjectProperties() const
IndirectHandle< Name > object() const
MapRef GetFunctionMapFromIndex(JSHeapBroker *broker, int index) const
MapRef GetInitialJSArrayMap(JSHeapBroker *broker, ElementsKind kind) const
static Type GetType(const Node *node)
static OptionalMapRef GetJSCreateMap(JSHeapBroker *broker, Node *receiver)
static Node * GetEffectInput(Node *node, int index=0)
static Node * GetContextInput(Node *node)
static Node * GetFrameStateInput(Node *node)
static Node * GetValueInput(Node *node, int index)
static Node * GetControlInput(Node *node, int index=0)
constexpr IrOpcode::Value opcode() const
const Operator * op() const
void CacheAsProtector(JSHeapBroker *broker) const
ObjectRef value(JSHeapBroker *broker) const
StringRef source(JSHeapBroker *broker) const
HeapObjectRef data(JSHeapBroker *broker) const
int ContextLength() const
int inobject_property_count() const
int instance_size() const
iterator begin_without_receiver_and_skip(int n_skips)
iterator begin_without_receiver() const
Node * NewNode(const Operator *op, int input_count, Node *const *inputs, bool incomplete=false)
static Type UnsignedSmall()
bool Maybe(Type that) const
bool IsHeapConstant() const
const HeapConstantType * AsHeapConstant() const
static Type For(MapRef type, JSHeapBroker *broker)
static Type SignedSmall()
#define V8_MAP_PACKING_BOOL
#define ALIGN_TO_ALLOCATION_ALIGNMENT(value)
DirectHandle< Object > new_target
std::optional< TNode< JSArray > > a
FunctionLiteral * literal
constexpr bool IsPowerOfTwo(T value)
const CreateArrayIteratorParameters & CreateArrayIteratorParametersOf(const Operator *op)
const int kMaxFastLiteralDepth
const CreateBoundFunctionParameters & CreateBoundFunctionParametersOf(const Operator *op)
const int kMaxFastLiteralProperties
ScopeInfoRef ScopeInfoOf(const Operator *op)
const CreateCollectionIteratorParameters & CreateCollectionIteratorParametersOf(const Operator *op)
CreateFunctionContextParameters const & CreateFunctionContextParametersOf(Operator const *op)
const CreateArrayParameters & CreateArrayParametersOf(const Operator *op)
CreateArgumentsType const & CreateArgumentsTypeOf(const Operator *op)
int RegisterCountOf(Operator const *op)
ref_traits< T >::ref_type MakeRef(JSHeapBroker *broker, Tagged< T > object)
HeapObjectMatcherImpl< IrOpcode::kHeapConstant > HeapObjectMatcher
constexpr int kTaggedSize
constexpr int kMaxRegularHeapObjectSize
constexpr bool IsHoleyElementsKind(ElementsKind kind)
bool IsClassConstructor(FunctionKind kind)
bool Is(IndirectHandle< U > value)
constexpr bool IsSmiElementsKind(ElementsKind kind)
constexpr uint64_t kHoleNanInt64
constexpr JSDispatchHandle kNullJSDispatchHandle(0)
ElementsKind GetHoleyElementsKind(ElementsKind packed_kind)
DONT_OVERRIDE DISABLE_ALLOCATION_SITES HOLEY_ELEMENTS
bool IsFastElementsKind(ElementsKind kind)
DONT_OVERRIDE DISABLE_ALLOCATION_SITES DISABLE_ALLOCATION_SITES HOLEY_DOUBLE_ELEMENTS
constexpr bool IsDoubleElementsKind(ElementsKind kind)
ElementsKind GetMoreGeneralElementsKind(ElementsKind from_kind, ElementsKind to_kind)
!IsContextMap !IsContextMap native_context
static constexpr RelaxedLoadTag kRelaxedLoad
#define DCHECK_LE(v1, v2)
#define DCHECK_NOT_NULL(val)
#define DCHECK_IMPLIES(v1, v2)
#define DCHECK_GE(v1, v2)
#define DCHECK(condition)
#define DCHECK_EQ(v1, v2)
#define DCHECK_GT(v1, v2)
static ConstFieldInfo None()