mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-11-23 10:09:54 +00:00
Judge special value use Isxxx() instead of equal
Signed-off-by: g00416891 <guobingbing3@huawei.com> Change-Id: I3113af0caddc39519d070cc370d1843e6177982c
This commit is contained in:
parent
51be825113
commit
4669062b16
@ -254,7 +254,7 @@ bool BuiltinsArrayBuffer::IsDetachedBuffer(JSTaggedValue arrayBuffer)
|
||||
JSTaggedValue dataSlot = buffer->GetArrayBufferData();
|
||||
// 2. If arrayBuffer’s [[ArrayBufferData]] internal slot is null, return true.
|
||||
// 3. Return false.
|
||||
return dataSlot == JSTaggedValue::Null();
|
||||
return dataSlot.IsNull();
|
||||
}
|
||||
|
||||
// 24.1.1.4
|
||||
|
@ -55,7 +55,7 @@ JSTaggedValue BuiltinsBoolean::ThisBooleanValue(JSThread *thread, JSTaggedValue
|
||||
BUILTINS_API_TRACE(thread, Boolean, ThisBooleanValue);
|
||||
// 1. If Type(value) is Boolean, return value
|
||||
if (value.IsBoolean()) {
|
||||
return value == JSTaggedValue::True() ? GetTaggedBoolean(true) : GetTaggedBoolean(false);
|
||||
return value;
|
||||
}
|
||||
// 2. If Type(value) is Object and value has a [[BooleanData]] internal slot, then
|
||||
if (value.IsJSPrimitiveRef()) {
|
||||
@ -63,7 +63,7 @@ JSTaggedValue BuiltinsBoolean::ThisBooleanValue(JSThread *thread, JSTaggedValue
|
||||
// a. Assert: value's [[BooleanData]] internal slot is a Boolean value.
|
||||
if (primitive.IsBoolean()) {
|
||||
// b. Return the value of value's [[BooleanData]] internal slot.
|
||||
return primitive == JSTaggedValue::True() ? GetTaggedBoolean(true) : GetTaggedBoolean(false);
|
||||
return primitive;
|
||||
}
|
||||
}
|
||||
[[maybe_unused]] EcmaHandleScope handleScope(thread);
|
||||
|
@ -403,7 +403,7 @@ JSTaggedValue BuiltinsRegExp::Match(EcmaRuntimeCallInfo *argv)
|
||||
if (useCache) {
|
||||
JSTaggedValue cacheResult = cacheTable->FindCachedResult(thread, pattern, flags, inputString,
|
||||
RegExpExecResultCache::EXEC_TYPE, thisObj);
|
||||
if (cacheResult != JSTaggedValue::Undefined()) {
|
||||
if (!cacheResult.IsUndefined()) {
|
||||
return cacheResult;
|
||||
}
|
||||
}
|
||||
@ -414,7 +414,7 @@ JSTaggedValue BuiltinsRegExp::Match(EcmaRuntimeCallInfo *argv)
|
||||
if (useCache) {
|
||||
JSTaggedValue cacheResult = cacheTable->FindCachedResult(thread, pattern, flags, inputString,
|
||||
RegExpExecResultCache::MATCH_TYPE, thisObj);
|
||||
if (cacheResult != JSTaggedValue::Undefined()) {
|
||||
if (!cacheResult.IsUndefined()) {
|
||||
return cacheResult;
|
||||
}
|
||||
}
|
||||
@ -621,7 +621,7 @@ JSTaggedValue BuiltinsRegExp::RegExpReplaceFast(JSThread *thread, JSHandle<JSTag
|
||||
JSTaggedValue cacheResult = cacheTable->FindCachedResult(thread, pattern, flagsBits, tagInputString,
|
||||
RegExpExecResultCache::REPLACE_TYPE, regexp,
|
||||
globalConst->GetEmptyString());
|
||||
if (cacheResult != JSTaggedValue::Undefined()) {
|
||||
if (!cacheResult.IsUndefined()) {
|
||||
return cacheResult;
|
||||
}
|
||||
}
|
||||
@ -778,7 +778,7 @@ JSTaggedValue BuiltinsRegExp::Replace(EcmaRuntimeCallInfo *argv)
|
||||
RegExpExecResultCache::REPLACE_TYPE,
|
||||
thisObj,
|
||||
inputReplaceValue.GetTaggedValue());
|
||||
if (cacheResult != JSTaggedValue::Undefined()) {
|
||||
if (!cacheResult.IsUndefined()) {
|
||||
return cacheResult;
|
||||
}
|
||||
}
|
||||
@ -1143,7 +1143,7 @@ JSTaggedValue BuiltinsRegExp::Split(EcmaRuntimeCallInfo *argv)
|
||||
if (useCache) {
|
||||
JSTaggedValue cacheResult = cacheTable->FindCachedResult(thread, pattern, flagsBits, inputString,
|
||||
RegExpExecResultCache::SPLIT_TYPE, thisObj);
|
||||
if (cacheResult != JSTaggedValue::Undefined()) {
|
||||
if (!cacheResult.IsUndefined()) {
|
||||
return cacheResult;
|
||||
}
|
||||
}
|
||||
@ -1678,7 +1678,7 @@ JSTaggedValue BuiltinsRegExp::RegExpInitialize(JSThread *thread, const JSHandle<
|
||||
RegExpParserCache *regExpParserCache = thread->GetEcmaVM()->GetRegExpParserCache();
|
||||
CVector<CString> groupName;
|
||||
auto getCache = regExpParserCache->GetCache(*patternStrHandle, flagsBits, groupName);
|
||||
if (getCache.first == JSTaggedValue::Hole()) {
|
||||
if (getCache.first.IsHole()) {
|
||||
parser.Init(const_cast<char *>(reinterpret_cast<const char *>(patternStdStr.c_str())), patternStdStr.size(),
|
||||
flagsBits);
|
||||
parser.Parse();
|
||||
@ -1703,7 +1703,7 @@ JSTaggedValue BuiltinsRegExp::RegExpInitialize(JSThread *thread, const JSHandle<
|
||||
regexp->SetGroupName(thread, taggedArray);
|
||||
}
|
||||
// 13. Set obj’s [[RegExpMatcher]] internal slot.
|
||||
if (getCache.first == JSTaggedValue::Hole()) {
|
||||
if (getCache.first.IsHole()) {
|
||||
auto bufferSize = parser.GetOriginBufferSize();
|
||||
auto buffer = parser.GetOriginBuffer();
|
||||
factory->NewJSRegExpByteCodeData(regexp, buffer, bufferSize);
|
||||
@ -1845,7 +1845,7 @@ void RegExpExecResultCache::AddResultInCache(JSThread *thread, JSHandle<RegExpEx
|
||||
ASSERT((static_cast<size_t>(CACHE_TABLE_HEADER_SIZE) +
|
||||
static_cast<size_t>(entry) * static_cast<size_t>(ENTRY_SIZE)) <= static_cast<size_t>(UINT32_MAX));
|
||||
uint32_t index = CACHE_TABLE_HEADER_SIZE + entry * ENTRY_SIZE;
|
||||
if (cache->Get(index) == JSTaggedValue::Undefined()) {
|
||||
if (cache->Get(index).IsUndefined()) {
|
||||
cache->SetCacheCount(thread, cache->GetCacheCount() + 1);
|
||||
cache->SetEntry(thread, entry, patternValue, flagsValue, inputValue, lastIndexValue, extend);
|
||||
cache->UpdateResultArray(thread, entry, resultArray.GetTaggedValue(), type);
|
||||
@ -1869,7 +1869,7 @@ void RegExpExecResultCache::AddResultInCache(JSThread *thread, JSHandle<RegExpEx
|
||||
index2 = CACHE_TABLE_HEADER_SIZE + entry2 * ENTRY_SIZE;
|
||||
}
|
||||
JSTaggedValue extendValue = extendHandle.GetTaggedValue();
|
||||
if (cache->Get(index2) == JSTaggedValue::Undefined()) {
|
||||
if (cache->Get(index2).IsUndefined()) {
|
||||
cache->SetCacheCount(thread, cache->GetCacheCount() + 1);
|
||||
cache->SetEntry(thread, entry2, patternValue, flagsValue, inputValue, lastIndexValue, extendValue);
|
||||
cache->UpdateResultArray(thread, entry2, resultArray.GetTaggedValue(), type);
|
||||
@ -1954,7 +1954,7 @@ bool RegExpExecResultCache::Match(int entry, JSTaggedValue &pattern, JSTaggedVal
|
||||
JSTaggedValue keyInput = Get(index + INPUT_STRING_INDEX);
|
||||
JSTaggedValue keyExtend = Get(index + EXTEND_INDEX);
|
||||
|
||||
if (keyPattern == JSTaggedValue::Undefined()) {
|
||||
if (keyPattern.IsUndefined()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ JSTaggedValue BuiltinsSharedArrayBuffer::IsSharedArrayBuffer(EcmaRuntimeCallInfo
|
||||
JSHandle<JSArrayBuffer> buffer(arg);
|
||||
JSTaggedValue bufferdata = buffer->GetArrayBufferData();
|
||||
// 3. If bufferData is null, return false.
|
||||
if (bufferdata == JSTaggedValue::Null()) {
|
||||
if (bufferdata.IsNull()) {
|
||||
return BuiltinsSharedArrayBuffer::GetTaggedBoolean(false);
|
||||
}
|
||||
// 4. If this ArrayBuffer is not shared, return false.
|
||||
|
@ -242,8 +242,7 @@ JSTaggedValue BuiltinsString::CharAt(EcmaRuntimeCallInfo *argv)
|
||||
JSHandle<JSTaggedValue> thisTag(JSTaggedValue::RequireObjectCoercible(thread, GetThis(argv)));
|
||||
JSHandle<EcmaString> thisHandle = JSTaggedValue::ToString(thread, thisTag);
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
JSHandle<EcmaString> thisFlat = JSHandle<EcmaString>(thread,
|
||||
EcmaStringAccessor::Flatten(thread->GetEcmaVM(), thisHandle));
|
||||
JSHandle<EcmaString> thisFlat(thread, EcmaStringAccessor::Flatten(thread->GetEcmaVM(), thisHandle));
|
||||
int32_t thisLen = static_cast<int32_t>(EcmaStringAccessor(thisFlat).GetLength());
|
||||
JSHandle<JSTaggedValue> posTag = BuiltinsString::GetCallArg(argv, 0);
|
||||
int32_t pos = 0;
|
||||
@ -273,8 +272,7 @@ JSTaggedValue BuiltinsString::CharCodeAt(EcmaRuntimeCallInfo *argv)
|
||||
JSHandle<JSTaggedValue> thisTag(JSTaggedValue::RequireObjectCoercible(thread, GetThis(argv)));
|
||||
JSHandle<EcmaString> thisHandle = JSTaggedValue::ToString(thread, thisTag);
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
JSHandle<EcmaString> thisFlat = JSHandle<EcmaString>(thread,
|
||||
EcmaStringAccessor::Flatten(thread->GetEcmaVM(), thisHandle));
|
||||
JSHandle<EcmaString> thisFlat(thread, EcmaStringAccessor::Flatten(thread->GetEcmaVM(), thisHandle));
|
||||
int32_t thisLen = static_cast<int32_t>(EcmaStringAccessor(thisFlat).GetLength());
|
||||
JSHandle<JSTaggedValue> posTag = BuiltinsString::GetCallArg(argv, 0);
|
||||
int32_t pos = 0;
|
||||
@ -304,8 +302,7 @@ JSTaggedValue BuiltinsString::CodePointAt(EcmaRuntimeCallInfo *argv)
|
||||
JSHandle<JSTaggedValue> thisTag(JSTaggedValue::RequireObjectCoercible(thread, GetThis(argv)));
|
||||
JSHandle<EcmaString> thisHandle = JSTaggedValue::ToString(thread, thisTag);
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
JSHandle<EcmaString> thisFlat = JSHandle<EcmaString>(thread,
|
||||
EcmaStringAccessor::Flatten(thread->GetEcmaVM(), thisHandle));
|
||||
JSHandle<EcmaString> thisFlat(thread, EcmaStringAccessor::Flatten(thread->GetEcmaVM(), thisHandle));
|
||||
JSHandle<JSTaggedValue> posTag = BuiltinsString::GetCallArg(argv, 0);
|
||||
|
||||
JSTaggedNumber posVal = JSTaggedValue::ToNumber(thread, posTag);
|
||||
@ -574,7 +571,7 @@ JSTaggedValue BuiltinsString::Match(EcmaRuntimeCallInfo *argv)
|
||||
JSHandle<JSTaggedValue> flags(thread, re->GetOriginalFlags());
|
||||
JSTaggedValue cacheResult = cacheTable->FindCachedResult(thread, pattern, flags, thisTag,
|
||||
RegExpExecResultCache::MATCH_TYPE, regexp);
|
||||
if (cacheResult != JSTaggedValue::Undefined()) {
|
||||
if (!cacheResult.IsUndefined()) {
|
||||
return cacheResult;
|
||||
}
|
||||
}
|
||||
@ -809,7 +806,7 @@ JSTaggedValue BuiltinsString::Replace(EcmaRuntimeCallInfo *argv)
|
||||
JSTaggedValue cacheResult = cacheTable->FindCachedResult(thread, pattern, flags, thisTag,
|
||||
RegExpExecResultCache::REPLACE_TYPE, searchTag,
|
||||
replaceTag.GetTaggedValue());
|
||||
if (cacheResult != JSTaggedValue::Undefined()) {
|
||||
if (!cacheResult.IsUndefined()) {
|
||||
return cacheResult;
|
||||
}
|
||||
}
|
||||
@ -1050,8 +1047,7 @@ JSTaggedValue BuiltinsString::GetSubstitution(JSThread *thread, const JSHandle<E
|
||||
auto ecmaVm = thread->GetEcmaVM();
|
||||
ObjectFactory *factory = ecmaVm->GetFactory();
|
||||
JSHandle<EcmaString> dollarString = JSHandle<EcmaString>::Cast(thread->GlobalConstants()->GetHandledDollarString());
|
||||
JSHandle<EcmaString> replacementFlat = JSHandle<EcmaString>(
|
||||
thread, EcmaStringAccessor::Flatten(ecmaVm, replacement));
|
||||
JSHandle<EcmaString> replacementFlat(thread, EcmaStringAccessor::Flatten(ecmaVm, replacement));
|
||||
int32_t replaceLength = static_cast<int32_t>(EcmaStringAccessor(replacementFlat).GetLength());
|
||||
int32_t tailPos = position + static_cast<int32_t>(EcmaStringAccessor(matched).GetLength());
|
||||
|
||||
|
@ -1055,7 +1055,7 @@ JSTaggedValue BuiltinsTypedArray::Set(EcmaRuntimeCallInfo *argv)
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
// 18. Let srcLength be ToLength(Get(src, "length")).
|
||||
JSHandle<JSTaggedValue> lengthKey = thread->GlobalConstants()->GetHandledLengthString();
|
||||
JSHandle<JSTaggedValue> lenResult = JSHandle<JSTaggedValue>(thread,
|
||||
JSHandle<JSTaggedValue> lenResult(thread,
|
||||
FastRuntimeStub::FastGetPropertyByValue(thread,
|
||||
JSHandle<JSTaggedValue>::Cast(src).GetTaggedValue(),
|
||||
lengthKey.GetTaggedValue()));
|
||||
@ -1123,7 +1123,7 @@ JSTaggedValue BuiltinsTypedArray::Set(EcmaRuntimeCallInfo *argv)
|
||||
// 12. Let srcBuffer be the value of typedArray’s [[ViewedArrayBuffer]] internal slot.
|
||||
// 13. If IsDetachedBuffer(srcBuffer) is true, throw a TypeError exception.
|
||||
JSTaggedValue srcBuffer = typedArray->GetViewedArrayBuffer();
|
||||
JSHandle<JSTaggedValue> srcBufferHandle = JSHandle<JSTaggedValue>(thread, srcBuffer);
|
||||
JSHandle<JSTaggedValue> srcBufferHandle(thread, srcBuffer);
|
||||
if (BuiltinsArrayBuffer::IsDetachedBuffer(srcBuffer)) {
|
||||
THROW_TYPE_ERROR_AND_RETURN(thread, "The ArrayBuffer of typedArray is detached buffer.",
|
||||
JSTaggedValue::Exception());
|
||||
|
@ -130,7 +130,7 @@ static JSTaggedValue JSDateTimeFormatCreateWithLocaleTest(JSThread *thread, JSHa
|
||||
{
|
||||
JSHandle<GlobalEnv> env = thread->GetEcmaVM()->GetGlobalEnv();
|
||||
JSHandle<JSFunction> newTarget(env->GetDateTimeFormatFunction());
|
||||
JSHandle<JSObject> optionsObj = JSHandle<JSObject>(thread, BuiltinsDateTimeOptionsSet(thread));
|
||||
JSHandle<JSObject> optionsObj(thread, BuiltinsDateTimeOptionsSet(thread));
|
||||
|
||||
JSHandle<JSTaggedValue> localesString = locale;
|
||||
auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*newTarget), 8);
|
||||
|
@ -669,7 +669,7 @@ HWTEST_F_L0(BuiltinsObjectTest, Values)
|
||||
// Object.preventExtensions(obj)
|
||||
HWTEST_F_L0(BuiltinsObjectTest, PreventExtensions)
|
||||
{
|
||||
JSHandle<JSObject> obj = JSHandle<JSObject>(thread, CreateBuiltinJSObject(thread, "x"));
|
||||
JSHandle<JSObject> obj(thread, CreateBuiltinJSObject(thread, "x"));
|
||||
obj->GetJSHClass()->SetExtensible(true);
|
||||
auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6);
|
||||
ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
|
||||
|
@ -651,10 +651,10 @@ HWTEST_F_L0(BuiltinsRegExpTest, RegExpParseCache)
|
||||
JSHandle<EcmaString> string2 = factory->NewFromASCII("abcd");
|
||||
CVector<CString> vec;
|
||||
regExpParserCache->SetCache(*string1, 0, JSTaggedValue::True(), 2, vec);
|
||||
ASSERT_TRUE(regExpParserCache->GetCache(*string1, 0, vec).first == JSTaggedValue::True());
|
||||
ASSERT_TRUE(regExpParserCache->GetCache(*string1, 0, vec).first.IsTrue());
|
||||
ASSERT_TRUE(regExpParserCache->GetCache(*string1, 0, vec).second == 2U);
|
||||
ASSERT_TRUE(regExpParserCache->GetCache(*string1,
|
||||
RegExpParserCache::CACHE_SIZE, vec).first == JSTaggedValue::Hole());
|
||||
ASSERT_TRUE(regExpParserCache->GetCache(*string2, 0, vec).first == JSTaggedValue::Hole());
|
||||
RegExpParserCache::CACHE_SIZE, vec).first.IsHole());
|
||||
ASSERT_TRUE(regExpParserCache->GetCache(*string2, 0, vec).first.IsHole());
|
||||
}
|
||||
} // namespace panda::test
|
||||
|
@ -2142,7 +2142,7 @@ void SlowPathLowering::LowerConditionJump(GateRef gate, bool isEqualJump)
|
||||
{
|
||||
std::vector<GateRef> trueState;
|
||||
GateRef value = acc_.GetValueIn(gate, 0);
|
||||
// GET_ACC() == JSTaggedValue::False()
|
||||
// GET_ACC().IsFalse()
|
||||
GateRef condition = builder_.IsSpecial(value, JSTaggedValue::VALUE_FALSE);
|
||||
GateRef ifBranch = builder_.Branch(acc_.GetState(gate), condition);
|
||||
GateRef ifTrue = builder_.IfTrue(ifBranch);
|
||||
|
@ -158,7 +158,7 @@ JSTaggedValue ContainersPrivate::InitializeContainer(JSThread *thread, const JSH
|
||||
JSHandle<JSTaggedValue> key(factory->NewFromASCII(name));
|
||||
JSTaggedValue value =
|
||||
FastRuntimeStub::GetPropertyByName<true>(thread, obj.GetTaggedValue(), key.GetTaggedValue());
|
||||
if (value != JSTaggedValue::Undefined()) {
|
||||
if (!value.IsUndefined()) {
|
||||
return value;
|
||||
}
|
||||
JSHandle<JSTaggedValue> map = func(thread);
|
||||
|
@ -354,8 +354,7 @@ int32_t DebuggerApi::GetModuleVariableIndex(const EcmaVM *ecmaVm, const FrameHan
|
||||
JSTaggedValue localExportEntries = SourceTextModule::Cast(
|
||||
currentModule.GetTaggedObject())->GetLocalExportEntries();
|
||||
ASSERT(localExportEntries.IsTaggedArray());
|
||||
JSHandle<TaggedArray> localExportArray = JSHandle<TaggedArray>(
|
||||
thread, TaggedArray::Cast(localExportEntries.GetTaggedObject()));
|
||||
JSHandle<TaggedArray> localExportArray(thread, localExportEntries);
|
||||
uint32_t exportEntriesLen = localExportArray->GetLength();
|
||||
JSMutableHandle<LocalExportEntry> ee(thread, thread->GlobalConstants()->GetUndefined());
|
||||
for (uint32_t idx = 0; idx < exportEntriesLen; idx++) {
|
||||
@ -466,10 +465,9 @@ void DebuggerApi::GetModuleVariables(const EcmaVM *ecmaVm, Local<ObjectRef> &mod
|
||||
JSTaggedValue localExportEntries = SourceTextModule::Cast(
|
||||
currentModule.GetTaggedObject())->GetLocalExportEntries();
|
||||
ASSERT(localExportEntries.IsTaggedArray());
|
||||
JSHandle<TaggedArray> localExportArray = JSHandle<TaggedArray>(
|
||||
thread, TaggedArray::Cast(localExportEntries.GetTaggedObject()));
|
||||
JSHandle<TaggedArray> localExportArray(thread, localExportEntries);
|
||||
uint32_t exportEntriesLen = localExportArray->GetLength();
|
||||
JSHandle<TaggedArray> dict = JSHandle<TaggedArray>(thread, TaggedArray::Cast(dictionary.GetTaggedObject()));
|
||||
JSHandle<TaggedArray> dict(thread, dictionary);
|
||||
uint32_t valueLen = dict->GetLength();
|
||||
if (exportEntriesLen != valueLen) {
|
||||
LOG_FULL(FATAL) << "Key does not match value";
|
||||
|
@ -479,7 +479,7 @@ void CpuProfiler::GetNativeStack(const FrameIterator &it, char *functionName, si
|
||||
JSThread *thread = vm_->GetJSThread();
|
||||
const GlobalEnvConstants *globalConst = thread->GlobalConstants();
|
||||
JSHandle<JSTaggedValue> nameKey = globalConst->GetHandledNameString();
|
||||
JSHandle<JSTaggedValue> func = JSHandle<JSTaggedValue>(thread, function);
|
||||
JSHandle<JSTaggedValue> func(thread, function);
|
||||
JSHandle<JSTaggedValue> funcNameValue = JSObject::GetProperty(thread, func, nameKey).GetValue();
|
||||
std::string methodNameStr;
|
||||
if (funcNameValue->IsString()) {
|
||||
|
@ -452,7 +452,7 @@ Expected<JSTaggedValue, bool> EcmaVM::InvokeEcmaEntrypoint(const JSPandaFile *js
|
||||
// for debugger
|
||||
debuggerManager_->GetNotificationManager()->LoadModuleEvent(jsPandaFile->GetJSPandaFileDesc(), entryPoint);
|
||||
|
||||
JSHandle<JSFunction> func = JSHandle<JSFunction>(thread_, program->GetMainFunction());
|
||||
JSHandle<JSFunction> func(thread_, program->GetMainFunction());
|
||||
JSHandle<JSTaggedValue> global = GlobalEnv::Cast(globalEnv_.GetTaggedObject())->GetJSGlobalObject();
|
||||
JSHandle<JSTaggedValue> undefined = thread_->GlobalConstants()->GetHandledUndefined();
|
||||
if (jsPandaFile->IsModule(entryPoint.data())) {
|
||||
|
@ -532,7 +532,7 @@ ARK_INLINE void InterpretedFrame::GCIterate(const FrameIterator &it,
|
||||
{
|
||||
auto sp = it.GetSp();
|
||||
InterpretedFrame *frame = InterpretedFrame::GetFrameFromSp(sp);
|
||||
if (frame->function == JSTaggedValue::Hole()) {
|
||||
if (frame->function.IsHole()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -216,7 +216,7 @@ JSTaggedValue CompareOp::NotEqualWithIC(JSThread *thread, JSTaggedValue left,
|
||||
{
|
||||
INTERPRETER_TRACE(thread, NotEqualWithIC);
|
||||
JSTaggedValue res = EqualWithIC(thread, left, right, operationType);
|
||||
return res == JSTaggedValue::True() ? JSTaggedValue::False() : JSTaggedValue::True();
|
||||
return res.IsTrue() ? JSTaggedValue::False() : JSTaggedValue::True();
|
||||
}
|
||||
|
||||
ComparisonResult CompareOp::Compare(JSThread *thread, JSTaggedValue left,
|
||||
|
@ -74,7 +74,7 @@ JSTaggedValue ICRuntimeStub::CheckPolyHClass(JSTaggedValue cachedValue, JSHClass
|
||||
uint32_t length = array->GetLength();
|
||||
for (uint32_t i = 0; i < length; i += 2) { // 2 means one ic, two slot
|
||||
auto result = array->Get(i);
|
||||
if (result != JSTaggedValue::Undefined() && result.GetWeakReferent() == hclass) {
|
||||
if (!result.IsUndefined() && result.GetWeakReferent() == hclass) {
|
||||
return array->Get(i + 1);
|
||||
}
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ void ProfileTypeAccessor::AddHandlerWithoutKey(JSHandle<JSTaggedValue> hclass, J
|
||||
return;
|
||||
}
|
||||
if (!profileData.IsWeak() && profileData.IsTaggedArray()) { // POLY
|
||||
ASSERT(profileTypeInfo_->Get(index + 1) == JSTaggedValue::Hole());
|
||||
ASSERT(profileTypeInfo_->Get(index + 1).IsHole());
|
||||
JSHandle<TaggedArray> arr(thread_, profileData);
|
||||
const uint32_t step = 2;
|
||||
uint32_t newLen = arr->GetLength() + step;
|
||||
@ -100,7 +100,7 @@ void ProfileTypeAccessor::AddHandlerWithKey(JSHandle<JSTaggedValue> key, JSHandl
|
||||
ASSERT(!profileData.IsHole());
|
||||
auto index = slotId_;
|
||||
if (profileData.IsUndefined()) {
|
||||
ASSERT(profileTypeInfo_->Get(index + 1) == JSTaggedValue::Undefined());
|
||||
ASSERT(profileTypeInfo_->Get(index + 1).IsUndefined());
|
||||
profileTypeInfo_->Set(thread_, index, key.GetTaggedValue());
|
||||
const int arrayLength = 2;
|
||||
JSHandle<TaggedArray> newArr = thread_->GetEcmaVM()->GetFactory()->NewTaggedArray(arrayLength);
|
||||
|
@ -58,7 +58,7 @@ uint32_t ChangeListener::CheckHole(const JSHandle<ChangeListener> &array)
|
||||
{
|
||||
for (uint32_t i = 0; i < array->GetEnd(); i++) {
|
||||
JSTaggedValue value = array->Get(i);
|
||||
if (value == JSTaggedValue::Hole() || value == JSTaggedValue::Undefined()) {
|
||||
if (value.IsHole() || value.IsUndefined()) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
@ -692,7 +692,7 @@ bool FastRuntimeStub::FastSetPropertyByIndex(JSThread *thread, JSTaggedValue rec
|
||||
INTERPRETER_TRACE(thread, FastSetPropertyByIndex);
|
||||
JSTaggedValue result = FastRuntimeStub::SetPropertyByIndex(thread, receiver, index, value);
|
||||
if (!result.IsHole()) {
|
||||
return result != JSTaggedValue::Exception();
|
||||
return !result.IsException();
|
||||
}
|
||||
return JSTaggedValue::SetProperty(thread, JSHandle<JSTaggedValue>(thread, receiver), index,
|
||||
JSHandle<JSTaggedValue>(thread, value), true);
|
||||
@ -704,7 +704,7 @@ bool FastRuntimeStub::FastSetPropertyByValue(JSThread *thread, JSTaggedValue rec
|
||||
INTERPRETER_TRACE(thread, FastSetPropertyByValue);
|
||||
JSTaggedValue result = FastRuntimeStub::SetPropertyByValue(thread, receiver, key, value);
|
||||
if (!result.IsHole()) {
|
||||
return result != JSTaggedValue::Exception();
|
||||
return !result.IsException();
|
||||
}
|
||||
return JSTaggedValue::SetProperty(thread, JSHandle<JSTaggedValue>(thread, receiver),
|
||||
JSHandle<JSTaggedValue>(thread, key), JSHandle<JSTaggedValue>(thread, value),
|
||||
|
@ -960,7 +960,7 @@ NO_UB_SANITIZE void EcmaInterpreter::RunInternal(JSThread *thread, const uint8_t
|
||||
int8_t offset = READ_INST_8_0();
|
||||
LOG_INST() << "jeqz ->\t"
|
||||
<< "cond jmpz " << std::hex << static_cast<int32_t>(offset);
|
||||
if (GET_ACC() == JSTaggedValue::False() || (GET_ACC().IsInt() && GET_ACC().GetInt() == 0) ||
|
||||
if (GET_ACC().IsFalse() || (GET_ACC().IsInt() && GET_ACC().GetInt() == 0) ||
|
||||
(GET_ACC().IsDouble() && GET_ACC().GetDouble() == 0)) {
|
||||
UPDATE_HOTNESS_COUNTER(offset);
|
||||
DISPATCH_OFFSET(offset);
|
||||
@ -972,7 +972,7 @@ NO_UB_SANITIZE void EcmaInterpreter::RunInternal(JSThread *thread, const uint8_t
|
||||
int16_t offset = READ_INST_16_0();
|
||||
LOG_INST() << "jeqz ->\t"
|
||||
<< "cond jmpz " << std::hex << static_cast<int32_t>(offset);
|
||||
if (GET_ACC() == JSTaggedValue::False() || (GET_ACC().IsInt() && GET_ACC().GetInt() == 0) ||
|
||||
if (GET_ACC().IsFalse() || (GET_ACC().IsInt() && GET_ACC().GetInt() == 0) ||
|
||||
(GET_ACC().IsDouble() && GET_ACC().GetDouble() == 0)) {
|
||||
UPDATE_HOTNESS_COUNTER(offset);
|
||||
DISPATCH_OFFSET(offset);
|
||||
@ -984,7 +984,7 @@ NO_UB_SANITIZE void EcmaInterpreter::RunInternal(JSThread *thread, const uint8_t
|
||||
int32_t offset = READ_INST_32_0();
|
||||
LOG_INST() << "jeqz ->\t"
|
||||
<< "cond jmpz " << std::hex << static_cast<int32_t>(offset);
|
||||
if (GET_ACC() == JSTaggedValue::False() || (GET_ACC().IsInt() && GET_ACC().GetInt() == 0) ||
|
||||
if (GET_ACC().IsFalse() || (GET_ACC().IsInt() && GET_ACC().GetInt() == 0) ||
|
||||
(GET_ACC().IsDouble() && GET_ACC().GetDouble() == 0)) {
|
||||
UPDATE_HOTNESS_COUNTER(offset);
|
||||
DISPATCH_OFFSET(offset);
|
||||
@ -996,7 +996,7 @@ NO_UB_SANITIZE void EcmaInterpreter::RunInternal(JSThread *thread, const uint8_t
|
||||
int8_t offset = READ_INST_8_0();
|
||||
LOG_INST() << "jnez ->\t"
|
||||
<< "cond jmpz " << std::hex << static_cast<int32_t>(offset);
|
||||
if (GET_ACC() == JSTaggedValue::True() || (GET_ACC().IsInt() && GET_ACC().GetInt() != 0) ||
|
||||
if (GET_ACC().IsTrue() || (GET_ACC().IsInt() && GET_ACC().GetInt() != 0) ||
|
||||
(GET_ACC().IsDouble() && GET_ACC().GetDouble() != 0)) {
|
||||
UPDATE_HOTNESS_COUNTER(offset);
|
||||
DISPATCH_OFFSET(offset);
|
||||
@ -1008,7 +1008,7 @@ NO_UB_SANITIZE void EcmaInterpreter::RunInternal(JSThread *thread, const uint8_t
|
||||
int16_t offset = READ_INST_16_0();
|
||||
LOG_INST() << "jnez ->\t"
|
||||
<< "cond jmpz " << std::hex << static_cast<int32_t>(offset);
|
||||
if (GET_ACC() == JSTaggedValue::True() || (GET_ACC().IsInt() && GET_ACC().GetInt() != 0) ||
|
||||
if (GET_ACC().IsTrue() || (GET_ACC().IsInt() && GET_ACC().GetInt() != 0) ||
|
||||
(GET_ACC().IsDouble() && GET_ACC().GetDouble() != 0)) {
|
||||
UPDATE_HOTNESS_COUNTER(offset);
|
||||
DISPATCH_OFFSET(offset);
|
||||
@ -1020,7 +1020,7 @@ NO_UB_SANITIZE void EcmaInterpreter::RunInternal(JSThread *thread, const uint8_t
|
||||
int32_t offset = READ_INST_32_0();
|
||||
LOG_INST() << "jnez ->\t"
|
||||
<< "cond jmpz " << std::hex << static_cast<int32_t>(offset);
|
||||
if (GET_ACC() == JSTaggedValue::True() || (GET_ACC().IsInt() && GET_ACC().GetInt() != 0) ||
|
||||
if (GET_ACC().IsTrue() || (GET_ACC().IsInt() && GET_ACC().GetInt() != 0) ||
|
||||
(GET_ACC().IsDouble() && GET_ACC().GetDouble() != 0)) {
|
||||
UPDATE_HOTNESS_COUNTER(offset);
|
||||
DISPATCH_OFFSET(offset);
|
||||
@ -7174,7 +7174,7 @@ bool EcmaInterpreter::UpdateHotnessCounter(JSThread* thread, JSTaggedType *sp, J
|
||||
needRestoreAcc = thread->CheckSafepoint();
|
||||
RESTORE_ACC();
|
||||
method = JSFunction::Cast(state->function.GetTaggedObject())->GetCallTarget();
|
||||
if (state->profileTypeInfo == JSTaggedValue::Undefined()) {
|
||||
if (state->profileTypeInfo.IsUndefined()) {
|
||||
state->acc = acc;
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
|
||||
auto thisFunc = JSFunction::Cast(state->function.GetTaggedObject());
|
||||
|
@ -337,7 +337,7 @@ void InterpreterAssembly::HandleJeqzImm8(
|
||||
int8_t offset = READ_INST_8_0();
|
||||
LOG_INST() << "jeqz ->\t"
|
||||
<< "cond jmpz " << std::hex << static_cast<int32_t>(offset);
|
||||
if (GET_ACC() == JSTaggedValue::False() || (GET_ACC().IsInt() && GET_ACC().GetInt() == 0) ||
|
||||
if (GET_ACC().IsFalse() || (GET_ACC().IsInt() && GET_ACC().GetInt() == 0) ||
|
||||
(GET_ACC().IsDouble() && GET_ACC().GetDouble() == 0)) {
|
||||
UPDATE_HOTNESS_COUNTER(offset);
|
||||
DISPATCH_OFFSET(offset);
|
||||
@ -353,7 +353,7 @@ void InterpreterAssembly::HandleJeqzImm16(
|
||||
int16_t offset = static_cast<int16_t>(READ_INST_16_0());
|
||||
LOG_INST() << "jeqz ->\t"
|
||||
<< "cond jmpz " << std::hex << static_cast<int32_t>(offset);
|
||||
if (GET_ACC() == JSTaggedValue::False() || (GET_ACC().IsInt() && GET_ACC().GetInt() == 0) ||
|
||||
if (GET_ACC().IsFalse() || (GET_ACC().IsInt() && GET_ACC().GetInt() == 0) ||
|
||||
(GET_ACC().IsDouble() && GET_ACC().GetDouble() == 0)) {
|
||||
UPDATE_HOTNESS_COUNTER(offset);
|
||||
DISPATCH_OFFSET(offset);
|
||||
@ -369,7 +369,7 @@ void InterpreterAssembly::HandleJeqzImm32(
|
||||
int32_t offset = static_cast<int32_t>(READ_INST_32_0());
|
||||
LOG_INST() << "jeqz ->\t"
|
||||
<< "cond jmpz " << std::hex << offset;
|
||||
if (GET_ACC() == JSTaggedValue::False() || (GET_ACC().IsInt() && GET_ACC().GetInt() == 0) ||
|
||||
if (GET_ACC().IsFalse() || (GET_ACC().IsInt() && GET_ACC().GetInt() == 0) ||
|
||||
(GET_ACC().IsDouble() && GET_ACC().GetDouble() == 0)) {
|
||||
UPDATE_HOTNESS_COUNTER(offset);
|
||||
DISPATCH_OFFSET(offset);
|
||||
@ -385,7 +385,7 @@ void InterpreterAssembly::HandleJnezImm8(
|
||||
int8_t offset = READ_INST_8_0();
|
||||
LOG_INST() << "jnez ->\t"
|
||||
<< "cond jmpz " << std::hex << static_cast<int32_t>(offset);
|
||||
if (GET_ACC() == JSTaggedValue::True() || (GET_ACC().IsInt() && GET_ACC().GetInt() != 0) ||
|
||||
if (GET_ACC().IsTrue() || (GET_ACC().IsInt() && GET_ACC().GetInt() != 0) ||
|
||||
(GET_ACC().IsDouble() && GET_ACC().GetDouble() != 0)) {
|
||||
UPDATE_HOTNESS_COUNTER(offset);
|
||||
DISPATCH_OFFSET(offset);
|
||||
@ -401,7 +401,7 @@ void InterpreterAssembly::HandleJnezImm16(
|
||||
int16_t offset = static_cast<int16_t>(READ_INST_16_0());
|
||||
LOG_INST() << "jnez ->\t"
|
||||
<< "cond jmpz " << std::hex << static_cast<int32_t>(offset);
|
||||
if (GET_ACC() == JSTaggedValue::True() || (GET_ACC().IsInt() && GET_ACC().GetInt() != 0) ||
|
||||
if (GET_ACC().IsTrue() || (GET_ACC().IsInt() && GET_ACC().GetInt() != 0) ||
|
||||
(GET_ACC().IsDouble() && GET_ACC().GetDouble() != 0)) {
|
||||
UPDATE_HOTNESS_COUNTER(offset);
|
||||
DISPATCH_OFFSET(offset);
|
||||
@ -417,7 +417,7 @@ void InterpreterAssembly::HandleJnezImm32(
|
||||
int32_t offset = static_cast<int32_t>(READ_INST_32_0());
|
||||
LOG_INST() << "jnez ->\t"
|
||||
<< "cond jmpz " << std::hex << offset;
|
||||
if (GET_ACC() == JSTaggedValue::True() || (GET_ACC().IsInt() && GET_ACC().GetInt() != 0) ||
|
||||
if (GET_ACC().IsTrue() || (GET_ACC().IsInt() && GET_ACC().GetInt() != 0) ||
|
||||
(GET_ACC().IsDouble() && GET_ACC().GetDouble() != 0)) {
|
||||
UPDATE_HOTNESS_COUNTER(offset);
|
||||
DISPATCH_OFFSET(offset);
|
||||
@ -7482,7 +7482,7 @@ inline JSTaggedValue InterpreterAssembly::UpdateHotnessCounter(JSThread* thread,
|
||||
JSFunction* function = JSFunction::Cast(state->function.GetTaggedObject());
|
||||
Method *method = function->GetCallTarget();
|
||||
JSTaggedValue profileTypeInfo = method->GetProfileTypeInfo();
|
||||
if (profileTypeInfo == JSTaggedValue::Undefined()) {
|
||||
if (profileTypeInfo.IsUndefined()) {
|
||||
return SlowRuntimeStub::NotifyInlineCache(thread, method);
|
||||
}
|
||||
return profileTypeInfo;
|
||||
|
@ -294,12 +294,12 @@ JSTaggedValue JSAPILightWeightMap::IsEmpty()
|
||||
void JSAPILightWeightMap::Clear(JSThread *thread, const JSHandle<JSAPILightWeightMap> &lightWeightMap)
|
||||
{
|
||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||
JSHandle<JSTaggedValue> hashArray = JSHandle<JSTaggedValue>(factory->NewTaggedArray(DEFAULT_CAPACITY_LENGTH));
|
||||
JSHandle<JSTaggedValue> keyArray = JSHandle<JSTaggedValue>(factory->NewTaggedArray(DEFAULT_CAPACITY_LENGTH));
|
||||
JSHandle<JSTaggedValue> valueArray = JSHandle<JSTaggedValue>(factory->NewTaggedArray(DEFAULT_CAPACITY_LENGTH));
|
||||
lightWeightMap->SetHashes(thread, hashArray);
|
||||
lightWeightMap->SetKeys(thread, keyArray);
|
||||
lightWeightMap->SetValues(thread, valueArray);
|
||||
JSHandle<TaggedArray> hashArray = factory->NewTaggedArray(DEFAULT_CAPACITY_LENGTH);
|
||||
JSHandle<TaggedArray> keyArray = factory->NewTaggedArray(DEFAULT_CAPACITY_LENGTH);
|
||||
JSHandle<TaggedArray> valueArray = factory->NewTaggedArray(DEFAULT_CAPACITY_LENGTH);
|
||||
lightWeightMap->SetHashes(thread, hashArray.GetTaggedValue());
|
||||
lightWeightMap->SetKeys(thread, keyArray.GetTaggedValue());
|
||||
lightWeightMap->SetValues(thread, valueArray.GetTaggedValue());
|
||||
lightWeightMap->SetLength(0);
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ public:
|
||||
bool IsDetach()
|
||||
{
|
||||
JSTaggedValue arrayBufferData = GetArrayBufferData();
|
||||
return arrayBufferData == JSTaggedValue::Null();
|
||||
return arrayBufferData.IsNull();
|
||||
}
|
||||
|
||||
static constexpr size_t DATA_OFFSET = JSObject::SIZE;
|
||||
|
@ -845,7 +845,7 @@ void JSDateTimeFormat::ResolvedOptions(JSThread *thread, const JSHandle<JSDateTi
|
||||
const icu::Calendar *calendar = icuSimpleDateFormat->getCalendar();
|
||||
std::string icuCalendar = calendar->getType();
|
||||
if (icuCalendar == "gregorian") {
|
||||
if (dateTimeFormat->GetIso8601() == JSTaggedValue::True()) {
|
||||
if (dateTimeFormat->GetIso8601().IsTrue()) {
|
||||
calendarValue.Update(globalConst->GetHandledIso8601String().GetTaggedValue());
|
||||
} else {
|
||||
calendarValue.Update(globalConst->GetHandledGregoryString().GetTaggedValue());
|
||||
|
@ -52,7 +52,7 @@ bool CellRecordVector::IsEmpty()
|
||||
}
|
||||
for (uint32_t i = 0; i < GetEnd(); i++) {
|
||||
JSTaggedValue value = Get(i);
|
||||
if (value != JSTaggedValue::Hole()) {
|
||||
if (!value.IsHole()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -63,7 +63,7 @@ uint32_t CellRecordVector::CheckHole(const JSHandle<CellRecordVector> &array)
|
||||
{
|
||||
for (uint32_t i = 0; i < array->GetEnd(); i++) {
|
||||
JSTaggedValue value = array->Get(i);
|
||||
if (value == JSTaggedValue::Hole()) {
|
||||
if (value.IsHole()) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
@ -1206,7 +1206,7 @@ bool JSObject::CreateDataProperty(JSThread *thread, const JSHandle<JSObject> &ob
|
||||
auto result = FastRuntimeStub::SetPropertyByValue<true>(thread, obj.GetTaggedValue(), key.GetTaggedValue(),
|
||||
value.GetTaggedValue());
|
||||
if (!result.IsHole()) {
|
||||
return result != JSTaggedValue::Exception();
|
||||
return !result.IsException();
|
||||
}
|
||||
PropertyDescriptor desc(thread, value, true, true, true);
|
||||
return JSTaggedValue::DefineOwnProperty(thread, JSHandle<JSTaggedValue>::Cast(obj), key, desc);
|
||||
@ -1219,7 +1219,7 @@ bool JSObject::CreateDataProperty(JSThread *thread, const JSHandle<JSObject> &ob
|
||||
auto result =
|
||||
FastRuntimeStub::SetPropertyByIndex<true>(thread, obj.GetTaggedValue(), index, value.GetTaggedValue());
|
||||
if (!result.IsHole()) {
|
||||
return result != JSTaggedValue::Exception();
|
||||
return !result.IsException();
|
||||
}
|
||||
PropertyDescriptor desc(thread, value, true, true, true);
|
||||
return DefineOwnProperty(thread, obj, index, desc);
|
||||
|
@ -51,10 +51,8 @@ bool JSPrimitiveRef::StringGetIndexProperty(const JSThread *thread, const JSHand
|
||||
{
|
||||
uint16_t tmpChar = 0;
|
||||
{
|
||||
JSHandle<EcmaString> strHandle = JSHandle<EcmaString>(thread,
|
||||
EcmaString::Cast(JSPrimitiveRef::Cast(*obj)->GetValue()));
|
||||
JSHandle<EcmaString> strFlat = JSHandle<EcmaString>(thread,
|
||||
EcmaStringAccessor::Flatten(thread->GetEcmaVM(), strHandle));
|
||||
JSHandle<EcmaString> strHandle(thread, EcmaString::Cast(JSPrimitiveRef::Cast(*obj)->GetValue()));
|
||||
JSHandle<EcmaString> strFlat(thread, EcmaStringAccessor::Flatten(thread->GetEcmaVM(), strHandle));
|
||||
if (EcmaStringAccessor(strFlat).GetLength() <= index) {
|
||||
return false;
|
||||
}
|
||||
|
@ -412,7 +412,7 @@ bool JSSerializer::WriteJSFunction(const JSHandle<JSTaggedValue> &value)
|
||||
return false;
|
||||
}
|
||||
JSHandle<JSFunction> func = JSHandle<JSFunction>::Cast(value);
|
||||
JSHandle<JSTaggedValue> method = JSHandle<JSTaggedValue>(thread_, func->GetMethod());
|
||||
JSHandle<JSTaggedValue> method(thread_, func->GetMethod());
|
||||
if (!SerializeJSTaggedValue(method)) {
|
||||
bufferSize_ = oldSize;
|
||||
return false;
|
||||
|
@ -563,7 +563,7 @@ OperationResult JSTaggedValue::GetProperty(JSThread *thread, const JSHandle<JSTa
|
||||
}
|
||||
|
||||
if (obj->IsSpecialContainer()) {
|
||||
JSHandle<JSTaggedValue> keyHandle = JSHandle<JSTaggedValue>(thread, JSTaggedValue(key));
|
||||
JSHandle<JSTaggedValue> keyHandle(thread, JSTaggedValue(key));
|
||||
return GetJSAPIProperty(thread, obj, keyHandle);
|
||||
}
|
||||
|
||||
@ -645,7 +645,7 @@ bool JSTaggedValue::SetProperty(JSThread *thread, const JSHandle<JSTaggedValue>
|
||||
} else if (obj->IsModuleNamespace()) {
|
||||
success = ModuleNamespace::SetProperty(thread, mayThrow);
|
||||
} else if (obj->IsSpecialContainer()) {
|
||||
JSHandle<JSTaggedValue> keyHandle = JSHandle<JSTaggedValue>(thread, JSTaggedValue(key));
|
||||
JSHandle<JSTaggedValue> keyHandle(thread, JSTaggedValue(key));
|
||||
success = SetJSAPIProperty(thread, obj, keyHandle, value);
|
||||
} else {
|
||||
success = JSObject::SetProperty(thread, obj, key, value, mayThrow);
|
||||
|
@ -757,7 +757,7 @@ int ModuleManager::GetExportObjectIndex(EcmaVM *vm, JSHandle<SourceTextModule> e
|
||||
const std::string &key)
|
||||
{
|
||||
JSThread *thread = vm->GetJSThread();
|
||||
JSHandle<TaggedArray> localExportEntries = JSHandle<TaggedArray>(thread, ecmaModule->GetLocalExportEntries());
|
||||
JSHandle<TaggedArray> localExportEntries(thread, ecmaModule->GetLocalExportEntries());
|
||||
size_t exportEntriesLen = localExportEntries->GetLength();
|
||||
// 0: There's only one export value "default"
|
||||
int index = 0;
|
||||
|
@ -782,7 +782,7 @@ Local<JSValueRef> PrimitiveRef::GetValue(const EcmaVM *vm)
|
||||
JSHandle<JSTaggedValue> obj = JSNApiHelper::ToJSHandle(this);
|
||||
if (obj->IsJSPrimitiveRef()) {
|
||||
JSTaggedValue primitiveValue = JSPrimitiveRef::Cast(obj->GetTaggedObject())->GetValue();
|
||||
JSHandle<JSTaggedValue> value = JSHandle<JSTaggedValue>(vm->GetJSThread(), primitiveValue);
|
||||
JSHandle<JSTaggedValue> value(vm->GetJSThread(), primitiveValue);
|
||||
return JSNApiHelper::ToLocal<JSValueRef>(value);
|
||||
}
|
||||
return Local<JSValueRef>();
|
||||
@ -1385,7 +1385,7 @@ Local<StringRef> FunctionRef::GetName(const EcmaVM *vm)
|
||||
{
|
||||
EscapeLocalScope scope(vm);
|
||||
JSThread *thread = vm->GetJSThread();
|
||||
JSHandle<JSFunctionBase> func = JSHandle<JSFunctionBase>(thread, JSNApiHelper::ToJSTaggedValue(this));
|
||||
JSHandle<JSFunctionBase> func(thread, JSNApiHelper::ToJSTaggedValue(this));
|
||||
JSHandle<JSTaggedValue> name = JSFunctionBase::GetFunctionName(thread, func);
|
||||
RETURN_VALUE_IF_ABRUPT(thread, JSValueRef::Undefined(vm));
|
||||
return scope.Escape(JSNApiHelper::ToLocal<StringRef>(name));
|
||||
@ -1395,8 +1395,8 @@ Local<StringRef> FunctionRef::GetSourceCode(const EcmaVM *vm, int lineNumber)
|
||||
{
|
||||
EscapeLocalScope scope(vm);
|
||||
JSThread *thread = vm->GetJSThread();
|
||||
JSHandle<JSFunctionBase> func = JSHandle<JSFunctionBase>(thread, JSNApiHelper::ToJSTaggedValue(this));
|
||||
JSHandle<Method> method = JSHandle<Method>(thread, func->GetMethod());
|
||||
JSHandle<JSFunctionBase> func(thread, JSNApiHelper::ToJSTaggedValue(this));
|
||||
JSHandle<Method> method(thread, func->GetMethod());
|
||||
const JSPandaFile *jsPandaFile = method->GetJSPandaFile();
|
||||
DebugInfoExtractor *debugExtractor = JSPandaFileManager::GetInstance()->GetJSPtExtractor(jsPandaFile);
|
||||
ecmascript::CString entry = JSPandaFile::ENTRY_FUNCTION_NAME;
|
||||
@ -1430,8 +1430,8 @@ Local<StringRef> FunctionRef::GetSourceCode(const EcmaVM *vm, int lineNumber)
|
||||
bool FunctionRef::IsNative(const EcmaVM *vm)
|
||||
{
|
||||
JSThread *thread = vm->GetJSThread();
|
||||
JSHandle<JSFunctionBase> func = JSHandle<JSFunctionBase>(thread, JSNApiHelper::ToJSTaggedValue(this));
|
||||
JSHandle<Method> method = JSHandle<Method>(thread, func->GetMethod());
|
||||
JSHandle<JSFunctionBase> func(thread, JSNApiHelper::ToJSTaggedValue(this));
|
||||
JSHandle<Method> method(thread, func->GetMethod());
|
||||
return method->IsNativeWithCallField();
|
||||
}
|
||||
|
||||
@ -2221,7 +2221,7 @@ Local<BooleanRef> JSValueRef::ToBoolean(const EcmaVM *vm)
|
||||
{
|
||||
JSThread *thread = vm->GetJSThread();
|
||||
JSHandle<JSTaggedValue> obj = JSNApiHelper::ToJSHandle(this);
|
||||
JSHandle<JSTaggedValue> booleanObj = JSHandle<JSTaggedValue>(thread, JSTaggedValue(obj->ToBoolean()));
|
||||
JSHandle<JSTaggedValue> booleanObj(thread, JSTaggedValue(obj->ToBoolean()));
|
||||
return JSNApiHelper::ToLocal<BooleanRef>(booleanObj);
|
||||
}
|
||||
|
||||
|
@ -226,7 +226,7 @@ void ObjectFactory::NewJSArrayBufferData(const JSHandle<JSArrayBuffer> &array, i
|
||||
|
||||
JSTaggedValue data = array->GetArrayBufferData();
|
||||
size_t size = static_cast<size_t>(length) * sizeof(uint8_t);
|
||||
if (data != JSTaggedValue::Undefined()) {
|
||||
if (!data.IsUndefined()) {
|
||||
auto *pointer = JSNativePointer::Cast(data.GetTaggedObject());
|
||||
auto newData = vm_->GetNativeAreaAllocator()->AllocateBuffer(size);
|
||||
if (memset_s(newData, length, 0, length) != EOK) {
|
||||
@ -363,7 +363,7 @@ void ObjectFactory::NewJSRegExpByteCodeData(const JSHandle<JSRegExp> ®exp, vo
|
||||
UNREACHABLE();
|
||||
}
|
||||
JSTaggedValue data = regexp->GetByteCodeBuffer();
|
||||
if (data != JSTaggedValue::Undefined()) {
|
||||
if (!data.IsUndefined()) {
|
||||
JSNativePointer *native = JSNativePointer::Cast(data.GetTaggedObject());
|
||||
native->ResetExternalPointer(newBuffer);
|
||||
return;
|
||||
|
@ -216,7 +216,7 @@ bool PatchLoader::ExecutePatchMain(JSThread *thread, const JSPandaFile *patchFil
|
||||
constpoolVal = vm->FindConstpool(patchFile, 0);
|
||||
}
|
||||
ASSERT(!constpoolVal.IsHole());
|
||||
JSHandle<ConstantPool> constpool = JSHandle<ConstantPool>(thread, constpoolVal);
|
||||
JSHandle<ConstantPool> constpool(thread, constpoolVal);
|
||||
JSHandle<Program> program =
|
||||
PandaFileTranslator::GenerateProgramInternal(vm, patchFile, mainMethodIndex, constpool);
|
||||
|
||||
@ -226,7 +226,7 @@ bool PatchLoader::ExecutePatchMain(JSThread *thread, const JSPandaFile *patchFil
|
||||
|
||||
// For add a new function, Call patch_main_0.
|
||||
JSHandle<JSTaggedValue> undefined = thread->GlobalConstants()->GetHandledUndefined();
|
||||
JSHandle<JSFunction> func = JSHandle<JSFunction>(thread, program->GetMainFunction());
|
||||
JSHandle<JSFunction> func(thread, program->GetMainFunction());
|
||||
JSHandle<SourceTextModule> module = vm->GetModuleManager()->HostGetImportedModule(recordName);
|
||||
func->SetModule(thread, module);
|
||||
EcmaRuntimeCallInfo *info =
|
||||
|
@ -73,7 +73,7 @@ HWTEST_F_L0(CjsModuleCacheTest, PutIfAbsent)
|
||||
newCacheTested->GetModule(fileName.GetTaggedValue()));
|
||||
|
||||
EXPECT_TRUE(newCacheTested->ContainsModule(fileName.GetTaggedValue()));
|
||||
JSHandle<EcmaString> fileNameTested = JSHandle<EcmaString>(thread, moduleTested->GetFilename());
|
||||
JSHandle<EcmaString> fileNameTested(thread, moduleTested->GetFilename());
|
||||
EXPECT_EQ(EcmaStringAccessor::Compare(vm, fileNameTested, JSHandle<EcmaString>(fileName)), 0);
|
||||
}
|
||||
|
||||
@ -104,7 +104,7 @@ HWTEST_F_L0(CjsModuleCacheTest, ResetModule)
|
||||
JSHandle<CjsModule> moduleTested = JSHandle<CjsModule>(thread,
|
||||
newCacheTested->GetModule(fileName.GetTaggedValue()));
|
||||
|
||||
JSHandle<EcmaString> exportsTested = JSHandle<EcmaString>(thread, moduleTested->GetExports());
|
||||
JSHandle<EcmaString> exportsTested(thread, moduleTested->GetExports());
|
||||
EXPECT_EQ(EcmaStringAccessor::Compare(vm, exportsTested, test), 0);
|
||||
}
|
||||
} // namespace panda::test
|
||||
|
@ -905,7 +905,7 @@ DEF_RUNTIME_STUBS(UpdateHotnessCounter)
|
||||
thread->CheckSafepoint();
|
||||
JSHandle<Method> method(thread, thisFunc->GetMethod());
|
||||
auto profileTypeInfo = method->GetProfileTypeInfo();
|
||||
if (profileTypeInfo == JSTaggedValue::Undefined()) {
|
||||
if (profileTypeInfo.IsUndefined()) {
|
||||
if (thread->IsPGOProfilerEnable()) {
|
||||
thread->GetEcmaVM()->GetPGOProfiler()->Sample(thisFunc.GetTaggedType(), SampleMode::HOTNESS_MODE);
|
||||
}
|
||||
|
@ -300,7 +300,7 @@ HWTEST_F_L0(JSAPILinkedListTest, Clear)
|
||||
list->Clear(thread);
|
||||
|
||||
EXPECT_EQ(list->Length(), 0);
|
||||
EXPECT_TRUE(list->GetFirst() == JSTaggedValue::Undefined());
|
||||
EXPECT_TRUE(list->GetFirst().IsUndefined());
|
||||
}
|
||||
|
||||
HWTEST_F_L0(JSAPILinkedListTest, Set)
|
||||
|
@ -247,7 +247,7 @@ HWTEST_F_L0(JSAPIListTest, Clear)
|
||||
list->Clear(thread);
|
||||
|
||||
EXPECT_EQ(list->Length(), 0);
|
||||
EXPECT_TRUE(list->GetFirst() == JSTaggedValue::Undefined());
|
||||
EXPECT_TRUE(list->GetFirst().IsUndefined());
|
||||
}
|
||||
|
||||
HWTEST_F_L0(JSAPIListTest, Set)
|
||||
|
@ -1024,9 +1024,9 @@ HWTEST_F_L0(JSObjectTest, EnableProtoChangeMarker)
|
||||
JSTaggedValue protoDetails1 = obj1Class->GetProtoChangeDetails();
|
||||
EXPECT_TRUE(protoDetails1.IsProtoChangeDetails());
|
||||
JSTaggedValue listeners1 = ProtoChangeDetails::Cast(protoDetails1.GetTaggedObject())->GetChangeListener();
|
||||
EXPECT_TRUE(listeners1 != JSTaggedValue::Undefined());
|
||||
EXPECT_TRUE(!listeners1.IsUndefined());
|
||||
JSTaggedValue listeners2 = ProtoChangeDetails::Cast(protoDetails2.GetTaggedObject())->GetChangeListener();
|
||||
EXPECT_TRUE(listeners2 == JSTaggedValue::Undefined());
|
||||
EXPECT_TRUE(listeners2.IsUndefined());
|
||||
uint32_t index = ProtoChangeDetails::Cast(protoDetails2.GetTaggedObject())->GetRegisterIndex();
|
||||
JSTaggedValue listenersResult = ChangeListener::Cast(listeners1.GetTaggedObject())->Get(index);
|
||||
EXPECT_TRUE(listenersResult == obj2Class.GetTaggedValue());
|
||||
@ -1177,7 +1177,7 @@ HWTEST_F_L0(JSObjectTest, NoticeThroughChain)
|
||||
JSTaggedValue listeners2Value = ProtoChangeDetails::Cast(protoDetails2.GetTaggedObject())->GetChangeListener();
|
||||
EXPECT_TRUE(listeners2Value != JSTaggedValue(0));
|
||||
uint32_t index2 = ProtoChangeDetails::Cast(protoDetails2.GetTaggedObject())->GetRegisterIndex();
|
||||
EXPECT_TRUE(listeners1->Get(index2) == JSTaggedValue::Hole());
|
||||
EXPECT_TRUE(listeners1->Get(index2).IsHole());
|
||||
|
||||
JSTaggedValue obj6Marker = obj6Class->GetProtoChangeMarker();
|
||||
EXPECT_TRUE(obj6Marker.IsProtoChangeMarker());
|
||||
|
@ -987,7 +987,7 @@ int32_t TSManager::GetOldConstantPoolIDByMethodOffset(const JSPandaFile *jsPanda
|
||||
|
||||
JSHandle<ConstantPool> TSManager::GetSnapshotConstantPool(uint32_t cpListIndex)
|
||||
{
|
||||
JSHandle<TaggedArray> snapshotCPList = JSHandle<TaggedArray>(thread_, snapshotData_.GetSnapshotCPList());
|
||||
JSHandle<TaggedArray> snapshotCPList(thread_, snapshotData_.GetSnapshotCPList());
|
||||
return JSHandle<ConstantPool>(thread_, snapshotCPList->Get(cpListIndex));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user