bugfix:Proxy function backstack error

issue:https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/I9GJXA

Signed-off-by: hecunmao <hecunmao@huawei.com>
Change-Id: I9209666fa479e30ef8950d3e1f44225c4452027d
This commit is contained in:
hecunmao 2024-04-16 14:53:38 +08:00
parent 46cbbff369
commit bbb5853e50
3 changed files with 19 additions and 2 deletions

View File

@ -1026,9 +1026,15 @@ JSTaggedValue JSProxy::ConstructInternal(EcmaRuntimeCallInfo *info)
JSHandle<JSArray> arrHandle = JSArray::CreateArrayFromList(thread, taggedArray);
// step 8 ~ 9 Call(trap, handler, «target, argArray, newTarget »).
JSHandle<JSTaggedValue> newTarget(info->GetNewTarget());
JSHandle<JSTaggedValue> newTarget(thread, info->GetNewTargetValue());
const uint32_t argsLength = 3; // 3: «target, argArray, newTarget »
JSHandle<JSTaggedValue> undefined = globalConst->GetHandledUndefined();
JSTaggedType *currentSp = reinterpret_cast<JSTaggedType *>(info);
InterpretedEntryFrame *currentEntryState = InterpretedEntryFrame::GetFrameFromSp(currentSp);
JSTaggedType *prevSp = currentEntryState->base.prev;
thread->SetCurrentSPFrame(prevSp);
EcmaRuntimeCallInfo *runtimeInfo =
EcmaInterpreter::NewRuntimeCallInfo(thread, method, handler, undefined, argsLength);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);

View File

@ -25,3 +25,4 @@ constructor is fail
TypeError
[object Array]
TypeError: function.toString() target is incompatible object
test proxy constructor success!

View File

@ -110,4 +110,14 @@ print(Object.prototype.toString.call(pro1));
} catch (error) {
print(error);
}
}
}
class C9{};
let v4 = new Proxy(Uint32Array,Reflect);
class C4 extends v4 {
constructor(a6,a7,a8){
super();
new C9(a7,C4);
}
}
new C4();
print("test proxy constructor success!")