mirror of
https://github.com/openharmony/ark_js_runtime.git
synced 2026-08-27 20:40:01 -04:00
bf8671a948
There are many similar "call" in the CircuitBuilder and most of them can be merged or removed. Merge the similar ones and remove the redundant ones to improve the maintainability and readability. Issue:https://gitee.com/openharmony/ark_js_runtime/issues/I57GSO Signed-off-by: wuzhefeng <wuzhefeng1@huawei.com> Change-Id: Ie575580a5d4d3eae67eff49efd8df126d96db48f
52 lines
2.0 KiB
C++
52 lines
2.0 KiB
C++
/*
|
|
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
#include "ecmascript/compiler/rt_call_signature.h"
|
|
#include "ecmascript/compiler/call_signature.h"
|
|
#include "ecmascript/compiler/assembler_module.h"
|
|
#include "ecmascript/stubs/runtime_stubs.h"
|
|
|
|
namespace panda::ecmascript::kungfu {
|
|
CallSignature RuntimeStubCSigns::callSigns_[RuntimeStubCSigns::NUM_OF_RTSTUBS_WITHOUT_GC];
|
|
|
|
void RuntimeStubCSigns::Initialize()
|
|
{
|
|
#define INIT_SIGNATURES(name) \
|
|
name##CallSignature::Initialize(&callSigns_[ID_##name]); \
|
|
callSigns_[ID_##name].SetID(ID_##name); \
|
|
assert(callSigns_[ID_##name].IsRuntimeNGCStub() || \
|
|
callSigns_[ID_##name].IsRuntimeStub() || \
|
|
callSigns_[ID_##name].IsRuntimeVAStub());
|
|
RUNTIME_STUB_WITHOUT_GC_LIST(INIT_SIGNATURES)
|
|
#undef INIT_SIGNATURES
|
|
|
|
#define INIT_ASM_SIGNATURES(name) \
|
|
callSigns_[RuntimeStubCSigns::ID_##name].SetConstructor( \
|
|
[]([[maybe_unused]]void* arg) { \
|
|
return static_cast<void*>(new name##Stub()); \
|
|
});
|
|
RUNTIME_ASM_STUB_LIST(INIT_ASM_SIGNATURES)
|
|
#undef INIT_ASM_SIGNATURES
|
|
}
|
|
|
|
void RuntimeStubCSigns::GetASMCSigns(std::vector<const CallSignature*>& outputCallSigns)
|
|
{
|
|
#define INIT_ASM_SIGNATURES(name) \
|
|
outputCallSigns.push_back(&callSigns_[RuntimeStubCSigns::ID_##name]);
|
|
|
|
RUNTIME_ASM_STUB_LIST(INIT_ASM_SIGNATURES)
|
|
#undef INIT_ASM_SIGNATURES
|
|
}
|
|
} // namespace panda::ecmascript::kungfu
|