!6037 异常未及时返回part5

Merge pull request !6037 from 杨云飞/master
This commit is contained in:
openharmony_ci 2024-01-30 06:44:34 +00:00 committed by Gitee
commit ed94a2df73
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
11 changed files with 22 additions and 9 deletions

View File

@ -50,9 +50,8 @@ int64_t ArrayHelper::GetStartIndex(JSThread *thread, const JSHandle<JSTaggedValu
}
// Slow path: startIndexHandle is targged double, or type conversion is involved.
JSTaggedNumber fromIndexTemp = JSTaggedValue::ToNumber(thread, startIndexHandle);
if (UNLIKELY(thread->HasPendingException())) {
return length;
}
RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, length);
double fromIndexValue = base::NumberHelper::TruncateDouble(fromIndexTemp.GetNumber()); // NaN -> 0
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.
JSTaggedNumber fromIndexTemp = JSTaggedValue::ToNumber(thread, startIndexHandle);
if (UNLIKELY(thread->HasPendingException())) {
return -1;
}
RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, -1);
double fromIndexValue = base::NumberHelper::TruncateDouble(fromIndexTemp.GetNumber()); // NaN -> 0
return doClamp(fromIndexValue);
}

View File

@ -2257,6 +2257,7 @@ JSTaggedValue BuiltinsArray::Sort(EcmaRuntimeCallInfo *argv)
JSStableArray::Sort(thread, thisObjHandle, callbackFnHandle);
} else {
JSArray::Sort(thread, JSHandle<JSTaggedValue>::Cast(thisObjHandle), callbackFnHandle);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
}
return thisObjHandle.GetTaggedValue();
}

View File

@ -2495,6 +2495,7 @@ JSTaggedValue RegExpExecResultCache::FindCachedResult(JSThread *thread,
JSHandle<JSTaggedValue> lastIndexHandle = thread->GlobalConstants()->GetHandledLastIndexString();
ObjectFastOperator::FastSetPropertyByValue(thread, regexp.GetTaggedValue(), lastIndexHandle.GetTaggedValue(),
Get(index + LAST_INDEX_INDEX));
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
if (!isIntermediateResult && result.IsJSArray()) {
JSHandle<JSArray> resultHandle(thread, JSArray::Cast(result));
JSHandle<JSArray> copyArray = thread->GetEcmaVM()->GetFactory()->CloneArrayLiteral(resultHandle);

View File

@ -70,6 +70,7 @@ bool JSForInIterator::HasProperty(JSThread *thread, JSHandle<JSTaggedValue> rece
return true;
}
current.Update(JSTaggedValue::GetPrototype(thread, current));
RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, false);
}
return false;
}

View File

@ -757,6 +757,7 @@ JSHandle<JSHClass> JSFunction::GetInstanceJSHClass(JSThread *thread, JSHandle<JS
JSMutableHandle<JSTaggedValue> mutableNewTargetProto(thread, JSTaggedValue::Undefined());
while (!mutableNewTargetProto->IsNull()) {
mutableNewTargetProto.Update(JSTaggedValue::GetPrototype(thread, mutableNewTarget));
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSHClass, thread);
if (mutableNewTargetProto.GetTaggedValue() == constructor.GetTaggedValue()) {
return GetOrCreateDerivedJSHClass(thread, newTargetFunc, ctorInitialJSHClass);
}

View File

@ -547,9 +547,11 @@ public:
// b. Let mnsd be ? DefaultNumberOption(mnsd, 1, 21, 1).
mnsd = JSHandle<JSTaggedValue>(
thread, JSTaggedValue(JSLocale::DefaultNumberOption(thread, mnsd, 1, MAX_DIGITS, 1)));
RETURN_IF_ABRUPT_COMPLETION(thread);
// c. Let mxsd be ? DefaultNumberOption(mxsd, mnsd, 21, 21).
mxsd = JSHandle<JSTaggedValue>(thread,
JSTaggedValue(JSLocale::DefaultNumberOption(thread, mxsd, mnsd->GetInt(), MAX_DIGITS, MAX_DIGITS)));
RETURN_IF_ABRUPT_COMPLETION(thread);
// d. Set intlObj.[[MinimumSignificantDigits]] to mnsd.
intlObj->SetMinimumSignificantDigits(thread, mnsd);
// e. Set intlObj.[[MaximumSignificantDigits]] to mxsd.
@ -562,6 +564,7 @@ public:
if (!mxfd->IsUndefined()) {
JSTaggedValue mxfdValue =
JSTaggedValue(JSLocale::DefaultNumberOption(thread, mxfd, 0, MAX_FRACTION_DIGITS, mxfdDefault));
RETURN_IF_ABRUPT_COMPLETION(thread);
mxfd = JSHandle<JSTaggedValue>(thread, mxfdValue);
mnfdDefault = std::min(mnfdDefault, mxfd->GetInt());
}
@ -574,6 +577,7 @@ public:
mxfd = JSHandle<JSTaggedValue>(
thread, JSTaggedValue(JSLocale::DefaultNumberOption(thread, mxfd, mnfd->GetInt(),
MAX_FRACTION_DIGITS, mxfdActualDefault)));
RETURN_IF_ABRUPT_COMPLETION(thread);
// e. Set intlObj.[[MinimumFractionDigits]] to mnfd.
intlObj->SetMinimumFractionDigits(thread, mnfd);
// f. Set intlObj.[[MaximumFractionDigits]] to mxfd.

View File

@ -1410,6 +1410,7 @@ bool JSObject::SetPrototype(JSThread *thread, const JSHandle<JSObject> &obj, con
break;
}
tempProtoHandle.Update(JSTaggedValue::GetPrototype(thread, JSHandle<JSTaggedValue>(tempProtoHandle)));
RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, false);
}
}
// map transition

View File

@ -579,12 +579,12 @@ bool JSTypedArray::IntegerIndexedElementSet(JSThread *thread, const JSHandle<JST
ContentType contentType = JSHandle<JSTypedArray>::Cast(typedarray)->GetContentType();
if (UNLIKELY(contentType == ContentType::BigInt)) {
numValueHandle = JSHandle<JSTaggedValue>(thread, JSTaggedValue::ToBigInt(thread, value));
RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, false);
} else {
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);
JSTaggedValue buffer = typedarrayObj->GetViewedArrayBufferOrByteArray();
JSHandle<JSTaggedValue> indexHandle(thread, index);

View File

@ -77,6 +77,7 @@ void PropertyAccessor::CollectPrototypeInfo()
{
DISALLOW_GARBAGE_COLLECTION;
JSTaggedValue current = JSTaggedValue::GetPrototype(thread_, receiver_);
RETURN_IF_ABRUPT_COMPLETION(thread_);
while (current.IsHeapObject()) {
if (current.IsSlowKeysObject()) {
hasSlowProperties_ = true;
@ -227,6 +228,7 @@ JSHandle<JSTaggedValue> PropertyAccessor::GetKeysSlow()
JSObject::ClearHasDeleteProperty(current);
visited.emplace_back(thread_, current.GetTaggedValue());
current.Update(JSTaggedValue::GetPrototype(thread_, current));
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSTaggedValue, thread_);
}
MergeRemainings(remainings, visited);
return JSHandle<JSTaggedValue>(thread_, slowKeysArray_.GetTaggedValue());

View File

@ -619,6 +619,7 @@ JSTaggedValue RuntimeStubs::RuntimeLdSuperByValue(JSThread *thread, const JSHand
// get Homeobject form function
JSHandle<JSTaggedValue> homeObject(thread, JSFunction::Cast(thisFunc.GetTaggedObject())->GetHomeObject());
JSHandle<JSTaggedValue> superBase(thread, JSTaggedValue::GetSuperBase(thread, homeObject));
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
JSTaggedValue::RequireObjectCoercible(thread, superBase);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
JSHandle<JSTaggedValue> propKey(JSTaggedValue::ToPropertyKey(thread, key));
@ -637,6 +638,7 @@ JSTaggedValue RuntimeStubs::RuntimeStSuperByValue(JSThread *thread, const JSHand
// get Homeobject form function
JSHandle<JSTaggedValue> homeObject(thread, JSFunction::Cast(thisFunc.GetTaggedObject())->GetHomeObject());
JSHandle<JSTaggedValue> superBase(thread, JSTaggedValue::GetSuperBase(thread, homeObject));
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
JSTaggedValue::RequireObjectCoercible(thread, superBase);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
JSHandle<JSTaggedValue> propKey(JSTaggedValue::ToPropertyKey(thread, key));

View File

@ -3054,6 +3054,7 @@ DEF_RUNTIME_STUBS(LocaleCompare)
JSHandle<JSTaggedValue> options = GetHArg<JSTaggedValue>(argv, argc, 3); // 3: means the third parameter
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);
RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSTaggedValue::Exception().GetRawData());
[[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());
JSArray::Sort(thread, JSHandle<JSTaggedValue>::Cast(thisObjHandle), callbackFnHandle);
RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSTaggedValue::Exception());
return thisObjHandle.GetTaggedValue();
}