From 99d8808bc5b85d54e8e735953a27a0c0c788f10e Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Thu, 14 Jun 2018 10:12:20 +0200 Subject: Add support for function calls with spread Function calls with thread are modelled by pushing an empty value in front of every argument that requires spreading. The runtime methods callWithSpread and constructWithSpread then take care of spreading out the arguments. Change-Id: Ie877c59d3d9d08fc5f20d7befb7153c7b716bf30 Reviewed-by: Simon Hausmann --- src/qml/jsruntime/qv4vme_moth.cpp | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'src/qml/jsruntime/qv4vme_moth.cpp') diff --git a/src/qml/jsruntime/qv4vme_moth.cpp b/src/qml/jsruntime/qv4vme_moth.cpp index 73a28557c2..9bd19cbe6b 100644 --- a/src/qml/jsruntime/qv4vme_moth.cpp +++ b/src/qml/jsruntime/qv4vme_moth.cpp @@ -877,6 +877,24 @@ QV4::ReturnedValue VME::interpret(CppStackFrame &frame, const char *code) CHECK_EXCEPTION; MOTH_END_INSTR(CallContextObjectProperty) + MOTH_BEGIN_INSTR(CallWithSpread) + STORE_IP(); + acc = Runtime::method_callWithSpread(engine, STACK_VALUE(func), STACK_VALUE(thisObject), stack + argv, argc); + CHECK_EXCEPTION; + MOTH_END_INSTR(CallWithSpread) + + MOTH_BEGIN_INSTR(Construct) + STORE_IP(); + acc = Runtime::method_construct(engine, STACK_VALUE(func), stack + argv, argc); + CHECK_EXCEPTION; + MOTH_END_INSTR(Construct) + + MOTH_BEGIN_INSTR(ConstructWithSpread) + STORE_IP(); + acc = Runtime::method_constructWithSpread(engine, STACK_VALUE(func), stack + argv, argc); + CHECK_EXCEPTION; + MOTH_END_INSTR(ConstructWithSpread) + MOTH_BEGIN_INSTR(SetUnwindHandler) frame.unwindHandler = offset ? code + offset : nullptr; MOTH_END_INSTR(SetUnwindHandler) @@ -1062,12 +1080,6 @@ QV4::ReturnedValue VME::interpret(CppStackFrame &frame, const char *code) CHECK_EXCEPTION; MOTH_END_INSTR(ToObject) - MOTH_BEGIN_INSTR(Construct) - STORE_IP(); - acc = Runtime::method_construct(engine, STACK_VALUE(func), stack + argv, argc); - CHECK_EXCEPTION; - MOTH_END_INSTR(Construct) - MOTH_BEGIN_INSTR(Jump) code += offset; MOTH_END_INSTR(Jump) -- cgit v1.2.3