aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2013-10-16 10:50:08 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-10-16 16:03:54 +0200
commitc1c526aafb2fc70ac6155eb775b3784f1e2e6504 (patch)
tree824bf1c301d24d51d3197f01400c55ec8b4e17ea /src/qml/compiler
parentddd9c93b084c5168d7b12396450125e7a0929c28 (diff)
Speed up stack trace generation for the JIT
It turns out that in QML it is not unusual that during early binding evaluations due to the undefined order, the evaluation tries to look up properties in objects that aren't initialized yet and thus exceptions are thrown. Eeach thrown exception saves a stack trace, which is expensive to generate when using the JIT, as it does full stack unwinding. This patch implements a more light-weight approach by storing the instruction pointer in the context before leaving JIT generated code. Change-Id: I95e1cfd01179247dfc2c1df949828f474a23161b Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/compiler')
-rw-r--r--src/qml/compiler/qv4isel_masm_p.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/qml/compiler/qv4isel_masm_p.h b/src/qml/compiler/qv4isel_masm_p.h
index 4d1114e756..02ddd158a9 100644
--- a/src/qml/compiler/qv4isel_masm_p.h
+++ b/src/qml/compiler/qv4isel_masm_p.h
@@ -430,7 +430,25 @@ public:
V4IR::BasicBlock *block;
};
+ void saveInstructionPointer(RegisterID freeScratchRegister) {
+ Address ipAddr(ContextRegister, qOffsetOf(QV4::ExecutionContext, jitInstructionPointer));
+ RegisterID sourceRegister = freeScratchRegister;
+
+#if CPU(X86_64) || CPU(X86)
+ callToRetrieveIP();
+ peek(sourceRegister);
+ pop();
+#elif CPU(ARM)
+ move(JSC::ARMRegisters::pc, sourceRegister);
+#else
+#error "Port me!"
+#endif
+
+ storePtr(sourceRegister, ipAddr);
+ }
+
void callAbsolute(const char* functionName, FunctionPtr function) {
+ saveInstructionPointer(ScratchRegister);
CallToLink ctl;
ctl.call = call();
ctl.externalFunction = function;
@@ -439,11 +457,13 @@ public:
}
void callAbsolute(const char* /*functionName*/, Address addr) {
+ saveInstructionPointer(ScratchRegister);
call(addr);
}
void callAbsolute(const char* /*functionName*/, const RelativeCall &relativeCall)
{
+ saveInstructionPointer(ScratchRegister);
call(relativeCall.addr);
}