!10320 AI review问题处理

Merge pull request !10320 from yangliping/day1120
This commit is contained in:
openharmony_ci 2024-11-22 00:32:53 +00:00 committed by Gitee
commit a1654add9f
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
6 changed files with 53 additions and 6 deletions

View File

@ -362,22 +362,32 @@ void AotCompilerImpl::HandlePowerDisconnected()
{
LOG_SA(INFO) << "AotCompilerImpl::HandlePowerDisconnected";
PauseAotCompiler();
std::thread([]() {
std::thread t([]() {
(void)AotCompilerImpl::GetInstance().StopAotCompiler();
sleep(30); // wait for 30 seconds
AotCompilerImpl::GetInstance().AllowAotCompiler();
}).detach();
});
if (t.joinable()) {
t.detach();
} else {
LOG_SA(ERROR) << "Failed to create thread for AotCompilerImpl::HandlePowerDisconnected";
}
}
void AotCompilerImpl::HandleScreenOn()
{
LOG_SA(INFO) << "AotCompilerImpl::HandleScreenOn";
PauseAotCompiler();
std::thread([]() {
std::thread t([]() {
(void)AotCompilerImpl::GetInstance().StopAotCompiler();
sleep(40); // wait for 40 seconds
AotCompilerImpl::GetInstance().AllowAotCompiler();
}).detach();
});
if (t.joinable()) {
t.detach();
} else {
LOG_SA(ERROR) << "Failed to create thread for AotCompilerImpl::HandleScreenOn";
}
}
void AotCompilerImpl::HandleThermalLevelChanged(const int32_t level)

View File

@ -31,6 +31,10 @@ void StubFileInfo::Save(const std::string &filename, Triple triple)
}
std::ofstream file(realPath.c_str(), std::ofstream::binary);
if (!file.is_open()) {
LOG_ECMA(FATAL) << "Failed to open file : " << realPath.c_str();
UNREACHABLE();
}
ASSERT(GetCodeUnitsNum() == ASMSTUB_MODULE_NUM);
SetStubNum(entries_.size());
ModuleSectionDes &des = des_[0];

View File

@ -37,7 +37,7 @@ Circuit::Circuit(NativeAreaAllocator* allocator, DebugInfo* debugInfo, const cha
, allGates_(chunk())
#endif
{
if (funcName != nullptr && debugInfo_->IsEnable()) {
if (funcName != nullptr && debugInfo_ != nullptr && debugInfo_->IsEnable()) {
debugInfo_->AddFuncDebugInfo(funcName);
}
space_ = panda::ecmascript::PageMap(CIRCUIT_SPACE, PAGE_PROT_READWRITE).GetMem();

View File

@ -117,7 +117,7 @@ bool InductionVariableAnalysis::IsLessOrGreaterCmp(GateRef gate) const
bool InductionVariableAnalysis::TryGetLoopTimes(const GraphLinearizer::LoopInfo& loop, int32_t& loopTimes) const
{
if (loop.loopExits->size() > 1) {
if (loop.loopExits == nullptr || loop.loopExits->size() > 1) {
return false;
}
ASSERT(loop.loopExits->size() == 1);

View File

@ -680,6 +680,9 @@ bool StorePrivatePropertyTypeInfoAccessor::AotAccessorStrategy::GenerateObjectAc
return true;
}
if (parent_.types_.size() == 0) {
return false;
}
ProfileTyper receiverType = std::get<0>(parent_.types_.at(0));
ProfileTyper holderType = std::get<1>(parent_.types_.at(0));
if (receiverType == holderType) {
@ -704,6 +707,9 @@ bool StorePrivatePropertyTypeInfoAccessor::JitAccessorStrategy::GenerateObjectAc
return true;
}
if (parent_.jitTypes_.size() == 0) {
return false;
}
JSHClass *receiverType = parent_.jitTypes_[0].GetReceiverHclass();
JSHClass *holderType = parent_.jitTypes_[0].GetHolderHclass();
if (receiverType->IsJsPrimitiveRef() || holderType->IsJsPrimitiveRef()) {
@ -780,6 +786,9 @@ bool LoadPrivatePropertyTypeInfoAccessor::AotAccessorStrategy::GenerateObjectAcc
return true;
}
if (parent_.types_.size() == 0) {
return false;
}
ProfileTyper receiverType = parent_.types_.at(0).first;
ProfileTyper holderType = parent_.types_.at(0).second;
if (receiverType == holderType) {
@ -804,6 +813,9 @@ bool LoadPrivatePropertyTypeInfoAccessor::JitAccessorStrategy::GenerateObjectAcc
return true;
}
if (parent_.jitTypes_.size() == 0) {
return false;
}
JSHClass *receiver = parent_.jitTypes_[0].GetReceiverHclass();
JSHClass *holder = parent_.jitTypes_[0].GetHolderHclass();
// case: r.toFixed() => HeapObjectCheck Deopt
@ -876,6 +888,9 @@ bool LoadObjByNameTypeInfoAccessor::AotAccessorStrategy::GenerateObjectAccessInf
if (key.IsUndefined()) {
return false;
}
if (parent_.types_.size() == 0) {
return false;
}
for (size_t i = 0; i < parent_.types_.size(); ++i) {
ProfileTyper receiverType = parent_.types_[i].first;
ProfileTyper holderType = parent_.types_[i].second;
@ -909,6 +924,9 @@ bool LoadObjByNameTypeInfoAccessor::JitAccessorStrategy::GenerateObjectAccessInf
if (key.IsUndefined()) {
return false;
}
if (parent_.jitTypes_.size() == 0) {
return false;
}
for (size_t i = 0; i < parent_.jitTypes_.size(); ++i) {
JSHClass *receiver = parent_.jitTypes_[i].GetReceiverHclass();
JSHClass *holder = parent_.jitTypes_[i].GetHolderHclass();
@ -1015,6 +1033,9 @@ void StoreObjByNameTypeInfoAccessor::JitAccessorStrategy::FetchPGORWTypesDual()
bool StoreObjByNameTypeInfoAccessor::AotAccessorStrategy::GenerateObjectAccessInfo()
{
JSTaggedValue key = parent_.GetKeyTaggedValue();
if (parent_.types_.size() == 0) {
return false;
}
for (size_t i = 0; i < parent_.types_.size(); ++i) {
ProfileTyper receiverType = std::get<0>(parent_.types_[i]);
ProfileTyper holderType = std::get<1>(parent_.types_[i]);
@ -1054,6 +1075,9 @@ bool StoreObjByNameTypeInfoAccessor::JitAccessorStrategy::GenerateObjectAccessIn
if (key.IsUndefined()) {
return false;
}
if (parent_.jitTypes_.size() == 0) {
return false;
}
for (size_t i = 0; i < parent_.jitTypes_.size(); ++i) {
JSHClass* receiverType = parent_.jitTypes_[i].GetReceiverHclass();
JSHClass* holderType = parent_.jitTypes_[i].GetHolderHclass();
@ -1169,6 +1193,9 @@ bool InstanceOfTypeInfoAccessor::AotAccessorStrategy::GenerateObjectAccessInfo()
if (!IsMono()) {
return false;
}
if (parent_.types_.size() == 0) {
return false;
}
JSTaggedValue key = parent_.GetKeyTaggedValue();
for (size_t i = 0; i < parent_.types_.size(); ++i) {
ProfileTyper targetPgoType = parent_.types_[i].first;
@ -1198,6 +1225,9 @@ bool InstanceOfTypeInfoAccessor::JitAccessorStrategy::GenerateObjectAccessInfo()
if (key.IsUndefined()) {
return false;
}
if (parent_.jitTypes_.size() == 0) {
return false;
}
for (size_t i = 0; i < parent_.jitTypes_.size(); ++i) {
JSHClass *receiver = parent_.jitTypes_[i].GetReceiverHclass();
if (receiver->IsJsPrimitiveRef()) {

View File

@ -33,11 +33,13 @@ bool PGOProfilerHeader::BuildFromLegacy(void *buffer, PGOProfilerHeader **header
Build(header, desSize);
// copy header base.
if (memcpy_s(*header, sizeof(FileHeaderBase), inHeader, sizeof(FileHeaderBase)) != EOK) {
LOG_ECMA(FATAL) << "PGOProfilerHeader BuildFromLegacy copy header base memcpy failed!";
UNREACHABLE();
}
// skip elastic header field, and copy section info from incoming buffer.
auto sectionSize = desSize - sizeof(FileHeaderElastic);
if (memcpy_s(&((*header)->sectionNumber_), sectionSize, &(inHeader->GetSectionNumber()), sectionSize) != EOK) {
LOG_ECMA(FATAL) << "PGOProfilerHeader BuildFromLegacy copy section info memcpy failed!";
UNREACHABLE();
}
return true;
@ -56,6 +58,7 @@ bool PGOProfilerHeader::BuildFromElastic(void *buffer, size_t bufferSize, PGOPro
}
Build(header, desSize);
if (memcpy_s(*header, desSize, inHeader, desSize) != EOK) {
LOG_ECMA(FATAL) << "PGOProfilerHeader BuildFromElastic memcpy failed!";
UNREACHABLE();
}
return true;