aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4jscall_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/jsruntime/qv4jscall_p.h')
-rw-r--r--src/qml/jsruntime/qv4jscall_p.h18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/qml/jsruntime/qv4jscall_p.h b/src/qml/jsruntime/qv4jscall_p.h
index 8fd6119102..18dfdc102b 100644
--- a/src/qml/jsruntime/qv4jscall_p.h
+++ b/src/qml/jsruntime/qv4jscall_p.h
@@ -63,24 +63,36 @@ namespace QV4 {
struct JSCall {
JSCall(const Scope &scope, std::nullptr_t, int argc = 0)
{
- int size = int(offsetof(QV4::CallData, args)/sizeof(QV4::Value)) + qMax(argc , int(QV4::Global::ReservedArgumentCount));
+ int size = int(offsetof(QV4::CallData, args)/sizeof(QV4::Value)) + argc;
ptr = reinterpret_cast<CallData *>(scope.alloc(size));
ptr->setArgc(argc);
}
JSCall(const Scope &scope, const FunctionObject *function, int argc = 0)
{
- int size = int(offsetof(QV4::CallData, args)/sizeof(QV4::Value)) + qMax(argc , int(QV4::Global::ReservedArgumentCount));
+ int size = int(offsetof(QV4::CallData, args)/sizeof(QV4::Value)) + argc;
ptr = reinterpret_cast<CallData *>(scope.alloc(size));
ptr->setArgc(argc);
ptr->function = *function;
}
JSCall(const Scope &scope, Heap::FunctionObject *function, int argc = 0)
{
- int size = int(offsetof(QV4::CallData, args)/sizeof(QV4::Value)) + qMax(argc , int(QV4::Global::ReservedArgumentCount));
+ int size = int(offsetof(QV4::CallData, args)/sizeof(QV4::Value)) + argc;
ptr = reinterpret_cast<CallData *>(scope.alloc(size));
ptr->setArgc(argc);
ptr->function = function;
}
+ JSCall(const Scope &scope, Value *argv, int argc, Value *thisObject = 0)
+ {
+ int size = int(offsetof(QV4::CallData, args)/sizeof(QV4::Value)) + argc;
+ ptr = reinterpret_cast<CallData *>(scope.engine->jsStackTop);
+ scope.engine->jsStackTop += size;
+ ptr->function = Encode::undefined();
+ ptr->context = Encode::undefined();
+ ptr->accumulator = Encode::undefined();
+ ptr->thisObject = thisObject ? thisObject->asReturnedValue() : Encode::undefined();
+ ptr->setArgc(argc);
+ memcpy(ptr->args, argv, argc*sizeof(Value));
+ }
CallData *operator->() {
return ptr;