• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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_FUNC_ENTRY_DES_H
17 #define ECMASCRIPT_COMPILER_FUNC_ENTRY_DES_H
18 
19 #include "ecmascript/common.h"
20 #include "ecmascript/compiler/aot_file/executed_memory_allocator.h"
21 #include "ecmascript/compiler/bc_call_signature.h"
22 #include "ecmascript/deoptimizer/calleeReg.h"
23 
24 namespace panda::ecmascript {
25 struct FuncEntryDes {
26     uint64_t codeAddr_ {};
27     CallSignature::TargetKind kind_;
28     bool isMainFunc_ {};
29     bool isFastCall_ {};
30     uint32_t indexInKindOrMethodId_ {};
31     uint32_t moduleIndex_ {};
32     uint32_t abcIndexInAi_ {INVALID_INDEX};
33     int fpDeltaPrevFrameSp_ {};
34     uint32_t funcSize_ {};
35     uint32_t calleeRegisterNum_ {};
36     int32_t CalleeReg2Offset_[2 * kungfu::MAX_CALLEE_SAVE_REIGISTER_NUM];
IsStubFuncEntryDes37     bool IsStub() const
38     {
39         return CallSignature::TargetKind::STUB_BEGIN <= kind_ && kind_ < CallSignature::TargetKind::STUB_END;
40     }
IsBCStubFuncEntryDes41     bool IsBCStub() const
42     {
43         return CallSignature::TargetKind::BCHANDLER_BEGIN <= kind_ &&
44                kind_ < CallSignature::TargetKind::BCHANDLER_END;
45     }
IsBCHandlerStubFuncEntryDes46     bool IsBCHandlerStub() const
47     {
48         return (kind_ == CallSignature::TargetKind::BYTECODE_HANDLER);
49     }
IsBuiltinsStubFuncEntryDes50     bool IsBuiltinsStub() const
51     {
52         return (kind_ == CallSignature::TargetKind::BUILTINS_STUB ||
53                 kind_ == CallSignature::TargetKind::BUILTINS_WITH_ARGV_STUB);
54     }
IsCommonStubFuncEntryDes55     bool IsCommonStub() const
56     {
57         return (kind_ == CallSignature::TargetKind::COMMON_STUB);
58     }
IsGeneralRTStubFuncEntryDes59     bool IsGeneralRTStub() const
60     {
61         return (kind_ >= CallSignature::TargetKind::RUNTIME_STUB && kind_ <= CallSignature::TargetKind::DEOPT_STUB);
62     }
63 };
64 }  // namespace panda::ecmascript
65 #endif  // ECMASCRIPT_COMPILER_FUNC_ENTRY_DES_H
66 
67