14514f5e3Sopenharmony_ci/*
24514f5e3Sopenharmony_ci * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
34514f5e3Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
44514f5e3Sopenharmony_ci * you may not use this file except in compliance with the License.
54514f5e3Sopenharmony_ci * You may obtain a copy of the License at
64514f5e3Sopenharmony_ci *
74514f5e3Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
84514f5e3Sopenharmony_ci *
94514f5e3Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
104514f5e3Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
114514f5e3Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
124514f5e3Sopenharmony_ci * See the License for the specific language governing permissions and
134514f5e3Sopenharmony_ci * limitations under the License.
144514f5e3Sopenharmony_ci */
154514f5e3Sopenharmony_ci
164514f5e3Sopenharmony_ci#ifndef ECMASCRIPT_BUILTINS_BUILTINS_ARRAY_H
174514f5e3Sopenharmony_ci#define ECMASCRIPT_BUILTINS_BUILTINS_ARRAY_H
184514f5e3Sopenharmony_ci
194514f5e3Sopenharmony_ci#include "ecmascript/base/builtins_base.h"
204514f5e3Sopenharmony_ci
214514f5e3Sopenharmony_ci// List of functions in Array, excluding the '@@' properties.
224514f5e3Sopenharmony_ci// V(name, func, length, stubIndex)
234514f5e3Sopenharmony_ci// where BuiltinsArray::func refers to the native implementation of Array[name].
244514f5e3Sopenharmony_ci//       kungfu::BuiltinsStubCSigns::stubIndex refers to the builtin stub index, or INVALID if no stub available.
254514f5e3Sopenharmony_ci#define BUILTIN_ARRAY_FUNCTIONS(V)                          \
264514f5e3Sopenharmony_ci    /* Array.from ( items [ , mapfn [ , thisArg ] ] ) */    \
274514f5e3Sopenharmony_ci    V("from",    From,    1, ArrayFrom)                     \
284514f5e3Sopenharmony_ci    /* Array.isArray ( arg ) */                             \
294514f5e3Sopenharmony_ci    V("isArray", IsArray, 1, ArrayIsArray)                  \
304514f5e3Sopenharmony_ci    /* Array.of ( ...items ) */                             \
314514f5e3Sopenharmony_ci    V("of",      Of,      0, INVALID)
324514f5e3Sopenharmony_ci
334514f5e3Sopenharmony_ci// List of functions in Array.prototype, excluding the constructor and '@@' properties.
344514f5e3Sopenharmony_ci// V(name, func, length, stubIndex)
354514f5e3Sopenharmony_ci// where BuiltinsArray::func refers to the native implementation of Array.prototype[name].
364514f5e3Sopenharmony_ci#define BUILTIN_ARRAY_PROTOTYPE_FUNCTIONS(V)                                \
374514f5e3Sopenharmony_ci    /* Array.prototype.at ( index ) */                                      \
384514f5e3Sopenharmony_ci    V("at",             At,               1, INVALID)                       \
394514f5e3Sopenharmony_ci    /* Array.prototype.concat ( ...items ) */                               \
404514f5e3Sopenharmony_ci    V("concat",         Concat,           1, ArrayConcat)                   \
414514f5e3Sopenharmony_ci    /* Array.prototype.copyWithin ( target, start [ , end ] ) */            \
424514f5e3Sopenharmony_ci    V("copyWithin",     CopyWithin,       2, ArrayCopyWithin)               \
434514f5e3Sopenharmony_ci    /* Array.prototype.entries ( ) */                                       \
444514f5e3Sopenharmony_ci    V("entries",        Entries,          0, ArrayEntries)                  \
454514f5e3Sopenharmony_ci    /* Array.prototype.every ( callbackfn [ , thisArg ] ) */                \
464514f5e3Sopenharmony_ci    V("every",          Every,            1, ArrayEvery)                    \
474514f5e3Sopenharmony_ci    /* Array.prototype.fill ( value [ , start [ , end ] ] ) */              \
484514f5e3Sopenharmony_ci    V("fill",           Fill,             1, ArrayFill)                     \
494514f5e3Sopenharmony_ci    /* Array.prototype.filter ( callbackfn [ , thisArg ] ) */               \
504514f5e3Sopenharmony_ci    V("filter",         Filter,           1, ArrayFilter)                   \
514514f5e3Sopenharmony_ci    /* Array.prototype.find ( predicate [ , thisArg ] ) */                  \
524514f5e3Sopenharmony_ci    V("find",           Find,             1, ArrayFind)                     \
534514f5e3Sopenharmony_ci    /* Array.prototype.findIndex ( predicate [ , thisArg ] ) */             \
544514f5e3Sopenharmony_ci    V("findIndex",      FindIndex,        1, ArrayFindIndex)                \
554514f5e3Sopenharmony_ci    /* Array.prototype.findLast ( predicate [ , thisArg ] ) */              \
564514f5e3Sopenharmony_ci    V("findLast",       FindLast,         1, ArrayFindLast)                 \
574514f5e3Sopenharmony_ci    /* Array.prototype.findLastIndex ( predicate [ , thisArg ] ) */         \
584514f5e3Sopenharmony_ci    V("findLastIndex",  FindLastIndex,    1, ArrayFindLastIndex)            \
594514f5e3Sopenharmony_ci    /* Array.prototype.flat ( [ depth ] ) */                                \
604514f5e3Sopenharmony_ci    V("flat",           Flat,             0, INVALID)                       \
614514f5e3Sopenharmony_ci    /* Array.prototype.flatMap ( mapperFunction [ , thisArg ] ) */          \
624514f5e3Sopenharmony_ci    V("flatMap",        FlatMap,          1, ArrayFlatMap)                  \
634514f5e3Sopenharmony_ci    /* Array.prototype.forEach ( callbackfn [ , thisArg ] ) */              \
644514f5e3Sopenharmony_ci    V("forEach",        ForEach,          1, ArrayForEach)                  \
654514f5e3Sopenharmony_ci    /* Array.prototype.includes ( searchElement [ , fromIndex ] ) */        \
664514f5e3Sopenharmony_ci    V("includes",       Includes,         1, ArrayIncludes)                 \
674514f5e3Sopenharmony_ci    /* Array.prototype.indexOf ( searchElement [ , fromIndex ] ) */         \
684514f5e3Sopenharmony_ci    V("indexOf",        IndexOf,          1, ArrayIndexOf)                  \
694514f5e3Sopenharmony_ci    /* Array.prototype.join ( separator ) */                                \
704514f5e3Sopenharmony_ci    V("join",           Join,             1, INVALID)                       \
714514f5e3Sopenharmony_ci    /* Array.prototype.keys ( ) */                                          \
724514f5e3Sopenharmony_ci    V("keys",           Keys,             0, ArrayKeys)                     \
734514f5e3Sopenharmony_ci    /* Array.prototype.lastIndexOf ( searchElement [ , fromIndex ] ) */     \
744514f5e3Sopenharmony_ci    V("lastIndexOf",    LastIndexOf,      1, ArrayLastIndexOf)              \
754514f5e3Sopenharmony_ci    /* Array.prototype.map ( callbackfn [ , thisArg ] ) */                  \
764514f5e3Sopenharmony_ci    V("map",            Map,              1, ArrayMap)                      \
774514f5e3Sopenharmony_ci    /* Array.prototype.pop ( ) */                                           \
784514f5e3Sopenharmony_ci    V("pop",            Pop,              0, ArrayPop)                      \
794514f5e3Sopenharmony_ci    /* Array.prototype.push ( ...items ) */                                 \
804514f5e3Sopenharmony_ci    V("push",           Push,             1, ArrayPush)                     \
814514f5e3Sopenharmony_ci    /* Array.prototype.reduce ( callbackfn [ , initialValue ] ) */          \
824514f5e3Sopenharmony_ci    V("reduce",         Reduce,           1, ArrayReduce)                   \
834514f5e3Sopenharmony_ci    /* Array.prototype.reduceRight ( callbackfn [ , initialValue ] ) */     \
844514f5e3Sopenharmony_ci    V("reduceRight",    ReduceRight,      1, ArrayReduceRight)              \
854514f5e3Sopenharmony_ci    /* Array.prototype.reverse ( ) */                                       \
864514f5e3Sopenharmony_ci    V("reverse",        Reverse,          0, ArrayReverse)                  \
874514f5e3Sopenharmony_ci    /* Array.prototype.shift ( ) */                                         \
884514f5e3Sopenharmony_ci    V("shift",          Shift,            0, ArrayShift)                    \
894514f5e3Sopenharmony_ci    /* Array.prototype.slice ( start, end ) */                              \
904514f5e3Sopenharmony_ci    V("slice",          Slice,            2, ArraySlice)                    \
914514f5e3Sopenharmony_ci    /* Array.prototype.some ( callbackfn [ , thisArg ] ) */                 \
924514f5e3Sopenharmony_ci    V("some",           Some,             1, ArraySome)                     \
934514f5e3Sopenharmony_ci    /* Array.prototype.sort ( comparefn ) */                                \
944514f5e3Sopenharmony_ci    V("sort",           Sort,             1, ArraySort)                     \
954514f5e3Sopenharmony_ci    /* Array.prototype.splice ( start, deleteCount, ...items ) */           \
964514f5e3Sopenharmony_ci    V("splice",         Splice,           2, ArraySplice)                   \
974514f5e3Sopenharmony_ci    /* Array.prototype.toLocaleString ( [ reserved1 [ , reserved2 ] ] ) */  \
984514f5e3Sopenharmony_ci    V("toLocaleString", ToLocaleString,   0, INVALID)                       \
994514f5e3Sopenharmony_ci    /* Array.prototype.toReversed ( ) */                                    \
1004514f5e3Sopenharmony_ci    V("toReversed",     ToReversed,       0, ArrayToReversed)               \
1014514f5e3Sopenharmony_ci    /* Array.prototype.toSorted ( comparefn ) */                            \
1024514f5e3Sopenharmony_ci    V("toSorted",       ToSorted,         1, ArrayToSorted)                 \
1034514f5e3Sopenharmony_ci    /* Array.prototype.toSpliced ( start, skipCount, ...items ) */          \
1044514f5e3Sopenharmony_ci    V("toSpliced",      ToSpliced,        2, ArrayToSpliced)                \
1054514f5e3Sopenharmony_ci    /* Array.prototype.toString ( ) */                                      \
1064514f5e3Sopenharmony_ci    V("toString",       ToString,         0, INVALID)                       \
1074514f5e3Sopenharmony_ci    /* Array.prototype.unshift ( ...items ) */                              \
1084514f5e3Sopenharmony_ci    V("unshift",        Unshift,          1, ArrayUnshift)                  \
1094514f5e3Sopenharmony_ci    /* Array.prototype.values ( ) */                                        \
1104514f5e3Sopenharmony_ci    V("values",         Values,           0, ArrayValues)                   \
1114514f5e3Sopenharmony_ci    /* Array.prototype.with ( index, value ) */                             \
1124514f5e3Sopenharmony_ci    V("with",           With,             2, ArrayWith)
1134514f5e3Sopenharmony_ci
1144514f5e3Sopenharmony_cinamespace panda::ecmascript::builtins {
1154514f5e3Sopenharmony_cistatic constexpr uint8_t INDEX_TWO = 2;
1164514f5e3Sopenharmony_cistatic constexpr uint8_t INDEX_THREE = 3;
1174514f5e3Sopenharmony_ciclass BuiltinsArray : public base::BuiltinsBase {
1184514f5e3Sopenharmony_cipublic:
1194514f5e3Sopenharmony_ci    // 22.1.1
1204514f5e3Sopenharmony_ci    static JSTaggedValue ArrayConstructor(EcmaRuntimeCallInfo *argv);
1214514f5e3Sopenharmony_ci
1224514f5e3Sopenharmony_ci    // 22.1.2.1
1234514f5e3Sopenharmony_ci    static JSTaggedValue From(EcmaRuntimeCallInfo *argv);
1244514f5e3Sopenharmony_ci    // 22.1.2.2
1254514f5e3Sopenharmony_ci    static JSTaggedValue IsArray(EcmaRuntimeCallInfo *argv);
1264514f5e3Sopenharmony_ci    // 22.1.2.3
1274514f5e3Sopenharmony_ci    static JSTaggedValue Of(EcmaRuntimeCallInfo *argv);
1284514f5e3Sopenharmony_ci    // 22.1.2.5
1294514f5e3Sopenharmony_ci    static JSTaggedValue Species(EcmaRuntimeCallInfo *argv);
1304514f5e3Sopenharmony_ci
1314514f5e3Sopenharmony_ci    // prototype
1324514f5e3Sopenharmony_ci    // 22.1.3.1
1334514f5e3Sopenharmony_ci    static JSTaggedValue Concat(EcmaRuntimeCallInfo *argv);
1344514f5e3Sopenharmony_ci    // 22.1.3.3
1354514f5e3Sopenharmony_ci    static JSTaggedValue CopyWithin(EcmaRuntimeCallInfo *argv);
1364514f5e3Sopenharmony_ci    // 22.1.3.4
1374514f5e3Sopenharmony_ci    static JSTaggedValue Entries(EcmaRuntimeCallInfo *argv);
1384514f5e3Sopenharmony_ci    // 22.1.3.5
1394514f5e3Sopenharmony_ci    static JSTaggedValue Every(EcmaRuntimeCallInfo *argv);
1404514f5e3Sopenharmony_ci    // 22.1.3.6
1414514f5e3Sopenharmony_ci    static JSTaggedValue Fill(EcmaRuntimeCallInfo *argv);
1424514f5e3Sopenharmony_ci    // 22.1.3.7
1434514f5e3Sopenharmony_ci    static JSTaggedValue Filter(EcmaRuntimeCallInfo *argv);
1444514f5e3Sopenharmony_ci    // 22.1.3.8
1454514f5e3Sopenharmony_ci    static JSTaggedValue Find(EcmaRuntimeCallInfo *argv);
1464514f5e3Sopenharmony_ci    // 22.1.3.9
1474514f5e3Sopenharmony_ci    static JSTaggedValue FindIndex(EcmaRuntimeCallInfo *argv);
1484514f5e3Sopenharmony_ci    // 22.1.3.10
1494514f5e3Sopenharmony_ci    static JSTaggedValue ForEach(EcmaRuntimeCallInfo *argv);
1504514f5e3Sopenharmony_ci    // 22.1.3.11
1514514f5e3Sopenharmony_ci    static JSTaggedValue IndexOf(EcmaRuntimeCallInfo *argv);
1524514f5e3Sopenharmony_ci    // 22.1.3.12
1534514f5e3Sopenharmony_ci    static JSTaggedValue Join(EcmaRuntimeCallInfo *argv);
1544514f5e3Sopenharmony_ci    // 22.1.3.13
1554514f5e3Sopenharmony_ci    static JSTaggedValue Keys(EcmaRuntimeCallInfo *argv);
1564514f5e3Sopenharmony_ci    // 22.1.3.14
1574514f5e3Sopenharmony_ci    static JSTaggedValue LastIndexOf(EcmaRuntimeCallInfo *argv);
1584514f5e3Sopenharmony_ci    // 22.1.3.15
1594514f5e3Sopenharmony_ci    static JSTaggedValue Map(EcmaRuntimeCallInfo *argv);
1604514f5e3Sopenharmony_ci    // 22.1.3.16
1614514f5e3Sopenharmony_ci    static JSTaggedValue Pop(EcmaRuntimeCallInfo *argv);
1624514f5e3Sopenharmony_ci    // 22.1.3.17
1634514f5e3Sopenharmony_ci    static JSTaggedValue Push(EcmaRuntimeCallInfo *argv);
1644514f5e3Sopenharmony_ci    // 22.1.3.18
1654514f5e3Sopenharmony_ci    static JSTaggedValue Reduce(EcmaRuntimeCallInfo *argv);
1664514f5e3Sopenharmony_ci    // 22.1.3.19
1674514f5e3Sopenharmony_ci    static JSTaggedValue ReduceRight(EcmaRuntimeCallInfo *argv);
1684514f5e3Sopenharmony_ci    // 22.1.3.20
1694514f5e3Sopenharmony_ci    static JSTaggedValue Reverse(EcmaRuntimeCallInfo *argv);
1704514f5e3Sopenharmony_ci    // 22.1.3.21
1714514f5e3Sopenharmony_ci    static JSTaggedValue Shift(EcmaRuntimeCallInfo *argv);
1724514f5e3Sopenharmony_ci    // 22.1.3.22
1734514f5e3Sopenharmony_ci    static JSTaggedValue Slice(EcmaRuntimeCallInfo *argv);
1744514f5e3Sopenharmony_ci    // 22.1.3.23
1754514f5e3Sopenharmony_ci    static JSTaggedValue Some(EcmaRuntimeCallInfo *argv);
1764514f5e3Sopenharmony_ci    // 22.1.3.24
1774514f5e3Sopenharmony_ci    static JSTaggedValue Sort(EcmaRuntimeCallInfo *argv);
1784514f5e3Sopenharmony_ci    // 22.1.3.25
1794514f5e3Sopenharmony_ci    static JSTaggedValue Splice(EcmaRuntimeCallInfo *argv);
1804514f5e3Sopenharmony_ci    // 22.1.3.26
1814514f5e3Sopenharmony_ci    static JSTaggedValue ToLocaleString(EcmaRuntimeCallInfo *argv);
1824514f5e3Sopenharmony_ci    // 22.1.3.27
1834514f5e3Sopenharmony_ci    static JSTaggedValue ToString(EcmaRuntimeCallInfo *argv); // no change
1844514f5e3Sopenharmony_ci    // 22.1.3.28
1854514f5e3Sopenharmony_ci    static JSTaggedValue Unshift(EcmaRuntimeCallInfo *argv); // done
1864514f5e3Sopenharmony_ci    // 22.1.3.29
1874514f5e3Sopenharmony_ci    static JSTaggedValue Values(EcmaRuntimeCallInfo *argv); // no change
1884514f5e3Sopenharmony_ci    // es12 23.1.3.13
1894514f5e3Sopenharmony_ci    static JSTaggedValue Includes(EcmaRuntimeCallInfo *argv); // no change
1904514f5e3Sopenharmony_ci    // es12 23.1.3.10
1914514f5e3Sopenharmony_ci    static JSTaggedValue Flat(EcmaRuntimeCallInfo *argv);
1924514f5e3Sopenharmony_ci    // es12 23.1.3.11
1934514f5e3Sopenharmony_ci    static JSTaggedValue FlatMap(EcmaRuntimeCallInfo *argv);
1944514f5e3Sopenharmony_ci    // 23.1.3.1 Array.prototype.at ( index )
1954514f5e3Sopenharmony_ci    static JSTaggedValue At(EcmaRuntimeCallInfo *argv); // no change
1964514f5e3Sopenharmony_ci    // 23.1.3.33 Array.prototype.toReversed ( )
1974514f5e3Sopenharmony_ci    static JSTaggedValue ToReversed(EcmaRuntimeCallInfo *argv); // no change
1984514f5e3Sopenharmony_ci    // 23.1.3.39 Array.prototype.with ( index, value )
1994514f5e3Sopenharmony_ci    static JSTaggedValue With(EcmaRuntimeCallInfo *argv); // done
2004514f5e3Sopenharmony_ci    // 23.1.3.34 Array.prototype.toSorted ( comparefn )
2014514f5e3Sopenharmony_ci    static JSTaggedValue ToSorted(EcmaRuntimeCallInfo *argv);
2024514f5e3Sopenharmony_ci    // 23.1.3.11
2034514f5e3Sopenharmony_ci    static JSTaggedValue FindLast(EcmaRuntimeCallInfo *argv); // no change
2044514f5e3Sopenharmony_ci    // 23.1.3.12
2054514f5e3Sopenharmony_ci    static JSTaggedValue FindLastIndex(EcmaRuntimeCallInfo *argv); // no change
2064514f5e3Sopenharmony_ci    // 23.1.3.35 Array.prototype.toSpliced ( start, skipCount, ...items )
2074514f5e3Sopenharmony_ci    static JSTaggedValue ToSpliced(EcmaRuntimeCallInfo *argv);
2084514f5e3Sopenharmony_ci
2094514f5e3Sopenharmony_ci    // Excluding the '@@' internal properties
2104514f5e3Sopenharmony_ci    static Span<const base::BuiltinFunctionEntry> GetArrayFunctions()
2114514f5e3Sopenharmony_ci    {
2124514f5e3Sopenharmony_ci        return Span<const base::BuiltinFunctionEntry>(ARRAY_FUNCTIONS);
2134514f5e3Sopenharmony_ci    }
2144514f5e3Sopenharmony_ci
2154514f5e3Sopenharmony_ci    // Excluding the constructor and '@@' internal properties.
2164514f5e3Sopenharmony_ci    static Span<const base::BuiltinFunctionEntry> GetArrayPrototypeFunctions()
2174514f5e3Sopenharmony_ci    {
2184514f5e3Sopenharmony_ci        return Span<const base::BuiltinFunctionEntry>(ARRAY_PROTOTYPE_FUNCTIONS);
2194514f5e3Sopenharmony_ci    }
2204514f5e3Sopenharmony_ci
2214514f5e3Sopenharmony_ci    static size_t GetNumPrototypeInlinedProperties()
2224514f5e3Sopenharmony_ci    {
2234514f5e3Sopenharmony_ci        // 4 : 4 More inlined entries in Array.prototype for the following functions/accessors:
2244514f5e3Sopenharmony_ci        //   (1) 'length' accessor
2254514f5e3Sopenharmony_ci        //   (2) Array.prototype.constructor, i.e. Array()
2264514f5e3Sopenharmony_ci        //   (3) Array.prototype[@@iterator]()
2274514f5e3Sopenharmony_ci        //   (4) Array.prototype[@@unscopables]()
2284514f5e3Sopenharmony_ci        return GetArrayPrototypeFunctions().Size() + 4;
2294514f5e3Sopenharmony_ci    }
2304514f5e3Sopenharmony_ci    static JSTaggedValue ReduceUnStableJSArray(JSThread *thread, JSHandle<JSTaggedValue> &thisHandle,
2314514f5e3Sopenharmony_ci        JSHandle<JSTaggedValue> &thisObjVal, int64_t k, int64_t len, JSMutableHandle<JSTaggedValue> &accumulator,
2324514f5e3Sopenharmony_ci        JSHandle<JSTaggedValue> &callbackFnHandle);
2334514f5e3Sopenharmony_ci
2344514f5e3Sopenharmony_ci    static JSTaggedValue FilterUnStableJSArray(JSThread *thread, JSHandle<JSTaggedValue> &thisArgHandle,
2354514f5e3Sopenharmony_ci        JSHandle<JSTaggedValue> &thisObjVal, int64_t k, int64_t len, uint32_t toIndex,
2364514f5e3Sopenharmony_ci        JSHandle<JSObject> newArrayHandle, JSHandle<JSTaggedValue> &callbackFnHandle);
2374514f5e3Sopenharmony_ci
2384514f5e3Sopenharmony_ci    static JSTaggedValue MapUnStableJSArray(JSThread *thread, JSHandle<JSTaggedValue> &thisArgHandle,
2394514f5e3Sopenharmony_ci        JSHandle<JSTaggedValue> &thisObjVal, int64_t k, int64_t len, JSHandle<JSObject> newArrayHandle,
2404514f5e3Sopenharmony_ci        JSHandle<JSTaggedValue> &callbackFnHandle);
2414514f5e3Sopenharmony_ci
2424514f5e3Sopenharmony_ci    static JSTaggedValue ReduceInner(EcmaRuntimeCallInfo *argv, int64_t len);
2434514f5e3Sopenharmony_ci
2444514f5e3Sopenharmony_ci    static JSTaggedValue ReduceRightInner(EcmaRuntimeCallInfo *argv, int64_t len);
2454514f5e3Sopenharmony_ciprivate:
2464514f5e3Sopenharmony_ci#define BUILTIN_ARRAY_FUNCTION_ENTRY(name, method, length, id) \
2474514f5e3Sopenharmony_ci    base::BuiltinFunctionEntry::Create(name, BuiltinsArray::method, length, kungfu::BuiltinsStubCSigns::id),
2484514f5e3Sopenharmony_ci
2494514f5e3Sopenharmony_ci    static constexpr std::array ARRAY_FUNCTIONS  = {
2504514f5e3Sopenharmony_ci        BUILTIN_ARRAY_FUNCTIONS(BUILTIN_ARRAY_FUNCTION_ENTRY)
2514514f5e3Sopenharmony_ci    };
2524514f5e3Sopenharmony_ci    static constexpr std::array ARRAY_PROTOTYPE_FUNCTIONS = {
2534514f5e3Sopenharmony_ci        BUILTIN_ARRAY_PROTOTYPE_FUNCTIONS(BUILTIN_ARRAY_FUNCTION_ENTRY)
2544514f5e3Sopenharmony_ci    };
2554514f5e3Sopenharmony_ci#undef BUILTIN_ARRAY_FUNCTION_ENTRY
2564514f5e3Sopenharmony_ci
2574514f5e3Sopenharmony_ci    static JSTaggedValue IndexOfStable(
2584514f5e3Sopenharmony_ci        EcmaRuntimeCallInfo *argv, JSThread *thread, const JSHandle<JSTaggedValue> &thisHandle);
2594514f5e3Sopenharmony_ci    static JSTaggedValue IndexOfSlowPath(
2604514f5e3Sopenharmony_ci        EcmaRuntimeCallInfo *argv, JSThread *thread, const JSHandle<JSTaggedValue> &thisHandle);
2614514f5e3Sopenharmony_ci    static JSTaggedValue IndexOfSlowPath(
2624514f5e3Sopenharmony_ci        EcmaRuntimeCallInfo *argv, JSThread *thread, const JSHandle<JSTaggedValue> &thisObjVal,
2634514f5e3Sopenharmony_ci        int64_t length, int64_t fromIndex);
2644514f5e3Sopenharmony_ci
2654514f5e3Sopenharmony_ci    static JSTaggedValue LastIndexOfStable(
2664514f5e3Sopenharmony_ci        EcmaRuntimeCallInfo *argv, JSThread *thread, const JSHandle<JSTaggedValue> &thisHandle);
2674514f5e3Sopenharmony_ci    static JSTaggedValue LastIndexOfSlowPath(
2684514f5e3Sopenharmony_ci        EcmaRuntimeCallInfo *argv, JSThread *thread, const JSHandle<JSTaggedValue> &thisHandle);
2694514f5e3Sopenharmony_ci    static JSTaggedValue LastIndexOfSlowPath(
2704514f5e3Sopenharmony_ci        EcmaRuntimeCallInfo *argv, JSThread *thread, const JSHandle<JSTaggedValue> &thisObjVal, int64_t fromIndex);
2714514f5e3Sopenharmony_ci};
2724514f5e3Sopenharmony_ci}  // namespace panda::ecmascript::builtins
2734514f5e3Sopenharmony_ci
2744514f5e3Sopenharmony_ci#endif  // ECMASCRIPT_BUILTINS_BUILTINS_ARRAY_H
275