mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-11-24 02:30:03 +00:00
Remove unused framework abc variables
Signed-off-by: g00416891 <guobingbing3@huawei.com> Change-Id: Ifa7a18bfd4d36ff7d9140c30bcc45064d3bf5f27
This commit is contained in:
parent
5e3e241a38
commit
1e7481bba8
@ -147,8 +147,6 @@ EcmaVM::EcmaVM(JSRuntimeOptions options, EcmaParamConfiguration config)
|
||||
options_ = std::move(options);
|
||||
icEnabled_ = options_.EnableIC();
|
||||
optionalLogEnabled_ = options_.EnableOptionalLog();
|
||||
snapshotFileName_ = options_.GetSnapshotFile().c_str();
|
||||
frameworkAbcFileName_ = options_.GetFrameworkAbcFile().c_str();
|
||||
options_.ParseAsmInterOption();
|
||||
}
|
||||
|
||||
@ -445,15 +443,8 @@ JSTaggedValue EcmaVM::ExecuteAot(size_t actualNumArgs, JSTaggedType *args, const
|
||||
Expected<JSTaggedValue, bool> EcmaVM::InvokeEcmaEntrypoint(const JSPandaFile *jsPandaFile, std::string_view entryPoint,
|
||||
bool excuteFromJob)
|
||||
{
|
||||
JSTaggedValue result;
|
||||
[[maybe_unused]] EcmaHandleScope scope(thread_);
|
||||
JSHandle<Program> program;
|
||||
if (jsPandaFile != frameworkPandaFile_) {
|
||||
program = JSPandaFileManager::GetInstance()->GenerateProgram(this, jsPandaFile, entryPoint);
|
||||
} else {
|
||||
program = JSHandle<Program>(thread_, frameworkProgram_);
|
||||
frameworkProgram_ = JSTaggedValue::Hole();
|
||||
}
|
||||
JSHandle<Program> program = JSPandaFileManager::GetInstance()->GenerateProgram(this, jsPandaFile, entryPoint);
|
||||
if (program.IsEmpty()) {
|
||||
LOG_ECMA(ERROR) << "program is empty, invoke entrypoint failed";
|
||||
return Unexpected(false);
|
||||
@ -463,8 +454,9 @@ Expected<JSTaggedValue, bool> EcmaVM::InvokeEcmaEntrypoint(const JSPandaFile *js
|
||||
|
||||
JSHandle<JSFunction> func = JSHandle<JSFunction>(thread_, program->GetMainFunction());
|
||||
JSHandle<JSTaggedValue> global = GlobalEnv::Cast(globalEnv_.GetTaggedObject())->GetJSGlobalObject();
|
||||
JSHandle<JSTaggedValue> undefined = thread_->GlobalConstants()->GetHandledUndefined();
|
||||
if (jsPandaFile->IsModule(entryPoint.data())) {
|
||||
global = JSHandle<JSTaggedValue>(thread_, JSTaggedValue::Undefined());
|
||||
global = undefined;
|
||||
CString moduleName = jsPandaFile->GetJSPandaFileDesc();
|
||||
if (!jsPandaFile->IsBundlePack()) {
|
||||
moduleName = entryPoint.data();
|
||||
@ -478,6 +470,7 @@ Expected<JSTaggedValue, bool> EcmaVM::InvokeEcmaEntrypoint(const JSPandaFile *js
|
||||
func->SetModule(thread_, recordName);
|
||||
}
|
||||
|
||||
JSTaggedValue result;
|
||||
if (aotFileManager_->IsLoadMain(jsPandaFile, entryPoint.data())) {
|
||||
thread_->SetPrintBCOffset(true);
|
||||
EcmaRuntimeStatScope runtimeStatScope(this);
|
||||
@ -486,7 +479,6 @@ Expected<JSTaggedValue, bool> EcmaVM::InvokeEcmaEntrypoint(const JSPandaFile *js
|
||||
if (jsPandaFile->IsCjs(entryPoint.data())) {
|
||||
CJSExecution(func, global, jsPandaFile);
|
||||
} else {
|
||||
JSHandle<JSTaggedValue> undefined = thread_->GlobalConstants()->GetHandledUndefined();
|
||||
EcmaRuntimeCallInfo *info =
|
||||
EcmaInterpreter::NewRuntimeCallInfo(thread_, JSHandle<JSTaggedValue>(func), global, undefined, 0);
|
||||
EcmaRuntimeStatScope runtimeStatScope(this);
|
||||
@ -500,8 +492,7 @@ Expected<JSTaggedValue, bool> EcmaVM::InvokeEcmaEntrypoint(const JSPandaFile *js
|
||||
|
||||
// print exception information
|
||||
if (!excuteFromJob && thread_->HasPendingException()) {
|
||||
auto exception = thread_->GetException();
|
||||
HandleUncaughtException(exception.GetTaggedObject());
|
||||
HandleUncaughtException(thread_->GetException());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -568,7 +559,7 @@ void EcmaVM::CJSExecution(JSHandle<JSFunction> &func, JSHandle<JSTaggedValue> &t
|
||||
if (jsPandaFile->IsBundlePack()) {
|
||||
RequireManager::ResolveCurrentPath(thread_, dirname, filename, jsPandaFile);
|
||||
} else {
|
||||
filename.Update(JSFunction::Cast(func.GetTaggedValue().GetTaggedObject())->GetModule());
|
||||
filename.Update(func->GetModule());
|
||||
ASSERT(filename->IsString());
|
||||
RequireManager::ResolveDirPath(thread_, dirname, filename);
|
||||
}
|
||||
@ -600,8 +591,7 @@ void EcmaVM::CJSExecution(JSHandle<JSFunction> &func, JSHandle<JSTaggedValue> &t
|
||||
|
||||
// print exception information
|
||||
if (thread_->HasPendingException()) {
|
||||
auto exception = thread_->GetException();
|
||||
HandleUncaughtException(exception.GetTaggedObject());
|
||||
HandleUncaughtException(thread_->GetException());
|
||||
}
|
||||
// Collecting module.exports : exports ---> module.exports --->Module._cache
|
||||
RequireManager::CollectExecutedExp(thread_, cjsInfo);
|
||||
@ -640,13 +630,13 @@ void EcmaVM::EnableUserUncaughtErrorHandler()
|
||||
isUncaughtExceptionRegistered_ = true;
|
||||
}
|
||||
|
||||
void EcmaVM::HandleUncaughtException(TaggedObject *exception)
|
||||
void EcmaVM::HandleUncaughtException(JSTaggedValue exception)
|
||||
{
|
||||
if (isUncaughtExceptionRegistered_) {
|
||||
return;
|
||||
}
|
||||
[[maybe_unused]] EcmaHandleScope handleScope(thread_);
|
||||
JSHandle<JSTaggedValue> exceptionHandle(thread_, JSTaggedValue(exception));
|
||||
JSHandle<JSTaggedValue> exceptionHandle(thread_, exception);
|
||||
// if caught exceptionHandle type is JSError
|
||||
thread_->ClearException();
|
||||
if (exceptionHandle->IsJSError()) {
|
||||
@ -829,7 +819,6 @@ void EcmaVM::Iterate(const RootVisitor &v, const RootRangeVisitor &rv)
|
||||
v(Root::ROOT_VM, ObjectSlot(reinterpret_cast<uintptr_t>(&globalEnv_)));
|
||||
v(Root::ROOT_VM, ObjectSlot(reinterpret_cast<uintptr_t>(µJobQueue_)));
|
||||
v(Root::ROOT_VM, ObjectSlot(reinterpret_cast<uintptr_t>(®expCache_)));
|
||||
v(Root::ROOT_VM, ObjectSlot(reinterpret_cast<uintptr_t>(&frameworkProgram_)));
|
||||
rv(Root::ROOT_VM, ObjectSlot(ToUintPtr(&internalNativeMethods_.front())),
|
||||
ObjectSlot(ToUintPtr(&internalNativeMethods_.back()) + JSTaggedValue::TaggedTypeSize()));
|
||||
moduleManager_->Iterate(v);
|
||||
|
@ -591,7 +591,7 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
void HandleUncaughtException(TaggedObject *exception);
|
||||
void HandleUncaughtException(JSTaggedValue exception);
|
||||
|
||||
void PrintJSErrorInfo(const JSHandle<JSTaggedValue> &exceptionInfo);
|
||||
|
||||
@ -655,11 +655,6 @@ private:
|
||||
JSTaggedValue microJobQueue_ {JSTaggedValue::Hole()};
|
||||
EcmaRuntimeStat *runtimeStat_ {nullptr};
|
||||
|
||||
// For framewrok file snapshot.
|
||||
CString snapshotFileName_;
|
||||
CString frameworkAbcFileName_;
|
||||
JSTaggedValue frameworkProgram_ {JSTaggedValue::Hole()};
|
||||
const JSPandaFile *frameworkPandaFile_ {nullptr};
|
||||
CMap<const JSPandaFile *, CMap<int32_t, JSTaggedValue>> cachedConstpools_ {};
|
||||
|
||||
// VM resources.
|
||||
|
@ -138,7 +138,6 @@ bool JSRuntimeOptions::ParseCommand(const int argc, const char **argv)
|
||||
{"enable-type-lowering", required_argument, nullptr, OPTION_ENABLE_TYPE_LOWERING},
|
||||
{"entry-point", required_argument, nullptr, OPTION_ENTRY_POINT},
|
||||
{"force-full-gc", required_argument, nullptr, OPTION_FORCE_FULL_GC},
|
||||
{"framework-abc-file", required_argument, nullptr, OPTION_FRAMEWORK_ABC_FILE},
|
||||
{"gcThreadNum", required_argument, nullptr, OPTION_GC_THREADNUM},
|
||||
{"heap-size-limit", required_argument, nullptr, OPTION_HEAP_SIZE_LIMIT},
|
||||
{"help", no_argument, nullptr, OPTION_HELP},
|
||||
@ -160,7 +159,6 @@ bool JSRuntimeOptions::ParseCommand(const int argc, const char **argv)
|
||||
{"print-any-types", required_argument, nullptr, OPTION_PRINT_ANY_TYPES},
|
||||
{"reloc-mode", required_argument, nullptr, OPTION_RELOCATION_MODE},
|
||||
{"serializer-buffer-size-limit", required_argument, nullptr, OPTION_SERIALIZER_BUFFER_SIZE_LIMIT},
|
||||
{"snapshot-file", required_argument, nullptr, OPTION_SNAPSHOT_FILE},
|
||||
{"startup-time", required_argument, nullptr, OPTION_STARTUP_TIME},
|
||||
{"stub-file", required_argument, nullptr, OPTION_STUB_FILE},
|
||||
{"target-triple", required_argument, nullptr, OPTION_TARGET_TRIPLE},
|
||||
@ -333,9 +331,6 @@ bool JSRuntimeOptions::ParseCommand(const int argc, const char **argv)
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case OPTION_FRAMEWORK_ABC_FILE:
|
||||
SetFrameworkAbcFile(optarg);
|
||||
break;
|
||||
case OPTION_GC_THREADNUM:
|
||||
ret = ParseUint32Param("gcThreadNum", &argUint32);
|
||||
if (ret) {
|
||||
@ -479,9 +474,6 @@ bool JSRuntimeOptions::ParseCommand(const int argc, const char **argv)
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case OPTION_SNAPSHOT_FILE:
|
||||
SetSnapshotFile(optarg);
|
||||
break;
|
||||
case OPTION_STARTUP_TIME:
|
||||
ret = ParseBoolParam(&argBool);
|
||||
if (ret) {
|
||||
|
@ -73,8 +73,6 @@ enum CommandValues {
|
||||
OPTION_SERIALIZER_BUFFER_SIZE_LIMIT,
|
||||
OPTION_HEAP_SIZE_LIMIT,
|
||||
OPTION_ENABLE_IC,
|
||||
OPTION_SNAPSHOT_FILE,
|
||||
OPTION_FRAMEWORK_ABC_FILE,
|
||||
OPTION_ICU_DATA_PATH,
|
||||
OPTION_STARTUP_TIME,
|
||||
OPTION_COMPILER_LOG_OPT,
|
||||
@ -508,36 +506,6 @@ public:
|
||||
return WasOptionSet(OPTION_ENABLE_IC);
|
||||
}
|
||||
|
||||
std::string GetSnapshotFile() const
|
||||
{
|
||||
return snapshotFile_;
|
||||
}
|
||||
|
||||
void SetSnapshotFile(std::string value)
|
||||
{
|
||||
snapshotFile_ = std::move(value);
|
||||
}
|
||||
|
||||
bool WasSetSnapshotFile() const
|
||||
{
|
||||
return WasOptionSet(OPTION_SNAPSHOT_FILE);
|
||||
}
|
||||
|
||||
std::string GetFrameworkAbcFile() const
|
||||
{
|
||||
return frameworkAbcFile_;
|
||||
}
|
||||
|
||||
void SetFrameworkAbcFile(std::string value)
|
||||
{
|
||||
frameworkAbcFile_ = std::move(value);
|
||||
}
|
||||
|
||||
bool WasSetFrameworkAbcFile() const
|
||||
{
|
||||
return WasOptionSet(OPTION_FRAMEWORK_ABC_FILE);
|
||||
}
|
||||
|
||||
std::string GetIcuDataPath() const
|
||||
{
|
||||
return icuDataPath_;
|
||||
@ -879,8 +847,6 @@ private:
|
||||
uint64_t serializerBufferSizeLimit_ {2_GB};
|
||||
uint32_t heapSizeLimit_ {512_MB};
|
||||
bool enableIC_ {true};
|
||||
std::string snapshotFile_ {"/system/etc/snapshot"};
|
||||
std::string frameworkAbcFile_ {"strip.native.min.abc"};
|
||||
std::string icuDataPath_ {"default"};
|
||||
bool startupTime_ {false};
|
||||
std::string compilerLogOpt_ {"none"};
|
||||
|
@ -201,11 +201,11 @@ MethodLiteral *JSPandaFile::FindMethodLiteral(uint32_t offset) const
|
||||
bool JSPandaFile::IsModule(const CString &recordName) const
|
||||
{
|
||||
if (IsBundlePack()) {
|
||||
return jsRecordInfo_.begin()->second.moduleRecordIdx == -1 ? false : true;
|
||||
return jsRecordInfo_.begin()->second.moduleRecordIdx != -1;
|
||||
}
|
||||
auto info = jsRecordInfo_.find(recordName);
|
||||
if (info != jsRecordInfo_.end()) {
|
||||
return info->second.moduleRecordIdx == -1 ? false : true;
|
||||
return info->second.moduleRecordIdx != -1;
|
||||
}
|
||||
LOG_FULL(FATAL) << "find entryPoint failed: " << recordName;
|
||||
UNREACHABLE();
|
||||
|
@ -59,8 +59,8 @@ Expected<JSTaggedValue, bool> JSPandaFileExecutor::ExecuteFromFile(JSThread *thr
|
||||
entry = entryPoint.data();
|
||||
}
|
||||
|
||||
const JSPandaFile *jsPandaFile = JSPandaFileManager::GetInstance()->LoadJSPandaFile(thread, name, entry.c_str(),
|
||||
needUpdate);
|
||||
const JSPandaFile *jsPandaFile =
|
||||
JSPandaFileManager::GetInstance()->LoadJSPandaFile(thread, name, entry.c_str(), needUpdate);
|
||||
if (jsPandaFile == nullptr) {
|
||||
return Unexpected(false);
|
||||
}
|
||||
@ -83,11 +83,11 @@ Expected<JSTaggedValue, bool> JSPandaFileExecutor::ExecuteFromFile(JSThread *thr
|
||||
SourceTextModule::Instantiate(thread, moduleRecord);
|
||||
if (thread->HasPendingException()) {
|
||||
if (!excuteFromJob) {
|
||||
auto exception = thread->GetException();
|
||||
vm->HandleUncaughtException(exception.GetTaggedObject());
|
||||
vm->HandleUncaughtException(thread->GetException());
|
||||
}
|
||||
return JSTaggedValue::Undefined();
|
||||
}
|
||||
|
||||
moduleRecord->SetStatus(ModuleStatus::INSTANTIATED);
|
||||
SourceTextModule::Evaluate(thread, moduleRecord, nullptr, 0, excuteFromJob);
|
||||
return JSTaggedValue::Undefined();
|
||||
@ -105,6 +105,7 @@ Expected<JSTaggedValue, bool> JSPandaFileExecutor::ExecuteFromBuffer(JSThread *t
|
||||
if (jsPandaFile == nullptr) {
|
||||
return Unexpected(false);
|
||||
}
|
||||
|
||||
CString entry = entryPoint.data();
|
||||
bool isModule = jsPandaFile->IsModule(entry);
|
||||
bool isBundle = jsPandaFile->IsBundlePack();
|
||||
@ -162,8 +163,7 @@ Expected<JSTaggedValue, bool> JSPandaFileExecutor::CommonExecuteBuffer(JSThread
|
||||
}
|
||||
SourceTextModule::Instantiate(thread, moduleRecord);
|
||||
if (thread->HasPendingException()) {
|
||||
auto exception = thread->GetException();
|
||||
vm->HandleUncaughtException(exception.GetTaggedObject());
|
||||
vm->HandleUncaughtException(thread->GetException());
|
||||
return JSTaggedValue::Undefined();
|
||||
}
|
||||
moduleRecord->SetStatus(ModuleStatus::INSTANTIATED);
|
||||
|
@ -16,7 +16,6 @@
|
||||
#ifndef ECMASCRIPT_JSPANDAFILE_JS_PANDAFILE_EXECUTOR_H
|
||||
#define ECMASCRIPT_JSPANDAFILE_JS_PANDAFILE_EXECUTOR_H
|
||||
|
||||
#include "ecmascript/mem/c_containers.h"
|
||||
#include "ecmascript/js_tagged_value.h"
|
||||
#include "ecmascript/js_thread.h"
|
||||
#include "ecmascript/jspandafile/js_pandafile.h"
|
||||
|
@ -120,8 +120,7 @@ JSHandle<Program> JSPandaFileManager::GenerateProgram(
|
||||
{
|
||||
ASSERT(GetJSPandaFile(jsPandaFile->GetPandaFile()) != nullptr);
|
||||
vm->GetAOTFileManager()->LoadAiFile(jsPandaFile);
|
||||
JSHandle<Program> program = PandaFileTranslator::GenerateProgram(vm, jsPandaFile, entryPoint);
|
||||
return program;
|
||||
return PandaFileTranslator::GenerateProgram(vm, jsPandaFile, entryPoint);
|
||||
}
|
||||
|
||||
const JSPandaFile *JSPandaFileManager::FindJSPandaFileWithChecksum(const CString &filename, uint32_t checksum)
|
||||
|
@ -2730,8 +2730,7 @@ bool JSNApi::InitForConcurrentFunction(EcmaVM *vm, Local<JSValueRef> function)
|
||||
}
|
||||
ecmascript::SourceTextModule::Instantiate(thread, moduleRecord);
|
||||
if (thread->HasPendingException()) {
|
||||
auto exception = thread->GetException();
|
||||
vm->HandleUncaughtException(exception.GetTaggedObject());
|
||||
vm->HandleUncaughtException(thread->GetException());
|
||||
return false;
|
||||
}
|
||||
moduleRecord->SetStatus(ecmascript::ModuleStatus::INSTANTIATED);
|
||||
|
Loading…
Reference in New Issue
Block a user