From 12d8b8c9e4ff05707df7bda479e69d997799c486 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Mon, 25 Jun 2018 23:27:24 +0200 Subject: Move the Vtable for Managed objects into it's own file Move both the code from qv4object and qv4managed into a new qv4vtable_p.h file. Change-Id: Ib1d58120b6c3b9b779b2692526c7e40a5265c4db Reviewed-by: Simon Hausmann --- src/qml/jsruntime/qv4object_p.h | 77 ----------------------------------------- 1 file changed, 77 deletions(-) (limited to 'src/qml/jsruntime/qv4object_p.h') diff --git a/src/qml/jsruntime/qv4object_p.h b/src/qml/jsruntime/qv4object_p.h index e604cdb190..272f1dbb9d 100644 --- a/src/qml/jsruntime/qv4object_p.h +++ b/src/qml/jsruntime/qv4object_p.h @@ -64,9 +64,6 @@ QT_BEGIN_NAMESPACE namespace QV4 { -typedef ReturnedValue (*jsCallFunction)(const FunctionObject *, const Value *thisObject, const Value *argv, int argc); -typedef ReturnedValue (*jsConstructFunction)(const FunctionObject *, const Value *argv, int argc); - namespace Heap { #define ObjectMembers(class, Member) \ @@ -141,80 +138,6 @@ DECLARE_EXPORTED_HEAP_OBJECT(Object, Base) { } -#define V4_OBJECT2(DataClass, superClass) \ - private: \ - DataClass() Q_DECL_EQ_DELETE; \ - Q_DISABLE_COPY(DataClass) \ - public: \ - Q_MANAGED_CHECK \ - typedef QV4::Heap::DataClass Data; \ - typedef superClass SuperClass; \ - static const QV4::ObjectVTable static_vtbl; \ - static inline const QV4::VTable *staticVTable() { return &static_vtbl.vTable; } \ - V4_MANAGED_SIZE_TEST \ - QV4::Heap::DataClass *d_unchecked() const { return static_cast(m()); } \ - QV4::Heap::DataClass *d() const { \ - QV4::Heap::DataClass *dptr = d_unchecked(); \ - dptr->_checkIsInitialized(); \ - return dptr; \ - } \ - Q_STATIC_ASSERT(std::is_trivial< QV4::Heap::DataClass >::value); - -#define V4_PROTOTYPE(p) \ - static QV4::Object *defaultPrototype(QV4::ExecutionEngine *e) \ - { return e->p(); } - -struct ObjectVTable -{ - VTable vTable; - ReturnedValue (*call)(const FunctionObject *, const Value *thisObject, const Value *argv, int argc); - ReturnedValue (*callAsConstructor)(const FunctionObject *, const Value *argv, int argc); - ReturnedValue (*get)(const Managed *, PropertyKey id, const Value *receiver, bool *hasProperty); - bool (*put)(Managed *, PropertyKey id, const Value &value, Value *receiver); - bool (*deleteProperty)(Managed *m, PropertyKey id); - bool (*hasProperty)(const Managed *m, PropertyKey id); - PropertyAttributes (*getOwnProperty)(Managed *m, PropertyKey id, Property *p); - bool (*defineOwnProperty)(Managed *m, PropertyKey id, const Property *p, PropertyAttributes attrs); - bool (*isExtensible)(const Managed *); - bool (*preventExtensions)(Managed *); - Heap::Object *(*getPrototypeOf)(const Managed *); - bool (*setPrototypeOf)(Managed *, const Object *); - qint64 (*getLength)(const Managed *m); - void (*advanceIterator)(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attributes); - ReturnedValue (*instanceOf)(const Object *typeObject, const Value &var); -}; - -#define DEFINE_OBJECT_VTABLE_BASE(classname) \ -const QV4::ObjectVTable classname::static_vtbl = \ -{ \ - DEFINE_MANAGED_VTABLE_INT(classname, (std::is_same::value) ? nullptr : &classname::SuperClass::static_vtbl.vTable), \ - call, \ - callAsConstructor, \ - get, \ - put, \ - deleteProperty, \ - hasProperty, \ - getOwnProperty, \ - defineOwnProperty, \ - isExtensible, \ - preventExtensions, \ - getPrototypeOf, \ - setPrototypeOf, \ - getLength, \ - advanceIterator, \ - instanceOf \ -} - -#define DEFINE_OBJECT_VTABLE(classname) \ -QT_WARNING_SUPPRESS_GCC_TAUTOLOGICAL_COMPARE_ON \ -DEFINE_OBJECT_VTABLE_BASE(classname) \ -QT_WARNING_SUPPRESS_GCC_TAUTOLOGICAL_COMPARE_OFF - -#define DEFINE_OBJECT_TEMPLATE_VTABLE(classname) \ -QT_WARNING_SUPPRESS_GCC_TAUTOLOGICAL_COMPARE_ON \ -template<> DEFINE_OBJECT_VTABLE_BASE(classname) \ -QT_WARNING_SUPPRESS_GCC_TAUTOLOGICAL_COMPARE_OFF - struct Q_QML_EXPORT Object: Managed { V4_OBJECT2(Object, Object) Q_MANAGED_TYPE(Object) -- cgit v1.2.3