diff options
author | Lars Knoll <[email protected]> | 2017-08-31 13:43:39 +0200 |
---|---|---|
committer | Lars Knoll <[email protected]> | 2017-09-01 12:31:08 +0000 |
commit | ef4b896d293ef8bb85dbf54a6049ed80bfdd19f8 (patch) | |
tree | 553fd986430c927db082568123ba3b126dfb8aa6 /src/qml/jsruntime | |
parent | 37195fe928494cb192220f115254bfe084cc3ab8 (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 <[email protected]>
Diffstat (limited to 'src/qml/jsruntime')
-rw-r--r-- | src/qml/jsruntime/qv4runtime.cpp | 7 |
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())); |