aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4jscall_p.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2017-10-20 16:54:10 +0200
committerLars Knoll <lars.knoll@qt.io>2017-11-07 09:00:44 +0000
commitbc5ff76e5afe6356bebb344c9a5d8b304e852f3c (patch)
tree436e4cfdcad3ec2e882c300c85395fdeee3a4d48 /src/qml/jsruntime/qv4jscall_p.h
parent9b25000cb41b97c9c9f49a542c9b82cf25c032db (diff)
Simplify JSCallData construction
Change-Id: Ic53532edae9a209aa7125af6f00a9d993d74f1a3 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4jscall_p.h')
-rw-r--r--src/qml/jsruntime/qv4jscall_p.h30
1 files changed, 3 insertions, 27 deletions
diff --git a/src/qml/jsruntime/qv4jscall_p.h b/src/qml/jsruntime/qv4jscall_p.h
index 0bb2d840da..0f22aa1aa7 100644
--- a/src/qml/jsruntime/qv4jscall_p.h
+++ b/src/qml/jsruntime/qv4jscall_p.h
@@ -61,20 +61,7 @@ QT_BEGIN_NAMESPACE
namespace QV4 {
struct JSCallData {
- JSCallData(const Scope &scope, std::nullptr_t, int argc = 0)
- {
- int size = int(offsetof(QV4::CallData, args)/sizeof(QV4::Value)) + argc;
- ptr = reinterpret_cast<CallData *>(scope.alloc(size));
- ptr->setArgc(argc);
- }
- JSCallData(const Scope &scope, const FunctionObject *function, int argc = 0)
- {
- int size = int(offsetof(QV4::CallData, args)/sizeof(QV4::Value)) + argc;
- ptr = reinterpret_cast<CallData *>(scope.alloc(size));
- ptr->setArgc(argc);
- ptr->function = *function;
- }
- JSCallData(const Scope &scope, Value *argv, int argc, Value *thisObject = 0)
+ JSCallData(const Scope &scope, int argc = 0, const Value *argv = 0, const Value *thisObject = 0)
{
int size = int(offsetof(QV4::CallData, args)/sizeof(QV4::Value)) + argc;
ptr = reinterpret_cast<CallData *>(scope.engine->jsStackTop);
@@ -84,19 +71,8 @@ struct JSCallData {
ptr->accumulator = Encode::undefined();
ptr->thisObject = thisObject ? thisObject->asReturnedValue() : Encode::undefined();
ptr->setArgc(argc);
- memcpy(ptr->args, argv, argc*sizeof(Value));
- }
- JSCallData(const Scope &scope, ReturnedValue function, const Value *argv, int argc, const 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 = function;
- 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));
+ if (argv)
+ memcpy(ptr->args, argv, argc*sizeof(Value));
}
CallData *operator->() const {