From c82b8448207e470a918ce7c398d059bc159cafbf Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Tue, 6 Nov 2012 12:31:02 +0100 Subject: Add tracing for runtime methods. Change-Id: I540297e83e3e297d0724c3e08e5780eee0d2fac8 Reviewed-by: Lars Knoll --- moth/moth.pri | 1 + moth/qv4vme_moth.cpp | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'moth') diff --git a/moth/moth.pri b/moth/moth.pri index d91d13fca8..4381c9a53b 100644 --- a/moth/moth.pri +++ b/moth/moth.pri @@ -10,3 +10,4 @@ SOURCES += \ $$PWD/qv4instr_moth.cpp \ $$PWD/qv4vme_moth.cpp \ +#DEFINES += DO_TRACE_INSTR diff --git a/moth/qv4vme_moth.cpp b/moth/qv4vme_moth.cpp index 98b40ff47f..abe7909456 100644 --- a/moth/qv4vme_moth.cpp +++ b/moth/qv4vme_moth.cpp @@ -1,17 +1,17 @@ #include "qv4vme_moth_p.h" #include "qv4instr_moth_p.h" -using namespace QQmlJS; -using namespace QQmlJS::Moth; - #ifdef DO_TRACE_INSTR # define TRACE_INSTR(I) fprintf(stderr, "executing a %s\n", #I); -# define TRACE(n, str, ...) { fprintf(stderr, "-- %s : ", #n); fprintf(stderr, str, __VA_ARGS__); fprintf(stderr, "\n"); } +# define TRACE(n, str, ...) { fprintf(stderr, " %s : ", #n); fprintf(stderr, str, __VA_ARGS__); fprintf(stderr, "\n"); } #else # define TRACE_INSTR(I) # define TRACE(n, str, ...) #endif // DO_TRACE_INSTR +using namespace QQmlJS; +using namespace QQmlJS::Moth; + #define MOTH_BEGIN_INSTR_COMMON(I) { \ const InstrMeta<(int)Instr::I>::DataType &instr = InstrMeta<(int)Instr::I>::data(*genericInstr); \ code += InstrMeta<(int)Instr::I>::Size; \ @@ -123,6 +123,7 @@ void VME::operator()(QQmlJS::VM::Context *context, const uchar *code MOTH_END_INSTR(LoadFalse) MOTH_BEGIN_INSTR(LoadNumber) + TRACE(inline, "number = %f", instr.value); tempRegister = VM::Value::fromDouble(instr.value); MOTH_END_INSTR(LoadNumber) @@ -145,6 +146,7 @@ void VME::operator()(QQmlJS::VM::Context *context, const uchar *code MOTH_END_INSTR(StoreName) MOTH_BEGIN_INSTR(Push) + TRACE(inline, "stack size: %u", instr.value); stack.resize(instr.value); MOTH_END_INSTR(Push) -- cgit v1.2.3