aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jit/qv4assemblercommon_p.h
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2019-06-13 12:29:02 +0200
committerUlf Hermann <ulf.hermann@qt.io>2019-09-03 13:21:10 +0200
commitdb3dd029d7cd911712102efd5ea71868494f9f6f (patch)
tree143e600d5393496b2b77ed7da74b94fc864efcf8 /src/qml/jit/qv4assemblercommon_p.h
parenteeb00570679c447f4701a92cd2e836f098724979 (diff)
Fix various accumulator-saving problems
We need to keep the accumulator alive across function calls. This requires: 1, Saving the accumulator on the stack if the function might allocate, to protect it from the garbage collector. However, we don't need to do that if the result of the function is to be saved in the accumulator and the function itself doesn't use the accumulator as argument. In this case the previous value becomes unaccessible and we might as well GC it. 2, In the JIT, restoring the accumulator from the stack after the function call if we want to ignore the return value. 3, Therefore, also saving the accumulator on the stack before calling in case of 2. We assume that we don't need to keep the accumulator alive across the jump to the exception handler. Saving the accumulator more often than necessary is detrimental for performance. To make sure the assumption holds, explicitly load the accumulator with undefined _before_ jumping to any exception handler. Change-Id: I78cbc42847b8885a0659b23f3b81655b7f1a0bc4 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jit/qv4assemblercommon_p.h')
-rw-r--r--src/qml/jit/qv4assemblercommon_p.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/qml/jit/qv4assemblercommon_p.h b/src/qml/jit/qv4assemblercommon_p.h
index 729d0fc53d..dcf39ab636 100644
--- a/src/qml/jit/qv4assemblercommon_p.h
+++ b/src/qml/jit/qv4assemblercommon_p.h
@@ -621,9 +621,9 @@ public:
loadPtr(exceptionHandlerAddress(), ScratchRegister);
Jump exitFunction = branchPtr(Equal, ScratchRegister, TrustedImmPtr(0));
+ loadUndefined();
jump(ScratchRegister);
exitFunction.link(this);
- loadUndefined();
if (functionExit.isSet())
jump(functionExit);