aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-09-12 22:47:07 +0200
committerLars Knoll <lars.knoll@qt.io>2018-09-14 19:21:25 +0000
commit6982d0d6290c137468749bb8ab2f2e20dfa453fd (patch)
tree62b0c22c5bbff0b2da8031930b355815b88a0c8a
parent2beb77c81a1f3585c15099a09ba8b2192c6da824 (diff)
Optimize the JIT helpers
Match the argument order to the lookup functions being called to minimize register shuffling that needs to be done inside the function. Change-Id: I0c55234d0c86b524dad021a519c6416d62d34c52 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
-rw-r--r--src/qml/jit/qv4baselinejit.cpp15
-rw-r--r--src/qml/jit/qv4jithelpers.cpp16
-rw-r--r--src/qml/jit/qv4jithelpers_p.h7
3 files changed, 24 insertions, 14 deletions
diff --git a/src/qml/jit/qv4baselinejit.cpp b/src/qml/jit/qv4baselinejit.cpp
index 1e77c1a001..f8be5fb140 100644
--- a/src/qml/jit/qv4baselinejit.cpp
+++ b/src/qml/jit/qv4baselinejit.cpp
@@ -205,8 +205,8 @@ void BaselineJIT::generate_LoadGlobalLookup(int index)
{
as->prepareCallWithArgCount(3);
as->passInt32AsArg(index, 2);
- as->passFunctionAsArg(1);
- as->passEngineAsArg(0);
+ as->passEngineAsArg(1);
+ as->passFunctionAsArg(0);
BASELINEJIT_GENERATE_RUNTIME_CALL(Helpers::loadGlobalLookup, CallResultDestination::InAccumulator);
as->checkException();
}
@@ -277,10 +277,10 @@ void BaselineJIT::generate_GetLookup(int index)
STORE_IP();
STORE_ACC();
as->prepareCallWithArgCount(4);
- as->passAccumulatorAsArg(3);
- as->passInt32AsArg(index, 2);
- as->passFunctionAsArg(1);
- as->passEngineAsArg(0);
+ as->passInt32AsArg(index, 3);
+ as->passAccumulatorAsArg(2);
+ as->passEngineAsArg(1);
+ as->passFunctionAsArg(0);
BASELINEJIT_GENERATE_RUNTIME_CALL(Helpers::getLookup, CallResultDestination::InAccumulator);
as->checkException();
}
@@ -307,7 +307,8 @@ void BaselineJIT::generate_SetLookup(int index, int base)
as->passJSSlotAsArg(base, 2);
as->passInt32AsArg(index, 1);
as->passFunctionAsArg(0);
- BASELINEJIT_GENERATE_RUNTIME_CALL(Helpers::setLookup, CallResultDestination::InAccumulator);
+ BASELINEJIT_GENERATE_RUNTIME_CALL((function->isStrict() ? Helpers::setLookupStrict : Helpers::setLookupSloppy),
+ CallResultDestination::InAccumulator);
as->checkException();
}
diff --git a/src/qml/jit/qv4jithelpers.cpp b/src/qml/jit/qv4jithelpers.cpp
index 427356e5ed..f43f37ad70 100644
--- a/src/qml/jit/qv4jithelpers.cpp
+++ b/src/qml/jit/qv4jithelpers.cpp
@@ -64,7 +64,7 @@ void convertThisToObject(ExecutionEngine *engine, Value *t)
}
}
-ReturnedValue loadGlobalLookup(ExecutionEngine *engine, Function *f, int index)
+ReturnedValue loadGlobalLookup(Function *f, ExecutionEngine *engine, int index)
{
Lookup *l = f->compilationUnit->runtimeLookups + index;
return l->globalGetter(l, engine);
@@ -87,20 +87,28 @@ ReturnedValue exp(const Value &base, const Value &exp)
return Encode(pow(b,e));
}
-ReturnedValue getLookup(ExecutionEngine *engine, Function *f, int index, const Value &base)
+ReturnedValue getLookup(Function *f, ExecutionEngine *engine, const Value &base, int index)
{
Lookup *l = f->compilationUnit->runtimeLookups + index;
return l->getter(l, engine, base);
}
-void setLookup(Function *f, int index, Value &base, const Value &value)
+void setLookupSloppy(Function *f, int index, Value &base, const Value &value)
{
ExecutionEngine *engine = f->internalClass->engine;
QV4::Lookup *l = f->compilationUnit->runtimeLookups + index;
- if (!l->setter(l, engine, base, value) && f->isStrict())
+ l->setter(l, engine, base, value);
+}
+
+void setLookupStrict(Function *f, int index, Value &base, const Value &value)
+{
+ ExecutionEngine *engine = f->internalClass->engine;
+ QV4::Lookup *l = f->compilationUnit->runtimeLookups + index;
+ if (!l->setter(l, engine, base, value))
engine->throwTypeError();
}
+
void pushBlockContext(Value *stack, int index)
{
ExecutionContext *c = static_cast<ExecutionContext *>(stack + CallData::Context);
diff --git a/src/qml/jit/qv4jithelpers_p.h b/src/qml/jit/qv4jithelpers_p.h
index dd68452e7f..bd5f65034d 100644
--- a/src/qml/jit/qv4jithelpers_p.h
+++ b/src/qml/jit/qv4jithelpers_p.h
@@ -65,11 +65,12 @@ namespace JIT {
namespace Helpers {
void convertThisToObject(ExecutionEngine *engine, Value *t);
-ReturnedValue loadGlobalLookup(ExecutionEngine *engine, Function *f, int index);
+ReturnedValue loadGlobalLookup(Function *f, ExecutionEngine *engine, int index);
ReturnedValue toObject(ExecutionEngine *engine, const Value &obj);
ReturnedValue exp(const Value &base, const Value &exp);
-ReturnedValue getLookup(ExecutionEngine *engine, Function *f, int index, const Value &base);
-void setLookup(Function *f, int index, Value &base, const Value &value);
+ReturnedValue getLookup(Function *f, ExecutionEngine *engine, const Value &base, int index);
+void setLookupStrict(Function *f, int index, Value &base, const Value &value);
+void setLookupSloppy(Function *f, int index, Value &base, const Value &value);
void pushBlockContext(Value *stack, int index);
void cloneBlockContext(Value *contextSlot);
void pushScriptContext(Value *stack, ExecutionEngine *engine, int index);