From 1f5c79c59aa43e416778a2046e4121731b34bb6a Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Tue, 21 Nov 2017 10:00:45 +0100 Subject: 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 --- src/qml/jit/qv4jit.cpp | 7 ++++--- src/qml/jit/qv4jit_p.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'src/qml/jit') diff --git a/src/qml/jit/qv4jit.cpp b/src/qml/jit/qv4jit.cpp index a8bdd20fbd..e1737cbe45 100644 --- a/src/qml/jit/qv4jit.cpp +++ b/src/qml/jit/qv4jit.cpp @@ -255,12 +255,13 @@ void BaselineJIT::generate_LoadRuntimeString(int stringId) as->loadString(stringId); } -void BaselineJIT::generate_LoadRegExp(int regExpId) +void BaselineJIT::generate_MoveRegExp(int regExpId, int destReg) { as->prepareCallWithArgCount(2); as->passInt32AsArg(regExpId, 1); as->passEngineAsArg(0); JIT_GENERATE_RUNTIME_CALL(Runtime::method_regexpLiteral, Assembler::ResultInAccumulator); + as->storeReg(destReg); } void BaselineJIT::generate_LoadClosure(int value) @@ -1062,8 +1063,8 @@ void BaselineJIT::collectLabelsInBytecode() MOTH_BEGIN_INSTR(LoadRuntimeString) MOTH_END_INSTR(LoadRuntimeString) - MOTH_BEGIN_INSTR(LoadRegExp) - MOTH_END_INSTR(LoadRegExp) + MOTH_BEGIN_INSTR(MoveRegExp) + MOTH_END_INSTR(MoveRegExp) MOTH_BEGIN_INSTR(LoadClosure) MOTH_END_INSTR(LoadClosure) diff --git a/src/qml/jit/qv4jit_p.h b/src/qml/jit/qv4jit_p.h index dfa2a79c48..f9e2a9650c 100644 --- a/src/qml/jit/qv4jit_p.h +++ b/src/qml/jit/qv4jit_p.h @@ -137,7 +137,7 @@ public: void generate_LoadScopedLocal(int scope, int index) Q_DECL_OVERRIDE; void generate_StoreScopedLocal(int scope, int index) Q_DECL_OVERRIDE; void generate_LoadRuntimeString(int stringId) Q_DECL_OVERRIDE; - void generate_LoadRegExp(int regExpId) Q_DECL_OVERRIDE; + void generate_MoveRegExp(int regExpId, int destReg) Q_DECL_OVERRIDE; void generate_LoadClosure(int value) Q_DECL_OVERRIDE; void generate_LoadName(int name) Q_DECL_OVERRIDE; void generate_LoadGlobalLookup(int index) Q_DECL_OVERRIDE; -- cgit v1.2.3