From 6e79a00cad2f5dd09bdf40e594a65af58b370d9d Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Sun, 1 Jul 2018 11:33:04 +0200 Subject: Get rid of the duplication for the GetLookup instructions GetLookup and GetLookupA were doing exactly the same thing. Only keep the version that expects the base object in the accumulator and rename it to GetLookup. Change-Id: Ia14256880cef23f7b70d8c7e6bb74aba371b8d9a Reviewed-by: Simon Hausmann --- src/qml/compiler/qv4bytecodehandler.cpp | 3 --- src/qml/compiler/qv4codegen.cpp | 14 ++++---------- src/qml/compiler/qv4instr_moth.cpp | 6 +----- src/qml/compiler/qv4instr_moth_p.h | 4 +--- src/qml/jit/qv4baselinejit.cpp | 14 +------------- src/qml/jit/qv4baselinejit_p.h | 3 +-- src/qml/jsruntime/qv4vme_moth.cpp | 9 +-------- 7 files changed, 9 insertions(+), 44 deletions(-) diff --git a/src/qml/compiler/qv4bytecodehandler.cpp b/src/qml/compiler/qv4bytecodehandler.cpp index b96c04dc01..45968570d0 100644 --- a/src/qml/compiler/qv4bytecodehandler.cpp +++ b/src/qml/compiler/qv4bytecodehandler.cpp @@ -206,9 +206,6 @@ std::vector ByteCodeHandler::collectLabelsInBytecode(const char *code, uint COLLECTOR_BEGIN_INSTR(GetLookup) COLLECTOR_END_INSTR(GetLookup) - COLLECTOR_BEGIN_INSTR(GetLookupA) - COLLECTOR_END_INSTR(GetLookupA) - COLLECTOR_BEGIN_INSTR(StoreProperty) COLLECTOR_END_INSTR(StoreProperty) diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp index cb9049c73d..7e22966302 100644 --- a/src/qml/compiler/qv4codegen.cpp +++ b/src/qml/compiler/qv4codegen.cpp @@ -4106,16 +4106,10 @@ QT_WARNING_POP return; case Member: if (!disable_lookups && codegen->useFastLookups) { - if (propertyBase.isAccumulator()) { - Instruction::GetLookupA load; - load.index = codegen->registerGetterLookup(propertyNameIndex); - codegen->bytecodeGenerator->addInstruction(load); - } else { - Instruction::GetLookup load; - load.base = propertyBase.storeOnStack().stackSlot(); - load.index = codegen->registerGetterLookup(propertyNameIndex); - codegen->bytecodeGenerator->addInstruction(load); - } + propertyBase.loadInAccumulator(); + Instruction::GetLookup load; + load.index = codegen->registerGetterLookup(propertyNameIndex); + codegen->bytecodeGenerator->addInstruction(load); } else { propertyBase.loadInAccumulator(); Instruction::LoadProperty load; diff --git a/src/qml/compiler/qv4instr_moth.cpp b/src/qml/compiler/qv4instr_moth.cpp index 2ce06c9552..56da14b098 100644 --- a/src/qml/compiler/qv4instr_moth.cpp +++ b/src/qml/compiler/qv4instr_moth.cpp @@ -301,12 +301,8 @@ void dumpBytecode(const char *code, int len, int nLocals, int nFormals, int /*st MOTH_END_INSTR(LoadProperty) MOTH_BEGIN_INSTR(GetLookup) - d << dumpRegister(base, nFormals) << "(" << index << ")"; - MOTH_END_INSTR(GetLookup) - - MOTH_BEGIN_INSTR(GetLookupA) d << "acc(" << index << ")"; - MOTH_END_INSTR(GetLookupA) + MOTH_END_INSTR(GetLookup) MOTH_BEGIN_INSTR(StoreProperty) d << dumpRegister(base, nFormals) << "[" << name<< "]"; diff --git a/src/qml/compiler/qv4instr_moth_p.h b/src/qml/compiler/qv4instr_moth_p.h index 00ed76e6c2..f0a3332ee1 100644 --- a/src/qml/compiler/qv4instr_moth_p.h +++ b/src/qml/compiler/qv4instr_moth_p.h @@ -87,8 +87,7 @@ QT_BEGIN_NAMESPACE #define INSTR_StoreNameSloppy(op) INSTRUCTION(op, StoreNameSloppy, 1, name) #define INSTR_StoreNameStrict(op) INSTRUCTION(op, StoreNameStrict, 1, name) #define INSTR_LoadProperty(op) INSTRUCTION(op, LoadProperty, 1, name) -#define INSTR_GetLookup(op) INSTRUCTION(op, GetLookup, 2, index, base) -#define INSTR_GetLookupA(op) INSTRUCTION(op, GetLookupA, 1, index) +#define INSTR_GetLookup(op) INSTRUCTION(op, GetLookup, 1, index) #define INSTR_LoadScopeObjectProperty(op) INSTRUCTION(op, LoadScopeObjectProperty, 3, propertyIndex, base, captureRequired) #define INSTR_LoadContextObjectProperty(op) INSTRUCTION(op, LoadContextObjectProperty, 3, propertyIndex, base, captureRequired) #define INSTR_LoadIdObject(op) INSTRUCTION(op, LoadIdObject, 2, index, base) @@ -220,7 +219,6 @@ QT_BEGIN_NAMESPACE F(StoreElement) \ F(LoadProperty) \ F(GetLookup) \ - F(GetLookupA) \ F(StoreProperty) \ F(SetLookup) \ F(StoreScopeObjectProperty) \ diff --git a/src/qml/jit/qv4baselinejit.cpp b/src/qml/jit/qv4baselinejit.cpp index b52350a729..1df7223936 100644 --- a/src/qml/jit/qv4baselinejit.cpp +++ b/src/qml/jit/qv4baselinejit.cpp @@ -265,19 +265,7 @@ void BaselineJIT::generate_LoadProperty(int name) as->checkException(); } -void BaselineJIT::generate_GetLookup(int index, int base) -{ - STORE_IP(); - as->prepareCallWithArgCount(4); - as->passRegAsArg(base, 3); - as->passInt32AsArg(index, 2); - as->passFunctionAsArg(1); - as->passEngineAsArg(0); - JIT_GENERATE_RUNTIME_CALL(Helpers::getLookup, Assembler::ResultInAccumulator); - as->checkException(); -} - -void BaselineJIT::generate_GetLookupA(int index) +void BaselineJIT::generate_GetLookup(int index) { STORE_IP(); STORE_ACC(); diff --git a/src/qml/jit/qv4baselinejit_p.h b/src/qml/jit/qv4baselinejit_p.h index 26da3d5da3..d953d86a06 100644 --- a/src/qml/jit/qv4baselinejit_p.h +++ b/src/qml/jit/qv4baselinejit_p.h @@ -101,8 +101,7 @@ public: void generate_LoadElement(int base) override; void generate_StoreElement(int base, int index) override; void generate_LoadProperty(int name) override; - void generate_GetLookup(int index, int base) override; - void generate_GetLookupA(int index) override; + void generate_GetLookup(int index) override; void generate_StoreProperty(int name, int base) override; void generate_SetLookup(int index, int base) override; void generate_StoreScopeObjectProperty(int base, diff --git a/src/qml/jsruntime/qv4vme_moth.cpp b/src/qml/jsruntime/qv4vme_moth.cpp index 39eaa3a25c..83d1aa3250 100644 --- a/src/qml/jsruntime/qv4vme_moth.cpp +++ b/src/qml/jsruntime/qv4vme_moth.cpp @@ -587,19 +587,12 @@ QV4::ReturnedValue VME::interpret(CppStackFrame *frame, ExecutionEngine *engine, MOTH_END_INSTR(LoadProperty) MOTH_BEGIN_INSTR(GetLookup) - STORE_IP(); - QV4::Lookup *l = function->compilationUnit->runtimeLookups + index; - acc = l->getter(l, engine, STACK_VALUE(base)); - CHECK_EXCEPTION; - MOTH_END_INSTR(GetLookup) - - MOTH_BEGIN_INSTR(GetLookupA) STORE_IP(); STORE_ACC(); QV4::Lookup *l = function->compilationUnit->runtimeLookups + index; acc = l->getter(l, engine, accumulator); CHECK_EXCEPTION; - MOTH_END_INSTR(GetLookupA) + MOTH_END_INSTR(GetLookup) MOTH_BEGIN_INSTR(StoreProperty) STORE_IP(); -- cgit v1.2.3