diff options
| author | Lars Knoll <lars.knoll@qt.io> | 2016-11-30 15:35:16 +0100 |
|---|---|---|
| committer | Lars Knoll <lars.knoll@qt.io> | 2016-12-09 08:30:51 +0000 |
| commit | 55101d6937880f4dfd8d8eb79fbb15a8e7bb508a (patch) | |
| tree | c43905119590ac7b99da1471086fca86a6032acd /src/qml/jsruntime/qv4functionobject.cpp | |
| parent | 9f4cfec74517f7ff3f65037ad04abac33e2104ba (diff) | |
Move the check whether a function is simple to QV4::Function
This allows re-using the check in the QQmlJavascriptExpression code.
Change-Id: I647a6edb4844911f540f08c4a067d055676dd0ed
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4functionobject.cpp')
| -rw-r--r-- | src/qml/jsruntime/qv4functionobject.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp index 66549ffd3e..21edf1d8d3 100644 --- a/src/qml/jsruntime/qv4functionobject.cpp +++ b/src/qml/jsruntime/qv4functionobject.cpp @@ -195,12 +195,9 @@ void FunctionObject::markObjects(Heap::Base *that, ExecutionEngine *e) Heap::FunctionObject *FunctionObject::createScriptFunction(ExecutionContext *scope, Function *function, bool createProto) { - if (function->needsActivation() || - function->compiledFunction->flags & CompiledData::Function::HasCatchOrWith || - function->compiledFunction->nFormals > QV4::Global::ReservedArgumentCount || - function->isNamedExpression()) - return scope->d()->engine->memoryManager->allocObject<ScriptFunction>(scope, function); - return scope->d()->engine->memoryManager->allocObject<SimpleScriptFunction>(scope, function, createProto); + if (function->canUseSimpleFunction()) + return scope->d()->engine->memoryManager->allocObject<SimpleScriptFunction>(scope, function, createProto); + return scope->d()->engine->memoryManager->allocObject<ScriptFunction>(scope, function); } Heap::FunctionObject *FunctionObject::createQmlFunction(QQmlContextData *qmlContext, QObject *scopeObject, Function *runtimeFunction, const QList<QByteArray> &signalParameters, QString *error) |
