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/jsruntime/qv4runtimeapi_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/jsruntime/qv4runtimeapi_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4runtimeapi_p.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/qml/jsruntime/qv4runtimeapi_p.h b/src/qml/jsruntime/qv4runtimeapi_p.h index d431b9f4c8..d63a813a5a 100644 --- a/src/qml/jsruntime/qv4runtimeapi_p.h +++ b/src/qml/jsruntime/qv4runtimeapi_p.h @@ -47,9 +47,20 @@ namespace QV4 { struct NoThrowEngine; +#define RUNTIME_METHOD(returnvalue, name, args) \ + typedef returnvalue (*Method_##name)args; \ + static returnvalue method_##name args; \ + const Method_##name name + +#define INIT_RUNTIME_METHOD(name) \ + name(method_##name) + struct Q_QML_PRIVATE_EXPORT Runtime { + Runtime() + : INIT_RUNTIME_METHOD(callGlobalLookup) + { } // call - static ReturnedValue callGlobalLookup(ExecutionEngine *engine, uint index, CallData *callData); + RUNTIME_METHOD(ReturnedValue, callGlobalLookup, (ExecutionEngine *engine, uint index, CallData *callData)); static ReturnedValue callActivationProperty(ExecutionEngine *engine, int nameIndex, CallData *callData); static ReturnedValue callQmlScopeObjectProperty(ExecutionEngine *engine, int propertyIndex, CallData *callData); static ReturnedValue callQmlContextObjectProperty(ExecutionEngine *engine, int propertyIndex, CallData *callData); @@ -186,6 +197,9 @@ struct Q_QML_PRIVATE_EXPORT Runtime { static void setQmlQObjectProperty(ExecutionEngine *engine, const Value &object, int propertyIndex, const Value &value); }; +#undef RUNTIME_METHOD +#undef INIT_RUNTIME_METHOD + } // namespace QV4 QT_END_NAMESPACE |