• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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) {}
OperationsStubBuilder(StubBuilder * parent,GateRef globalEnv)26     OperationsStubBuilder(StubBuilder *parent, GateRef globalEnv)
27         : StubBuilder(parent, globalEnv) {}
28     ~OperationsStubBuilder() = default;
29     NO_MOVE_SEMANTIC(OperationsStubBuilder);
30     NO_COPY_SEMANTIC(OperationsStubBuilder);
GenerateCircuit()31     void GenerateCircuit() override {}
32     // unary op
33     GateRef Inc(GateRef glue, GateRef value, ProfileOperation callback = ProfileOperation());
34     GateRef Dec(GateRef glue, GateRef value, ProfileOperation callback = ProfileOperation());
35     GateRef Neg(GateRef glue, GateRef value, ProfileOperation callback = ProfileOperation());
36     GateRef Not(GateRef glue, GateRef value, ProfileOperation callback = ProfileOperation());
37 
38     // binary op
39     GateRef Equal(GateRef glue, GateRef left, GateRef right, ProfileOperation callback = ProfileOperation());
40     GateRef NotEqual(GateRef glue, GateRef left, GateRef right, ProfileOperation callback = ProfileOperation());
41     GateRef StrictEqual(GateRef glue, GateRef left, GateRef right, ProfileOperation callback = ProfileOperation());
42     GateRef StrictNotEqual(GateRef glue, GateRef left, GateRef right, ProfileOperation callback = ProfileOperation());
43     GateRef Less(GateRef glue, GateRef left, GateRef right, ProfileOperation callback = ProfileOperation());
44     GateRef LessEq(GateRef glue, GateRef left, GateRef right, ProfileOperation callback = ProfileOperation());
45     GateRef Greater(GateRef glue, GateRef left, GateRef right, ProfileOperation callback = ProfileOperation());
46     GateRef GreaterEq(GateRef glue, GateRef left, GateRef right, ProfileOperation callback = ProfileOperation());
47     GateRef Add(GateRef glue, GateRef left, GateRef right, ProfileOperation callback = ProfileOperation());
48     GateRef Sub(GateRef glue, GateRef left, GateRef right, ProfileOperation callback = ProfileOperation());
49     GateRef Mul(GateRef glue, GateRef left, GateRef right, ProfileOperation callback = ProfileOperation());
50     GateRef Div(GateRef glue, GateRef left, GateRef right, ProfileOperation callback = ProfileOperation());
51     GateRef Mod(GateRef glue, GateRef left, GateRef right, ProfileOperation callback = ProfileOperation());
52     GateRef Shl(GateRef glue, GateRef left, GateRef right, ProfileOperation callback = ProfileOperation());
53     GateRef Shr(GateRef glue, GateRef left, GateRef right, ProfileOperation callback = ProfileOperation());
54     GateRef Ashr(GateRef glue, GateRef left, GateRef right, ProfileOperation callback = ProfileOperation());
55     GateRef And(GateRef glue, GateRef left, GateRef right, ProfileOperation callback = ProfileOperation());
56     GateRef Or(GateRef glue, GateRef left, GateRef right, ProfileOperation callback = ProfileOperation());
57     GateRef Xor(GateRef glue, GateRef left, GateRef right, ProfileOperation callback = ProfileOperation());
58 };
59 }  // namespace panda::ecmascript::kungfu
60 #endif  // ECMASCRIPT_COMPILER_OPERATIONS_STUB_BUILDER_H
61