aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jit
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-05-15 13:15:43 +0200
committerLars Knoll <lars.knoll@qt.io>2018-05-23 13:19:01 +0000
commit6f1e2722b9eef73a4fe19951b47c4b172642a2ba (patch)
tree01e58c038a7d63ed9206c834c4f6df1fb51db142 /src/qml/jit
parent3e6d5d9cd1de1373f67f2ff31373a59c37f7b576 (diff)
Simplify Push and PopContext instructions
There's no need for a temp register to store the old context in, as PopContext can simply retrieve the old context from the current one. Change-Id: Ife9cfdff7fa8e47fc71e844a7798de88dbc79e26 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jit')
-rw-r--r--src/qml/jit/qv4assembler.cpp11
-rw-r--r--src/qml/jit/qv4assembler_p.h4
-rw-r--r--src/qml/jit/qv4jit.cpp22
-rw-r--r--src/qml/jit/qv4jit_p.h8
4 files changed, 22 insertions, 23 deletions
diff --git a/src/qml/jit/qv4assembler.cpp b/src/qml/jit/qv4assembler.cpp
index 736dfd0908..45dc87db19 100644
--- a/src/qml/jit/qv4assembler.cpp
+++ b/src/qml/jit/qv4assembler.cpp
@@ -2241,9 +2241,8 @@ void Assembler::clearExceptionHandler()
pasm()->storePtr(TrustedImmPtr(nullptr), pasm()->exceptionHandlerAddress());
}
-void Assembler::pushCatchContext(int reg, int index, int name)
+void Assembler::pushCatchContext(int index, int name)
{
- pasm()->copyReg(pasm()->contextAddress(), regAddr(reg));
prepareCallWithArgCount(3);
passInt32AsArg(name, 2);
passInt32AsArg(index, 1);
@@ -2252,9 +2251,13 @@ void Assembler::pushCatchContext(int reg, int index, int name)
pasm()->storeAccumulator(pasm()->contextAddress());
}
-void Assembler::popContext(int reg)
+void Assembler::popContext()
{
- pasm()->copyReg(regAddr(reg), pasm()->contextAddress());
+ Heap::CallContext ctx;
+ Q_UNUSED(ctx)
+ pasm()->loadPointerFromValue(regAddr(CallData::Context), PlatformAssembler::ScratchRegister);
+ pasm()->loadAccumulator(Address(PlatformAssembler::ScratchRegister, ctx.outer.offset));
+ pasm()->storeAccumulator(regAddr(CallData::Context));
}
void Assembler::ret()
diff --git a/src/qml/jit/qv4assembler_p.h b/src/qml/jit/qv4assembler_p.h
index 99ae48e5ed..a1596e1640 100644
--- a/src/qml/jit/qv4assembler_p.h
+++ b/src/qml/jit/qv4assembler_p.h
@@ -164,8 +164,8 @@ public:
void setException();
void setExceptionHandler(int offset);
void clearExceptionHandler();
- void pushCatchContext(int reg, int index, int name);
- void popContext(int reg);
+ void pushCatchContext(int index, int name);
+ void popContext();
// other stuff
void ret();
diff --git a/src/qml/jit/qv4jit.cpp b/src/qml/jit/qv4jit.cpp
index 15ece7e903..2bc60bff70 100644
--- a/src/qml/jit/qv4jit.cpp
+++ b/src/qml/jit/qv4jit.cpp
@@ -617,44 +617,40 @@ void BaselineJIT::generate_CreateCallContext()
as->storeHeapObject(CallData::Context);
}
-void BaselineJIT::generate_PushCatchContext(int reg, int index, int name) { as->pushCatchContext(reg, index, name); }
+void BaselineJIT::generate_PushCatchContext(int index, int name) { as->pushCatchContext(index, name); }
-static void pushWithContextHelper(ExecutionEngine *engine, QV4::Value *stack, int reg)
+static void pushWithContextHelper(ExecutionEngine *engine, QV4::Value *stack)
{
QV4::Value &accumulator = stack[CallData::Accumulator];
accumulator = accumulator.toObject(engine);
if (engine->hasException)
return;
- stack[reg] = stack[CallData::Context];
ExecutionContext *c = static_cast<ExecutionContext *>(stack + CallData::Context);
stack[CallData::Context] = Runtime::method_createWithContext(c, accumulator);
}
-void BaselineJIT::generate_PushWithContext(int reg)
+void BaselineJIT::generate_PushWithContext()
{
STORE_IP();
as->saveAccumulatorInFrame();
- as->prepareCallWithArgCount(3);
- as->passInt32AsArg(reg, 2);
+ as->prepareCallWithArgCount(2);
as->passRegAsArg(0, 1);
as->passEngineAsArg(0);
JIT_GENERATE_RUNTIME_CALL(pushWithContextHelper, Assembler::IgnoreResult);
as->checkException();
}
-static void pushBlockContextHelper(QV4::Value *stack, int reg, int index)
+static void pushBlockContextHelper(QV4::Value *stack, int index)
{
- stack[reg] = stack[CallData::Context];
ExecutionContext *c = static_cast<ExecutionContext *>(stack + CallData::Context);
stack[CallData::Context] = Runtime::method_createBlockContext(c, index);
}
-void BaselineJIT::generate_PushBlockContext(int reg, int index)
+void BaselineJIT::generate_PushBlockContext(int index)
{
as->saveAccumulatorInFrame();
- as->prepareCallWithArgCount(3);
- as->passInt32AsArg(index, 2);
- as->passInt32AsArg(reg, 1);
+ as->prepareCallWithArgCount(2);
+ as->passInt32AsArg(index, 1);
as->passRegAsArg(0, 0);
JIT_GENERATE_RUNTIME_CALL(pushBlockContextHelper, Assembler::IgnoreResult);
}
@@ -701,7 +697,7 @@ void BaselineJIT::generate_PopScriptContext()
JIT_GENERATE_RUNTIME_CALL(popScriptContextHelper, Assembler::IgnoreResult);
}
-void BaselineJIT::generate_PopContext(int reg) { as->popContext(reg); }
+void BaselineJIT::generate_PopContext() { as->popContext(); }
void BaselineJIT::generate_GetIterator(int iterator)
{
diff --git a/src/qml/jit/qv4jit_p.h b/src/qml/jit/qv4jit_p.h
index d48041d954..8aa0cb430e 100644
--- a/src/qml/jit/qv4jit_p.h
+++ b/src/qml/jit/qv4jit_p.h
@@ -178,13 +178,13 @@ public:
void generate_GetException() override;
void generate_SetException() override;
void generate_CreateCallContext() override;
- void generate_PushCatchContext(int reg, int index, int name) override;
- void generate_PushWithContext(int reg) override;
- void generate_PushBlockContext(int reg, int index) override;
+ void generate_PushCatchContext(int index, int name) override;
+ void generate_PushWithContext() override;
+ void generate_PushBlockContext(int index) override;
void generate_CloneBlockContext() override;
void generate_PushScriptContext(int index) override;
void generate_PopScriptContext() override;
- void generate_PopContext(int reg) override;
+ void generate_PopContext() override;
void generate_GetIterator(int iterator) override;
void generate_IteratorNext(int value) override;
void generate_IteratorClose(int done) override;