aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4functionobject.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2021-03-12 15:46:29 +0100
committerUlf Hermann <ulf.hermann@qt.io>2021-03-17 13:10:22 +0100
commit9caea013ceb221b5617c4940e7bb9ee9fecdd631 (patch)
treef4480e860a965f6515e516475baeced69b5d91fd /src/qml/jsruntime/qv4functionobject.cpp
parentb0e9c83f99aa7090c82b7c55894f5e264b74608a (diff)
Clean up JSCallData setup
We either have pre-populated arguments and thisObject, then we can just use them and keep them const. Or, we want to allocate and populate the arguments and the thisObject. Then, do allocate them in a separate object, and transform that into JSCallData afterwards if necessary. Furthermore, avoid alloc(0) as that just returns the current stack top. Writing to it will clobber other data. Rather, just use nullptr and crash if it's written to. Also, remove the useless operator-> from JSCallData. That one just confuses the reader. Change-Id: I8310911fcfe005b05a07b78fcb3791d991a0c2ce Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4functionobject.cpp')
-rw-r--r--src/qml/jsruntime/qv4functionobject.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp
index 3f0a316af7..9701e0e9ca 100644
--- a/src/qml/jsruntime/qv4functionobject.cpp
+++ b/src/qml/jsruntime/qv4functionobject.cpp
@@ -722,9 +722,9 @@ ReturnedValue BoundFunction::virtualCall(const FunctionObject *fo, const Value *
Scope scope(v4);
Scoped<MemberData> boundArgs(scope, f->boundArgs());
ScopedFunctionObject target(scope, f->target());
- JSCallData jsCallData(scope, (boundArgs ? boundArgs->size() : 0) + argc);
- *jsCallData->thisObject = f->boundThis();
- Value *argp = jsCallData->args;
+ JSCallArguments jsCallData(scope, (boundArgs ? boundArgs->size() : 0) + argc);
+ *jsCallData.thisObject = f->boundThis();
+ Value *argp = jsCallData.args;
if (boundArgs) {
memcpy(argp, boundArgs->data(), boundArgs->size()*sizeof(Value));
argp += boundArgs->size();
@@ -743,8 +743,8 @@ ReturnedValue BoundFunction::virtualCallAsConstructor(const FunctionObject *fo,
Scoped<MemberData> boundArgs(scope, f->boundArgs());
ScopedFunctionObject target(scope, f->target());
- JSCallData jsCallData(scope, (boundArgs ? boundArgs->size() : 0) + argc);
- Value *argp = jsCallData->args;
+ JSCallArguments jsCallData(scope, (boundArgs ? boundArgs->size() : 0) + argc);
+ Value *argp = jsCallData.args;
if (boundArgs) {
memcpy(argp, boundArgs->data(), boundArgs->size()*sizeof(Value));
argp += boundArgs->size();