Merge pull request !10265 from yumin/master
This commit is contained in:
openharmony_ci 2024-11-21 15:47:07 +00:00 committed by Gitee
commit d70a188a6c
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
24 changed files with 85 additions and 82 deletions

View File

@ -27,6 +27,7 @@ ohos_fuzztest("AotCompilerArgsPrepareFuzzTest") {
include_dirs = compiler_service_include_dirs
sources = aot_compiler_service_sources
external_deps = [
"ability_base:want",
"access_token:libaccesstoken_sdk",
"access_token:libtokenid_sdk",
"c_utils:utils",

View File

@ -27,6 +27,7 @@ ohos_fuzztest("CompilerInterfaceStubFuzzTest") {
include_dirs = compiler_service_include_dirs
sources = aot_compiler_service_sources
external_deps = [
"ability_base:want",
"access_token:libaccesstoken_sdk",
"access_token:libtokenid_sdk",
"c_utils:utils",

View File

@ -292,43 +292,6 @@ GateRef AccessObjectStubBuilder::DeprecatedLoadObjByValue(GateRef glue, GateRef
return ret;
}
GateRef AccessObjectStubBuilder::StoreObjByValue(GateRef glue, GateRef receiver, GateRef key, GateRef value,
GateRef profileTypeInfo, GateRef slotId, ProfileOperation callback)
{
auto env = GetEnvironment();
Label entry(env);
env->SubCfgEntry(&entry);
Label exit(env);
Label tryFastPath(env);
Label slowPath(env);
Label tryPreDump(env);
DEFVARIABLE(result, VariableType::JS_ANY(), Hole());
ICStubBuilder builder(this);
builder.SetParameters(glue, receiver, profileTypeInfo, value, slotId, key, callback);
builder.StoreICByValue(&result, &tryFastPath, &tryPreDump, &exit);
Bind(&tryFastPath);
{
result = SetPropertyByValue(glue, receiver, key, value, false, callback);
BRANCH(TaggedIsHole(*result), &slowPath, &exit);
}
Bind(&tryPreDump);
{
callback.TryPreDump();
Jump(&slowPath);
}
Bind(&slowPath);
{
result = CallRuntime(
glue, RTSTUB_ID(StoreICByValue), {profileTypeInfo, receiver, key, value, IntToTaggedInt(slotId)});
Jump(&exit);
}
Bind(&exit);
auto ret = *result;
env->SubCfgExit();
return ret;
}
GateRef AccessObjectStubBuilder::StoreOwnByIndex(GateRef glue, GateRef receiver, GateRef index, GateRef value,
GateRef profileTypeInfo, GateRef slotId, ProfileOperation callback)
{
@ -376,6 +339,43 @@ GateRef AccessObjectStubBuilder::StoreOwnByIndex(GateRef glue, GateRef receiver,
return ret;
}
GateRef AccessObjectStubBuilder::StoreObjByValue(GateRef glue, GateRef receiver, GateRef key, GateRef value,
GateRef profileTypeInfo, GateRef slotId, ProfileOperation callback)
{
auto env = GetEnvironment();
Label entry(env);
env->SubCfgEntry(&entry);
Label exit(env);
Label tryFastPath(env);
Label slowPath(env);
Label tryPreDump(env);
DEFVARIABLE(result, VariableType::JS_ANY(), Hole());
ICStubBuilder builder(this);
builder.SetParameters(glue, receiver, profileTypeInfo, value, slotId, key, callback);
builder.StoreICByValue(&result, &tryFastPath, &tryPreDump, &exit);
Bind(&tryFastPath);
{
result = SetPropertyByValue(glue, receiver, key, value, false, callback);
BRANCH(TaggedIsHole(*result), &slowPath, &exit);
}
Bind(&tryPreDump);
{
callback.TryPreDump();
Jump(&slowPath);
}
Bind(&slowPath);
{
result = CallRuntime(
glue, RTSTUB_ID(StoreICByValue), {profileTypeInfo, receiver, key, value, IntToTaggedInt(slotId)});
Jump(&exit);
}
Bind(&exit);
auto ret = *result;
env->SubCfgExit();
return ret;
}
GateRef AccessObjectStubBuilder::TryLoadGlobalByName(GateRef glue, GateRef prop, const StringIdInfo &info,
GateRef profileTypeInfo, GateRef slotId,
ProfileOperation callback)

View File

@ -180,11 +180,6 @@ public:
return constantIndexInfo_;
}
JSTaggedValue GetProtoTransTableInfo() const
{
return protoTransTableInfo_;
}
JSTaggedValue GetObjectLiteralHClassCache() const
{
if (hclassInfo_.IsTaggedArray()) {
@ -195,6 +190,11 @@ public:
return JSTaggedValue::Undefined();
}
JSTaggedValue GetProtoTransTableInfo() const
{
return protoTransTableInfo_;
}
void StoreHClassInfo(JSHandle<TaggedArray> info)
{
hclassInfo_ = info.GetTaggedValue();

View File

@ -18,7 +18,9 @@
#include "ecmascript/compiler/bytecode_circuit_builder.h"
#include "ecmascript/compiler/circuit.h"
#include "ecmascript/compiler/circuit_builder-inl.h"
#include "ecmascript/compiler/circuit_builder.h"
#include "ecmascript/mem/chunk_containers.h"
namespace panda::ecmascript::kungfu {
class AsyncFunctionLowering {

View File

@ -64,7 +64,7 @@ public:
head_ = other->head_;
size_ = other->size_;
}
GateRef GetHeadGate()
{
return head_->gate;

View File

@ -592,7 +592,7 @@ void BuiltinsArrayStubBuilder::Filter(GateRef glue, GateRef thisValue, GateRef n
Bind(&notEmptyArray);
BRANCH(Int64GreaterThan(len, Int64(JSObject::MAX_GAP)), slowPath, &notOverFlow);
Bind(&notOverFlow);
GateRef argHandle = GetCallArg1(numArgs);
GateRef newArray = NewArray(glue, len);
GateRef lengthOffset = IntPtr(JSArray::LENGTH_OFFSET);
@ -3524,7 +3524,7 @@ void BuiltinsArrayStubBuilder::CopyWithin(GateRef glue, GateRef thisValue, GateR
Bind(&afterCallArg1);
{
endPos = thisLen;
BRANCH(Int64GreaterThanOrEqual(IntPtr(2), numArgs), &afterCallArg2, &endTagExists);
BRANCH(Int64GreaterThanOrEqual(IntPtr(2), numArgs), &afterCallArg2, &endTagExists); //2: 2 parameters
Bind(&endTagExists);
{
GateRef endTag = GetCallArg2(numArgs);

View File

@ -577,11 +577,11 @@ private:
V(JSMapValues) \
V(JSSetHas) \
V(JSSetAdd) \
V(JSMapDelete) \
V(JSSetDelete) \
V(CreateJSTypedArrayEntries) \
V(CreateJSTypedArrayKeys) \
V(CreateJSTypedArrayValues) \
V(JSMapDelete) \
V(JSSetDelete) \
V(JSSetEntries) \
V(JSHClassFindProtoTransitions) \
V(NumberHelperStringToDouble) \
@ -592,8 +592,8 @@ private:
V(StringGetStart) \
V(StringGetEnd) \
V(ArrayTrim) \
V(OptimizedFastJmp) \
V(CopyTypedArrayBuffer) \
V(OptimizedFastJmp) \
V(CallArg0AndDispatchFromBaseline) \
V(CallArg1AndDispatchFromBaseline) \
V(CallArgs2AndDispatchFromBaseline) \

View File

@ -56,8 +56,7 @@ public:
}
};
class Aarch64TargetBuilderRegistry
{
class Aarch64TargetBuilderRegistry {
public:
Aarch64TargetBuilderRegistry()
{

View File

@ -53,8 +53,7 @@ public:
}
};
class X64TargetBuilderRegistry
{
class X64TargetBuilderRegistry {
public:
X64TargetBuilderRegistry()
{

View File

@ -907,7 +907,7 @@ class MemOperand : public OperandVisitable<MemOperand> {
public:
enum AArch64AddressingMode : uint8 {
kAddrModeUndef,
/* AddrMode_BO, base, offset. EA = [base] + offset; */
/* AddrMode_BO, base, offset. EA = [base] + offset */
kAddrModeBOi, /* INTACT: EA = [base]+immediate */
/*
* PRE: base += immediate, EA = [base]
@ -1367,7 +1367,7 @@ public:
uint32 ShiftAmount() const
{
uint32 scale = extend & 0xF;
/* 8 is 1 << 3, 4 is 1 << 2, 2 is 1 << 1, 1 is 1 << 0; */
/* 8 is 1 << 3, 4 is 1 << 2, 2 is 1 << 1, 1 is 1 << 0 */
return (scale == 8) ? 3 : ((scale == 4) ? 2 : ((scale == 2) ? 1 : 0));
}

View File

@ -369,7 +369,7 @@ ImmOperand *EnhanceStrLdrAArch64::GetInsnAddOrSubNewOffset(Insn &insn, ImmOperan
} else {
auto &immOpnd = static_cast<ImmOperand &>(insn.GetOperand(kInsnThirdOpnd));
auto &shiftOpnd = static_cast<BitShiftOperand &>(insn.GetOperand(kInsnFourthOpnd));
CHECK_FATAL(shiftOpnd.GetShiftAmount() == 12, "invalid shiftAmount");
CHECK_FATAL(shiftOpnd.GetShiftAmount() == 12, "invalid shiftAmount"); // 12: invalid shiftAmount
val = (immOpnd.GetValue() << shiftOpnd.GetShiftAmount());
}

View File

@ -564,7 +564,7 @@ bool UnreachBBPattern::Optimize(BB &curBB)
isRemoved = false;
}
/* flush after remove; */
/* flush after remove */
for (BB *bb : curBB.GetSuccs()) {
bb->RemovePreds(curBB);
cgFunc->GetTheCFG()->FlushUnReachableStatusAndRemoveRelations(*bb, *cgFunc);

View File

@ -35,7 +35,6 @@
// 3: with normal warning information
// 4: with normal information
// 5: with everything
//
#ifndef MIR_DEBUG_LEVEL
#define MIR_DEBUG_LEVEL 0
#endif // MIR_DEBUG_LEVEL

View File

@ -1475,7 +1475,7 @@ private:
// a dynamic memory block that needs reference
// count; the bitvector's size is given by
// BlockSize2BitvectorSize(frameSize)
// uint16 numlabels; // removed. label table size
// uint16 numlabels // removed. label table size
// StmtNode **lbl2stmt // lbl2stmt table, removed
// to hold unmangled class and function names
MeFunction *meFunc = nullptr;

View File

@ -102,7 +102,7 @@ using OptionCategoryRefWrp = std::reference_wrapper<OptionCategory>;
class OptionWrp {
public:
template <typename T>
/* implicit */ OptionWrp(T v) : val(v)
OptionWrp(T v) : val(v) /* implicit */
{
}
@ -227,7 +227,7 @@ public:
/* Conversation operator is needed to use the option like this:
* strding test = option1; or int dig = option2 - here will be implicit conversation.
*/
/*implicit*/ operator T()
operator T() /*implicit*/
{
return GetValue();
}

View File

@ -103,11 +103,11 @@ namespace panda::ecmascript::kungfu {
V(JSMapHas) \
V(JSSetHas) \
V(JSSetAdd) \
V(JSMapDelete) \
V(JSSetDelete) \
V(CreateJSTypedArrayEntries) \
V(CreateJSTypedArrayKeys) \
V(CreateJSTypedArrayValues) \
V(JSMapDelete) \
V(JSSetDelete) \
V(GetSingleCharCodeByIndex) \
V(FastStringEqual) \
V(FastStringAdd) \

View File

@ -1537,11 +1537,11 @@ void NativeInlineLowering::TryInlineArrayIterator(GateRef gate, BuiltinsStubCSig
if (!Uncheck()) {
builder_.CallTargetCheck(gate, tacc.GetFunc(), builder_.IntPtr(static_cast<int64_t>(id)), {tacc.GetThisObj()});
}
GateRef thisObj = acc_.GetValueIn(gate, 0);
builder_.EcmaObjectCheck(thisObj);
if (EnableTrace()) {
AddTraceLogs(gate, id);
}
GateRef thisObj = acc_.GetValueIn(gate, 0);
builder_.EcmaObjectCheck(thisObj);
GateRef CallIDRef = builder_.Int32(static_cast<int32_t>(id));
GateRef ret = builder_.ArrayIteratorBuiltin(thisObj, CallIDRef);
acc_.ReplaceHirAndDeleteIfException(gate, builder_.GetStateDepend(), ret);
@ -1656,7 +1656,7 @@ void NativeInlineLowering::TryInlineArrayFilter(GateRef gate, size_t argc, Built
ret = builder_.ArrayFilter(thisValue, callBackFn, builder_.UndefineConstant(), frameState, pcOffset);
} else {
ret = builder_.ArrayFilter(
thisValue, callBackFn, acc_.GetValueIn(gate, 2), frameState, pcOffset); //2: provide usingThis
thisValue, callBackFn, acc_.GetValueIn(gate, 2), frameState, pcOffset); // 2: provide usingThis
}
acc_.ReplaceGate(gate, builder_.GetState(), builder_.GetDepend(), ret);
}

View File

@ -260,8 +260,10 @@ void PGOTypeParser::GenerateHClassForPrototype(ProfileType rootType, const PGOHC
auto phc = ptManager_->QueryHClass(rootType, rootType);
auto thread = ptManager_->GetJSThread();
JSHandle<JSHClass> phclass(thread, phc);
JSHandle<JSObject> prototype = thread->GetEcmaVM()->GetFactory()->NewJSObjectWithInit(phclass);
ptManager_->RecordHClass(classType, classType, prototype.GetTaggedType());
if (!phc.IsUndefined()) {
JSHandle<JSObject> prototype = thread->GetEcmaVM()->GetFactory()->NewJSObjectWithInit(phclass);
ptManager_->RecordHClass(classType, classType, prototype.GetTaggedType());
}
}
}
} // namespace panda::ecmascript

View File

@ -35,8 +35,8 @@ public:
const JSPandaFile *jsPandaFile, uint32_t methodOffset);
~PGOTypeRecorder() = default;
std::vector<ElementsKind> PUBLIC_API GetElementsKindsForUser(int32_t offset) const;
std::vector<ElementsKind> PUBLIC_API GetTransitionElementsKindsForUser(int32_t offset) const;
std::vector<ElementsKind> PUBLIC_API GetElementsKindsForUser(int32_t offset) const;
ElementsKind PUBLIC_API GetElementsKindForCreater(int32_t offset) const;
uint32_t PUBLIC_API GetElementsLength(int32_t offset) const;
RegionSpaceFlag PUBLIC_API GetRegionSpaceFlag(int32_t offset) const;

View File

@ -343,7 +343,7 @@ GateRef ProfilerStubBuilder::TryGetBuiltinFunctionId(GateRef target)
Label exit(env);
DEFVARIABLE(functionId, VariableType::INT32(), Int32(PGO_BUILTINS_STUB_ID(NONE)));
BRANCH(IsJSFunction(target), &targetIsFunction, &exit);
Bind(&targetIsFunction);
{
@ -800,7 +800,7 @@ GateRef ProfilerStubBuilder::GetSlotID(const SlotIDInfo &slotInfo)
auto result = Int16Add(hight, ZExtInt8ToInt16(low));
return ZExtInt16ToInt32(result);
} else if (format == SlotIDFormat::PREF_IMM8) {
return ZExtInt8ToInt32(Load(VariableType::INT8(), pc, IntPtr(2)));
return ZExtInt8ToInt32(Load(VariableType::INT8(), pc, IntPtr(2))); // 2 : skip 1 byte of bytecode
}
return ZExtInt8ToInt32(Load(VariableType::INT8(), pc, IntPtr(1)));
}

View File

@ -2745,9 +2745,9 @@ void SlowPathLowering::LowerDefineClassWithBuffer(GateRef gate)
ASSERT(acc_.GetNumValueIn(gate) == 6); // 6: number of value inputs
GateRef jsFunc = argAcc_.GetFrameArgsIn(gate, FrameArgIdx::FUNC);
GateRef methodId = acc_.GetValueIn(gate, 0);
GateRef proto = acc_.GetValueIn(gate, 3);
GateRef literalId = acc_.GetValueIn(gate, 1);
GateRef length = acc_.GetValueIn(gate, 2); // 2: second arg
GateRef proto = acc_.GetValueIn(gate, 3);
GateRef lexicalEnv = acc_.GetValueIn(gate, 4); // 4: Get current env
GateRef sharedConstPool = argAcc_.GetFrameArgsIn(gate, FrameArgIdx::SHARED_CONST_POOL);
GateRef module = builder_.GetModuleFromFunction(jsFunc);
@ -3358,7 +3358,7 @@ void SlowPathLowering::LowerCallInternal(GateRef gate)
for (size_t i = 0; i < num; ++i) {
args[i] = acc_.GetValueIn(gate, i);
}
ASSERT(num >= 3); // 3: skip argc argv newtarget
ASSERT(num >= 3); // 3:skip argc argv newtarget
std::vector<GateRef> argsFastCall(num - 3); // 3:skip argc argv newtarget
size_t j = 0;
for (size_t i = 0; i < num; ++i) {
@ -3384,7 +3384,7 @@ void SlowPathLowering::LowerCallNew(GateRef gate)
for (size_t i = 0; i < num; ++i) {
args[i] = acc_.GetValueIn(gate, i);
}
ASSERT(num >= 3); // 3:skip argc argv newtarget
ASSERT(num >= 3); // 3: skip argc argv newtarget
std::vector<GateRef> argsFastCall(num - 3); // 3:skip argc argv newtarget
size_t j = 0;
for (size_t i = 0; i < num; ++i) {
@ -3796,11 +3796,12 @@ void SlowPathLowering::LowerDefineSendableClass(GateRef gate)
ASSERT(acc_.GetNumValueIn(gate) == 4);
GateRef jsFunc = argAcc_.GetFrameArgsIn(gate, FrameArgIdx::FUNC);
GateRef methodId = acc_.GetValueIn(gate, 0);
GateRef proto = acc_.GetValueIn(gate, 3);
GateRef literalId = acc_.GetValueIn(gate, 1);
GateRef length = acc_.GetValueIn(gate, 2); // 2: second arg
GateRef proto = acc_.GetValueIn(gate, 3);
GateRef constpool = argAcc_.GetFrameArgsIn(gate, FrameArgIdx::SHARED_CONST_POOL);
GateRef module = builder_.GetModuleFromFunction(jsFunc);
auto args = { proto, constpool, builder_.ToTaggedInt(methodId), builder_.ToTaggedInt(literalId),
builder_.ToTaggedInt(length), module };
GateRef newGate = LowerCallRuntime(gate, RTSTUB_ID(CreateSharedClass), args);

View File

@ -3879,13 +3879,6 @@ inline void StubBuilder::SetArrayBufferByteLength(GateRef glue, GateRef buffer,
Store(VariableType::INT32(), glue, buffer, offset, length);
}
inline GateRef StubBuilder::GetLastLeaveFrame(GateRef glue)
{
bool isArch32 = GetEnvironment()->Is32Bit();
GateRef spOffset = IntPtr(JSThread::GlueData::GetLeaveFrameOffset(isArch32));
return Load(VariableType::NATIVE_POINTER(), glue, spOffset);
}
inline GateRef StubBuilder::GetPropertiesCache(GateRef glue)
{
GateRef currentContextOffset = IntPtr(JSThread::GlueData::GetCurrentContextOffset(env_->Is32Bit()));
@ -3927,6 +3920,12 @@ inline GateRef StubBuilder::HashFromHclassAndKey(GateRef glue, GateRef cls, Gate
GateRef keyHash = GetKeyHashCode(glue, key, hir);
return Int32And(Int32Xor(clsHash, keyHash), Int32(PropertiesCache::CACHE_LENGTH_MASK));
}
inline GateRef StubBuilder::GetLastLeaveFrame(GateRef glue)
{
bool isArch32 = GetEnvironment()->Is32Bit();
GateRef spOffset = IntPtr(JSThread::GlueData::GetLeaveFrameOffset(isArch32));
return Load(VariableType::NATIVE_POINTER(), glue, spOffset);
}
inline GateRef StubBuilder::OrdinaryNewJSObjectCreate(GateRef glue, GateRef proto)
{

View File

@ -1017,7 +1017,6 @@ public:
inline GateRef GetAccessorHasChanged(GateRef obj);
inline GateRef ComputeTaggedTypedArraySize(GateRef elementSize, GateRef length);
GateRef ChangeTaggedPointerToInt64(GateRef x);
GateRef GetLastLeaveFrame(GateRef glue);
inline GateRef GetPropertiesCache(GateRef glue);
GateRef GetIndexFromPropertiesCache(GateRef glue, GateRef cache, GateRef cls, GateRef key,
GateRef hir = Circuit::NullGate());
@ -1033,6 +1032,7 @@ public:
FunctionKind targetKind = FunctionKind::LAST_FUNCTION_KIND);
GateRef BinarySearch(GateRef glue, GateRef layoutInfo, GateRef key, GateRef propsNum,
GateRef hir = Circuit::NullGate());
GateRef GetLastLeaveFrame(GateRef glue);
void UpdateProfileTypeInfoCellToFunction(GateRef glue, GateRef function,
GateRef profileTypeInfo, GateRef slotId);
GateRef Loadlocalmodulevar(GateRef glue, GateRef index, GateRef module);