mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-11-23 18:20:04 +00:00
commit
ed94a2df73
@ -50,9 +50,8 @@ int64_t ArrayHelper::GetStartIndex(JSThread *thread, const JSHandle<JSTaggedValu
|
|||||||
}
|
}
|
||||||
// Slow path: startIndexHandle is targged double, or type conversion is involved.
|
// Slow path: startIndexHandle is targged double, or type conversion is involved.
|
||||||
JSTaggedNumber fromIndexTemp = JSTaggedValue::ToNumber(thread, startIndexHandle);
|
JSTaggedNumber fromIndexTemp = JSTaggedValue::ToNumber(thread, startIndexHandle);
|
||||||
if (UNLIKELY(thread->HasPendingException())) {
|
RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, length);
|
||||||
return length;
|
|
||||||
}
|
|
||||||
double fromIndexValue = base::NumberHelper::TruncateDouble(fromIndexTemp.GetNumber()); // NaN -> 0
|
double fromIndexValue = base::NumberHelper::TruncateDouble(fromIndexTemp.GetNumber()); // NaN -> 0
|
||||||
return doClamp(fromIndexValue);
|
return doClamp(fromIndexValue);
|
||||||
}
|
}
|
||||||
@ -89,9 +88,8 @@ int64_t ArrayHelper::GetLastStartIndex(JSThread *thread, const JSHandle<JSTagged
|
|||||||
}
|
}
|
||||||
// Slow path: startIndexHandle is targged double, or type conversion is involved.
|
// Slow path: startIndexHandle is targged double, or type conversion is involved.
|
||||||
JSTaggedNumber fromIndexTemp = JSTaggedValue::ToNumber(thread, startIndexHandle);
|
JSTaggedNumber fromIndexTemp = JSTaggedValue::ToNumber(thread, startIndexHandle);
|
||||||
if (UNLIKELY(thread->HasPendingException())) {
|
RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, -1);
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
double fromIndexValue = base::NumberHelper::TruncateDouble(fromIndexTemp.GetNumber()); // NaN -> 0
|
double fromIndexValue = base::NumberHelper::TruncateDouble(fromIndexTemp.GetNumber()); // NaN -> 0
|
||||||
return doClamp(fromIndexValue);
|
return doClamp(fromIndexValue);
|
||||||
}
|
}
|
||||||
|
@ -2257,6 +2257,7 @@ JSTaggedValue BuiltinsArray::Sort(EcmaRuntimeCallInfo *argv)
|
|||||||
JSStableArray::Sort(thread, thisObjHandle, callbackFnHandle);
|
JSStableArray::Sort(thread, thisObjHandle, callbackFnHandle);
|
||||||
} else {
|
} else {
|
||||||
JSArray::Sort(thread, JSHandle<JSTaggedValue>::Cast(thisObjHandle), callbackFnHandle);
|
JSArray::Sort(thread, JSHandle<JSTaggedValue>::Cast(thisObjHandle), callbackFnHandle);
|
||||||
|
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||||
}
|
}
|
||||||
return thisObjHandle.GetTaggedValue();
|
return thisObjHandle.GetTaggedValue();
|
||||||
}
|
}
|
||||||
|
@ -2495,6 +2495,7 @@ JSTaggedValue RegExpExecResultCache::FindCachedResult(JSThread *thread,
|
|||||||
JSHandle<JSTaggedValue> lastIndexHandle = thread->GlobalConstants()->GetHandledLastIndexString();
|
JSHandle<JSTaggedValue> lastIndexHandle = thread->GlobalConstants()->GetHandledLastIndexString();
|
||||||
ObjectFastOperator::FastSetPropertyByValue(thread, regexp.GetTaggedValue(), lastIndexHandle.GetTaggedValue(),
|
ObjectFastOperator::FastSetPropertyByValue(thread, regexp.GetTaggedValue(), lastIndexHandle.GetTaggedValue(),
|
||||||
Get(index + LAST_INDEX_INDEX));
|
Get(index + LAST_INDEX_INDEX));
|
||||||
|
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||||
if (!isIntermediateResult && result.IsJSArray()) {
|
if (!isIntermediateResult && result.IsJSArray()) {
|
||||||
JSHandle<JSArray> resultHandle(thread, JSArray::Cast(result));
|
JSHandle<JSArray> resultHandle(thread, JSArray::Cast(result));
|
||||||
JSHandle<JSArray> copyArray = thread->GetEcmaVM()->GetFactory()->CloneArrayLiteral(resultHandle);
|
JSHandle<JSArray> copyArray = thread->GetEcmaVM()->GetFactory()->CloneArrayLiteral(resultHandle);
|
||||||
|
@ -70,6 +70,7 @@ bool JSForInIterator::HasProperty(JSThread *thread, JSHandle<JSTaggedValue> rece
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
current.Update(JSTaggedValue::GetPrototype(thread, current));
|
current.Update(JSTaggedValue::GetPrototype(thread, current));
|
||||||
|
RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, false);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -757,6 +757,7 @@ JSHandle<JSHClass> JSFunction::GetInstanceJSHClass(JSThread *thread, JSHandle<JS
|
|||||||
JSMutableHandle<JSTaggedValue> mutableNewTargetProto(thread, JSTaggedValue::Undefined());
|
JSMutableHandle<JSTaggedValue> mutableNewTargetProto(thread, JSTaggedValue::Undefined());
|
||||||
while (!mutableNewTargetProto->IsNull()) {
|
while (!mutableNewTargetProto->IsNull()) {
|
||||||
mutableNewTargetProto.Update(JSTaggedValue::GetPrototype(thread, mutableNewTarget));
|
mutableNewTargetProto.Update(JSTaggedValue::GetPrototype(thread, mutableNewTarget));
|
||||||
|
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSHClass, thread);
|
||||||
if (mutableNewTargetProto.GetTaggedValue() == constructor.GetTaggedValue()) {
|
if (mutableNewTargetProto.GetTaggedValue() == constructor.GetTaggedValue()) {
|
||||||
return GetOrCreateDerivedJSHClass(thread, newTargetFunc, ctorInitialJSHClass);
|
return GetOrCreateDerivedJSHClass(thread, newTargetFunc, ctorInitialJSHClass);
|
||||||
}
|
}
|
||||||
|
@ -547,9 +547,11 @@ public:
|
|||||||
// b. Let mnsd be ? DefaultNumberOption(mnsd, 1, 21, 1).
|
// b. Let mnsd be ? DefaultNumberOption(mnsd, 1, 21, 1).
|
||||||
mnsd = JSHandle<JSTaggedValue>(
|
mnsd = JSHandle<JSTaggedValue>(
|
||||||
thread, JSTaggedValue(JSLocale::DefaultNumberOption(thread, mnsd, 1, MAX_DIGITS, 1)));
|
thread, JSTaggedValue(JSLocale::DefaultNumberOption(thread, mnsd, 1, MAX_DIGITS, 1)));
|
||||||
|
RETURN_IF_ABRUPT_COMPLETION(thread);
|
||||||
// c. Let mxsd be ? DefaultNumberOption(mxsd, mnsd, 21, 21).
|
// c. Let mxsd be ? DefaultNumberOption(mxsd, mnsd, 21, 21).
|
||||||
mxsd = JSHandle<JSTaggedValue>(thread,
|
mxsd = JSHandle<JSTaggedValue>(thread,
|
||||||
JSTaggedValue(JSLocale::DefaultNumberOption(thread, mxsd, mnsd->GetInt(), MAX_DIGITS, MAX_DIGITS)));
|
JSTaggedValue(JSLocale::DefaultNumberOption(thread, mxsd, mnsd->GetInt(), MAX_DIGITS, MAX_DIGITS)));
|
||||||
|
RETURN_IF_ABRUPT_COMPLETION(thread);
|
||||||
// d. Set intlObj.[[MinimumSignificantDigits]] to mnsd.
|
// d. Set intlObj.[[MinimumSignificantDigits]] to mnsd.
|
||||||
intlObj->SetMinimumSignificantDigits(thread, mnsd);
|
intlObj->SetMinimumSignificantDigits(thread, mnsd);
|
||||||
// e. Set intlObj.[[MaximumSignificantDigits]] to mxsd.
|
// e. Set intlObj.[[MaximumSignificantDigits]] to mxsd.
|
||||||
@ -562,6 +564,7 @@ public:
|
|||||||
if (!mxfd->IsUndefined()) {
|
if (!mxfd->IsUndefined()) {
|
||||||
JSTaggedValue mxfdValue =
|
JSTaggedValue mxfdValue =
|
||||||
JSTaggedValue(JSLocale::DefaultNumberOption(thread, mxfd, 0, MAX_FRACTION_DIGITS, mxfdDefault));
|
JSTaggedValue(JSLocale::DefaultNumberOption(thread, mxfd, 0, MAX_FRACTION_DIGITS, mxfdDefault));
|
||||||
|
RETURN_IF_ABRUPT_COMPLETION(thread);
|
||||||
mxfd = JSHandle<JSTaggedValue>(thread, mxfdValue);
|
mxfd = JSHandle<JSTaggedValue>(thread, mxfdValue);
|
||||||
mnfdDefault = std::min(mnfdDefault, mxfd->GetInt());
|
mnfdDefault = std::min(mnfdDefault, mxfd->GetInt());
|
||||||
}
|
}
|
||||||
@ -574,6 +577,7 @@ public:
|
|||||||
mxfd = JSHandle<JSTaggedValue>(
|
mxfd = JSHandle<JSTaggedValue>(
|
||||||
thread, JSTaggedValue(JSLocale::DefaultNumberOption(thread, mxfd, mnfd->GetInt(),
|
thread, JSTaggedValue(JSLocale::DefaultNumberOption(thread, mxfd, mnfd->GetInt(),
|
||||||
MAX_FRACTION_DIGITS, mxfdActualDefault)));
|
MAX_FRACTION_DIGITS, mxfdActualDefault)));
|
||||||
|
RETURN_IF_ABRUPT_COMPLETION(thread);
|
||||||
// e. Set intlObj.[[MinimumFractionDigits]] to mnfd.
|
// e. Set intlObj.[[MinimumFractionDigits]] to mnfd.
|
||||||
intlObj->SetMinimumFractionDigits(thread, mnfd);
|
intlObj->SetMinimumFractionDigits(thread, mnfd);
|
||||||
// f. Set intlObj.[[MaximumFractionDigits]] to mxfd.
|
// f. Set intlObj.[[MaximumFractionDigits]] to mxfd.
|
||||||
|
@ -1410,6 +1410,7 @@ bool JSObject::SetPrototype(JSThread *thread, const JSHandle<JSObject> &obj, con
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
tempProtoHandle.Update(JSTaggedValue::GetPrototype(thread, JSHandle<JSTaggedValue>(tempProtoHandle)));
|
tempProtoHandle.Update(JSTaggedValue::GetPrototype(thread, JSHandle<JSTaggedValue>(tempProtoHandle)));
|
||||||
|
RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// map transition
|
// map transition
|
||||||
|
@ -579,12 +579,12 @@ bool JSTypedArray::IntegerIndexedElementSet(JSThread *thread, const JSHandle<JST
|
|||||||
ContentType contentType = JSHandle<JSTypedArray>::Cast(typedarray)->GetContentType();
|
ContentType contentType = JSHandle<JSTypedArray>::Cast(typedarray)->GetContentType();
|
||||||
if (UNLIKELY(contentType == ContentType::BigInt)) {
|
if (UNLIKELY(contentType == ContentType::BigInt)) {
|
||||||
numValueHandle = JSHandle<JSTaggedValue>(thread, JSTaggedValue::ToBigInt(thread, value));
|
numValueHandle = JSHandle<JSTaggedValue>(thread, JSTaggedValue::ToBigInt(thread, value));
|
||||||
|
RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, false);
|
||||||
} else {
|
} else {
|
||||||
numValueHandle = JSHandle<JSTaggedValue>(thread, JSTaggedValue::ToNumber(thread, value));
|
numValueHandle = JSHandle<JSTaggedValue>(thread, JSTaggedValue::ToNumber(thread, value));
|
||||||
|
RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, false);
|
||||||
}
|
}
|
||||||
// 4. ReturnIfAbrupt(numValue).
|
|
||||||
RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, false);
|
|
||||||
|
|
||||||
JSHandle<JSTypedArray> typedarrayObj(typedarray);
|
JSHandle<JSTypedArray> typedarrayObj(typedarray);
|
||||||
JSTaggedValue buffer = typedarrayObj->GetViewedArrayBufferOrByteArray();
|
JSTaggedValue buffer = typedarrayObj->GetViewedArrayBufferOrByteArray();
|
||||||
JSHandle<JSTaggedValue> indexHandle(thread, index);
|
JSHandle<JSTaggedValue> indexHandle(thread, index);
|
||||||
|
@ -77,6 +77,7 @@ void PropertyAccessor::CollectPrototypeInfo()
|
|||||||
{
|
{
|
||||||
DISALLOW_GARBAGE_COLLECTION;
|
DISALLOW_GARBAGE_COLLECTION;
|
||||||
JSTaggedValue current = JSTaggedValue::GetPrototype(thread_, receiver_);
|
JSTaggedValue current = JSTaggedValue::GetPrototype(thread_, receiver_);
|
||||||
|
RETURN_IF_ABRUPT_COMPLETION(thread_);
|
||||||
while (current.IsHeapObject()) {
|
while (current.IsHeapObject()) {
|
||||||
if (current.IsSlowKeysObject()) {
|
if (current.IsSlowKeysObject()) {
|
||||||
hasSlowProperties_ = true;
|
hasSlowProperties_ = true;
|
||||||
@ -227,6 +228,7 @@ JSHandle<JSTaggedValue> PropertyAccessor::GetKeysSlow()
|
|||||||
JSObject::ClearHasDeleteProperty(current);
|
JSObject::ClearHasDeleteProperty(current);
|
||||||
visited.emplace_back(thread_, current.GetTaggedValue());
|
visited.emplace_back(thread_, current.GetTaggedValue());
|
||||||
current.Update(JSTaggedValue::GetPrototype(thread_, current));
|
current.Update(JSTaggedValue::GetPrototype(thread_, current));
|
||||||
|
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSTaggedValue, thread_);
|
||||||
}
|
}
|
||||||
MergeRemainings(remainings, visited);
|
MergeRemainings(remainings, visited);
|
||||||
return JSHandle<JSTaggedValue>(thread_, slowKeysArray_.GetTaggedValue());
|
return JSHandle<JSTaggedValue>(thread_, slowKeysArray_.GetTaggedValue());
|
||||||
|
@ -619,6 +619,7 @@ JSTaggedValue RuntimeStubs::RuntimeLdSuperByValue(JSThread *thread, const JSHand
|
|||||||
// get Homeobject form function
|
// get Homeobject form function
|
||||||
JSHandle<JSTaggedValue> homeObject(thread, JSFunction::Cast(thisFunc.GetTaggedObject())->GetHomeObject());
|
JSHandle<JSTaggedValue> homeObject(thread, JSFunction::Cast(thisFunc.GetTaggedObject())->GetHomeObject());
|
||||||
JSHandle<JSTaggedValue> superBase(thread, JSTaggedValue::GetSuperBase(thread, homeObject));
|
JSHandle<JSTaggedValue> superBase(thread, JSTaggedValue::GetSuperBase(thread, homeObject));
|
||||||
|
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||||
JSTaggedValue::RequireObjectCoercible(thread, superBase);
|
JSTaggedValue::RequireObjectCoercible(thread, superBase);
|
||||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||||
JSHandle<JSTaggedValue> propKey(JSTaggedValue::ToPropertyKey(thread, key));
|
JSHandle<JSTaggedValue> propKey(JSTaggedValue::ToPropertyKey(thread, key));
|
||||||
@ -637,6 +638,7 @@ JSTaggedValue RuntimeStubs::RuntimeStSuperByValue(JSThread *thread, const JSHand
|
|||||||
// get Homeobject form function
|
// get Homeobject form function
|
||||||
JSHandle<JSTaggedValue> homeObject(thread, JSFunction::Cast(thisFunc.GetTaggedObject())->GetHomeObject());
|
JSHandle<JSTaggedValue> homeObject(thread, JSFunction::Cast(thisFunc.GetTaggedObject())->GetHomeObject());
|
||||||
JSHandle<JSTaggedValue> superBase(thread, JSTaggedValue::GetSuperBase(thread, homeObject));
|
JSHandle<JSTaggedValue> superBase(thread, JSTaggedValue::GetSuperBase(thread, homeObject));
|
||||||
|
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||||
JSTaggedValue::RequireObjectCoercible(thread, superBase);
|
JSTaggedValue::RequireObjectCoercible(thread, superBase);
|
||||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||||
JSHandle<JSTaggedValue> propKey(JSTaggedValue::ToPropertyKey(thread, key));
|
JSHandle<JSTaggedValue> propKey(JSTaggedValue::ToPropertyKey(thread, key));
|
||||||
|
@ -3054,6 +3054,7 @@ DEF_RUNTIME_STUBS(LocaleCompare)
|
|||||||
JSHandle<JSTaggedValue> options = GetHArg<JSTaggedValue>(argv, argc, 3); // 3: means the third parameter
|
JSHandle<JSTaggedValue> options = GetHArg<JSTaggedValue>(argv, argc, 3); // 3: means the third parameter
|
||||||
|
|
||||||
JSHandle<JSTaggedValue> thisObj(JSTaggedValue::RequireObjectCoercible(thread, thisTag));
|
JSHandle<JSTaggedValue> thisObj(JSTaggedValue::RequireObjectCoercible(thread, thisTag));
|
||||||
|
RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSTaggedValue::Exception().GetRawData());
|
||||||
[[maybe_unused]] JSHandle<EcmaString> thisHandle = JSTaggedValue::ToString(thread, thisObj);
|
[[maybe_unused]] JSHandle<EcmaString> thisHandle = JSTaggedValue::ToString(thread, thisObj);
|
||||||
RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSTaggedValue::Exception().GetRawData());
|
RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSTaggedValue::Exception().GetRawData());
|
||||||
[[maybe_unused]] JSHandle<EcmaString> thatHandle = JSTaggedValue::ToString(thread, thatTag);
|
[[maybe_unused]] JSHandle<EcmaString> thatHandle = JSTaggedValue::ToString(thread, thatTag);
|
||||||
@ -3132,6 +3133,7 @@ JSTaggedValue RuntimeStubs::RuntimeArraySort(JSThread *thread, JSHandle<JSTagged
|
|||||||
|
|
||||||
JSHandle<JSTaggedValue> callbackFnHandle(thread, JSTaggedValue::Undefined());
|
JSHandle<JSTaggedValue> callbackFnHandle(thread, JSTaggedValue::Undefined());
|
||||||
JSArray::Sort(thread, JSHandle<JSTaggedValue>::Cast(thisObjHandle), callbackFnHandle);
|
JSArray::Sort(thread, JSHandle<JSTaggedValue>::Cast(thisObjHandle), callbackFnHandle);
|
||||||
|
RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSTaggedValue::Exception());
|
||||||
return thisObjHandle.GetTaggedValue();
|
return thisObjHandle.GetTaggedValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user