diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2016-07-25 15:58:04 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2016-07-28 15:09:27 +0000 |
commit | ddde056393b13db4bab7cf3fddf2a0aeb1fdb6e7 (patch) | |
tree | 3f59715e0fa0781714d405c09acad0721ae9885f | |
parent | ab976add7f62891038d97edc29c9d57168fbefb4 (diff) |
V4: Leave out Debug and Line istructions on -no-qml-debug
Change-Id: Ida861af5636a1605783f7af4bf88cb46b44f9022
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
-rw-r--r-- | src/qml/compiler/qv4instr_moth_p.h | 15 | ||||
-rw-r--r-- | src/qml/compiler/qv4isel_moth.cpp | 33 | ||||
-rw-r--r-- | src/qml/compiler/qv4isel_moth_p.h | 2 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4vme_moth.cpp | 4 |
4 files changed, 36 insertions, 18 deletions
diff --git a/src/qml/compiler/qv4instr_moth_p.h b/src/qml/compiler/qv4instr_moth_p.h index 112003ebb8..20b871c4e8 100644 --- a/src/qml/compiler/qv4instr_moth_p.h +++ b/src/qml/compiler/qv4instr_moth_p.h @@ -58,10 +58,17 @@ QT_BEGIN_NAMESPACE +#ifdef QT_NO_QML_DEBUGGER +#define MOTH_DEBUG_INSTR(F) +#else +#define MOTH_DEBUG_INSTR(F) \ + F(Line, line) \ + F(Debug, debug) +#endif + #define FOR_EACH_MOTH_INSTR(F) \ F(Ret, ret) \ - F(Line, line) \ - F(Debug, debug) \ + MOTH_DEBUG_INSTR(F) \ F(LoadRuntimeString, loadRuntimeString) \ F(LoadRegExp, loadRegExp) \ F(LoadClosure, loadClosure) \ @@ -254,6 +261,8 @@ union Instr MOTH_INSTR_HEADER Param result; }; + +#ifndef QT_NO_QML_DEBUGGING struct instr_line { MOTH_INSTR_HEADER qint32 lineNumber; @@ -262,6 +271,8 @@ union Instr MOTH_INSTR_HEADER qint32 lineNumber; }; +#endif // QT_NO_QML_DEBUGGING + struct instr_loadRuntimeString { MOTH_INSTR_HEADER int stringId; diff --git a/src/qml/compiler/qv4isel_moth.cpp b/src/qml/compiler/qv4isel_moth.cpp index dc803f1ee2..41790c04a9 100644 --- a/src/qml/compiler/qv4isel_moth.cpp +++ b/src/qml/compiler/qv4isel_moth.cpp @@ -412,6 +412,7 @@ void InstructionSelection::run(int functionIndex) if (s->location.startLine != currentLine) { blockNeedsDebugInstruction = false; currentLine = s->location.startLine; +#ifndef QT_NO_QML_DEBUGGER if (irModule->debugMode) { Instruction::Debug debug; debug.lineNumber = currentLine; @@ -421,6 +422,7 @@ void InstructionSelection::run(int functionIndex) line.lineNumber = currentLine; addInstruction(line); } +#endif } } @@ -1092,6 +1094,17 @@ void InstructionSelection::prepareCallArgs(IR::ExprList *e, quint32 &argc, quint } } +void InstructionSelection::addDebugInstruction() +{ +#ifndef QT_NO_QML_DEBUGGER + if (blockNeedsDebugInstruction) { + Instruction::Debug debug; + debug.lineNumber = -int(currentLine); + addInstruction(debug); + } +#endif +} + void InstructionSelection::visitJump(IR::Jump *s) { if (s->target == _nextBlock) @@ -1099,11 +1112,7 @@ void InstructionSelection::visitJump(IR::Jump *s) if (_removableJumps.contains(s)) return; - if (blockNeedsDebugInstruction) { - Instruction::Debug debug; - debug.lineNumber = -int(currentLine); - addInstruction(debug); - } + addDebugInstruction(); Instruction::Jump jump; jump.offset = 0; @@ -1114,11 +1123,7 @@ void InstructionSelection::visitJump(IR::Jump *s) void InstructionSelection::visitCJump(IR::CJump *s) { - if (blockNeedsDebugInstruction) { - Instruction::Debug debug; - debug.lineNumber = -int(currentLine); - addInstruction(debug); - } + addDebugInstruction(); Param condition; if (IR::Temp *t = s->cond->asTemp()) { @@ -1153,12 +1158,8 @@ void InstructionSelection::visitCJump(IR::CJump *s) void InstructionSelection::visitRet(IR::Ret *s) { - if (blockNeedsDebugInstruction) { - // this is required so stepOut will always be guaranteed to stop in every stack frame - Instruction::Debug debug; - debug.lineNumber = -int(currentLine); - addInstruction(debug); - } + // this is required so stepOut will always be guaranteed to stop in every stack frame + addDebugInstruction(); Instruction::Ret ret; ret.result = getParam(s->expr); diff --git a/src/qml/compiler/qv4isel_moth_p.h b/src/qml/compiler/qv4isel_moth_p.h index ea323497ef..2d2bb91228 100644 --- a/src/qml/compiler/qv4isel_moth_p.h +++ b/src/qml/compiler/qv4isel_moth_p.h @@ -177,6 +177,8 @@ private: template <int Instr> inline ptrdiff_t addInstruction(const InstrData<Instr> &data); + inline void addDebugInstruction(); + ptrdiff_t addInstructionHelper(Instr::Type type, Instr &instr); void patchJumpAddresses(); QByteArray squeezeCode() const; diff --git a/src/qml/jsruntime/qv4vme_moth.cpp b/src/qml/jsruntime/qv4vme_moth.cpp index b83bae8a38..9b46871c85 100644 --- a/src/qml/jsruntime/qv4vme_moth.cpp +++ b/src/qml/jsruntime/qv4vme_moth.cpp @@ -142,6 +142,7 @@ Q_QML_EXPORT int qt_v4DebuggerHook(const char *json); } // extern "C" +#ifndef QT_NO_QML_DEBUGGER static int qt_v4BreakpointCount = 0; static bool qt_v4IsDebugging = true; static bool qt_v4IsStepping = false; @@ -285,6 +286,7 @@ static void qt_v4CheckForBreak(QV4::ExecutionContext *context, QV4::Value **scop } } +#endif // QT_NO_QML_DEBUGGER // End of debugger interface using namespace QV4; @@ -904,6 +906,7 @@ QV4::ReturnedValue VME::run(ExecutionEngine *engine, const uchar *code return VALUE(instr.result).asReturnedValue(); MOTH_END_INSTR(Ret) +#ifndef QT_NO_QML_DEBUGGER MOTH_BEGIN_INSTR(Debug) engine->current->lineNumber = instr.lineNumber; QV4::Debugging::Debugger *debugger = context->engine()->debugger; @@ -918,6 +921,7 @@ QV4::ReturnedValue VME::run(ExecutionEngine *engine, const uchar *code if (qt_v4IsDebugging) qt_v4CheckForBreak(context, scopes, scopeDepth); MOTH_END_INSTR(Line) +#endif // QT_NO_QML_DEBUGGER MOTH_BEGIN_INSTR(LoadThis) VALUE(instr.result) = context->thisObject(); |