Move load AOT and Snapshot file after builtins initialized

Description:Load AOT and Snapshot file after builtins initialized
ISSUE:https://gitee.com/openharmony/ark_js_runtime/issues/I571GL

Signed-off-by: dingwen <dingwen6@huawei.com>
Change-Id: Icd509469da3b8bad955cbba40bd1b7fe0fcc0a4c
This commit is contained in:
dingwen 2022-05-12 10:23:24 +08:00
parent 491482c043
commit b10ba05de9

View File

@ -159,17 +159,6 @@ bool EcmaVM::Initialize()
GlobalEnv::SIZE,
JSType::GLOBAL_ENV);
globalConst->InitRootsClass(thread_, *dynClassClassHandle);
tsLoader_ = new TSLoader(this);
snapshotEnv_ = new SnapshotEnv(this);
aotInfo_ = new AotCodeInfo();
if (options_.EnableStubAot()) {
LoadStubs();
}
if (options_.EnableTSAot()) {
TryLoadSnapshotFile();
std::string file = options_.GetAOTOutputFile();
LoadAOTFile(file);
}
globalConst->InitGlobalConstant(thread_);
JSHandle<GlobalEnv> globalEnv = factory_->NewGlobalEnv(*globalEnvClass);
globalEnv->Init(thread_);
@ -181,6 +170,17 @@ bool EcmaVM::Initialize()
thread_->SetGlobalObject(GetGlobalEnv()->GetGlobalObject());
moduleManager_ = new ModuleManager(this);
debuggerManager_->Initialize();
tsLoader_ = new TSLoader(this);
snapshotEnv_ = new SnapshotEnv(this);
aotInfo_ = new AotCodeInfo();
if (options_.EnableStubAot()) {
LoadStubs();
}
if (options_.EnableTSAot()) {
TryLoadSnapshotFile();
std::string file = options_.GetAOTOutputFile();
LoadAOTFile(file);
}
InitializeFinish();
return true;
}