diff options
author | Lars Knoll <lars.knoll@qt.io> | 2017-03-31 13:33:22 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2017-04-04 10:26:13 +0000 |
commit | 4af4741c4a833cd9527bd70accdcab655ceb3559 (patch) | |
tree | 035bd58629ca83a5719de24ad60f33cf47e954a2 /src | |
parent | 4427be1a9dfd889fc1a65654f0aa61cb253b5271 (diff) |
Don't waste CPU cycles when checking whether a breakpoint is active
QV4::Function::sourceFile() actually malloc's a new string each
time it's being called. Let's not call it unless we need its
return value.
Change-Id: I4e47422860549df5e1b5b19f3a68f027ff74f05a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/qml/jsruntime/qv4vme_moth.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/qml/jsruntime/qv4vme_moth.cpp b/src/qml/jsruntime/qv4vme_moth.cpp index c9b249011b..a74016ab0c 100644 --- a/src/qml/jsruntime/qv4vme_moth.cpp +++ b/src/qml/jsruntime/qv4vme_moth.cpp @@ -249,10 +249,11 @@ int qt_v4DebuggerHook(const char *json) return -NoSuchCommand; // Failure. } -static void qt_v4CheckForBreak(QV4::ExecutionContext *context, QV4::Value **scopes, int scopeDepth) +static void qt_v4CheckForBreak(QV4::ExecutionContext *context) { - Q_UNUSED(scopes); - Q_UNUSED(scopeDepth); + if (!qt_v4IsStepping && !qt_v4Breakpoints.size()) + return; + const int lineNumber = context->d()->lineNumber; QV4::Function *function = qt_v4ExtractFunction(context); QString engineName = function->sourceFile(); @@ -915,13 +916,13 @@ QV4::ReturnedValue VME::run(ExecutionEngine *engine, const uchar *code if (debugger && debugger->pauseAtNextOpportunity()) debugger->maybeBreakAtInstruction(); if (qt_v4IsDebugging) - qt_v4CheckForBreak(context, scopes, scopeDepth); + qt_v4CheckForBreak(context); MOTH_END_INSTR(Debug) MOTH_BEGIN_INSTR(Line) engine->current->lineNumber = instr.lineNumber; if (qt_v4IsDebugging) - qt_v4CheckForBreak(context, scopes, scopeDepth); + qt_v4CheckForBreak(context); MOTH_END_INSTR(Line) #endif // QT_NO_QML_DEBUGGER |