aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4codegen.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2017-08-30 14:14:00 +0200
committerLars Knoll <lars.knoll@qt.io>2017-09-01 12:30:23 +0000
commitede52ec76ed0939ce41bb81843dc750241c6e78f (patch)
treecb39f94e9a5eb3a948d18bc1cb90e1c975c8636c /src/qml/compiler/qv4codegen.cpp
parent3bb642089b736b1ca1c0f722af2dc18bed3e068b (diff)
Add the current context and function object to CallData
Like this we can avoid creating Scope's when calling functions. Change-Id: I59b82c85eafd3a5437c233aba5f2e8330d5ce104 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4codegen.cpp')
-rw-r--r--src/qml/compiler/qv4codegen.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp
index b881454f40..34cffc3faa 100644
--- a/src/qml/compiler/qv4codegen.cpp
+++ b/src/qml/compiler/qv4codegen.cpp
@@ -1230,10 +1230,15 @@ Moth::StackSlot Codegen::pushArgs(ArgumentList *args)
int argc = 0;
for (ArgumentList *it = args; it; it = it->next)
++argc;
- int calldata = bytecodeGenerator->newRegisterArray(argc + 2); // 2 additional values for CallData
+ int calldata = bytecodeGenerator->newRegisterArray(sizeof(CallData)/sizeof(Value) - 1 + argc);
(void) Reference::fromConst(this, QV4::Encode(argc)).storeOnStack(calldata);
+#ifndef QT_NO_DEBUG
(void) Reference::fromConst(this, QV4::Encode::undefined()).storeOnStack(calldata + 1);
+ (void) Reference::fromConst(this, QV4::Encode::undefined()).storeOnStack(calldata + 2);
+#endif
+ (void) Reference::fromConst(this, QV4::Encode::undefined()).storeOnStack(calldata + 3);
+ Q_STATIC_ASSERT(sizeof(CallData) == 5 * sizeof(Value));
argc = 0;
for (ArgumentList *it = args; it; it = it->next) {
@@ -1241,7 +1246,7 @@ Moth::StackSlot Codegen::pushArgs(ArgumentList *args)
Reference e = expression(it->expression);
if (hasError)
break;
- (void) e.storeOnStack(calldata + 2 + argc);
+ (void) e.storeOnStack(calldata + sizeof(CallData)/sizeof(Value) - 1 + argc);
++argc;
}