aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime
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 /src/qml/jsruntime
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>
Diffstat (limited to 'src/qml/jsruntime')
-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
28 files changed, 83 insertions, 67 deletions
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);