aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4runtime.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2017-08-31 13:43:39 +0200
committerLars Knoll <lars.knoll@qt.io>2017-09-01 12:31:08 +0000
commitef4b896d293ef8bb85dbf54a6049ed80bfdd19f8 (patch)
tree553fd986430c927db082568123ba3b126dfb8aa6 /src/qml/jsruntime/qv4runtime.cpp
parent37195fe928494cb192220f115254bfe084cc3ab8 (diff)
Don't emit bytecode just to set the thisObject to undefined
The stubs doing the calls often overwrite the value, and can in any case do it more efficiently. Change-Id: I0bb2fb3dcc34e805e0a4a178db02f99816d5cf46 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4runtime.cpp')
-rw-r--r--src/qml/jsruntime/qv4runtime.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp
index 57c24e5c12..18eac9a7fb 100644
--- a/src/qml/jsruntime/qv4runtime.cpp
+++ b/src/qml/jsruntime/qv4runtime.cpp
@@ -991,7 +991,7 @@ uint Runtime::method_compareIn(ExecutionEngine *engine, const Value &left, const
ReturnedValue Runtime::method_callGlobalLookup(ExecutionEngine *engine, uint index, CallData *callData)
{
- Q_ASSERT(callData->thisObject.isUndefined());
+ callData->thisObject = Encode::undefined();
Lookup *l = engine->currentStackFrame->v4Function->compilationUnit->runtimeLookups + index;
callData->function = l->globalGetter(l, engine);
@@ -1003,7 +1003,7 @@ ReturnedValue Runtime::method_callGlobalLookup(ExecutionEngine *engine, uint ind
ReturnedValue Runtime::method_callPossiblyDirectEval(ExecutionEngine *engine, CallData *callData)
{
- Q_ASSERT(callData->thisObject.isUndefined());
+ callData->thisObject = Encode::undefined();
ExecutionContext &ctx = static_cast<ExecutionContext &>(engine->currentStackFrame->jsFrame->context);
callData->function = ctx.getPropertyAndBase(engine->id_eval(), &callData->thisObject);
if (engine->hasException)
@@ -1027,7 +1027,7 @@ ReturnedValue Runtime::method_callPossiblyDirectEval(ExecutionEngine *engine, Ca
ReturnedValue Runtime::method_callName(ExecutionEngine *engine, int nameIndex, CallData *callData)
{
- Q_ASSERT(callData->thisObject.isUndefined());
+ callData->thisObject = Encode::undefined();
callData->function = engine->currentStackFrame->v4Function->compilationUnit->runtimeStrings[nameIndex];
ExecutionContext &ctx = static_cast<ExecutionContext &>(engine->currentStackFrame->jsFrame->context);
@@ -1107,6 +1107,7 @@ ReturnedValue Runtime::method_callElement(ExecutionEngine *engine, const Value &
ReturnedValue Runtime::method_callValue(ExecutionEngine *engine, const Value &func, CallData *callData)
{
+ callData->thisObject = Encode::undefined();
callData->function = func;
if (!func.isFunctionObject())
return engine->throwTypeError(QStringLiteral("%1 is not a function").arg(func.toQStringNoThrow()));