• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_INTERPRETER_FAST_RUNTIME_STUB_H
17 #define ECMASCRIPT_INTERPRETER_FAST_RUNTIME_STUB_H
18 
19 #include <memory>
20 
21 #include "ecmascript/frames.h"
22 #include "ecmascript/js_tagged_value.h"
23 
24 namespace panda::ecmascript {
25 class GlobalEnv;
26 class PropertyAttributes;
27 
28 class FastRuntimeStub {
29 public:
30     static inline JSTaggedValue FastMul(JSTaggedValue left, JSTaggedValue right);
31     static inline JSTaggedValue FastDiv(JSTaggedValue left, JSTaggedValue right);
32     static inline JSTaggedValue FastMod(JSTaggedValue left, JSTaggedValue right);
33     static inline JSTaggedValue FastEqual(JSTaggedValue left, JSTaggedValue right);
34     static inline JSTaggedValue FastTypeOf(JSThread *thread, JSTaggedValue obj);
35     static inline bool FastStrictEqual(JSTaggedValue left, JSTaggedValue right);
36     static inline JSTaggedValue NewLexicalEnv(JSThread *thread, ObjectFactory *factory, uint16_t numVars);
37     static inline JSTaggedValue GetGlobalOwnProperty(JSThread *thread, JSTaggedValue receiver, JSTaggedValue key);
38     template<bool UseOwn = false>
39     static inline JSTaggedValue GetPropertyByName(JSThread *thread, JSTaggedValue receiver, JSTaggedValue key);
40     template<bool UseOwn = false>
41     static inline JSTaggedValue GetPropertyByValue(JSThread *thread, JSTaggedValue receiver, JSTaggedValue key);
42     template<bool UseOwn = false>
43     static inline JSTaggedValue GetPropertyByIndex(JSThread *thread, JSTaggedValue receiver, uint32_t index);
44     template<bool UseOwn = false>
45     static inline JSTaggedValue SetPropertyByName(JSThread *thread, JSTaggedValue receiver, JSTaggedValue key,
46                                                   JSTaggedValue value);
47     template<bool UseOwn = false>
48     static inline JSTaggedValue SetPropertyByValue(JSThread *thread, JSTaggedValue receiver, JSTaggedValue key,
49                                                    JSTaggedValue value);
50     template<bool UseOwn = false>
51     static inline JSTaggedValue SetPropertyByIndex(JSThread *thread, JSTaggedValue receiver, uint32_t index,
52                                                    JSTaggedValue value);
53 
54     static inline JSTaggedValue NewThisObject(JSThread *thread, JSTaggedValue ctor, JSTaggedValue newTarget,
55                                               InterpretedFrame* state);
56     static inline JSTaggedValue CallGetter(JSThread *thread, JSTaggedValue receiver, JSTaggedValue holder,
57                                            JSTaggedValue value);
58 
59 private:
60     friend class ICRuntimeStub;
61 
62     static inline JSTaggedValue CallSetter(JSThread *thread, JSTaggedValue receiver, JSTaggedValue value,
63                                            JSTaggedValue accessorValue);
64 };
65 }  // namespace panda::ecmascript
66 
67 #endif  // ECMASCRIPT_INTERPRETER_OBJECT_OPERATOR_INL_H
68