1 /* 2 * Copyright (c) 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_SHAREDARRAYBUFFER_H 17 #define ECMASCRIPT_BUILTINS_BUILTINS_SHAREDARRAYBUFFER_H 18 19 #include "ecmascript/base/builtins_base.h" 20 #include "ecmascript/base/number_helper.h" 21 #include "ecmascript/js_dataview.h" 22 23 namespace panda::ecmascript::builtins { 24 class BuiltinsSharedArrayBuffer : public base::BuiltinsBase { 25 public: 26 // 25.2.2.1 SharedArrayBuffer ( [ length ] ) 27 static JSTaggedValue SharedArrayBufferConstructor(EcmaRuntimeCallInfo *argv); 28 // 25.2.1.2 IsSharedArrayBuffer ( obj ) 29 static JSTaggedValue IsSharedArrayBuffer(EcmaRuntimeCallInfo *argv); 30 // 24.2.3.2 get SharedArrayBuffer [ @@species ] 31 static JSTaggedValue Species(EcmaRuntimeCallInfo *argv); 32 // 25.2.4.1 get SharedArrayBuffer.prototype.byteLength 33 static JSTaggedValue GetByteLength(EcmaRuntimeCallInfo *argv); 34 // 25.2.4.3 SharedArrayBuffer.prototype.slice ( start, end ) 35 static JSTaggedValue Slice(EcmaRuntimeCallInfo *argv); 36 37 static bool IsShared(JSTaggedValue arrayBuffer); 38 private: 39 // 25.2.1.1 AllocateSharedArrayBuffer ( constructor, byteLength ) 40 static JSTaggedValue AllocateSharedArrayBuffer(JSThread *thread, const JSHandle<JSTaggedValue> &newTarget, 41 uint64_t byteLength); 42 }; 43 } // namespace panda::ecmascript::builtins 44 45 #endif // ECMASCRIPT_BUILTINS_BUILTINS_SHAREDARRAYBUFFER_H