1 /* 2 * Copyright (c) 2024 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_COMPILER_BUILTINS_DATAVIEW_STUB_BUILDER_H 17 #define ECMASCRIPT_COMPILER_BUILTINS_DATAVIEW_STUB_BUILDER_H 18 #include "ecmascript/compiler/builtins/builtins_stubs.h" 19 #include "ecmascript/js_dataview.h" 20 namespace panda::ecmascript::kungfu { 21 class BuiltinsDataViewStubBuilder : public BuiltinsStubBuilder { 22 public: 23 enum OffsetIndex : uint8_t { ZERO = 0, ONE, TWO, THREE, FOUR, FIVE, SIX, SEVEN}; BuiltinsDataViewStubBuilder(StubBuilder * parent,GateRef globalEnv)24 explicit BuiltinsDataViewStubBuilder(StubBuilder *parent, GateRef globalEnv) 25 : BuiltinsStubBuilder(parent, globalEnv) {} 26 ~BuiltinsDataViewStubBuilder() override = default; 27 NO_MOVE_SEMANTIC(BuiltinsDataViewStubBuilder); 28 NO_COPY_SEMANTIC(BuiltinsDataViewStubBuilder); GenerateCircuit()29 void GenerateCircuit() override {} 30 template <DataViewType type> 31 void SetTypedValue(GateRef glue, GateRef thisValue, GateRef numArgs, 32 Variable* res, Label *exit, Label *slowPath); 33 void SetValueInBufferForInt32(GateRef glue, GateRef pointer, GateRef offset, 34 GateRef value, GateRef littleEndianHandle); 35 void SetValueInBufferForInt64(GateRef glue, GateRef pointer, GateRef offset, 36 GateRef value, GateRef littleEndianHandle); 37 GateRef GetElementSize(DataViewType type); 38 }; 39 } // namespace panda::ecmascript::kungfu 40 #endif // ECMASCRIPT_COMPILER_BUILTINS_DATAVIEW_STUB_BUILDER_H