1 /* 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef ECMASCRIPT_BUILTINS_BUILTINS_TYPEDARRAY_H 17 #define ECMASCRIPT_BUILTINS_BUILTINS_TYPEDARRAY_H 18 19 #include "ecmascript/base/builtins_base.h" 20 21 namespace panda::ecmascript::builtins { 22 class BuiltinsTypedArray : public base::BuiltinsBase { 23 public: 24 enum SeparatorFlag : int { MINUS_ONE = -1, MINUS_TWO = -2 }; 25 // 22.2.1 26 static JSTaggedValue TypedArrayBaseConstructor(EcmaRuntimeCallInfo *argv); 27 static JSTaggedValue Int8ArrayConstructor(EcmaRuntimeCallInfo *argv); 28 static JSTaggedValue Uint8ArrayConstructor(EcmaRuntimeCallInfo *argv); 29 static JSTaggedValue Uint8ClampedArrayConstructor(EcmaRuntimeCallInfo *argv); 30 static JSTaggedValue Int16ArrayConstructor(EcmaRuntimeCallInfo *argv); 31 static JSTaggedValue Uint16ArrayConstructor(EcmaRuntimeCallInfo *argv); 32 static JSTaggedValue Int32ArrayConstructor(EcmaRuntimeCallInfo *argv); 33 static JSTaggedValue Uint32ArrayConstructor(EcmaRuntimeCallInfo *argv); 34 static JSTaggedValue Float32ArrayConstructor(EcmaRuntimeCallInfo *argv); 35 static JSTaggedValue Float64ArrayConstructor(EcmaRuntimeCallInfo *argv); 36 static JSTaggedValue BigInt64ArrayConstructor(EcmaRuntimeCallInfo *argv); 37 static JSTaggedValue BigUint64ArrayConstructor(EcmaRuntimeCallInfo *argv); 38 39 // 22.2.1.2.1 40 static JSTaggedValue AllocateTypedArray(EcmaRuntimeCallInfo *argv); 41 42 // 22.2.2.1 43 static JSTaggedValue From(EcmaRuntimeCallInfo *argv); 44 // 22.2.2.2 45 static JSTaggedValue Of(EcmaRuntimeCallInfo *argv); 46 // 22.2.2.4 47 static JSTaggedValue Species(EcmaRuntimeCallInfo *argv); 48 49 // prototype 50 // 22.2.3.1 51 static JSTaggedValue GetBuffer(EcmaRuntimeCallInfo *argv); 52 // 22.2.3.2 53 static JSTaggedValue GetByteLength(EcmaRuntimeCallInfo *argv); 54 // 22.2.3.3 55 static JSTaggedValue GetByteOffset(EcmaRuntimeCallInfo *argv); 56 // 22.2.3.5 57 static JSTaggedValue CopyWithin(EcmaRuntimeCallInfo *argv); 58 // 22.2.3.6 59 static JSTaggedValue Entries(EcmaRuntimeCallInfo *argv); 60 // 22.2.3.7 61 static JSTaggedValue Every(EcmaRuntimeCallInfo *argv); 62 // 22.2.3.8 63 static JSTaggedValue Fill(EcmaRuntimeCallInfo *argv); 64 // 22.2.3.9 65 static JSTaggedValue Filter(EcmaRuntimeCallInfo *argv); 66 // 22.2.3.10 67 static JSTaggedValue Find(EcmaRuntimeCallInfo *argv); 68 // 22.2.3.11 69 static JSTaggedValue FindIndex(EcmaRuntimeCallInfo *argv); 70 // 22.2.3.12 71 static JSTaggedValue ForEach(EcmaRuntimeCallInfo *argv); 72 // 22.2.3.13 73 static JSTaggedValue IndexOf(EcmaRuntimeCallInfo *argv); 74 // 22.2.3.14 75 static JSTaggedValue Join(EcmaRuntimeCallInfo *argv); 76 // 22.2.3.15 77 static JSTaggedValue Keys(EcmaRuntimeCallInfo *argv); 78 // 22.2.3.16 79 static JSTaggedValue LastIndexOf(EcmaRuntimeCallInfo *argv); 80 // 22.2.3.17 81 static JSTaggedValue GetLength(EcmaRuntimeCallInfo *argv); 82 // 22.2.3.18 83 static JSTaggedValue Map(EcmaRuntimeCallInfo *argv); 84 // 22.2.3.19 85 static JSTaggedValue Reduce(EcmaRuntimeCallInfo *argv); 86 // 22.2.3.20 87 static JSTaggedValue ReduceRight(EcmaRuntimeCallInfo *argv); 88 // 22.2.3.21 89 static JSTaggedValue Reverse(EcmaRuntimeCallInfo *argv); 90 // 22.2.3.22 91 static JSTaggedValue Set(EcmaRuntimeCallInfo *argv); 92 // 22.2.3.23 93 static JSTaggedValue Slice(EcmaRuntimeCallInfo *argv); 94 // 22.2.3.24 95 static JSTaggedValue Some(EcmaRuntimeCallInfo *argv); 96 // 22.2.3.25 97 static JSTaggedValue Sort(EcmaRuntimeCallInfo *argv); 98 // 22.2.3.26 99 static JSTaggedValue Subarray(EcmaRuntimeCallInfo *argv); 100 // 22.2.3.27 101 static JSTaggedValue ToLocaleString(EcmaRuntimeCallInfo *argv); 102 // 22.2.3.28 103 static JSTaggedValue ToString(EcmaRuntimeCallInfo *argv); 104 // 22.2.3.29 105 static JSTaggedValue Values(EcmaRuntimeCallInfo *argv); 106 // 22.2.3.31 107 static JSTaggedValue ToStringTag(EcmaRuntimeCallInfo *argv); 108 // es12 23.2.3.13 109 static JSTaggedValue Includes(EcmaRuntimeCallInfo *argv); 110 static const uint32_t MAX_ARRAY_INDEX = std::numeric_limits<uint32_t>::max(); 111 }; 112 } // namespace panda::ecmascript::builtins 113 114 #endif // ECMASCRIPT_BUILTINS_BUILTINS_TYPEDARRAY_H 115