diff options
author | Lars Knoll <lars.knoll@theqtcompany.com> | 2015-10-09 08:58:36 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2016-04-11 09:41:57 +0000 |
commit | c810daa67536803905cdb1ba32a3dadfec95aa4c (patch) | |
tree | a7392c39dc7a288e8d40c80b5902efbc1366fa17 /src/qml/jit/qv4assembler_p.h | |
parent | 20dbb21f51f44f9b7e75960f8e36aead79c5ab55 (diff) |
Start converting Runtime calls to 'vtable' calls
The old code was using absolute addressing for calls into
methods of the Runtime. This produces non relocatable code,
which is bad for caching.
So instead, we'll have a table of function pointers for all
runtime methods in the ExecutionEngine, and do the runtime
calls through that table.
Change-Id: I75c04f699ea11c38f742575f9ce264c0c5ad0c96
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/qml/jit/qv4assembler_p.h')
-rw-r--r-- | src/qml/jit/qv4assembler_p.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/qml/jit/qv4assembler_p.h b/src/qml/jit/qv4assembler_p.h index bf10dab446..957e8fc444 100644 --- a/src/qml/jit/qv4assembler_p.h +++ b/src/qml/jit/qv4assembler_p.h @@ -104,6 +104,12 @@ struct LookupCall { {} }; +struct RuntimeCall { + JSC::MacroAssembler::Address addr; + + inline RuntimeCall(uint offset); +}; + template <typename T> struct ExceptionCheck { enum { NeedsCheck = 1 }; @@ -359,6 +365,17 @@ public: call(lookupCall.addr); } + void callAbsolute(const char *functionName, const RuntimeCall &runtimeCall) + { + call(runtimeCall.addr); + // the code below is to get proper function names in the disassembly + CallToLink ctl; + ctl.externalFunction = FunctionPtr(); + ctl.functionName = functionName; + ctl.label = label(); + _callsToLink.append(ctl); + } + void registerBlock(IR::BasicBlock*, IR::BasicBlock *nextBlock); IR::BasicBlock *nextBlock() const { return _nextBlock; } void jumpToBlock(IR::BasicBlock* current, IR::BasicBlock *target); @@ -1232,6 +1249,11 @@ void Assembler::copyValue(Result result, IR::Expr* source) } } +inline RuntimeCall::RuntimeCall(uint offset) + : addr(Assembler::EngineRegister, offset + qOffsetOf(QV4::ExecutionEngine, runtime)) +{ +} + template <typename T> inline bool prepareCall(T &, Assembler *) |