2022-02-06 15:16:08 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2022 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.
|
|
|
|
*/
|
|
|
|
|
2022-02-28 07:04:37 +00:00
|
|
|
#ifndef ECMASCRIPT_JSPANDAFILE_JS_PANDAFILE_H
|
|
|
|
#define ECMASCRIPT_JSPANDAFILE_JS_PANDAFILE_H
|
2022-02-06 15:16:08 +00:00
|
|
|
|
2022-04-16 09:32:42 +00:00
|
|
|
#include "ecmascript/common.h"
|
2022-06-16 09:27:35 +00:00
|
|
|
#include "ecmascript/js_function.h"
|
2022-02-28 07:04:37 +00:00
|
|
|
#include "ecmascript/jspandafile/constpool_value.h"
|
2022-08-16 13:05:02 +00:00
|
|
|
#include "ecmascript/jspandafile/method_literal.h"
|
2022-03-10 09:02:04 +00:00
|
|
|
#include "ecmascript/mem/c_containers.h"
|
2022-07-23 10:33:33 +00:00
|
|
|
|
2023-04-12 02:41:30 +00:00
|
|
|
#include "libpandafile/file-inl.h"
|
2022-11-15 08:25:33 +00:00
|
|
|
#include "libpandafile/file_items.h"
|
2023-02-08 01:47:52 +00:00
|
|
|
#include "libpandafile/literal_data_accessor.h"
|
2022-12-03 14:03:40 +00:00
|
|
|
|
2022-02-06 15:16:08 +00:00
|
|
|
namespace panda {
|
|
|
|
namespace ecmascript {
|
|
|
|
class JSPandaFile {
|
|
|
|
public:
|
2022-08-30 12:52:16 +00:00
|
|
|
struct JSRecordInfo {
|
|
|
|
uint32_t mainMethodIndex {0};
|
|
|
|
bool isCjs {false};
|
2022-12-26 08:05:37 +00:00
|
|
|
bool isJson {false};
|
|
|
|
int jsonStringId {-1};
|
2022-11-15 03:05:29 +00:00
|
|
|
CUnorderedSet<const EcmaVM *> vmListOfParsedConstPool;
|
2022-08-30 12:52:16 +00:00
|
|
|
int moduleRecordIdx {-1};
|
2022-09-06 02:19:13 +00:00
|
|
|
CUnorderedMap<uint32_t, uint64_t> constpoolMap;
|
2022-10-20 03:08:39 +00:00
|
|
|
bool hasTSTypes {false};
|
|
|
|
uint32_t typeSummaryOffset {0};
|
2022-12-01 03:13:10 +00:00
|
|
|
CString npmPackageName;
|
2022-11-15 03:05:29 +00:00
|
|
|
|
|
|
|
void SetParsedConstpoolVM(const EcmaVM *vm)
|
|
|
|
{
|
|
|
|
vmListOfParsedConstPool.insert(vm);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool IsParsedConstpoolOfCurrentVM(const EcmaVM *vm) const
|
|
|
|
{
|
|
|
|
auto iter = vmListOfParsedConstPool.find(vm);
|
|
|
|
if (iter != vmListOfParsedConstPool.end()) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
2022-08-30 12:52:16 +00:00
|
|
|
};
|
2022-04-18 04:39:12 +00:00
|
|
|
static constexpr char ENTRY_FUNCTION_NAME[] = "func_main_0";
|
|
|
|
static constexpr char ENTRY_MAIN_FUNCTION[] = "_GLOBAL::func_main_0";
|
2022-11-15 08:25:33 +00:00
|
|
|
static constexpr char PATCH_MAIN_FUNCTION[] = "_GLOBAL::patch_main_0";
|
2022-09-09 03:49:20 +00:00
|
|
|
static constexpr char PATCH_FUNCTION_NAME_0[] = "patch_main_0";
|
|
|
|
static constexpr char PATCH_FUNCTION_NAME_1[] = "patch_main_1";
|
2022-08-27 03:52:15 +00:00
|
|
|
|
2022-04-18 04:39:12 +00:00
|
|
|
static constexpr char MODULE_CLASS[] = "L_ESModuleRecord;";
|
2022-06-08 02:59:06 +00:00
|
|
|
static constexpr char COMMONJS_CLASS[] = "L_CommonJsRecord;";
|
2022-04-18 04:39:12 +00:00
|
|
|
static constexpr char TYPE_FLAG[] = "typeFlag";
|
2022-09-30 02:00:06 +00:00
|
|
|
static constexpr char TYPE_SUMMARY_OFFSET[] = "typeSummaryOffset";
|
2022-08-31 10:21:38 +00:00
|
|
|
|
2022-08-30 12:52:16 +00:00
|
|
|
static constexpr char IS_COMMON_JS[] = "isCommonjs";
|
2022-12-26 08:05:37 +00:00
|
|
|
static constexpr char IS_JSON_CONTENT[] = "jsonFileContent";
|
2022-08-30 12:52:16 +00:00
|
|
|
static constexpr char MODULE_RECORD_IDX[] = "moduleRecordIdx";
|
2022-12-01 03:13:10 +00:00
|
|
|
static constexpr char PACKAGE_NAME[] = "pkgName@";
|
2023-02-01 03:27:49 +00:00
|
|
|
static constexpr char MERGE_ABC_NAME[] = "modules.abc";
|
|
|
|
static constexpr char NPM_PATH_SEGMENT[] = "node_modules";
|
2023-02-02 08:08:18 +00:00
|
|
|
static constexpr char PACKAGE_PATH_SEGMENT[] = "pkg_modules";
|
2023-02-01 03:27:49 +00:00
|
|
|
static constexpr char BUNDLE_INSTALL_PATH[] = "/data/storage/el1/bundle/";
|
2022-12-01 03:13:10 +00:00
|
|
|
static constexpr int PACKAGE_NAME_LEN = 8;
|
2023-02-10 01:39:14 +00:00
|
|
|
static constexpr int TYPE_SUMMARY_OFFSET_NOT_FOUND = 0;
|
2022-04-18 04:39:12 +00:00
|
|
|
|
2022-10-09 10:01:37 +00:00
|
|
|
JSPandaFile(const panda_file::File *pf, const CString &descriptor);
|
2022-02-06 15:16:08 +00:00
|
|
|
~JSPandaFile();
|
|
|
|
|
2022-03-31 15:38:07 +00:00
|
|
|
const CString &GetJSPandaFileDesc() const
|
2022-02-06 15:16:08 +00:00
|
|
|
{
|
|
|
|
return desc_;
|
|
|
|
}
|
|
|
|
|
2022-12-13 07:01:05 +00:00
|
|
|
uint32_t GetChecksum() const
|
|
|
|
{
|
|
|
|
return checksum_;
|
|
|
|
}
|
|
|
|
|
2022-02-06 15:16:08 +00:00
|
|
|
const panda_file::File *GetPandaFile() const
|
|
|
|
{
|
|
|
|
return pf_;
|
|
|
|
}
|
|
|
|
|
2022-09-22 15:53:58 +00:00
|
|
|
std::string GetFileName() const
|
|
|
|
{
|
|
|
|
return pf_->GetFilename();
|
|
|
|
}
|
|
|
|
|
2022-08-23 01:56:32 +00:00
|
|
|
MethodLiteral* GetMethodLiterals() const
|
2022-02-06 15:16:08 +00:00
|
|
|
{
|
2022-08-23 01:56:32 +00:00
|
|
|
return methodLiterals_;
|
2022-02-06 15:16:08 +00:00
|
|
|
}
|
|
|
|
|
2022-08-27 03:52:15 +00:00
|
|
|
void SetMethodLiteralToMap(MethodLiteral *methodLiteral)
|
2022-03-10 09:02:04 +00:00
|
|
|
{
|
2022-12-28 03:22:56 +00:00
|
|
|
ASSERT(methodLiteral != nullptr);
|
|
|
|
methodLiteralMap_.emplace(methodLiteral->GetMethodId().GetOffset(), methodLiteral);
|
2022-03-10 09:02:04 +00:00
|
|
|
}
|
|
|
|
|
2022-08-27 03:52:15 +00:00
|
|
|
const CUnorderedMap<uint32_t, MethodLiteral *> &GetMethodLiteralMap() const
|
|
|
|
{
|
|
|
|
return methodLiteralMap_;
|
|
|
|
}
|
|
|
|
|
2022-02-06 15:16:08 +00:00
|
|
|
uint32_t GetNumMethods() const
|
|
|
|
{
|
|
|
|
return numMethods_;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t GetConstpoolIndex() const
|
|
|
|
{
|
|
|
|
return constpoolIndex_;
|
|
|
|
}
|
|
|
|
|
2022-08-30 12:52:16 +00:00
|
|
|
uint32_t GetMainMethodIndex(const CString &recordName = ENTRY_FUNCTION_NAME) const
|
2022-02-06 15:16:08 +00:00
|
|
|
{
|
2022-09-09 08:44:33 +00:00
|
|
|
if (IsBundlePack()) {
|
|
|
|
return jsRecordInfo_.begin()->second.mainMethodIndex;
|
|
|
|
}
|
2022-08-30 12:52:16 +00:00
|
|
|
auto info = jsRecordInfo_.find(recordName);
|
|
|
|
if (info != jsRecordInfo_.end()) {
|
|
|
|
return info->second.mainMethodIndex;
|
|
|
|
}
|
2022-11-14 11:28:35 +00:00
|
|
|
LOG_ECMA(ERROR) << "can not get main method index: " << recordName;
|
2022-08-30 12:52:16 +00:00
|
|
|
return 0;
|
2022-02-06 15:16:08 +00:00
|
|
|
}
|
|
|
|
|
2022-09-22 04:04:15 +00:00
|
|
|
const CUnorderedMap<uint32_t, uint64_t> *GetConstpoolMapByReocrd(const CString &recordName) const
|
2022-02-06 15:16:08 +00:00
|
|
|
{
|
2022-09-06 02:19:13 +00:00
|
|
|
auto info = jsRecordInfo_.find(recordName);
|
|
|
|
if (info != jsRecordInfo_.end()) {
|
2022-09-22 04:04:15 +00:00
|
|
|
return &info->second.constpoolMap;
|
2022-09-06 02:19:13 +00:00
|
|
|
}
|
2022-10-12 09:22:34 +00:00
|
|
|
LOG_FULL(FATAL) << "find entryPoint failed: " << recordName;
|
2022-09-06 14:50:58 +00:00
|
|
|
UNREACHABLE();
|
2022-02-06 15:16:08 +00:00
|
|
|
}
|
|
|
|
|
2022-09-22 04:04:15 +00:00
|
|
|
const CUnorderedMap<uint32_t, uint64_t> &GetConstpoolMap() const
|
|
|
|
{
|
|
|
|
return constpoolMap_;
|
|
|
|
}
|
|
|
|
|
2022-09-06 02:19:13 +00:00
|
|
|
uint32_t PUBLIC_API GetOrInsertConstantPool(ConstPoolType type, uint32_t offset,
|
2022-09-22 04:04:15 +00:00
|
|
|
const CUnorderedMap<uint32_t, uint64_t> *constpoolMap = nullptr);
|
2022-02-06 15:16:08 +00:00
|
|
|
|
2022-08-30 12:52:16 +00:00
|
|
|
void UpdateMainMethodIndex(uint32_t mainMethodIndex, const CString &recordName = ENTRY_FUNCTION_NAME)
|
2022-02-06 15:16:08 +00:00
|
|
|
{
|
2022-09-09 08:44:33 +00:00
|
|
|
if (IsBundlePack()) {
|
|
|
|
jsRecordInfo_.begin()->second.mainMethodIndex = mainMethodIndex;
|
|
|
|
} else {
|
|
|
|
auto info = jsRecordInfo_.find(recordName);
|
|
|
|
if (info != jsRecordInfo_.end()) {
|
|
|
|
info->second.mainMethodIndex = mainMethodIndex;
|
|
|
|
}
|
2022-08-30 12:52:16 +00:00
|
|
|
}
|
2022-02-06 15:16:08 +00:00
|
|
|
}
|
|
|
|
|
2022-09-05 09:12:02 +00:00
|
|
|
PUBLIC_API MethodLiteral *FindMethodLiteral(uint32_t offset) const;
|
2022-02-06 15:16:08 +00:00
|
|
|
|
2022-08-30 12:52:16 +00:00
|
|
|
int GetModuleRecordIdx(const CString &recordName = ENTRY_FUNCTION_NAME) const
|
2022-08-26 12:40:41 +00:00
|
|
|
{
|
2022-09-09 08:44:33 +00:00
|
|
|
if (IsBundlePack()) {
|
|
|
|
return jsRecordInfo_.begin()->second.moduleRecordIdx;
|
|
|
|
}
|
2022-08-30 12:52:16 +00:00
|
|
|
auto info = jsRecordInfo_.find(recordName);
|
|
|
|
if (info != jsRecordInfo_.end()) {
|
|
|
|
return info->second.moduleRecordIdx;
|
|
|
|
}
|
|
|
|
// The array subscript will not have a negative number, and returning -1 means the search failed
|
|
|
|
return -1;
|
2022-08-26 12:40:41 +00:00
|
|
|
}
|
2022-02-06 15:16:08 +00:00
|
|
|
|
|
|
|
Span<const uint32_t> GetClasses() const
|
|
|
|
{
|
|
|
|
return pf_->GetClasses();
|
|
|
|
}
|
|
|
|
|
2022-12-03 14:03:40 +00:00
|
|
|
inline bool IsExternal(panda_file::File::EntityId id) const
|
|
|
|
{
|
|
|
|
return pf_->IsExternal(id);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline panda_file::File::StringData GetStringData(panda_file::File::EntityId id) const
|
|
|
|
{
|
|
|
|
return pf_->GetStringData(id);
|
|
|
|
}
|
|
|
|
|
|
|
|
panda_file::File::EntityId ResolveMethodIndex(panda_file::File::EntityId id, uint16_t idx) const
|
|
|
|
{
|
|
|
|
return pf_->ResolveMethodIndex(id, idx);
|
|
|
|
}
|
|
|
|
|
2023-02-08 01:47:52 +00:00
|
|
|
panda_file::LiteralDataAccessor GetLiteralDataAccessor() const
|
2022-12-03 14:03:40 +00:00
|
|
|
{
|
2023-02-08 01:47:52 +00:00
|
|
|
EntityId literalArraysId = pf_->GetLiteralArraysId();
|
|
|
|
panda_file::LiteralDataAccessor lda(*pf_, literalArraysId);
|
|
|
|
return lda;
|
2022-12-03 14:03:40 +00:00
|
|
|
}
|
|
|
|
|
2023-02-16 12:28:51 +00:00
|
|
|
uint32_t GetConstpoolNum() const
|
|
|
|
{
|
|
|
|
return pf_->GetHeader()->num_indexes;
|
|
|
|
}
|
|
|
|
|
2022-12-03 14:03:40 +00:00
|
|
|
Span<const panda_file::File::EntityId> GetMethodIndex(const panda_file::File::IndexHeader *indexHeader) const
|
|
|
|
{
|
|
|
|
return pf_->GetMethodIndex(indexHeader);
|
|
|
|
}
|
|
|
|
|
|
|
|
const void *GetHeader() const
|
|
|
|
{
|
|
|
|
return static_cast<const void *>(pf_->GetHeader());
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t GetFileSize() const
|
|
|
|
{
|
|
|
|
return pf_->GetHeader()->file_size;
|
|
|
|
}
|
|
|
|
|
2023-04-06 14:10:18 +00:00
|
|
|
bool PUBLIC_API IsModule(JSThread *thread, const CString &recordName = ENTRY_FUNCTION_NAME,
|
|
|
|
CString fullRecordName = "") const;
|
2022-01-30 08:01:33 +00:00
|
|
|
|
2023-01-17 13:01:22 +00:00
|
|
|
bool IsCjs(JSThread *thread, const CString &recordName = ENTRY_FUNCTION_NAME) const;
|
2022-01-30 08:01:33 +00:00
|
|
|
|
2022-12-26 08:05:37 +00:00
|
|
|
bool IsJson(JSThread *thread, const CString &recordName = ENTRY_FUNCTION_NAME) const;
|
|
|
|
|
2023-01-09 07:19:40 +00:00
|
|
|
CString GetJsonStringId(JSThread *thread, const CString &recordName = ENTRY_FUNCTION_NAME) const;
|
2022-12-26 08:05:37 +00:00
|
|
|
|
2022-09-09 08:44:33 +00:00
|
|
|
bool IsBundlePack() const
|
2022-08-26 12:40:41 +00:00
|
|
|
{
|
2022-09-09 08:44:33 +00:00
|
|
|
return isBundlePack_;
|
2022-08-26 12:40:41 +00:00
|
|
|
}
|
2022-06-08 02:59:06 +00:00
|
|
|
|
2022-06-08 06:43:48 +00:00
|
|
|
bool IsLoadedAOT() const
|
|
|
|
{
|
2022-12-05 14:55:52 +00:00
|
|
|
return (anFileInfoIndex_ != INVALID_INDEX);
|
2022-06-08 06:43:48 +00:00
|
|
|
}
|
|
|
|
|
2022-06-16 03:21:48 +00:00
|
|
|
uint32_t GetFileUniqId() const
|
|
|
|
{
|
|
|
|
return static_cast<uint32_t>(GetPandaFile()->GetUniqId());
|
|
|
|
}
|
2022-06-16 09:27:35 +00:00
|
|
|
|
2022-08-26 12:40:41 +00:00
|
|
|
bool IsNewVersion() const
|
|
|
|
{
|
|
|
|
return isNewVersion_;
|
|
|
|
}
|
|
|
|
|
2022-08-30 12:52:16 +00:00
|
|
|
bool HasRecord(const CString &recordName) const
|
|
|
|
{
|
2023-01-09 07:19:40 +00:00
|
|
|
return jsRecordInfo_.find(recordName) != jsRecordInfo_.end();
|
2022-08-30 12:52:16 +00:00
|
|
|
}
|
2022-09-09 08:44:33 +00:00
|
|
|
|
2022-11-15 03:05:29 +00:00
|
|
|
JSRecordInfo &FindRecordInfo(const CString &recordName)
|
2022-09-17 06:19:16 +00:00
|
|
|
{
|
|
|
|
auto info = jsRecordInfo_.find(recordName);
|
|
|
|
if (info == jsRecordInfo_.end()) {
|
2022-10-12 09:22:34 +00:00
|
|
|
LOG_FULL(FATAL) << "find recordName failed: " << recordName;
|
2022-09-17 06:19:16 +00:00
|
|
|
UNREACHABLE();
|
|
|
|
}
|
2022-10-12 09:22:34 +00:00
|
|
|
return info->second;
|
2022-09-17 06:19:16 +00:00
|
|
|
}
|
|
|
|
|
2022-10-12 09:22:34 +00:00
|
|
|
// note : it only uses in TDD
|
|
|
|
void InsertJSRecordInfo(const CString &recordName)
|
2022-09-17 06:19:16 +00:00
|
|
|
{
|
2022-10-12 09:22:34 +00:00
|
|
|
JSRecordInfo info;
|
|
|
|
jsRecordInfo_.insert({recordName, info});
|
2022-09-17 06:19:16 +00:00
|
|
|
}
|
|
|
|
|
2022-09-06 02:19:13 +00:00
|
|
|
const CUnorderedMap<CString, JSRecordInfo> &GetJSRecordInfo() const
|
|
|
|
{
|
|
|
|
return jsRecordInfo_;
|
|
|
|
}
|
2022-10-12 09:22:34 +00:00
|
|
|
|
2023-01-09 07:19:40 +00:00
|
|
|
static CString ParseEntryPoint(const CString &desc)
|
2022-09-09 08:44:33 +00:00
|
|
|
{
|
2023-01-09 07:19:40 +00:00
|
|
|
return desc.substr(1, desc.size() - 2); // 2 : skip symbol "L" and ";"
|
2022-09-09 08:44:33 +00:00
|
|
|
}
|
|
|
|
|
2022-10-12 09:22:34 +00:00
|
|
|
void CheckIsBundlePack();
|
2023-03-23 08:18:06 +00:00
|
|
|
void CheckIsRecordWithBundleName(EcmaVM *vm);
|
|
|
|
bool IsRecordWithBundleName() const
|
|
|
|
{
|
|
|
|
return isRecordWithBundleName_;
|
|
|
|
}
|
2023-03-16 08:48:37 +00:00
|
|
|
CString GetEntryPoint(const CString &recordName) const;
|
|
|
|
CString GetNpmEntries(const CString &recordName) const;
|
2022-10-20 12:02:49 +00:00
|
|
|
uint32_t GetAOTFileInfoIndex() const
|
2022-10-19 01:53:32 +00:00
|
|
|
{
|
2022-10-20 12:02:49 +00:00
|
|
|
return anFileInfoIndex_;
|
2022-10-19 01:53:32 +00:00
|
|
|
}
|
|
|
|
|
2022-12-05 14:55:52 +00:00
|
|
|
void SetAOTFileInfoIndex(uint32_t index)
|
2022-10-19 01:53:32 +00:00
|
|
|
{
|
2022-12-05 14:55:52 +00:00
|
|
|
anFileInfoIndex_ = index;
|
2022-10-19 01:53:32 +00:00
|
|
|
}
|
|
|
|
|
2022-10-20 03:08:39 +00:00
|
|
|
static bool IsEntryOrPatch(const CString &name)
|
|
|
|
{
|
|
|
|
return (name == PATCH_FUNCTION_NAME_0) || (name == ENTRY_FUNCTION_NAME);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool HasTSTypes(const CString &recordName) const
|
|
|
|
{
|
2023-01-05 11:01:54 +00:00
|
|
|
auto it = jsRecordInfo_.find(recordName);
|
|
|
|
if (it != jsRecordInfo_.end()) {
|
2023-01-09 07:19:40 +00:00
|
|
|
return it->second.hasTSTypes;
|
2023-01-05 11:01:54 +00:00
|
|
|
}
|
|
|
|
return false;
|
2022-10-20 03:08:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t GetTypeSummaryOffset(const CString &recordName) const
|
|
|
|
{
|
2023-01-05 11:01:54 +00:00
|
|
|
auto it = jsRecordInfo_.find(recordName);
|
|
|
|
if (it != jsRecordInfo_.end()) {
|
2023-01-09 07:19:40 +00:00
|
|
|
return it->second.typeSummaryOffset;
|
2023-01-05 11:01:54 +00:00
|
|
|
}
|
2023-02-10 01:39:14 +00:00
|
|
|
return TYPE_SUMMARY_OFFSET_NOT_FOUND;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool HasTypeSummaryOffset(const CString &recordName) const
|
|
|
|
{
|
|
|
|
return GetTypeSummaryOffset(recordName) != TYPE_SUMMARY_OFFSET_NOT_FOUND;
|
2022-10-20 03:08:39 +00:00
|
|
|
}
|
|
|
|
|
2022-11-15 03:05:29 +00:00
|
|
|
void DeleteParsedConstpoolVM(const EcmaVM *vm)
|
|
|
|
{
|
|
|
|
for (auto &recordInfo : jsRecordInfo_) {
|
|
|
|
recordInfo.second.vmListOfParsedConstPool.erase(vm);
|
|
|
|
}
|
|
|
|
}
|
2022-11-15 08:25:33 +00:00
|
|
|
static FunctionKind PUBLIC_API GetFunctionKind(panda_file::FunctionKind funcKind);
|
|
|
|
static FunctionKind GetFunctionKind(ConstPoolType type);
|
2022-11-15 03:05:29 +00:00
|
|
|
|
2022-02-06 15:16:08 +00:00
|
|
|
private:
|
2022-08-30 12:52:16 +00:00
|
|
|
void InitializeUnMergedPF();
|
|
|
|
void InitializeMergedPF();
|
2022-08-26 12:40:41 +00:00
|
|
|
|
|
|
|
static constexpr size_t VERSION_SIZE = 4;
|
|
|
|
static constexpr std::array<uint8_t, VERSION_SIZE> OLD_VERSION {0, 0, 0, 2};
|
|
|
|
|
2022-08-31 10:21:38 +00:00
|
|
|
uint32_t constpoolIndex_ {0};
|
2022-12-13 07:01:05 +00:00
|
|
|
uint32_t checksum_ {0};
|
2022-09-06 02:19:13 +00:00
|
|
|
CUnorderedMap<uint32_t, MethodLiteral *> methodLiteralMap_;
|
2022-09-22 04:04:15 +00:00
|
|
|
CUnorderedMap<uint32_t, uint64_t> constpoolMap_;
|
2022-02-06 15:16:08 +00:00
|
|
|
uint32_t numMethods_ {0};
|
2022-08-23 01:56:32 +00:00
|
|
|
MethodLiteral *methodLiterals_ {nullptr};
|
2022-02-06 15:16:08 +00:00
|
|
|
const panda_file::File *pf_ {nullptr};
|
2022-03-31 15:38:07 +00:00
|
|
|
CString desc_;
|
2022-12-05 14:55:52 +00:00
|
|
|
uint32_t anFileInfoIndex_ {INVALID_INDEX};
|
2022-09-20 09:19:03 +00:00
|
|
|
bool isNewVersion_ {false};
|
2022-08-30 12:52:16 +00:00
|
|
|
|
|
|
|
// marge abc
|
2022-09-09 08:44:33 +00:00
|
|
|
bool isBundlePack_ {true}; // isBundlePack means app compile mode is JSBundle
|
2022-08-30 12:52:16 +00:00
|
|
|
CUnorderedMap<CString, JSRecordInfo> jsRecordInfo_;
|
2023-03-23 08:18:06 +00:00
|
|
|
bool isRecordWithBundleName_ {true};
|
2022-02-06 15:16:08 +00:00
|
|
|
};
|
|
|
|
} // namespace ecmascript
|
|
|
|
} // namespace panda
|
2022-08-31 10:21:38 +00:00
|
|
|
#endif // ECMASCRIPT_JSPANDAFILE_JS_PANDAFILE_H
|