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_COMPILER_OPERATIONS_STUB_BUILDER_H 17 #define ECMASCRIPT_COMPILER_OPERATIONS_STUB_BUILDER_H 18 #include "ecmascript/compiler/interpreter_stub.h" 19 #include "ecmascript/compiler/stub_builder.h" 20 21 namespace panda::ecmascript::kungfu { 22 class OperationsStubBuilder : public StubBuilder { 23 public: OperationsStubBuilder(StubBuilder * parent)24 explicit OperationsStubBuilder(StubBuilder *parent) 25 : StubBuilder(parent) {} 26 ~OperationsStubBuilder() = default; 27 NO_MOVE_SEMANTIC(OperationsStubBuilder); 28 NO_COPY_SEMANTIC(OperationsStubBuilder); GenerateCircuit()29 void GenerateCircuit() override {} 30 // unary op 31 GateRef Inc(GateRef glue, GateRef value, ProfileOperation callback = ProfileOperation()); 32 GateRef Dec(GateRef glue, GateRef value, ProfileOperation callback = ProfileOperation()); 33 GateRef Neg(GateRef glue, GateRef value, ProfileOperation callback = ProfileOperation()); 34 GateRef Not(GateRef glue, GateRef value, ProfileOperation callback = ProfileOperation()); 35 36 // binary op 37 GateRef Equal(GateRef glue, GateRef left, GateRef right, ProfileOperation callback = ProfileOperation()); 38 GateRef NotEqual(GateRef glue, GateRef left, GateRef right, ProfileOperation callback = ProfileOperation()); 39 GateRef StrictEqual(GateRef glue, GateRef left, GateRef right, ProfileOperation callback = ProfileOperation()); 40 GateRef StrictNotEqual(GateRef glue, GateRef left, GateRef right, ProfileOperation callback = ProfileOperation()); 41 GateRef Less(GateRef glue, GateRef left, GateRef right, ProfileOperation callback = ProfileOperation()); 42 GateRef LessEq(GateRef glue, GateRef left, GateRef right, ProfileOperation callback = ProfileOperation()); 43 GateRef Greater(GateRef glue, GateRef left, GateRef right, ProfileOperation callback = ProfileOperation()); 44 GateRef GreaterEq(GateRef glue, GateRef left, GateRef right, ProfileOperation callback = ProfileOperation()); 45 GateRef Add(GateRef glue, GateRef left, GateRef right, ProfileOperation callback = ProfileOperation()); 46 GateRef Sub(GateRef glue, GateRef left, GateRef right, ProfileOperation callback = ProfileOperation()); 47 GateRef Mul(GateRef glue, GateRef left, GateRef right, ProfileOperation callback = ProfileOperation()); 48 GateRef Div(GateRef glue, GateRef left, GateRef right, ProfileOperation callback = ProfileOperation()); 49 GateRef Mod(GateRef glue, GateRef left, GateRef right, ProfileOperation callback = ProfileOperation()); 50 GateRef Shl(GateRef glue, GateRef left, GateRef right, ProfileOperation callback = ProfileOperation()); 51 GateRef Shr(GateRef glue, GateRef left, GateRef right, ProfileOperation callback = ProfileOperation()); 52 GateRef Ashr(GateRef glue, GateRef left, GateRef right, ProfileOperation callback = ProfileOperation()); 53 GateRef And(GateRef glue, GateRef left, GateRef right, ProfileOperation callback = ProfileOperation()); 54 GateRef Or(GateRef glue, GateRef left, GateRef right, ProfileOperation callback = ProfileOperation()); 55 GateRef Xor(GateRef glue, GateRef left, GateRef right, ProfileOperation callback = ProfileOperation()); 56 }; 57 } // namespace panda::ecmascript::kungfu 58 #endif // ECMASCRIPT_COMPILER_OPERATIONS_STUB_BUILDER_H 59