aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4codegen.cpp
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@qt.io>2017-11-21 10:00:45 +0100
committerLars Knoll <lars.knoll@qt.io>2017-11-23 15:05:22 +0000
commit1f5c79c59aa43e416778a2046e4121731b34bb6a (patch)
tree27dbc03f147d484e79c40b42c79abc2a2291655b /src/qml/compiler/qv4codegen.cpp
parent8df195c8765429652ccf31e9de9829bbae5ba5bb (diff)
V4: Collapse LoadRegExp+StoreReg into MoveRegExp
LoadRegExp is nearly always followed by a store of the accumulator, so change LoadRegExp to be MoveRegExp. This saves an instruction. Change-Id: I5d47c5bf6ffd7f28247c328410872c3b229ca23c Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4codegen.cpp')
-rw-r--r--src/qml/compiler/qv4codegen.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp
index b9d223bab0..68bda2dcd3 100644
--- a/src/qml/compiler/qv4codegen.cpp
+++ b/src/qml/compiler/qv4codegen.cpp
@@ -1885,12 +1885,13 @@ bool Codegen::visit(RegExpLiteral *ast)
if (hasError)
return false;
- auto r = Reference::fromAccumulator(this);
+ auto r = Reference::fromStackSlot(this);
r.isReadonly = true;
_expr.setResult(r);
- Instruction::LoadRegExp instr;
+ Instruction::MoveRegExp instr;
instr.regExpId = jsUnitGenerator->registerRegExp(ast);
+ instr.destReg = r.stackSlot();
bytecodeGenerator->addInstruction(instr);
return false;
}