aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2013-10-30 13:33:49 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-11-01 23:01:27 +0100
commitaff3202b9fdd36ed64f55d658d1e4d066c5259d3 (patch)
tree18a55d42cabd2eb802fb195779c02ed845238832 /src/qml/compiler
parent2c078cc2912275c6b83be1f9670fb455e25ad7b6 (diff)
Avoid unnecessary saving of the instruction pointer in the JIT
We only need to save it when the line number changes, not for each and every call. Change-Id: I1a6fdf97abd3dd654bbd97d2a99cd09e9c20f64f Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/compiler')
-rw-r--r--src/qml/compiler/qv4isel_masm.cpp8
-rw-r--r--src/qml/compiler/qv4isel_masm_p.h3
2 files changed, 7 insertions, 4 deletions
diff --git a/src/qml/compiler/qv4isel_masm.cpp b/src/qml/compiler/qv4isel_masm.cpp
index 4eeab0f184..0b372fec03 100644
--- a/src/qml/compiler/qv4isel_masm.cpp
+++ b/src/qml/compiler/qv4isel_masm.cpp
@@ -697,14 +697,20 @@ void InstructionSelection::run(int functionIndex)
_as->addPtr(Assembler::TrustedImm32(sizeof(QV4::SafeValue)*locals), Assembler::LocalsRegister);
_as->storePtr(Assembler::LocalsRegister, Address(Assembler::ScratchRegister, qOffsetOf(ExecutionEngine, jsStackTop)));
+ int lastLine = -1;
for (int i = 0, ei = _function->basicBlocks.size(); i != ei; ++i) {
V4IR::BasicBlock *nextBlock = (i < ei - 1) ? _function->basicBlocks[i + 1] : 0;
_block = _function->basicBlocks[i];
_as->registerBlock(_block, nextBlock);
foreach (V4IR::Stmt *s, _block->statements) {
- if (s->location.isValid())
+ if (s->location.isValid()) {
_as->recordLineNumber(s->location.startLine);
+ if (s->location.startLine != lastLine) {
+ _as->saveInstructionPointer(Assembler::ScratchRegister);
+ lastLine = s->location.startLine;
+ }
+ }
s->accept(this);
}
}
diff --git a/src/qml/compiler/qv4isel_masm_p.h b/src/qml/compiler/qv4isel_masm_p.h
index 37e99bd359..b55192aae7 100644
--- a/src/qml/compiler/qv4isel_masm_p.h
+++ b/src/qml/compiler/qv4isel_masm_p.h
@@ -468,7 +468,6 @@ public:
}
void callAbsolute(const char* functionName, FunctionPtr function) {
- saveInstructionPointer(ScratchRegister);
CallToLink ctl;
ctl.call = call();
ctl.externalFunction = function;
@@ -477,13 +476,11 @@ 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);
}