diff options
author | Lars Knoll <lars.knoll@qt.io> | 2017-08-07 08:37:45 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2017-08-10 08:18:56 +0000 |
commit | 30e3664bf3668bda9a211fe7d1404f8f806dbf7b (patch) | |
tree | bd119839af7db0f6f9119401d478b37b44051c8b /src/qml/qml/v8/qqmlbuiltinfunctions.cpp | |
parent | eb2c08f57493aa12850e6cddff2cc3527e7cbfd7 (diff) |
Avoid creating a CallContext for simple functions
This cuts out quite a bit of overhead when entering
and leaving functions.
Change-Id: I32670c98a4087ea3b2d45853d9cabff9066399e8
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/qml/v8/qqmlbuiltinfunctions.cpp')
-rw-r--r-- | src/qml/qml/v8/qqmlbuiltinfunctions.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp index ebf8918d31..a3874e4e65 100644 --- a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp +++ b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp @@ -1908,10 +1908,10 @@ ReturnedValue GlobalExtensions::method_qsTr(const BuiltinFunction *b, CallData * int length = lastDot - (lastSlash + 1); context = (lastSlash > -1) ? path.mid(lastSlash + 1, (length > -1) ? length : -1) : QString(); } else { - ExecutionContext *parentCtx = scope.engine->currentContext; + ExecutionEngine::StackFrame *frame = scope.engine->currentStackFrame; // The first non-empty source URL in the call stack determines the translation context. - while (!!parentCtx && context.isEmpty()) { - if (CompiledData::CompilationUnit *unit = parentCtx->d()->v4Function->compilationUnit) { + while (frame && context.isEmpty()) { + if (CompiledData::CompilationUnit *unit = frame->v4Function->compilationUnit) { QString fileName = unit->fileName(); QUrl url(unit->fileName()); if (url.isValid() && url.isRelative()) { @@ -1923,7 +1923,7 @@ ReturnedValue GlobalExtensions::method_qsTr(const BuiltinFunction *b, CallData * } context = QFileInfo(context).baseName(); } - parentCtx = scope.engine->parentContext(parentCtx); + frame = frame->parent; } } |