mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-10-07 16:13:49 +00:00
Two throw exception problems
issue:https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/I9JQBX Signed-off-by: hecunmao <hecunmao@huawei.com> Change-Id: I26868b091fbee5637c53ae2e073eee73c18ca1cc
This commit is contained in:
parent
9f0e4b48b4
commit
f753765831
@ -280,6 +280,7 @@ JSTaggedValue BuiltinsFunction::FunctionPrototypeBind(EcmaRuntimeCallInfo *argv)
|
||||
status = JSFunction::SetFunctionName(thread, JSHandle<JSFunctionBase>(boundFunction),
|
||||
targetName, boundName);
|
||||
}
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
// Assert: status is not an abrupt completion.
|
||||
ASSERT_PRINT(status, "DefinePropertyOr failed");
|
||||
}
|
||||
|
@ -1455,10 +1455,18 @@ void BuiltinsTypedArrayStubBuilder::Filter(GateRef glue, GateRef thisValue, Gate
|
||||
i = Int32Add(*i, Int32(1));
|
||||
LoopEnd(&loopHead);
|
||||
Bind(&loopExit);
|
||||
|
||||
Label hasException2(env);
|
||||
Label notHasException2(env);
|
||||
NewObjectStubBuilder newBuilder(this);
|
||||
newBuilder.SetParameters(glue, 0);
|
||||
GateRef newArray = newBuilder.NewTypedArray(glue, thisValue, arrayType, TruncInt64ToInt32(*newArrayLen));
|
||||
BRANCH(HasPendingException(glue), &hasException2, ¬HasException2);
|
||||
Bind(&hasException2);
|
||||
{
|
||||
result->WriteVariable(Exception());
|
||||
Jump(exit);
|
||||
}
|
||||
Bind(¬HasException2);
|
||||
i = Int32(0);
|
||||
Label loopHead2(env);
|
||||
Label loopEnd2(env);
|
||||
@ -1519,6 +1527,8 @@ void BuiltinsTypedArrayStubBuilder::Slice(GateRef glue, GateRef thisValue, GateR
|
||||
Label newTypedArray(env);
|
||||
Label writeVariable(env);
|
||||
Label copyBuffer(env);
|
||||
Label hasException0(env);
|
||||
Label notHasException0(env);
|
||||
GateRef thisLen = ZExtInt32ToInt64(GetArrayLength(thisValue));
|
||||
BRANCH(Int64GreaterThanOrEqual(IntPtr(0), numArgs), slowPath, &startTagExists);
|
||||
Bind(&startTagExists);
|
||||
@ -1558,6 +1568,13 @@ void BuiltinsTypedArrayStubBuilder::Slice(GateRef glue, GateRef thisValue, GateR
|
||||
NewObjectStubBuilder newBuilder(this);
|
||||
newBuilder.SetParameters(glue, 0);
|
||||
GateRef newArray = newBuilder.NewTypedArray(glue, thisValue, arrayType, TruncInt64ToInt32(*newArrayLen));
|
||||
BRANCH(HasPendingException(glue), &hasException0, ¬HasException0);
|
||||
Bind(&hasException0);
|
||||
{
|
||||
result->WriteVariable(Exception());
|
||||
Jump(exit);
|
||||
}
|
||||
Bind(¬HasException0);
|
||||
BRANCH(Int32Equal(TruncInt64ToInt32(*newArrayLen), Int32(0)), &writeVariable, ©Buffer);
|
||||
Bind(©Buffer);
|
||||
{
|
||||
@ -1685,6 +1702,15 @@ void BuiltinsTypedArrayStubBuilder::With(GateRef glue, GateRef thisValue, GateRe
|
||||
NewObjectStubBuilder newBuilder(this);
|
||||
newBuilder.SetParameters(glue, 0);
|
||||
GateRef newArray = newBuilder.NewTypedArray(glue, thisValue, jsType, TruncInt64ToInt32(thisLen));
|
||||
Label hasException0(env);
|
||||
Label notHasException0(env);
|
||||
BRANCH(HasPendingException(glue), &hasException0, ¬HasException0);
|
||||
Bind(&hasException0);
|
||||
{
|
||||
result->WriteVariable(Exception());
|
||||
Jump(exit);
|
||||
}
|
||||
Bind(¬HasException0);
|
||||
CallNGCRuntime(glue, RTSTUB_ID(CopyTypedArrayBuffer),
|
||||
{thisValue, newArray, Int32(0), Int32(0), TruncInt64ToInt32(thisLen),
|
||||
newBuilder.GetElementSizeFromType(glue, jsType)});
|
||||
|
@ -26,3 +26,27 @@ print(holey_array.slice(2, 3)[0]);
|
||||
print(Object.getOwnPropertyDescriptor(narr, 0));
|
||||
})();
|
||||
|
||||
|
||||
|
||||
// This use case takes a long time, but the corresponding bug is only repeated in the debug
|
||||
let err = [];
|
||||
err.length=100;
|
||||
let err_len = 0;
|
||||
function runNearStackLimit(f) {
|
||||
function t() {
|
||||
try {
|
||||
t();
|
||||
} catch (e) {
|
||||
err[err_len++]=e;
|
||||
f();
|
||||
}
|
||||
}; try {
|
||||
t();
|
||||
} catch (e) { }
|
||||
}
|
||||
const v7 = new Proxy(String, {});
|
||||
function f0() {
|
||||
v7.bind();
|
||||
}
|
||||
runNearStackLimit(f0);
|
||||
print("runNearStackLimit test success!");
|
@ -14,3 +14,4 @@
|
||||
undefined
|
||||
3
|
||||
[object Object]
|
||||
runNearStackLimit test success!
|
||||
|
Loading…
Reference in New Issue
Block a user