aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2014-06-13 16:04:39 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2014-07-22 13:49:20 +0200
commitda9d5016613d04f002c6433e2b3083143fec34cb (patch)
treedb73090d9a3c79c2cf777aecc35612faa9797194
parentb393c405b7568e80628bc99501a9c53bbd0e678d (diff)
Fix Managed::as<>() method
The as<> casting method was not doing the right thing in 100% of the cases. It only checked if the object in question was exactly of the type being asked for. It however didn't check if the object was derived from the type. This commit fixes this by adding a parent chain to the vtables, that is then being used to check this safely at runtime. Change-Id: I9e0b13adbda668aee8c7451e2bb71cd6d4e316d9 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
-rw-r--r--src/imports/localstorage/plugin.cpp2
-rw-r--r--src/particles/qquickv4particledata.cpp2
-rw-r--r--src/qml/jsruntime/qv4argumentsobject_p.h6
-rw-r--r--src/qml/jsruntime/qv4arraydata.cpp4
-rw-r--r--src/qml/jsruntime/qv4arrayobject_p.h2
-rw-r--r--src/qml/jsruntime/qv4booleanobject_p.h2
-rw-r--r--src/qml/jsruntime/qv4context_p.h10
-rw-r--r--src/qml/jsruntime/qv4dateobject_p.h4
-rw-r--r--src/qml/jsruntime/qv4errorobject_p.h18
-rw-r--r--src/qml/jsruntime/qv4functionobject_p.h16
-rw-r--r--src/qml/jsruntime/qv4globalobject_p.h2
-rw-r--r--src/qml/jsruntime/qv4jsonobject_p.h2
-rw-r--r--src/qml/jsruntime/qv4managed.cpp1
-rw-r--r--src/qml/jsruntime/qv4managed_p.h35
-rw-r--r--src/qml/jsruntime/qv4mathobject_p.h2
-rw-r--r--src/qml/jsruntime/qv4memberdata_p.h2
-rw-r--r--src/qml/jsruntime/qv4numberobject_p.h2
-rw-r--r--src/qml/jsruntime/qv4object_p.h8
-rw-r--r--src/qml/jsruntime/qv4objectiterator_p.h2
-rw-r--r--src/qml/jsruntime/qv4objectproto_p.h2
-rw-r--r--src/qml/jsruntime/qv4qobjectwrapper_p.h6
-rw-r--r--src/qml/jsruntime/qv4regexp_p.h2
-rw-r--r--src/qml/jsruntime/qv4regexpobject_p.h6
-rw-r--r--src/qml/jsruntime/qv4script.cpp2
-rw-r--r--src/qml/jsruntime/qv4script_p.h2
-rw-r--r--src/qml/jsruntime/qv4sequenceobject.cpp2
-rw-r--r--src/qml/jsruntime/qv4string.cpp2
-rw-r--r--src/qml/jsruntime/qv4string_p.h2
-rw-r--r--src/qml/jsruntime/qv4stringobject_p.h4
-rw-r--r--src/qml/jsruntime/qv4variantobject_p.h2
-rw-r--r--src/qml/qml/qqmlcomponent.cpp2
-rw-r--r--src/qml/qml/qqmlcontextwrapper_p.h4
-rw-r--r--src/qml/qml/qqmllistwrapper_p.h2
-rw-r--r--src/qml/qml/qqmllocale_p.h2
-rw-r--r--src/qml/qml/qqmltypewrapper_p.h2
-rw-r--r--src/qml/qml/qqmlvaluetypewrapper.cpp4
-rw-r--r--src/qml/qml/qqmlvaluetypewrapper_p.h2
-rw-r--r--src/qml/qml/qqmlxmlhttprequest.cpp12
-rw-r--r--src/qml/qml/v8/qqmlbuiltinfunctions_p.h4
-rw-r--r--src/qml/types/qqmldelegatemodel.cpp6
-rw-r--r--src/qml/types/qqmldelegatemodel_p_p.h2
-rw-r--r--src/quick/items/context2d/qquickcontext2d.cpp10
-rw-r--r--src/quick/items/qquickview_p.h2
-rw-r--r--tools/qmljs/main.cpp4
44 files changed, 114 insertions, 98 deletions
diff --git a/src/imports/localstorage/plugin.cpp b/src/imports/localstorage/plugin.cpp
index d7ef00bc98..8b06043f8b 100644
--- a/src/imports/localstorage/plugin.cpp
+++ b/src/imports/localstorage/plugin.cpp
@@ -135,7 +135,7 @@ public:
bool forwardOnly; // type == Rows
} __data;
- V4_OBJECT
+ V4_OBJECT(Object)
static QQmlSqlDatabaseWrapper *create(QV8Engine *engine)
{
diff --git a/src/particles/qquickv4particledata.cpp b/src/particles/qquickv4particledata.cpp
index 4046c9da2e..469431067e 100644
--- a/src/particles/qquickv4particledata.cpp
+++ b/src/particles/qquickv4particledata.cpp
@@ -286,7 +286,7 @@ struct QV4ParticleData : public QV4::Object
QQuickParticleData* datum;//TODO: Guard needed?
} __data;
- V4_OBJECT
+ V4_OBJECT(QV4::Object)
};
DEFINE_OBJECT_VTABLE(QV4ParticleData);
diff --git a/src/qml/jsruntime/qv4argumentsobject_p.h b/src/qml/jsruntime/qv4argumentsobject_p.h
index c56effee77..cc3a70d0c3 100644
--- a/src/qml/jsruntime/qv4argumentsobject_p.h
+++ b/src/qml/jsruntime/qv4argumentsobject_p.h
@@ -62,7 +62,7 @@ struct ArgumentsGetterFunction: FunctionObject
struct {
uint index;
} __data;
- V4_OBJECT
+ V4_OBJECT(FunctionObject)
uint index() const { return d()->index; }
@@ -83,7 +83,7 @@ struct ArgumentsSetterFunction: FunctionObject
struct {
uint index;
} __data;
- V4_OBJECT
+ V4_OBJECT(FunctionObject)
uint index() const { return d()->index; }
@@ -103,7 +103,7 @@ struct ArgumentsObject: Object {
bool fullyCreated;
Members mappedArguments;
} __data;
- V4_OBJECT
+ V4_OBJECT(Object)
Q_MANAGED_TYPE(ArgumentsObject)
CallContext *context() const { return d()->context; }
diff --git a/src/qml/jsruntime/qv4arraydata.cpp b/src/qml/jsruntime/qv4arraydata.cpp
index fbc404878e..2d702aed97 100644
--- a/src/qml/jsruntime/qv4arraydata.cpp
+++ b/src/qml/jsruntime/qv4arraydata.cpp
@@ -47,7 +47,7 @@ using namespace QV4;
const ArrayVTable SimpleArrayData::static_vtbl =
{
- DEFINE_MANAGED_VTABLE_INT(SimpleArrayData),
+ DEFINE_MANAGED_VTABLE_INT(SimpleArrayData, 0),
SimpleArrayData::Simple,
SimpleArrayData::reallocate,
SimpleArrayData::get,
@@ -64,7 +64,7 @@ const ArrayVTable SimpleArrayData::static_vtbl =
const ArrayVTable SparseArrayData::static_vtbl =
{
- DEFINE_MANAGED_VTABLE_INT(SparseArrayData),
+ DEFINE_MANAGED_VTABLE_INT(SparseArrayData, 0),
ArrayData::Sparse,
SparseArrayData::reallocate,
SparseArrayData::get,
diff --git a/src/qml/jsruntime/qv4arrayobject_p.h b/src/qml/jsruntime/qv4arrayobject_p.h
index 7f983b997d..dccda2896e 100644
--- a/src/qml/jsruntime/qv4arrayobject_p.h
+++ b/src/qml/jsruntime/qv4arrayobject_p.h
@@ -55,7 +55,7 @@ struct ArrayCtor: FunctionObject
Data(ExecutionContext *scope);
};
- V4_OBJECT
+ V4_OBJECT(FunctionObject)
static ReturnedValue construct(Managed *m, CallData *callData);
static ReturnedValue call(Managed *that, CallData *callData);
diff --git a/src/qml/jsruntime/qv4booleanobject_p.h b/src/qml/jsruntime/qv4booleanobject_p.h
index cbcbaabf51..35cfd5729e 100644
--- a/src/qml/jsruntime/qv4booleanobject_p.h
+++ b/src/qml/jsruntime/qv4booleanobject_p.h
@@ -55,7 +55,7 @@ struct BooleanCtor: FunctionObject
Data(ExecutionContext *scope);
};
- V4_OBJECT
+ V4_OBJECT(FunctionObject)
static ReturnedValue construct(Managed *, CallData *callData);
static ReturnedValue call(Managed *that, CallData *callData);
diff --git a/src/qml/jsruntime/qv4context_p.h b/src/qml/jsruntime/qv4context_p.h
index 10a86dd898..7d816f947e 100644
--- a/src/qml/jsruntime/qv4context_p.h
+++ b/src/qml/jsruntime/qv4context_p.h
@@ -133,7 +133,7 @@ struct Q_QML_EXPORT ExecutionContext : public Managed
int lineNumber;
} __data;
- V4_MANAGED
+ V4_MANAGED(Managed)
Q_MANAGED_TYPE(ExecutionContext)
ExecutionContext(ExecutionEngine *engine, ContextType t)
@@ -208,7 +208,7 @@ struct CallContext : public ExecutionContext
Value *locals;
Object *activation;
} __data;
- V4_MANAGED
+ V4_MANAGED(ExecutionContext)
// formals are in reverse order
String * const *formals() const;
@@ -233,7 +233,7 @@ struct GlobalContext : public ExecutionContext
struct {
Object *global;
} __data;
- V4_MANAGED
+ V4_MANAGED(ExecutionContext)
};
@@ -248,7 +248,7 @@ struct CatchContext : public ExecutionContext
StringValue exceptionVarName;
Value exceptionValue;
} __data;
- V4_MANAGED
+ V4_MANAGED(ExecutionContext)
};
struct WithContext : public ExecutionContext
@@ -260,7 +260,7 @@ struct WithContext : public ExecutionContext
struct {
Object *withObject;
} __data;
- V4_MANAGED
+ V4_MANAGED(ExecutionContext)
};
inline CallContext *ExecutionContext::asCallContext()
diff --git a/src/qml/jsruntime/qv4dateobject_p.h b/src/qml/jsruntime/qv4dateobject_p.h
index d285680268..0526154788 100644
--- a/src/qml/jsruntime/qv4dateobject_p.h
+++ b/src/qml/jsruntime/qv4dateobject_p.h
@@ -70,7 +70,7 @@ struct DateObject: Object {
struct {
Value value;
} __data;
- V4_OBJECT
+ V4_OBJECT(Object)
Q_MANAGED_TYPE(DateObject)
@@ -86,7 +86,7 @@ struct DateCtor: FunctionObject
struct Data : FunctionObject::Data {
Data(ExecutionContext *scope);
};
- V4_OBJECT
+ V4_OBJECT(FunctionObject)
static ReturnedValue construct(Managed *, CallData *callData);
static ReturnedValue call(Managed *that, CallData *);
diff --git a/src/qml/jsruntime/qv4errorobject_p.h b/src/qml/jsruntime/qv4errorobject_p.h
index 39d2e3c5c7..e3fe6895a4 100644
--- a/src/qml/jsruntime/qv4errorobject_p.h
+++ b/src/qml/jsruntime/qv4errorobject_p.h
@@ -77,7 +77,7 @@ struct ErrorObject: Object {
String *stack;
} __data;
- V4_OBJECT
+ V4_OBJECT(Object)
Q_MANAGED_TYPE(ErrorObject)
SyntaxErrorObject *asSyntaxError();
@@ -118,7 +118,7 @@ struct SyntaxErrorObject: ErrorObject {
Data(ExecutionEngine *engine, const ValueRef message);
Data(ExecutionEngine *engine, const QString &msg, const QString &fileName, int lineNumber, int columnNumber);
};
- V4_OBJECT
+ V4_OBJECT(ErrorObject)
};
struct TypeErrorObject: ErrorObject {
@@ -141,7 +141,7 @@ struct ErrorCtor: FunctionObject
Data(ExecutionContext *scope, const QString &name);
};
- V4_OBJECT
+ V4_OBJECT(FunctionObject)
static ReturnedValue construct(Managed *, CallData *callData);
static ReturnedValue call(Managed *that, CallData *callData);
@@ -152,7 +152,7 @@ struct EvalErrorCtor: ErrorCtor
struct Data : ErrorCtor::Data {
Data(ExecutionContext *scope);
};
- V4_OBJECT
+ V4_OBJECT(ErrorCtor)
static ReturnedValue construct(Managed *m, CallData *callData);
};
@@ -162,7 +162,7 @@ struct RangeErrorCtor: ErrorCtor
struct Data : ErrorCtor::Data {
Data(ExecutionContext *scope);
};
- V4_OBJECT
+ V4_OBJECT(ErrorCtor)
static ReturnedValue construct(Managed *m, CallData *callData);
};
@@ -172,7 +172,7 @@ struct ReferenceErrorCtor: ErrorCtor
struct Data : ErrorCtor::Data {
Data(ExecutionContext *scope);
};
- V4_OBJECT
+ V4_OBJECT(ErrorCtor)
static ReturnedValue construct(Managed *m, CallData *callData);
};
@@ -182,7 +182,7 @@ struct SyntaxErrorCtor: ErrorCtor
struct Data : ErrorCtor::Data {
Data(ExecutionContext *scope);
};
- V4_OBJECT
+ V4_OBJECT(ErrorCtor)
static ReturnedValue construct(Managed *m, CallData *callData);
};
@@ -192,7 +192,7 @@ struct TypeErrorCtor: ErrorCtor
struct Data : ErrorCtor::Data {
Data(ExecutionContext *scope);
};
- V4_OBJECT
+ V4_OBJECT(ErrorCtor)
static ReturnedValue construct(Managed *m, CallData *callData);
};
@@ -202,7 +202,7 @@ struct URIErrorCtor: ErrorCtor
struct Data : ErrorCtor::Data {
Data(ExecutionContext *scope);
};
- V4_OBJECT
+ V4_OBJECT(ErrorCtor)
static ReturnedValue construct(Managed *m, CallData *callData);
};
diff --git a/src/qml/jsruntime/qv4functionobject_p.h b/src/qml/jsruntime/qv4functionobject_p.h
index eff65f7345..ce8c6e7b79 100644
--- a/src/qml/jsruntime/qv4functionobject_p.h
+++ b/src/qml/jsruntime/qv4functionobject_p.h
@@ -110,7 +110,7 @@ struct Q_QML_EXPORT FunctionObject: Object {
Function *function;
} __data;
- V4_OBJECT
+ V4_OBJECT(Object)
Q_MANAGED_TYPE(FunctionObject)
enum {
IsFunctionObject = true
@@ -173,7 +173,7 @@ struct FunctionCtor: FunctionObject
Data(ExecutionContext *scope);
};
- V4_OBJECT
+ V4_OBJECT(FunctionObject)
static ReturnedValue construct(Managed *that, CallData *callData);
static ReturnedValue call(Managed *that, CallData *callData);
@@ -184,7 +184,7 @@ struct FunctionPrototype: FunctionObject
struct Data : FunctionObject::Data {
Data(InternalClass *ic);
};
- V4_OBJECT
+ V4_OBJECT(FunctionObject)
void init(ExecutionEngine *engine, Object *ctor);
@@ -202,7 +202,7 @@ struct Q_QML_EXPORT BuiltinFunction: FunctionObject {
struct {
ReturnedValue (*code)(CallContext *);
} __data;
- V4_OBJECT
+ V4_OBJECT(FunctionObject)
static BuiltinFunction *create(ExecutionContext *scope, String *name, ReturnedValue (*code)(CallContext *))
{
@@ -230,7 +230,7 @@ struct IndexedBuiltinFunction: FunctionObject
ReturnedValue (*code)(CallContext *, uint index);
uint index;
} __data;
- V4_OBJECT
+ V4_OBJECT(FunctionObject)
static ReturnedValue construct(Managed *m, CallData *)
{
@@ -245,7 +245,7 @@ struct SimpleScriptFunction: FunctionObject {
struct Data : FunctionObject::Data {
Data(ExecutionContext *scope, Function *function, bool createProto);
};
- V4_OBJECT
+ V4_OBJECT(FunctionObject)
static ReturnedValue construct(Managed *, CallData *callData);
static ReturnedValue call(Managed *that, CallData *callData);
@@ -257,7 +257,7 @@ struct ScriptFunction: SimpleScriptFunction {
struct Data : SimpleScriptFunction::Data {
Data(ExecutionContext *scope, Function *function);
};
- V4_OBJECT
+ V4_OBJECT(FunctionObject)
static ReturnedValue construct(Managed *, CallData *callData);
static ReturnedValue call(Managed *that, CallData *callData);
@@ -276,7 +276,7 @@ struct BoundFunction: FunctionObject {
Value boundThis;
Members boundArgs;
} __data;
- V4_OBJECT
+ V4_OBJECT(FunctionObject)
static BoundFunction *create(ExecutionContext *scope, FunctionObject *target, const ValueRef boundThis, const QV4::Members &boundArgs)
{
diff --git a/src/qml/jsruntime/qv4globalobject_p.h b/src/qml/jsruntime/qv4globalobject_p.h
index d973adc847..b3fcb0c89b 100644
--- a/src/qml/jsruntime/qv4globalobject_p.h
+++ b/src/qml/jsruntime/qv4globalobject_p.h
@@ -54,7 +54,7 @@ struct Q_QML_EXPORT EvalFunction : FunctionObject
Data(ExecutionContext *scope);
};
- V4_OBJECT
+ V4_OBJECT(FunctionObject)
ReturnedValue evalCall(CallData *callData, bool directCall);
diff --git a/src/qml/jsruntime/qv4jsonobject_p.h b/src/qml/jsruntime/qv4jsonobject_p.h
index 86b1fc682d..03d5ad29c8 100644
--- a/src/qml/jsruntime/qv4jsonobject_p.h
+++ b/src/qml/jsruntime/qv4jsonobject_p.h
@@ -55,7 +55,7 @@ struct JsonObject : Object {
Data(InternalClass *ic);
};
Q_MANAGED_TYPE(JsonObject)
- V4_OBJECT
+ V4_OBJECT(Object)
private:
typedef QSet<QV4::Object *> V4ObjectSet;
public:
diff --git a/src/qml/jsruntime/qv4managed.cpp b/src/qml/jsruntime/qv4managed.cpp
index e3e8bb6fd2..6fc402e48f 100644
--- a/src/qml/jsruntime/qv4managed.cpp
+++ b/src/qml/jsruntime/qv4managed.cpp
@@ -48,6 +48,7 @@ using namespace QV4;
const ManagedVTable Managed::static_vtbl =
{
+ 0,
Managed::IsExecutionContext,
Managed::IsString,
Managed::IsObject,
diff --git a/src/qml/jsruntime/qv4managed_p.h b/src/qml/jsruntime/qv4managed_p.h
index fc0a87da9e..4d7af1a5f0 100644
--- a/src/qml/jsruntime/qv4managed_p.h
+++ b/src/qml/jsruntime/qv4managed_p.h
@@ -62,9 +62,10 @@ inline int qYouForgotTheQ_MANAGED_Macro(T, T) { return 0; }
template <typename T1, typename T2>
inline void qYouForgotTheQ_MANAGED_Macro(T1, T2) {}
-#define V4_MANAGED \
+#define V4_MANAGED(superClass) \
public: \
Q_MANAGED_CHECK \
+ typedef superClass SuperClass; \
static const QV4::ManagedVTable static_vtbl; \
static inline const QV4::ManagedVTable *staticVTable() { return &static_vtbl; } \
template <typename T> \
@@ -73,9 +74,10 @@ inline void qYouForgotTheQ_MANAGED_Macro(T1, T2) {}
const Data *d() const { return &static_cast<const Data &>(Managed::data); } \
Data *d() { return &static_cast<Data &>(Managed::data); }
-#define V4_OBJECT \
+#define V4_OBJECT(superClass) \
public: \
Q_MANAGED_CHECK \
+ typedef superClass SuperClass; \
static const QV4::ObjectVTable static_vtbl; \
static inline const QV4::ManagedVTable *staticVTable() { return &static_vtbl.managedVTable; } \
template <typename T> \
@@ -102,6 +104,7 @@ struct GCDeletable
struct ManagedVTable
{
+ const ManagedVTable * const parent;
uint isExecutionContext : 1;
uint isString : 1;
uint isObject : 1;
@@ -135,9 +138,9 @@ struct ObjectVTable
void (*advanceIterator)(Managed *m, ObjectIterator *it, String *&name, uint *index, Property *p, PropertyAttributes *attributes);
};
-
-#define DEFINE_MANAGED_VTABLE_INT(classname) \
+#define DEFINE_MANAGED_VTABLE_INT(classname, parentVTable) \
{ \
+ parentVTable, \
classname::IsExecutionContext, \
classname::IsString, \
classname::IsObject, \
@@ -146,20 +149,20 @@ struct ObjectVTable
classname::IsArrayData, \
0, \
classname::MyType, \
- #classname, \
+ #classname, \
Q_VTABLE_FUNCTION(classname, destroy), \
markObjects, \
isEqualTo \
}
#define DEFINE_MANAGED_VTABLE(classname) \
-const QV4::ManagedVTable classname::static_vtbl = DEFINE_MANAGED_VTABLE_INT(classname)
+const QV4::ManagedVTable classname::static_vtbl = DEFINE_MANAGED_VTABLE_INT(classname, 0)
#define DEFINE_OBJECT_VTABLE(classname) \
const QV4::ObjectVTable classname::static_vtbl = \
{ \
- DEFINE_MANAGED_VTABLE_INT(classname), \
+ DEFINE_MANAGED_VTABLE_INT(classname, &classname::SuperClass::static_vtbl == &Object::static_vtbl ? 0 : &classname::SuperClass::static_vtbl.managedVTable), \
call, \
construct, \
get, \
@@ -212,7 +215,7 @@ struct Q_QML_PRIVATE_EXPORT Managed
void *operator new(size_t, Managed::Data *m) { return m; }
};
Data data;
- V4_MANAGED
+ V4_MANAGED(Managed)
enum {
IsExecutionContext = false,
IsString = false,
@@ -272,7 +275,13 @@ public:
#if !defined(QT_NO_QOBJECT_CHECK)
static_cast<T *>(this)->qt_check_for_QMANAGED_macro(static_cast<T *>(this));
#endif
- return internalClass()->vtable == T::staticVTable() ? static_cast<T *>(this) : 0;
+ const ManagedVTable *vt = internalClass()->vtable;
+ while (vt) {
+ if (vt == T::staticVTable())
+ return static_cast<T *>(this);
+ vt = vt->parent;
+ }
+ return 0;
}
template <typename T>
const T *as() const {
@@ -282,7 +291,13 @@ public:
#if !defined(QT_NO_QOBJECT_CHECK)
static_cast<T *>(this)->qt_check_for_QMANAGED_macro(static_cast<T *>(const_cast<Managed *>(this)));
#endif
- return internalClass()->vtable == T::staticVTable() ? static_cast<const T *>(this) : 0;
+ const ManagedVTable *vt = internalClass()->vtable;
+ while (vt) {
+ if (vt == T::staticVTable())
+ return static_cast<T *>(this);
+ vt = vt->parent;
+ }
+ return 0;
}
String *asString() { return internalClass()->vtable->isString ? reinterpret_cast<String *>(this) : 0; }
diff --git a/src/qml/jsruntime/qv4mathobject_p.h b/src/qml/jsruntime/qv4mathobject_p.h
index bfca09793a..65366aab86 100644
--- a/src/qml/jsruntime/qv4mathobject_p.h
+++ b/src/qml/jsruntime/qv4mathobject_p.h
@@ -53,7 +53,7 @@ struct MathObject: Object
Data(InternalClass *ic);
};
- V4_OBJECT
+ V4_OBJECT(Object)
Q_MANAGED_TYPE(MathObject)
static ReturnedValue method_abs(CallContext *context);
diff --git a/src/qml/jsruntime/qv4memberdata_p.h b/src/qml/jsruntime/qv4memberdata_p.h
index f5f2305745..434683994f 100644
--- a/src/qml/jsruntime/qv4memberdata_p.h
+++ b/src/qml/jsruntime/qv4memberdata_p.h
@@ -65,7 +65,7 @@ struct MemberData : Managed
Value data[1];
} __data;
- V4_MANAGED
+ V4_MANAGED(Managed)
MemberData(QV4::InternalClass *ic) : Managed(ic) {}
Value &operator[] (uint idx) { return d()->data[idx]; }
diff --git a/src/qml/jsruntime/qv4numberobject_p.h b/src/qml/jsruntime/qv4numberobject_p.h
index 1b6371ee83..3e776f0f2f 100644
--- a/src/qml/jsruntime/qv4numberobject_p.h
+++ b/src/qml/jsruntime/qv4numberobject_p.h
@@ -54,7 +54,7 @@ struct NumberCtor: FunctionObject
struct Data : FunctionObject::Data {
Data(ExecutionContext *scope);
};
- V4_OBJECT
+ V4_OBJECT(FunctionObject)
static ReturnedValue construct(Managed *that, CallData *callData);
static ReturnedValue call(Managed *, CallData *callData);
diff --git a/src/qml/jsruntime/qv4object_p.h b/src/qml/jsruntime/qv4object_p.h
index 3497f58a77..774cb5c4b4 100644
--- a/src/qml/jsruntime/qv4object_p.h
+++ b/src/qml/jsruntime/qv4object_p.h
@@ -117,7 +117,7 @@ struct Q_QML_EXPORT Object: Managed {
Members memberData;
ArrayData *arrayData;
} __data;
- V4_OBJECT
+ V4_OBJECT(Object)
Q_MANAGED_TYPE(Object)
enum {
@@ -336,7 +336,7 @@ struct BooleanObject: Object {
struct {
Value value;
} __data;
- V4_OBJECT
+ V4_OBJECT(Object)
Q_MANAGED_TYPE(BooleanObject)
Value value() const { return d()->value; }
@@ -359,7 +359,7 @@ struct NumberObject: Object {
struct {
Value value;
} __data;
- V4_OBJECT
+ V4_OBJECT(Object)
Q_MANAGED_TYPE(NumberObject)
Value value() const { return d()->value; }
@@ -375,7 +375,7 @@ struct ArrayObject: Object {
{ memberData[LengthPropertyIndex] = Primitive::fromInt32(0); }
};
- V4_OBJECT
+ V4_OBJECT(Object)
Q_MANAGED_TYPE(ArrayObject)
enum {
LengthPropertyIndex = 0
diff --git a/src/qml/jsruntime/qv4objectiterator_p.h b/src/qml/jsruntime/qv4objectiterator_p.h
index fa2b2b725f..93877b8f2a 100644
--- a/src/qml/jsruntime/qv4objectiterator_p.h
+++ b/src/qml/jsruntime/qv4objectiterator_p.h
@@ -98,7 +98,7 @@ struct ForEachIteratorObject: Object {
ObjectIterator it;
Value workArea[2];
} __data;
- V4_OBJECT
+ V4_OBJECT(Object)
Q_MANAGED_TYPE(ForeachIteratorObject)
ReturnedValue nextPropertyName() { return d()->it.nextPropertyNameAsString(); }
diff --git a/src/qml/jsruntime/qv4objectproto_p.h b/src/qml/jsruntime/qv4objectproto_p.h
index e174565915..c34b367223 100644
--- a/src/qml/jsruntime/qv4objectproto_p.h
+++ b/src/qml/jsruntime/qv4objectproto_p.h
@@ -54,7 +54,7 @@ struct ObjectCtor: FunctionObject
struct Data : FunctionObject::Data {
Data(ExecutionContext *scope);
};
- V4_OBJECT
+ V4_OBJECT(FunctionObject)
static ReturnedValue construct(Managed *that, CallData *callData);
static ReturnedValue call(Managed *that, CallData *callData);
diff --git a/src/qml/jsruntime/qv4qobjectwrapper_p.h b/src/qml/jsruntime/qv4qobjectwrapper_p.h
index c342caf1be..87c07ce66c 100644
--- a/src/qml/jsruntime/qv4qobjectwrapper_p.h
+++ b/src/qml/jsruntime/qv4qobjectwrapper_p.h
@@ -85,7 +85,7 @@ struct Q_QML_EXPORT QObjectWrapper : public QV4::Object
QPointer<QObject> object;
} __data;
- V4_OBJECT
+ V4_OBJECT(QV4::Object)
enum RevisionMode { IgnoreRevision, CheckRevision };
@@ -141,7 +141,7 @@ struct QObjectMethod : public QV4::FunctionObject
QV4::PersistentValue qmlGlobal;
} __data;
- V4_OBJECT
+ V4_OBJECT(QV4::FunctionObject)
enum { DestroyMethod = -1, ToStringMethod = -2 };
@@ -175,7 +175,7 @@ struct QmlSignalHandler : public QV4::Object
int signalIndex;
} __data;
- V4_OBJECT
+ V4_OBJECT(QV4::Object)
int signalIndex() const { return d()->signalIndex; }
diff --git a/src/qml/jsruntime/qv4regexp_p.h b/src/qml/jsruntime/qv4regexp_p.h
index 4c941979a4..289b5388ec 100644
--- a/src/qml/jsruntime/qv4regexp_p.h
+++ b/src/qml/jsruntime/qv4regexp_p.h
@@ -90,7 +90,7 @@ struct RegExp : public Managed
bool ignoreCase;
bool multiLine;
} __data;
- V4_MANAGED
+ V4_MANAGED(Managed)
Q_MANAGED_TYPE(RegExp)
diff --git a/src/qml/jsruntime/qv4regexpobject_p.h b/src/qml/jsruntime/qv4regexpobject_p.h
index 238ce8a759..4148ca07d4 100644
--- a/src/qml/jsruntime/qv4regexpobject_p.h
+++ b/src/qml/jsruntime/qv4regexpobject_p.h
@@ -77,7 +77,7 @@ struct RegExpObject: Object {
bool global;
} __data;
- V4_OBJECT
+ V4_OBJECT(Object)
Q_MANAGED_TYPE(RegExpObject)
// needs to be compatible with the flags in qv4jsir_p.h
@@ -124,7 +124,7 @@ struct RegExpCtor: FunctionObject
int lastMatchEnd;
} __data;
- V4_OBJECT
+ V4_OBJECT(FunctionObject)
Value lastMatch() { return d()->lastMatch; }
StringValue lastInput() { return d()->lastInput; }
@@ -145,7 +145,7 @@ struct RegExpPrototype: RegExpObject
setVTable(staticVTable());
}
};
- V4_OBJECT
+ V4_OBJECT(RegExpObject)
void init(ExecutionEngine *engine, Object *ctor);
diff --git a/src/qml/jsruntime/qv4script.cpp b/src/qml/jsruntime/qv4script.cpp
index 638cf3c126..810e05c7f4 100644
--- a/src/qml/jsruntime/qv4script.cpp
+++ b/src/qml/jsruntime/qv4script.cpp
@@ -184,7 +184,7 @@ struct CompilationUnitHolder : public Object
QV4::CompiledData::CompilationUnit *unit;
} __data;
- V4_OBJECT
+ V4_OBJECT(Object)
static void destroy(Managed *that)
diff --git a/src/qml/jsruntime/qv4script_p.h b/src/qml/jsruntime/qv4script_p.h
index ac5df82ef2..ae19397e54 100644
--- a/src/qml/jsruntime/qv4script_p.h
+++ b/src/qml/jsruntime/qv4script_p.h
@@ -68,7 +68,7 @@ struct Q_QML_EXPORT QmlBindingWrapper : FunctionObject {
CallContext *qmlContext;
} __data;
- V4_OBJECT
+ V4_OBJECT(FunctionObject)
static ReturnedValue call(Managed *that, CallData *);
static void markObjects(Managed *m, ExecutionEngine *e);
diff --git a/src/qml/jsruntime/qv4sequenceobject.cpp b/src/qml/jsruntime/qv4sequenceobject.cpp
index a45d047c28..475c8ad71b 100644
--- a/src/qml/jsruntime/qv4sequenceobject.cpp
+++ b/src/qml/jsruntime/qv4sequenceobject.cpp
@@ -202,7 +202,7 @@ struct QQmlSequence : public QV4::Object
bool isReference;
} __data;
- V4_OBJECT
+ V4_OBJECT(QV4::Object)
Q_MANAGED_TYPE(QmlSequence)
public:
diff --git a/src/qml/jsruntime/qv4string.cpp b/src/qml/jsruntime/qv4string.cpp
index 1cdd439ab2..123d1648c2 100644
--- a/src/qml/jsruntime/qv4string.cpp
+++ b/src/qml/jsruntime/qv4string.cpp
@@ -108,7 +108,7 @@ static uint toArrayIndex(const char *ch, const char *end, bool *ok)
const ObjectVTable String::static_vtbl =
{
- DEFINE_MANAGED_VTABLE_INT(String),
+ DEFINE_MANAGED_VTABLE_INT(String, 0),
0,
0,
get,
diff --git a/src/qml/jsruntime/qv4string_p.h b/src/qml/jsruntime/qv4string_p.h
index 3578c0378e..3bcf1bdae1 100644
--- a/src/qml/jsruntime/qv4string_p.h
+++ b/src/qml/jsruntime/qv4string_p.h
@@ -95,7 +95,7 @@ struct Q_QML_PRIVATE_EXPORT String : public Managed {
uint len;
} __data;
// ### FIXME: Should this be a V4_OBJECT
- V4_OBJECT
+ V4_OBJECT(QV4::Managed)
Q_MANAGED_TYPE(String)
enum {
IsString = true
diff --git a/src/qml/jsruntime/qv4stringobject_p.h b/src/qml/jsruntime/qv4stringobject_p.h
index 5cddec0edc..f7a120bc74 100644
--- a/src/qml/jsruntime/qv4stringobject_p.h
+++ b/src/qml/jsruntime/qv4stringobject_p.h
@@ -61,7 +61,7 @@ struct StringObject: Object {
Value value;
mutable Property tmpProperty;
} __data;
- V4_OBJECT
+ V4_OBJECT(Object)
Q_MANAGED_TYPE(StringObject)
@@ -79,7 +79,7 @@ struct StringCtor: FunctionObject
struct Data : FunctionObject::Data {
Data(ExecutionContext *scope);
};
- V4_OBJECT
+ V4_OBJECT(FunctionObject)
static ReturnedValue construct(Managed *m, CallData *callData);
static ReturnedValue call(Managed *that, CallData *callData);
diff --git a/src/qml/jsruntime/qv4variantobject_p.h b/src/qml/jsruntime/qv4variantobject_p.h
index b1e872b5c5..e94bcf23d3 100644
--- a/src/qml/jsruntime/qv4variantobject_p.h
+++ b/src/qml/jsruntime/qv4variantobject_p.h
@@ -82,7 +82,7 @@ struct VariantObject : Object
int vmePropertyReferenceCount;
} __data;
- V4_OBJECT
+ V4_OBJECT(Object)
static QVariant toVariant(const ValueRef v);
diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp
index 3cf39bd494..a6a41ae365 100644
--- a/src/qml/qml/qqmlcomponent.cpp
+++ b/src/qml/qml/qqmlcomponent.cpp
@@ -1094,7 +1094,7 @@ struct QmlIncubatorObject : public QV4::Object
QV4::Value statusChanged;
} __data;
- V4_OBJECT
+ V4_OBJECT(QV4::Object)
static QV4::ReturnedValue method_get_statusChanged(QV4::CallContext *ctx);
static QV4::ReturnedValue method_set_statusChanged(QV4::CallContext *ctx);
diff --git a/src/qml/qml/qqmlcontextwrapper_p.h b/src/qml/qml/qqmlcontextwrapper_p.h
index a2cb0960d4..73747cadfc 100644
--- a/src/qml/qml/qqmlcontextwrapper_p.h
+++ b/src/qml/qml/qqmlcontextwrapper_p.h
@@ -94,7 +94,7 @@ struct Q_QML_EXPORT QmlContextWrapper : Object
QQmlIdObjectsArray *idObjectsWrapper;
} __data;
- V4_OBJECT
+ V4_OBJECT(Object)
static ReturnedValue qmlScope(QV8Engine *e, QQmlContextData *ctxt, QObject *scope);
static ReturnedValue urlScope(QV8Engine *e, const QUrl &);
@@ -130,7 +130,7 @@ struct QQmlIdObjectsArray : public Object
QmlContextWrapper *contextWrapper;
} __data;
- V4_OBJECT
+ V4_OBJECT(Object)
static ReturnedValue getIndexed(Managed *m, uint index, bool *hasProperty);
static void markObjects(Managed *that, ExecutionEngine *engine);
diff --git a/src/qml/qml/qqmllistwrapper_p.h b/src/qml/qml/qqmllistwrapper_p.h
index 670321bcd7..70f686b73c 100644
--- a/src/qml/qml/qqmllistwrapper_p.h
+++ b/src/qml/qml/qqmllistwrapper_p.h
@@ -84,7 +84,7 @@ struct Q_QML_EXPORT QmlListWrapper : Object
int propertyType;
} __data;
- V4_OBJECT
+ V4_OBJECT(Object)
static ReturnedValue create(QV8Engine *v8, QObject *object, int propId, int propType);
static ReturnedValue create(QV8Engine *v8, const QQmlListProperty<QObject> &prop, int propType);
diff --git a/src/qml/qml/qqmllocale_p.h b/src/qml/qml/qqmllocale_p.h
index d5812ef78a..dcf4a349c4 100644
--- a/src/qml/qml/qqmllocale_p.h
+++ b/src/qml/qml/qqmllocale_p.h
@@ -143,7 +143,7 @@ struct QQmlLocaleData : public QV4::Object
QLocale locale;
} __data;
- V4_OBJECT
+ V4_OBJECT(Object)
static QLocale *getThisLocale(QV4::CallContext *ctx) {
QQmlLocaleData *thisObject = ctx->d()->callData->thisObject.asObject()->as<QQmlLocaleData>();
diff --git a/src/qml/qml/qqmltypewrapper_p.h b/src/qml/qml/qqmltypewrapper_p.h
index a54fe99de1..effebf8806 100644
--- a/src/qml/qml/qqmltypewrapper_p.h
+++ b/src/qml/qml/qqmltypewrapper_p.h
@@ -91,7 +91,7 @@ struct Q_QML_EXPORT QmlTypeWrapper : Object
const void *importNamespace;
} __data;
- V4_OBJECT
+ V4_OBJECT(Object)
private:
public:
diff --git a/src/qml/qml/qqmlvaluetypewrapper.cpp b/src/qml/qml/qqmlvaluetypewrapper.cpp
index 52b45bd1bb..f228d96603 100644
--- a/src/qml/qml/qqmlvaluetypewrapper.cpp
+++ b/src/qml/qml/qqmlvaluetypewrapper.cpp
@@ -72,7 +72,7 @@ struct QmlValueTypeReference : public QmlValueTypeWrapper
QPointer<QObject> object;
int property;
} __data;
- V4_OBJECT
+ V4_OBJECT(QmlValueTypeWrapper)
};
DEFINE_OBJECT_VTABLE(QmlValueTypeReference);
@@ -88,7 +88,7 @@ struct QmlValueTypeCopy : public QmlValueTypeWrapper
{
QVariant value;
} __data;
- V4_OBJECT
+ V4_OBJECT(QmlValueTypeWrapper)
};
DEFINE_OBJECT_VTABLE(QmlValueTypeCopy);
diff --git a/src/qml/qml/qqmlvaluetypewrapper_p.h b/src/qml/qml/qqmlvaluetypewrapper_p.h
index 22fe628ab5..7647c0c8cc 100644
--- a/src/qml/qml/qqmlvaluetypewrapper_p.h
+++ b/src/qml/qml/qqmlvaluetypewrapper_p.h
@@ -81,7 +81,7 @@ struct Q_QML_EXPORT QmlValueTypeWrapper : Object
mutable QQmlValueType *type;
} __data;
- V4_OBJECT
+ V4_OBJECT(Object)
public:
diff --git a/src/qml/qml/qqmlxmlhttprequest.cpp b/src/qml/qml/qqmlxmlhttprequest.cpp
index d864c1f0b0..0ba4eabbca 100644
--- a/src/qml/qml/qqmlxmlhttprequest.cpp
+++ b/src/qml/qml/qqmlxmlhttprequest.cpp
@@ -209,7 +209,7 @@ public:
NodeImpl *d;
} __data;
- V4_OBJECT
+ V4_OBJECT(Object)
// C++ API
static ReturnedValue create(QV8Engine *, NodeImpl *, const QList<NodeImpl *> &);
@@ -247,7 +247,7 @@ public:
NodeImpl *d;
} __data;
- V4_OBJECT
+ V4_OBJECT(Object)
// JS API
static void destroy(Managed *that) {
@@ -288,7 +288,7 @@ public:
o->defineAccessorProperty(QStringLiteral("attributes"), method_get_attributes, 0);
}
};
- V4_OBJECT
+ V4_OBJECT(Object)
static void initClass(ExecutionEngine *engine);
@@ -339,7 +339,7 @@ struct Node : public Object
struct {
NodeImpl *d;
} __data;
- V4_OBJECT
+ V4_OBJECT(Object)
// JS API
@@ -1629,7 +1629,7 @@ struct QQmlXMLHttpRequestWrapper : public Object
QQmlXMLHttpRequest *request;
} __data;
- V4_OBJECT
+ V4_OBJECT(Object)
static void destroy(Managed *that) {
that->as<QQmlXMLHttpRequestWrapper>()->d()->~Data();
@@ -1664,7 +1664,7 @@ struct QQmlXMLHttpRequestCtor : public FunctionObject
Object *proto;
} __data;
- V4_OBJECT
+ V4_OBJECT(FunctionObject)
static void markObjects(Managed *that, ExecutionEngine *e) {
QQmlXMLHttpRequestCtor *c = that->as<QQmlXMLHttpRequestCtor>();
if (c->d()->proto)
diff --git a/src/qml/qml/v8/qqmlbuiltinfunctions_p.h b/src/qml/qml/v8/qqmlbuiltinfunctions_p.h
index 73c3b8da28..b4e680a4a3 100644
--- a/src/qml/qml/v8/qqmlbuiltinfunctions_p.h
+++ b/src/qml/qml/v8/qqmlbuiltinfunctions_p.h
@@ -75,7 +75,7 @@ struct QtObject : Object
QObject *application;
} __data;
- V4_OBJECT
+ V4_OBJECT(Object)
static ReturnedValue method_isQtObject(CallContext *ctx);
@@ -167,7 +167,7 @@ struct QQmlBindingFunction : public QV4::FunctionObject
QQmlSourceLocation bindingLocation;
} __data;
- V4_OBJECT
+ V4_OBJECT(QV4::FunctionObject)
void initBindingLocation(); // from caller stack trace
diff --git a/src/qml/types/qqmldelegatemodel.cpp b/src/qml/types/qqmldelegatemodel.cpp
index 7fd880681f..dfef707c97 100644
--- a/src/qml/types/qqmldelegatemodel.cpp
+++ b/src/qml/types/qqmldelegatemodel.cpp
@@ -78,7 +78,7 @@ struct DelegateModelGroupFunction: QV4::FunctionObject
QV4::ReturnedValue (*code)(QQmlDelegateModelItem *item, uint flag, const QV4::ValueRef arg);
} __data;
- V4_OBJECT
+ V4_OBJECT(QV4::FunctionObject)
static DelegateModelGroupFunction *create(QV4::ExecutionContext *scope, uint flag, QV4::ReturnedValue (*code)(QQmlDelegateModelItem *item, uint flag, const QV4::ValueRef arg))
{
@@ -3226,7 +3226,7 @@ struct QQmlDelegateModelGroupChange : QV4::Object
QQmlChangeSet::Change change;
} __data;
- V4_OBJECT
+ V4_OBJECT(QV4::Object)
static QQmlDelegateModelGroupChange *create(QV4::ExecutionEngine *e) {
return e->memoryManager->alloc<QQmlDelegateModelGroupChange>(e);
@@ -3276,7 +3276,7 @@ struct QQmlDelegateModelGroupChangeArray : public QV4::Object
struct {
QVector<QQmlChangeSet::Change> changes;
} __data;
- V4_OBJECT
+ V4_OBJECT(QV4::Object)
public:
static QQmlDelegateModelGroupChangeArray *create(QV4::ExecutionEngine *engine, const QVector<QQmlChangeSet::Change> &changes)
{
diff --git a/src/qml/types/qqmldelegatemodel_p_p.h b/src/qml/types/qqmldelegatemodel_p_p.h
index e305ac1f3a..f9cbc428c1 100644
--- a/src/qml/types/qqmldelegatemodel_p_p.h
+++ b/src/qml/types/qqmldelegatemodel_p_p.h
@@ -175,7 +175,7 @@ struct QQmlDelegateModelItemObject : QV4::Object
QQmlDelegateModelItem *item;
} __data;
- V4_OBJECT
+ V4_OBJECT(QV4::Object)
static void destroy(Managed *that);
};
diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp
index d71f1da98f..dd9b66cabb 100644
--- a/src/quick/items/context2d/qquickcontext2d.cpp
+++ b/src/quick/items/context2d/qquickcontext2d.cpp
@@ -490,7 +490,7 @@ struct QQuickJSContext2D : public QV4::Object
struct {
QQuickContext2D* context;
} __data;
- V4_OBJECT
+ V4_OBJECT(QV4::Object)
static QV4::ReturnedValue method_get_globalAlpha(QV4::CallContext *ctx);
static QV4::ReturnedValue method_set_globalAlpha(QV4::CallContext *ctx);
@@ -538,7 +538,7 @@ DEFINE_OBJECT_VTABLE(QQuickJSContext2D);
struct QQuickJSContext2DPrototype : public QV4::Object
{
- V4_OBJECT
+ V4_OBJECT(QV4::Object)
public:
static QQuickJSContext2DPrototype *create(QV4::ExecutionEngine *engine)
{
@@ -663,7 +663,7 @@ struct QQuickContext2DStyle : public QV4::Object
bool patternRepeatY:1;
} __data;
- V4_OBJECT
+ V4_OBJECT(QV4::Object)
static QV4::ReturnedValue gradient_proto_addColorStop(QV4::CallContext *ctx);
protected:
@@ -887,7 +887,7 @@ struct QQuickJSContext2DPixelData : public QV4::Object
QImage image;
} __data;
- V4_OBJECT
+ V4_OBJECT(QV4::Object)
static void destroy(QV4::Managed *that) {
static_cast<QQuickJSContext2DPixelData *>(that)->d()->~Data();
@@ -921,7 +921,7 @@ struct QQuickJSContext2DImageData : public QV4::Object
struct {
QV4::Value pixelData;
} __data;
- V4_OBJECT
+ V4_OBJECT(QV4::Object)
static QV4::ReturnedValue method_get_width(QV4::CallContext *ctx);
static QV4::ReturnedValue method_get_height(QV4::CallContext *ctx);
diff --git a/src/quick/items/qquickview_p.h b/src/quick/items/qquickview_p.h
index 4666ed4d4b..f88f03f291 100644
--- a/src/quick/items/qquickview_p.h
+++ b/src/quick/items/qquickview_p.h
@@ -118,7 +118,7 @@ struct QQuickRootItemMarker : public QV4::Object
QQuickWindow *window;
} __data;
- V4_OBJECT
+ V4_OBJECT(QV4::Object)
static QQuickRootItemMarker *create(QQmlEngine *engine, QQuickWindow *window);
diff --git a/tools/qmljs/main.cpp b/tools/qmljs/main.cpp
index 50bba820e5..98bf9ad2c5 100644
--- a/tools/qmljs/main.cpp
+++ b/tools/qmljs/main.cpp
@@ -78,7 +78,7 @@ struct Print: FunctionObject
setVTable(staticVTable());
}
};
- V4_OBJECT
+ V4_OBJECT(FunctionObject)
static ReturnedValue call(Managed *, CallData *callData)
{
@@ -105,7 +105,7 @@ struct GC: public FunctionObject
}
};
- V4_OBJECT
+ V4_OBJECT(FunctionObject)
static ReturnedValue call(Managed *m, CallData *)
{