39 int const argc =
args.length() - 3;
50 Factory* factory = isolate->factory();
61 bool can_use_type_feedback = !site.is_null();
62 bool can_inline_array_constructor =
true;
65 if (
IsSmi(*argument_one)) {
66 int value =
Cast<Smi>(*argument_one).value();
70 can_use_type_feedback =
false;
71 }
else if (value != 0) {
74 can_inline_array_constructor =
false;
79 can_use_type_feedback =
false;
88 ElementsKind to_kind = can_use_type_feedback ? site->GetElementsKind()
89 : initial_map->elements_kind();
93 if (!site.is_null()) site->SetElementsKind(to_kind);
105 allocation_site = site;
117 if (!site.is_null()) {
118 if ((old_kind != array->GetElementsKind() || !can_use_type_feedback ||
119 !can_inline_array_constructor)) {
123 site->SetDoNotInlineCall();
126 if (old_kind != array->GetElementsKind() || !can_inline_array_constructor) {
132 if (Protectors::IsArrayConstructorIntact(isolate)) {
133 Protectors::InvalidateArrayConstructor(isolate);
145 CHECK(!array->HasTypedArrayOrRabGsabTypedArrayElements());
146 CHECK(!IsJSGlobalProxy(*array));
164 index =
static_cast<uint32_t
>(
value);
171 index =
static_cast<uint32_t
>(
value);
174 uint32_t capacity =
static_cast<uint32_t
>(
object->elements()->
length());
176 if (index >= capacity) {
180 object->GetElementsAccessor()->GrowCapacity(
object, index));
186 return object->elements();
196 return isolate->heap()->ToBoolean(
result.FromJust());
203 return isolate->heap()->ToBoolean(IsJSArray(obj));
230 if (object->map()->instance_type() == JS_ARRAY_TYPE) {
242 isolate->factory()->length_string()));
256 if (!IsUndefined(*from_index, isolate)) {
261 if (start_from >= len)
return ReadOnlyRoots(isolate).false_value();
262 if (
V8_LIKELY(std::isfinite(start_from))) {
263 if (start_from < 0) {
264 index =
static_cast<int64_t
>(std::max<double>(start_from + len, 0));
281 elements->
IncludesValue(isolate, obj, search_element, index, len);
283 return *isolate->factory()->ToBoolean(
result.FromJust());
287 for (; index < len; ++
index) {
322 if (IsJSArray(*
object)) {
334 isolate->factory()->length_string()));
354 static_cast<double>(std::numeric_limits<int64_t>::min()))) {
355 DCHECK(fp <
static_cast<double>(std::numeric_limits<int64_t>::max()));
356 start_from =
static_cast<int64_t
>(fp);
358 start_from = std::numeric_limits<int64_t>::min();
363 if (start_from >= 0) {
366 index = len + start_from;
379 static_cast<uint32_t
>(index),
380 static_cast<uint32_t
>(len));
382 return *isolate->factory()->NewNumberFromInt64(
result.FromJust());
386 for (; index < len; ++
index) {
399 return *isolate->factory()->NewNumberFromInt64(index);
V8_INLINE T FromJust() const &
static bool ShouldTrack(ElementsKind boilerplate_elements_kind)
V8_INLINE int length() const
V8_INLINE Handle< S > at(int index) const
static ElementsAccessor * ForKind(ElementsKind elements_kind)
virtual Maybe< bool > IncludesValue(Isolate *isolate, DirectHandle< JSObject > receiver, DirectHandle< Object > value, size_t start, size_t length)=0
virtual void TransitionElementsKind(DirectHandle< JSObject > object, DirectHandle< Map > map)=0
virtual Maybe< int64_t > IndexOfValue(Isolate *isolate, DirectHandle< JSObject > receiver, DirectHandle< Object > value, size_t start, size_t length)=0
void NewJSArrayStorage(DirectHandle< JSArray > array, int length, int capacity, ArrayStorageAllocationMode mode=ArrayStorageAllocationMode::DONT_INITIALIZE_ARRAY_ELEMENTS)
Handle< JSObject > NewJSObjectFromMap(DirectHandle< Map > map, AllocationType allocation=AllocationType::kYoung, DirectHandle< AllocationSite > allocation_site=DirectHandle< AllocationSite >::null(), NewJSObjectType=NewJSObjectType::kNoAPIWrapper)
bool SetLengthWouldNormalize(uint32_t new_length)
static const int kInitialMaxFastElementArray
static V8_EXPORT_PRIVATE V8_WARN_UNUSED_RESULT MaybeHandle< Map > GetDerivedMap(Isolate *isolate, DirectHandle< JSFunction > constructor, DirectHandle< JSReceiver > new_target)
static V8_EXPORT_PRIVATE DirectHandle< NumberDictionary > NormalizeElements(DirectHandle< JSObject > object)
static bool PrototypeHasNoElements(Isolate *isolate, Tagged< JSObject > object)
static V8_EXPORT_PRIVATE void TransitionElementsKind(DirectHandle< JSObject > object, ElementsKind to_kind)
static constexpr uint32_t kMaxElementCount
V8_EXPORT_PRIVATE static V8_WARN_UNUSED_RESULT Maybe< bool > HasProperty(LookupIterator *it)
static V8_EXPORT_PRIVATE Handle< Map > AsElementsKind(Isolate *isolate, DirectHandle< Map > map, ElementsKind kind)
static V8_WARN_UNUSED_RESULT MaybeHandle< Object > ToLength(Isolate *isolate, DirectHandle< Object > input)
static bool ToArrayLength(Tagged< Object > obj, uint32_t *index)
static bool SameValueZero(Tagged< Object > obj, Tagged< Object > other)
static V8_WARN_UNUSED_RESULT HandleType< JSReceiver >::MaybeType ToObject(Isolate *isolate, HandleType< T > object, const char *method_name=nullptr)
static double NumberValue(Tagged< Number > obj)
static V8_WARN_UNUSED_RESULT Maybe< double > IntegerValue(Isolate *isolate, HandleType< T > input)
static V8_EXPORT_PRIVATE bool StrictEquals(Tagged< Object > obj, Tagged< Object > that)
V8_EXPORT_PRIVATE static V8_WARN_UNUSED_RESULT MaybeHandle< Object > GetProperty(LookupIterator *it, bool is_global_reference=false)
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< Object > ArraySpeciesConstructor(Isolate *isolate, DirectHandle< JSAny > original_array)
static constexpr int ToInt(const Tagged< Object > object)
static constexpr Tagged< Smi > FromInt(int value)
static constexpr Tagged< Smi > zero()
#define RUNTIME_FUNCTION(Name)
#define ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, dst, call)
#define RETURN_FAILURE_ON_EXCEPTION(isolate, 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
DirectHandle< Object > new_target
ZoneVector< RpoNumber > & result
constexpr bool IsHoleyElementsKind(ElementsKind kind)
MaybeDirectHandle< Object > ArrayConstructInitializeElements(DirectHandle< JSArray > array, JavaScriptArguments *args)
V8_INLINE constexpr bool IsSmi(TaggedImpl< kRefType, StorageType > obj)
bool IsSpecialReceiverMap(Tagged< Map > map)
ElementsKind GetHoleyElementsKind(ElementsKind packed_kind)
bool IsFastElementsKind(ElementsKind kind)
constexpr uint32_t kMaxUInt32
@ DONT_INITIALIZE_ARRAY_ELEMENTS
Tagged< To > Cast(Tagged< From > value, const v8::SourceLocation &loc=INIT_SOURCE_LOCATION_IN_DEBUG)
#define DCHECK_LE(v1, v2)
#define DCHECK_GE(v1, v2)
#define DCHECK(condition)
#define DCHECK_EQ(v1, v2)
#define V8_LIKELY(condition)