summaryrefslogtreecommitdiff
path: root/src/qml/jsruntime/qv4functionobject.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-11-02 21:10:13 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-11-05 22:23:25 +0100
commit90338de17a56304eace1f64661a9aac21fe4d29c (patch)
tree0960479c21e3d6f49c60ad7e90ae5fbdf9595ef2 /src/qml/jsruntime/qv4functionobject.cpp
parentb5f76295659dd49d46b306b66807f44841fca992 (diff)
downloadqtdeclarative-90338de17a56304eace1f64661a9aac21fe4d29c.tar.gz
Move conversion of this object into generated code
When a non strict mode function uses the this object, we need to make sure it's being correctly converted into a object before being accessed. So far this was being done by ScriptFunction::call. Move this into the generated code to avoid overhead for methods not using 'this', and simplify our ScriptFunction::call() implementation. Change-Id: I739f4a89d29ed8082ce59e48d1523776224fc29d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4functionobject.cpp')
-rw-r--r--src/qml/jsruntime/qv4functionobject.cpp16
1 files changed, 0 insertions, 16 deletions
diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp
index a270689b43..35e4202790 100644
--- a/src/qml/jsruntime/qv4functionobject.cpp
+++ b/src/qml/jsruntime/qv4functionobject.cpp
@@ -471,14 +471,6 @@ ReturnedValue ScriptFunction::call(Managed *that, CallData *callData)
CallContext *ctx = context->newCallContext(f, callData);
- if (!f->strictMode && !callData->thisObject.isObject()) {
- if (callData->thisObject.isNullOrUndefined()) {
- ctx->callData->thisObject = v4->globalObject->asReturnedValue();
- } else {
- ctx->callData->thisObject = callData->thisObject.toObject(context)->asReturnedValue();
- }
- }
-
if (f->function->compiledFunction->hasQmlDependencies())
QmlContextWrapper::registerQmlDependencies(ctx->engine, f->function->compiledFunction);
@@ -568,14 +560,6 @@ ReturnedValue SimpleScriptFunction::call(Managed *that, CallData *callData)
ExecutionContext *context = v4->current;
ExecutionContext *ctx = context->newCallContext(stackSpace, scope.alloc(f->varCount), f.getPointer(), callData);
- if (!f->strictMode && !callData->thisObject.isObject()) {
- if (callData->thisObject.isNullOrUndefined()) {
- ctx->callData->thisObject = v4->globalObject->asReturnedValue();
- } else {
- ctx->callData->thisObject = callData->thisObject.toObject(context)->asReturnedValue();
- }
- }
-
if (f->function->compiledFunction->hasQmlDependencies())
QmlContextWrapper::registerQmlDependencies(v4, f->function->compiledFunction);