1 /* 2 * Copyright (c) 2021 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 37 // 22.2.1.2.1 38 static JSTaggedValue AllocateTypedArray(EcmaRuntimeCallInfo *argv); 39 40 // 22.2.2.1 41 static JSTaggedValue From(EcmaRuntimeCallInfo *argv); 42 // 22.2.2.2 43 static JSTaggedValue Of(EcmaRuntimeCallInfo *argv); 44 // 22.2.2.4 45 static JSTaggedValue Species(EcmaRuntimeCallInfo *argv); 46 47 // prototype 48 // 22.2.3.1 49 static JSTaggedValue GetBuffer(EcmaRuntimeCallInfo *argv); 50 // 22.2.3.2 51 static JSTaggedValue GetByteLength(EcmaRuntimeCallInfo *argv); 52 // 22.2.3.3 53 static JSTaggedValue GetByteOffset(EcmaRuntimeCallInfo *argv); 54 // 22.2.3.5 55 static JSTaggedValue CopyWithin(EcmaRuntimeCallInfo *argv); 56 // 22.2.3.6 57 static JSTaggedValue Entries(EcmaRuntimeCallInfo *argv); 58 // 22.2.3.7 59 static JSTaggedValue Every(EcmaRuntimeCallInfo *argv); 60 // 22.2.3.8 61 static JSTaggedValue Fill(EcmaRuntimeCallInfo *argv); 62 // 22.2.3.9 63 static JSTaggedValue Filter(EcmaRuntimeCallInfo *argv); 64 // 22.2.3.10 65 static JSTaggedValue Find(EcmaRuntimeCallInfo *argv); 66 // 22.2.3.11 67 static JSTaggedValue FindIndex(EcmaRuntimeCallInfo *argv); 68 // 22.2.3.12 69 static JSTaggedValue ForEach(EcmaRuntimeCallInfo *argv); 70 // 22.2.3.13 71 static JSTaggedValue IndexOf(EcmaRuntimeCallInfo *argv); 72 // 22.2.3.14 73 static JSTaggedValue Join(EcmaRuntimeCallInfo *argv); 74 // 22.2.3.15 75 static JSTaggedValue Keys(EcmaRuntimeCallInfo *argv); 76 // 22.2.3.16 77 static JSTaggedValue LastIndexOf(EcmaRuntimeCallInfo *argv); 78 // 22.2.3.17 79 static JSTaggedValue GetLength(EcmaRuntimeCallInfo *argv); 80 // 22.2.3.18 81 static JSTaggedValue Map(EcmaRuntimeCallInfo *argv); 82 // 22.2.3.19 83 static JSTaggedValue Reduce(EcmaRuntimeCallInfo *argv); 84 // 22.2.3.20 85 static JSTaggedValue ReduceRight(EcmaRuntimeCallInfo *argv); 86 // 22.2.3.21 87 static JSTaggedValue Reverse(EcmaRuntimeCallInfo *argv); 88 // 22.2.3.22 89 static JSTaggedValue Set(EcmaRuntimeCallInfo *argv); 90 // 22.2.3.23 91 static JSTaggedValue Slice(EcmaRuntimeCallInfo *argv); 92 // 22.2.3.24 93 static JSTaggedValue Some(EcmaRuntimeCallInfo *argv); 94 // 22.2.3.25 95 static JSTaggedValue Sort(EcmaRuntimeCallInfo *argv); 96 // 22.2.3.26 97 static JSTaggedValue Subarray(EcmaRuntimeCallInfo *argv); 98 // 22.2.3.27 99 static JSTaggedValue ToLocaleString(EcmaRuntimeCallInfo *argv); 100 // 22.2.3.28 101 static JSTaggedValue ToString(EcmaRuntimeCallInfo *argv); 102 // 22.2.3.29 103 static JSTaggedValue Values(EcmaRuntimeCallInfo *argv); 104 // 22.2.3.31 105 static JSTaggedValue ToStringTag(EcmaRuntimeCallInfo *argv); 106 }; 107 } // namespace panda::ecmascript::builtins 108 109 #endif // ECMASCRIPT_BUILTINS_BUILTINS_TYPEDARRAY_H 110