!8214 skip try catch compile in jit

Merge pull request !8214 from zoumujia/trycatchjit
This commit is contained in:
openharmony_ci 2024-07-18 02:45:10 +00:00 committed by Gitee
commit b7fa81a4c6
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 22 additions and 4 deletions

View File

@ -21,6 +21,8 @@
#include "ecmascript/compiler/aot_file/func_entry_des.h"
#include "ecmascript/dfx/vmstat/jit_warmup_profiler.h"
#include "ecmascript/ic/profile_type_info.h"
#include "libpandafile/code_data_accessor-inl.h"
#include "libpandafile/method_data_accessor-inl.h"
namespace panda::ecmascript {
void (*Jit::initJitCompiler_)(JSRuntimeOptions options) = nullptr;
@ -172,8 +174,22 @@ Jit::~Jit()
{
}
bool Jit::SupportJIT(const Method *method) const
bool Jit::MethodHasTryCatch(const JSPandaFile *jsPandaFile, const MethodLiteral *methodLiteral) const
{
auto pf = jsPandaFile->GetPandaFile();
panda_file::MethodDataAccessor mda(*pf, methodLiteral->GetMethodId());
panda_file::CodeDataAccessor cda(*pf, mda.GetCodeId().value());
return cda.GetTriesSize() != 0;
}
bool Jit::SupportJIT(const Method *method, EcmaVM *vm) const
{
const JSPandaFile* jSPandaFile_ = method->GetJSPandaFile();
MethodLiteral* methodLiteral_ = method->GetMethodLiteral();
if (!vm->GetJSOptions().IsEnableTryCatchFunction() && MethodHasTryCatch(jSPandaFile_, methodLiteral_)) {
return false;
}
FunctionKind kind = method->GetFunctionKind();
switch (kind) {
case FunctionKind::NORMAL_FUNCTION:
@ -283,7 +299,7 @@ void Jit::Compile(EcmaVM *vm, JSHandle<JSFunction> &jsFunction, CompilerTier tie
return;
}
bool isJSSharedFunction = jsFunction.GetTaggedValue().IsJSSharedFunction();
if (!jit->SupportJIT(method) || isJSSharedFunction) {
if (!jit->SupportJIT(method, vm) || isJSSharedFunction) {
FunctionKind kind = method->GetFunctionKind();
std::stringstream msgStr;
msgStr << "method does not support jit:" << methodInfo << ", kind:" << static_cast<int>(kind)

View File

@ -69,6 +69,7 @@ public:
void Destroy();
void CheckMechineCodeSpaceMemory(JSThread *thread, int remainSize);
void ChangeTaskPoolState(bool inBackground);
bool MethodHasTryCatch(const JSPandaFile *jsPandaFile, const MethodLiteral *methodLiteral) const;
// dfx for jit warmup compile
static void CountInterpExecFuncs(JSHandle<JSFunction> &jsFunction);
@ -200,7 +201,7 @@ public:
};
private:
bool SupportJIT(const Method *method) const;
bool SupportJIT(const Method *method, EcmaVM *vm) const;
bool initialized_ { false };
bool fastJitEnable_ { false };
bool baselineJitEnable_ { false };

View File

@ -4586,7 +4586,8 @@ template("host_jit_test_action") {
" --asm-interpreter=true" + " --compiler-enable-jit=true" +
" --compiler-enable-jit-pgo=true" +
" --compiler-jit-hotness-threshold=5" + " --enable-pgo-profiler=true" +
" --compiler-enable-litecg=true" + " --entry-point=${_target_name_} "
" --compiler-enable-litecg=true" + " --entry-point=${_target_name_} " +
" --compiler-try-catch-function=true"
_jit_run_options_ += common_options
if (defined(invoker.enable_osr) && invoker.enable_osr) {