From 9570d89dfc387c9824353268c06a3f46046c0f17 Mon Sep 17 00:00:00 2001 From: Ishin Pavel Date: Tue, 18 Oct 2022 11:55:45 +0300 Subject: [PATCH] Fix GlobalDictionary::GetSafeBox and disable compilation for eval call Signed-off-by: Ishin Pavel --- runtime/global_dictionary-inl.h | 2 +- runtime/js_eval.cpp | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/runtime/global_dictionary-inl.h b/runtime/global_dictionary-inl.h index ca6f553ee..566c062c2 100644 --- a/runtime/global_dictionary-inl.h +++ b/runtime/global_dictionary-inl.h @@ -55,7 +55,7 @@ PropertyBox *GlobalDictionary::GetSafeBox(int entry) const if (!val.IsHeapObject()) { return nullptr; } - return PropertyBox::Cast(Get(index).GetTaggedObject()); + return PropertyBox::Cast(val.GetTaggedObject()); } JSTaggedValue GlobalDictionary::GetValue(int entry) const diff --git a/runtime/js_eval.cpp b/runtime/js_eval.cpp index 4ce5155b2..2936f822b 100644 --- a/runtime/js_eval.cpp +++ b/runtime/js_eval.cpp @@ -56,6 +56,15 @@ JSTaggedValue EvalUtils::GetEvaluatedScript(JSThread *thread, const JSHandleGetInvocableFunction(*pandaFile, "func_main_0"); ASSERT(resolveFunc.HasValue()); + JSHandle func(thread, resolveFunc.Value()); + // For DirectEval, functions in envirement and in arguments are different. + // Compiled code use function form the parameter for creating envirement. + // So we temporary disable compilation for eval calls. + auto method = func->GetCallTarget(); + ASSERT(method->GetCompilationStatus() == Method::NOT_COMPILED); + method->AtomicSetCompilationStatus(Method::NOT_COMPILED, Method::FAILED); + ASSERT(method->GetCompilationStatus() == Method::FAILED); + return resolveFunc.Value(); } -- Gitee