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_BASELINE_BASELINE_STUB_CSIGNS_H 17 #define ECMASCRIPT_COMPILER_BASELINE_BASELINE_STUB_CSIGNS_H 18 19 #include "ecmascript/compiler/baseline/baseline_compiler_builtins.h" 20 #include "ecmascript/compiler/call_signature.h" 21 22 namespace panda::ecmascript::kungfu { 23 24 #define BASELINE_STUB_ID_LIST(V) \ 25 BASELINE_COMPILER_BUILTIN_LIST(V) 26 27 class BaselineStubCSigns { 28 public: 29 enum ID { 30 #define DEF_STUB_ID(name) name, 31 BASELINE_STUB_ID_LIST(DEF_STUB_ID) 32 #undef DEF_STUB_ID 33 NUM_OF_STUBS 34 }; 35 36 static void Initialize(); 37 38 static void GetCSigns(std::vector<const CallSignature*>& callSigns); 39 Get(size_t index)40 static const CallSignature *Get(size_t index) 41 { 42 ASSERT(index < NUM_OF_STUBS); 43 return &callSigns_[index]; 44 } 45 GetName(size_t index)46 static const std::string &GetName(size_t index) 47 { 48 ASSERT(index < NUM_OF_STUBS); 49 return callSigns_[index].GetName(); 50 } 51 52 private: 53 static CallSignature callSigns_[NUM_OF_STUBS]; 54 }; 55 56 } // namespace panda::ecmascript::kungfu 57 #endif // ECMASCRIPT_COMPILER_BASELINE_BASELINE_STUB_CSIGNS_H 58