Fix code check

Signed-off-by: Gymee <yumeijie@huawei.com>
Change-Id: Ic0598321e33c1303f97fecd15d934f79db096ea4
This commit is contained in:
Gymee 2024-03-17 21:37:54 +08:00
parent 10924277fa
commit a62ec8f8b5
7 changed files with 21 additions and 25 deletions

View File

@ -72,7 +72,8 @@ void PostSchedule::GenerateExtraBB(ControlFlowGraph &cfg)
bool PostSchedule::VisitHeapAlloc(GateRef gate, ControlFlowGraph &cfg, size_t bbIdx, size_t instIdx)
{
ASSERT(acc_.TryGetValue(gate) == RegionSpaceFlag::IN_YOUNG_SPACE || acc_.TryGetValue(gate) == RegionSpaceFlag::IN_SHARED_OLD_SPACE);
ASSERT(acc_.TryGetValue(gate) == RegionSpaceFlag::IN_YOUNG_SPACE ||
acc_.TryGetValue(gate) == RegionSpaceFlag::IN_SHARED_OLD_SPACE);
std::vector<GateRef> currentBBGates;
std::vector<GateRef> successBBGates;
std::vector<GateRef> failBBGates;

View File

@ -1631,7 +1631,8 @@ void TypedHCRLowering::LowerLookupHolder(GateRef gate)
GateRef holderHCIndex = acc_.GetValueIn(gate, 1);
GateRef constPool = acc_.GetValueIn(gate, 2); // 2: constpool
GateRef unsharedConstpool = builder_.GetUnsharedConstpool(constPool);
GateRef holderHC = builder_.LoadHClassFromUnsharedConstpool(unsharedConstpool, acc_.GetConstantValue(holderHCIndex));
GateRef holderHC = builder_.LoadHClassFromUnsharedConstpool(unsharedConstpool,
acc_.GetConstantValue(holderHCIndex));
DEFVALUE(holder, (&builder_), VariableType::JS_ANY(), receiver);
Label loopHead(&builder_);
Label exit(&builder_);
@ -2084,7 +2085,8 @@ GateRef TypedHCRLowering::AllocateSlicedString(GateRef glue, GateRef flatString,
GateRef size = builder_.IntPtr(AlignUp(SlicedString::SIZE, static_cast<size_t>(MemAlignment::MEM_ALIGN_OBJECT)));
builder_.StartAllocate();
GateRef slicedString = builder_.HeapAlloc(glue, size, GateType::TaggedValue(), RegionSpaceFlag::IN_SHARED_OLD_SPACE);
GateRef slicedString = builder_.HeapAlloc(glue, size, GateType::TaggedValue(),
RegionSpaceFlag::IN_SHARED_OLD_SPACE);
builder_.StoreConstOffset(VariableType::JS_POINTER(), slicedString, 0, stringClass,
MemoryOrder::NeedBarrierAndAtomic());
builder_.StoreConstOffset(VariableType::INT32(), slicedString, EcmaString::MIX_LENGTH_OFFSET, *mixLength);

View File

@ -45,9 +45,10 @@ public:
EcmaString *CreateAndInternStringNonMovable(EcmaVM *vm, const uint8_t *utf8Data, uint32_t utf8Len);
EcmaString *GetOrInternString(EcmaVM *vm, const uint16_t *utf16Data, uint32_t utf16Len, bool canBeCompress);
EcmaString *GetOrInternString(EcmaVM *vm, EcmaString *string);
EcmaString *GetOrInternCompressedSubString(EcmaVM *vm, const JSHandle<EcmaString> &string, uint32_t offset, uint32_t utf8Len);
EcmaString *GetOrInternStringWithSpaceType(EcmaVM *vm, const uint8_t *utf8Data, uint32_t utf8Len, bool canBeCompress,
MemSpaceType type, bool isConstantString, uint32_t idOffset);
EcmaString *GetOrInternCompressedSubString(EcmaVM *vm, const JSHandle<EcmaString> &string,
uint32_t offset, uint32_t utf8Len);
EcmaString *GetOrInternStringWithSpaceType(EcmaVM *vm, const uint8_t *utf8Data, uint32_t utf8Len,
bool canBeCompress, MemSpaceType type, bool isConstantString, uint32_t idOffset);
EcmaString *GetOrInternStringWithSpaceType(EcmaVM *vm, const uint8_t *utf8Data, uint32_t utf16Len,
MemSpaceType type);
EcmaString *TryGetInternString(JSThread *thread, const JSHandle<EcmaString> &string);

View File

@ -55,8 +55,8 @@ void JSHClass::AddTransitions(const JSThread *thread, const JSHandle<JSHClass> &
}
auto metaData = JSHandle<JSTaggedValue>(thread, JSTaggedValue(attributes.GetPropertyMetaData()));
dict.Update(transitions);
transitions = TransitionsDictionary::PutIfAbsent(thread, dict, key, JSHandle<JSTaggedValue>(child), metaData)
.GetTaggedValue();
transitions = TransitionsDictionary::PutIfAbsent(thread, dict, key, JSHandle<JSTaggedValue>(child),
metaData).GetTaggedValue();
parent->SetTransitions(thread, transitions);
}
@ -81,11 +81,13 @@ void JSHClass::AddProtoTransitions(const JSThread *thread, const JSHandle<JSHCla
if (cachedHClass->HasProps()) {
uint32_t last = cachedHClass->LastPropIndex();
LayoutInfo* layoutInfo = LayoutInfo::Cast(cachedHClass->GetLayout().GetTaggedObject());
auto metaData = JSHandle<JSTaggedValue>(thread, JSTaggedValue(layoutInfo->GetAttr(last).GetPropertyMetaData()));
auto metaData = JSHandle<JSTaggedValue>(thread,
JSTaggedValue(layoutInfo->GetAttr(last).GetPropertyMetaData()));
auto lastKey = JSHandle<JSTaggedValue>(thread, layoutInfo->GetKey(last));
auto lastHClass = JSHandle<JSTaggedValue>(thread, cachedHClass);
dict.Update(TransitionsDictionary::Create(thread));
transitions = TransitionsDictionary::PutIfAbsent(thread, dict, lastKey, lastHClass, metaData).GetTaggedValue();
transitions = TransitionsDictionary::PutIfAbsent(thread, dict, lastKey, lastHClass,
metaData).GetTaggedValue();
}
}
dict.Update(transitions);

View File

@ -292,8 +292,7 @@ TaggedObject *SharedHeap::AllocateClassClass(JSHClass *hclass, size_t size)
UNREACHABLE();
}
*reinterpret_cast<MarkWordType *>(ToUintPtr(object)) = reinterpret_cast<MarkWordType>(hclass);
// todo(Gymee)
// OnAllocateEvent(reinterpret_cast<TaggedObject*>(object), size);
// todo(Gymee) OnAllocateEvent
return object;
}
@ -493,8 +492,7 @@ TaggedObject *SharedHeap::AllocateNonMovableOrHugeObject(JSThread *thread, JSHCl
CHECK_SOBJ_AND_THROW_OOM_ERROR(thread, object, size, sNonMovableSpace_,
"SharedHeap::AllocateNonMovableOrHugeObject");
object->SetClass(thread, hclass);
// todo(lukai)
// OnAllocateEvent(reinterpret_cast<TaggedObject*>(object), size);
// todo(lukai) OnAllocateEvent
return object;
}
@ -513,8 +511,7 @@ TaggedObject *SharedHeap::AllocateOldOrHugeObject(JSThread *thread, JSHClass *hc
auto object = reinterpret_cast<TaggedObject *>(sOldSpace_->Allocate(thread, size));
CHECK_SOBJ_AND_THROW_OOM_ERROR(thread, object, size, sOldSpace_, "SharedHeap::AllocateOldOrHugeObject");
object->SetClass(thread, hclass);
// todo(lukai)
// OnAllocateEvent(reinterpret_cast<TaggedObject*>(object), size);
// todo(lukai) OnAllocateEvent
return object;
}
@ -534,8 +531,7 @@ TaggedObject *SharedHeap::AllocateHugeObject(JSThread *thread, JSHClass *hclass,
{
auto object = AllocateHugeObject(thread, size);
object->SetClass(thread, hclass);
// todo(lukai)
// OnAllocateEvent(reinterpret_cast<TaggedObject*>(object), size);
// todo(lukai) OnAllocateEvent
return object;
}
@ -551,8 +547,7 @@ TaggedObject *SharedHeap::AllocateHugeObject(JSThread *thread, size_t size)
// if allocate huge object OOM, temporarily increase space size to avoid vm crash
size_t oomOvershootSize = config_.GetOutOfMemoryOvershootSize();
sHugeObjectSpace_->IncreaseOutOfMemoryOvershootSize(oomOvershootSize);
// todo(lukai)
// DumpHeapSnapshotBeforeOOM();
// todo(lukai) DumpHeapSnapshotBeforeOOM
ThrowOutOfMemoryError(thread, size, "SharedHeap::AllocateHugeObject");
object = reinterpret_cast<TaggedObject *>(sHugeObjectSpace_->Allocate(thread, size));
if (UNLIKELY(object == nullptr)) {

View File

@ -117,8 +117,6 @@ void STWYoungGC::Sweep()
}
}
}
// todo(hzzhouzebin) wait for shared-gc
// auto stringTable = heap_->GetEcmaVM()->GetEcmaStringTable();
WeakRootVisitor gcUpdateWeak = [](TaggedObject *header) {
Region *objectRegion = Region::ObjectAddressToRange(reinterpret_cast<TaggedObject *>(header));
if (!objectRegion->InYoungSpace()) {
@ -132,8 +130,6 @@ void STWYoungGC::Sweep()
}
return reinterpret_cast<TaggedObject *>(ToUintPtr(nullptr));
};
// todo(hzzhouzebin) wait for shared-gc
// stringTable->SweepWeakReference(gcUpdateWeak);
heap_->GetEcmaVM()->GetJSThread()->IterateWeakEcmaGlobalStorage(gcUpdateWeak);
heap_->GetEcmaVM()->ProcessReferences(gcUpdateWeak);
}

View File

@ -41,7 +41,6 @@ public:
void SetUp() override
{
// InitializeLogger();
TestHelper::CreateEcmaVMWithScope(instance, thread, scope);
}