diff options
author | Lars Knoll <lars.knoll@qt.io> | 2017-10-20 11:06:15 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2017-11-07 09:00:19 +0000 |
commit | fb84c9b4f860ee71d0584207f4c0f1d70d96755c (patch) | |
tree | e813c93c54c2cfb93ab0894de25740a093ca87ea /src/qml/jsruntime/qv4functionobject_p.h | |
parent | 07980a034609383e79132c9819b682c88d343a95 (diff) |
Add functions pointers for call/construct to FunctionObject
This will allow us to avoid one level of indirection when
calling js functions in the future.
Change-Id: I814b72d18adb5a5580c11053e53b582549b629fc
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4functionobject_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4functionobject_p.h | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/qml/jsruntime/qv4functionobject_p.h b/src/qml/jsruntime/qv4functionobject_p.h index d76655179d..36f873e1a2 100644 --- a/src/qml/jsruntime/qv4functionobject_p.h +++ b/src/qml/jsruntime/qv4functionobject_p.h @@ -64,11 +64,17 @@ namespace QV4 { struct BuiltinFunction; struct IndexedBuiltinFunction; +typedef ReturnedValue (*jsCallFunction)(const Managed *, CallData *data); +typedef ReturnedValue (*jsConstructFunction)(const Managed *, CallData *data); + namespace Heap { + #define FunctionObjectMembers(class, Member) \ Member(class, Pointer, ExecutionContext *, scope) \ - Member(class, NoMark, Function *, function) + Member(class, NoMark, Function *, function) \ + Member(class, NoMark, jsCallFunction, jsCall) \ + Member(class, NoMark, jsConstructFunction, jsConstruct) DECLARE_HEAP_OBJECT(FunctionObject, Object) { DECLARE_MARK_TABLE(FunctionObject); @@ -149,8 +155,12 @@ struct Q_QML_EXPORT FunctionObject: Object { void init(String *name, bool createProto); - using Object::construct; - using Object::call; + ReturnedValue construct(CallData *callData) { + return d()->jsConstruct(this, callData); + } + ReturnedValue call(CallData *callData) { + return d()->jsCall(this, callData); + } static ReturnedValue construct(const Managed *that, CallData *); static ReturnedValue call(const Managed *that, CallData *d); |