class QQmlSqlDatabaseWrapper : public Object
{
- Q_MANAGED
+ V4_OBJECT
public:
enum Type { Database, Query, Rows };
QQmlSqlDatabaseWrapper(QV8Engine *e)
: Object(QV8Engine::getV4(e)), type(Database), inTransaction(false), readonly(false), forwardOnly(false)
{
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
}
~QQmlSqlDatabaseWrapper() {
bool forwardOnly; // type == Rows
};
-DEFINE_MANAGED_VTABLE(QQmlSqlDatabaseWrapper);
+DEFINE_OBJECT_VTABLE(QQmlSqlDatabaseWrapper);
static ReturnedValue qmlsqldatabase_version(CallContext *ctx)
{
//### Particle data handles are not locked to within certain scopes like QQuickContext2D, but there's no way to reload either...
struct QV4ParticleData : public QV4::Object
{
- Q_MANAGED
+ V4_OBJECT
QV4ParticleData(QV4::ExecutionEngine *engine, QQuickParticleData *datum)
: Object(engine)
{
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
this->datum = datum;
}
{ that->as<QV4ParticleData>()->~QV4ParticleData(); }
};
-DEFINE_MANAGED_VTABLE(QV4ParticleData);
+DEFINE_OBJECT_VTABLE(QV4ParticleData);
class QV8ParticleDataDeletable : public QV8Engine::Deletable
{
using namespace QV4;
-DEFINE_MANAGED_VTABLE(ArgumentsObject);
+DEFINE_OBJECT_VTABLE(ArgumentsObject);
ArgumentsObject::ArgumentsObject(CallContext *context)
: Object(context->strictMode ? context->engine->strictArgumentsObjectClass : context->engine->argumentsObjectClass)
Property *lp = memberData + ArrayObject::LengthPropertyIndex;
lp->value = Primitive::fromInt32(context->realArgumentCount);
- Q_ASSERT(internalClass->vtable == &static_vtbl);
+ Q_ASSERT(internalClass->vtable == staticVTable());
}
void ArgumentsObject::destroy(Managed *that)
return Attr_Accessor;
}
-DEFINE_MANAGED_VTABLE(ArgumentsGetterFunction);
+DEFINE_OBJECT_VTABLE(ArgumentsGetterFunction);
ReturnedValue ArgumentsGetterFunction::call(Managed *getter, CallData *callData)
{
return o->context->argument(g->index);
}
-DEFINE_MANAGED_VTABLE(ArgumentsSetterFunction);
+DEFINE_OBJECT_VTABLE(ArgumentsSetterFunction);
ReturnedValue ArgumentsSetterFunction::call(Managed *setter, CallData *callData)
{
struct ArgumentsGetterFunction: FunctionObject
{
- Q_MANAGED
+ V4_OBJECT
uint index;
ArgumentsGetterFunction(ExecutionContext *scope, uint index)
: FunctionObject(scope), index(index) {
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
}
static ReturnedValue call(Managed *that, CallData *d);
struct ArgumentsSetterFunction: FunctionObject
{
- Q_MANAGED
+ V4_OBJECT
uint index;
ArgumentsSetterFunction(ExecutionContext *scope, uint index)
: FunctionObject(scope), index(index) {
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
}
static ReturnedValue call(Managed *that, CallData *callData);
struct ArgumentsObject: Object {
- Q_MANAGED
+ V4_OBJECT
Q_MANAGED_TYPE(ArgumentsObject)
CallContext *context;
bool fullyCreated;
using namespace QV4;
-DEFINE_MANAGED_VTABLE(ArrayCtor);
+DEFINE_OBJECT_VTABLE(ArrayCtor);
ArrayCtor::ArrayCtor(ExecutionContext *scope)
: FunctionObject(scope, QStringLiteral("Array"))
{
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
}
ReturnedValue ArrayCtor::construct(Managed *m, CallData *callData)
struct ArrayCtor: FunctionObject
{
- Q_MANAGED
+ V4_OBJECT
ArrayCtor(ExecutionContext *scope);
static ReturnedValue construct(Managed *m, CallData *callData);
using namespace QV4;
-DEFINE_MANAGED_VTABLE(BooleanCtor);
-DEFINE_MANAGED_VTABLE(BooleanObject);
+DEFINE_OBJECT_VTABLE(BooleanCtor);
+DEFINE_OBJECT_VTABLE(BooleanObject);
BooleanCtor::BooleanCtor(ExecutionContext *scope)
: FunctionObject(scope, QStringLiteral("Boolean"))
{
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
}
ReturnedValue BooleanCtor::construct(Managed *m, CallData *callData)
struct BooleanCtor: FunctionObject
{
- Q_MANAGED
+ V4_OBJECT
BooleanCtor(ExecutionContext *scope);
static ReturnedValue construct(Managed *, CallData *callData);
"ExecutionContext",
destroy,
markObjects,
- call,
- construct,
- 0 /*collectDeletables*/,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- isEqualTo,
- 0,
- 0
+ isEqualTo
};
CallContext *ExecutionContext::newCallContext(FunctionObject *function, CallData *callData)
struct Q_QML_EXPORT ExecutionContext : public Managed
{
- Q_MANAGED
+ V4_MANAGED
Q_MANAGED_TYPE(ExecutionContext)
enum {
IsExecutionContext = true
#endif
}
-DEFINE_MANAGED_VTABLE(DateObject);
+DEFINE_OBJECT_VTABLE(DateObject);
DateObject::DateObject(ExecutionEngine *engine, const QDateTime &date)
: Object(engine->dateClass)
{
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
value.setDouble(date.isValid() ? date.toMSecsSinceEpoch() : qSNaN());
}
return ToDateTime(value.asDouble(), Qt::LocalTime);
}
-DEFINE_MANAGED_VTABLE(DateCtor);
+DEFINE_OBJECT_VTABLE(DateCtor);
DateCtor::DateCtor(ExecutionContext *scope)
: FunctionObject(scope, QStringLiteral("Date"))
{
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
}
ReturnedValue DateCtor::construct(Managed *m, CallData *callData)
namespace QV4 {
struct DateObject: Object {
- Q_MANAGED
+ V4_OBJECT
Q_MANAGED_TYPE(DateObject)
SafeValue value;
DateObject(ExecutionEngine *engine, const ValueRef date): Object(engine->dateClass) {
protected:
DateObject(InternalClass *ic): Object(ic) {
- Q_ASSERT(internalClass->vtable == &static_vtbl);
+ Q_ASSERT(internalClass->vtable == staticVTable());
value = Primitive::fromDouble(qSNaN());
}
};
struct DateCtor: FunctionObject
{
- Q_MANAGED
+ V4_OBJECT
DateCtor(ExecutionContext *scope);
static ReturnedValue construct(Managed *, CallData *callData);
identifierTable = new IdentifierTable(this);
emptyClass = new (classPool.allocate(sizeof(InternalClass))) InternalClass(this);
- executionContextClass = InternalClass::create(this, &ExecutionContext::static_vtbl, 0);
- stringClass = InternalClass::create(this, &String::static_vtbl, 0);
- regExpValueClass = InternalClass::create(this, &RegExp::static_vtbl, 0);
+ executionContextClass = InternalClass::create(this, ExecutionContext::staticVTable(), 0);
+ stringClass = InternalClass::create(this, String::staticVTable(), 0);
+ regExpValueClass = InternalClass::create(this, RegExp::staticVTable(), 0);
id_undefined = newIdentifier(QStringLiteral("undefined"));
id_null = newIdentifier(QStringLiteral("null"));
id_toString = newIdentifier(QStringLiteral("toString"));
id_valueOf = newIdentifier(QStringLiteral("valueOf"));
- ObjectPrototype *objectPrototype = new (memoryManager) ObjectPrototype(InternalClass::create(this, &ObjectPrototype::static_vtbl, 0));
- objectClass = InternalClass::create(this, &Object::static_vtbl, objectPrototype);
- Q_ASSERT(objectClass->vtable == &Object::static_vtbl);
+ ObjectPrototype *objectPrototype = new (memoryManager) ObjectPrototype(InternalClass::create(this, ObjectPrototype::staticVTable(), 0));
+ objectClass = InternalClass::create(this, Object::staticVTable(), objectPrototype);
+ Q_ASSERT(objectClass->vtable == Object::staticVTable());
- arrayClass = InternalClass::create(this, &ArrayObject::static_vtbl, objectPrototype);
+ arrayClass = InternalClass::create(this, ArrayObject::staticVTable(), objectPrototype);
arrayClass = arrayClass->addMember(id_length, Attr_NotConfigurable|Attr_NotEnumerable);
ArrayPrototype *arrayPrototype = new (memoryManager) ArrayPrototype(arrayClass);
arrayClass = arrayClass->changePrototype(arrayPrototype);
- InternalClass *argsClass = InternalClass::create(this, &ArgumentsObject::static_vtbl, objectPrototype);
+ InternalClass *argsClass = InternalClass::create(this, ArgumentsObject::staticVTable(), objectPrototype);
argsClass = argsClass->addMember(id_length, Attr_NotEnumerable);
argumentsObjectClass = argsClass->addMember(id_callee, Attr_Data|Attr_NotEnumerable);
strictArgumentsObjectClass = argsClass->addMember(id_callee, Attr_Accessor|Attr_NotConfigurable|Attr_NotEnumerable);
strictArgumentsObjectClass = strictArgumentsObjectClass->addMember(id_caller, Attr_Accessor|Attr_NotConfigurable|Attr_NotEnumerable);
- Q_ASSERT(argumentsObjectClass->vtable == &ArgumentsObject::static_vtbl);
- Q_ASSERT(strictArgumentsObjectClass->vtable == &ArgumentsObject::static_vtbl);
+ Q_ASSERT(argumentsObjectClass->vtable == ArgumentsObject::staticVTable());
+ Q_ASSERT(strictArgumentsObjectClass->vtable == ArgumentsObject::staticVTable());
initRootContext();
- StringPrototype *stringPrototype = new (memoryManager) StringPrototype(InternalClass::create(this, &StringPrototype::static_vtbl, objectPrototype));
- stringObjectClass = InternalClass::create(this, &String::static_vtbl, stringPrototype);
+ StringPrototype *stringPrototype = new (memoryManager) StringPrototype(InternalClass::create(this, StringPrototype::staticVTable(), objectPrototype));
+ stringObjectClass = InternalClass::create(this, String::staticVTable(), stringPrototype);
- NumberPrototype *numberPrototype = new (memoryManager) NumberPrototype(InternalClass::create(this, &NumberPrototype::static_vtbl, objectPrototype));
- numberClass = InternalClass::create(this, &NumberObject::static_vtbl, numberPrototype);
+ NumberPrototype *numberPrototype = new (memoryManager) NumberPrototype(InternalClass::create(this, NumberPrototype::staticVTable(), objectPrototype));
+ numberClass = InternalClass::create(this, NumberObject::staticVTable(), numberPrototype);
- BooleanPrototype *booleanPrototype = new (memoryManager) BooleanPrototype(InternalClass::create(this, &BooleanPrototype::static_vtbl, objectPrototype));
- booleanClass = InternalClass::create(this, &BooleanObject::static_vtbl, booleanPrototype);
+ BooleanPrototype *booleanPrototype = new (memoryManager) BooleanPrototype(InternalClass::create(this, BooleanPrototype::staticVTable(), objectPrototype));
+ booleanClass = InternalClass::create(this, BooleanObject::staticVTable(), booleanPrototype);
- DatePrototype *datePrototype = new (memoryManager) DatePrototype(InternalClass::create(this, &DatePrototype::static_vtbl, objectPrototype));
- dateClass = InternalClass::create(this, &DateObject::static_vtbl, datePrototype);
+ DatePrototype *datePrototype = new (memoryManager) DatePrototype(InternalClass::create(this, DatePrototype::staticVTable(), objectPrototype));
+ dateClass = InternalClass::create(this, DateObject::staticVTable(), datePrototype);
- FunctionPrototype *functionPrototype = new (memoryManager) FunctionPrototype(InternalClass::create(this, &FunctionPrototype::static_vtbl, objectPrototype));
- functionClass = InternalClass::create(this, &FunctionObject::static_vtbl, functionPrototype);
+ FunctionPrototype *functionPrototype = new (memoryManager) FunctionPrototype(InternalClass::create(this, FunctionPrototype::staticVTable(), objectPrototype));
+ functionClass = InternalClass::create(this, FunctionObject::staticVTable(), functionPrototype);
uint index;
functionWithProtoClass = functionClass->addMember(id_prototype, Attr_NotEnumerable|Attr_NotConfigurable, &index);
Q_ASSERT(index == FunctionObject::Index_Prototype);
protoClass = objectClass->addMember(id_constructor, Attr_NotEnumerable, &index);
Q_ASSERT(index == FunctionObject::Index_ProtoConstructor);
- RegExpPrototype *regExpPrototype = new (memoryManager) RegExpPrototype(InternalClass::create(this, &RegExpPrototype::static_vtbl, objectPrototype));
- regExpClass = InternalClass::create(this, &RegExpObject::static_vtbl, regExpPrototype);
+ RegExpPrototype *regExpPrototype = new (memoryManager) RegExpPrototype(InternalClass::create(this, RegExpPrototype::staticVTable(), objectPrototype));
+ regExpClass = InternalClass::create(this, RegExpObject::staticVTable(), regExpPrototype);
regExpExecArrayClass = arrayClass->addMember(id_index, Attr_Data, &index);
Q_ASSERT(index == RegExpObject::Index_ArrayIndex);
regExpExecArrayClass = regExpExecArrayClass->addMember(id_input, Attr_Data, &index);
Q_ASSERT(index == RegExpObject::Index_ArrayInput);
- ErrorPrototype *errorPrototype = new (memoryManager) ErrorPrototype(InternalClass::create(this, &ErrorObject::static_vtbl, objectPrototype));
- errorClass = InternalClass::create(this, &ErrorObject::static_vtbl, errorPrototype);
+ ErrorPrototype *errorPrototype = new (memoryManager) ErrorPrototype(InternalClass::create(this, ErrorObject::staticVTable(), objectPrototype));
+ errorClass = InternalClass::create(this, ErrorObject::staticVTable(), errorPrototype);
EvalErrorPrototype *evalErrorPrototype = new (memoryManager) EvalErrorPrototype(errorClass);
- evalErrorClass = InternalClass::create(this, &EvalErrorObject::static_vtbl, evalErrorPrototype);
+ evalErrorClass = InternalClass::create(this, EvalErrorObject::staticVTable(), evalErrorPrototype);
RangeErrorPrototype *rangeErrorPrototype = new (memoryManager) RangeErrorPrototype(errorClass);
- rangeErrorClass = InternalClass::create(this, &RangeErrorObject::static_vtbl, rangeErrorPrototype);
+ rangeErrorClass = InternalClass::create(this, RangeErrorObject::staticVTable(), rangeErrorPrototype);
ReferenceErrorPrototype *referenceErrorPrototype = new (memoryManager) ReferenceErrorPrototype(errorClass);
- referenceErrorClass = InternalClass::create(this, &ReferenceErrorObject::static_vtbl, referenceErrorPrototype);
+ referenceErrorClass = InternalClass::create(this, ReferenceErrorObject::staticVTable(), referenceErrorPrototype);
SyntaxErrorPrototype *syntaxErrorPrototype = new (memoryManager) SyntaxErrorPrototype(errorClass);
- syntaxErrorClass = InternalClass::create(this, &SyntaxErrorObject::static_vtbl, syntaxErrorPrototype);
+ syntaxErrorClass = InternalClass::create(this, SyntaxErrorObject::staticVTable(), syntaxErrorPrototype);
TypeErrorPrototype *typeErrorPrototype = new (memoryManager) TypeErrorPrototype(errorClass);
- typeErrorClass = InternalClass::create(this, &TypeErrorObject::static_vtbl, typeErrorPrototype);
+ typeErrorClass = InternalClass::create(this, TypeErrorObject::staticVTable(), typeErrorPrototype);
URIErrorPrototype *uRIErrorPrototype = new (memoryManager) URIErrorPrototype(errorClass);
- uriErrorClass = InternalClass::create(this, &URIErrorObject::static_vtbl, uRIErrorPrototype);
+ uriErrorClass = InternalClass::create(this, URIErrorObject::staticVTable(), uRIErrorPrototype);
- VariantPrototype *variantPrototype = new (memoryManager) VariantPrototype(InternalClass::create(this, &VariantPrototype::static_vtbl, objectPrototype));
- variantClass = InternalClass::create(this, &VariantObject::static_vtbl, variantPrototype);
+ VariantPrototype *variantPrototype = new (memoryManager) VariantPrototype(InternalClass::create(this, VariantPrototype::staticVTable(), objectPrototype));
+ variantClass = InternalClass::create(this, VariantObject::staticVTable(), variantPrototype);
Q_ASSERT(variantClass->prototype == variantPrototype);
Q_ASSERT(variantPrototype->internalClass->prototype == objectPrototype);
globalObject->defineDefaultProperty(QStringLiteral("TypeError"), typeErrorCtor);
globalObject->defineDefaultProperty(QStringLiteral("URIError"), uRIErrorCtor);
ScopedObject o(scope);
- globalObject->defineDefaultProperty(QStringLiteral("Math"), (o = new (memoryManager) MathObject(QV4::InternalClass::create(this, &MathObject::static_vtbl, objectPrototype))));
- globalObject->defineDefaultProperty(QStringLiteral("JSON"), (o = new (memoryManager) JsonObject(QV4::InternalClass::create(this, &JsonObject::static_vtbl, objectPrototype))));
+ globalObject->defineDefaultProperty(QStringLiteral("Math"), (o = new (memoryManager) MathObject(QV4::InternalClass::create(this, MathObject::staticVTable(), objectPrototype))));
+ globalObject->defineDefaultProperty(QStringLiteral("JSON"), (o = new (memoryManager) JsonObject(QV4::InternalClass::create(this, JsonObject::staticVTable(), objectPrototype))));
globalObject->defineReadonlyProperty(QStringLiteral("undefined"), Primitive::undefinedValue());
globalObject->defineReadonlyProperty(QStringLiteral("NaN"), Primitive::fromDouble(std::numeric_limits<double>::quiet_NaN()));
Object::markObjects(that, e);
}
-DEFINE_MANAGED_VTABLE(ErrorObject);
+DEFINE_OBJECT_VTABLE(ErrorObject);
-DEFINE_MANAGED_VTABLE(SyntaxErrorObject);
+DEFINE_OBJECT_VTABLE(SyntaxErrorObject);
SyntaxErrorObject::SyntaxErrorObject(ExecutionEngine *engine, const ValueRef msg)
: ErrorObject(engine->syntaxErrorClass, msg, SyntaxError)
{
}
-DEFINE_MANAGED_VTABLE(ErrorCtor);
-DEFINE_MANAGED_VTABLE(EvalErrorCtor);
-DEFINE_MANAGED_VTABLE(RangeErrorCtor);
-DEFINE_MANAGED_VTABLE(ReferenceErrorCtor);
-DEFINE_MANAGED_VTABLE(SyntaxErrorCtor);
-DEFINE_MANAGED_VTABLE(TypeErrorCtor);
-DEFINE_MANAGED_VTABLE(URIErrorCtor);
+DEFINE_OBJECT_VTABLE(ErrorCtor);
+DEFINE_OBJECT_VTABLE(EvalErrorCtor);
+DEFINE_OBJECT_VTABLE(RangeErrorCtor);
+DEFINE_OBJECT_VTABLE(ReferenceErrorCtor);
+DEFINE_OBJECT_VTABLE(SyntaxErrorCtor);
+DEFINE_OBJECT_VTABLE(TypeErrorCtor);
+DEFINE_OBJECT_VTABLE(URIErrorCtor);
ErrorCtor::ErrorCtor(ExecutionContext *scope)
: FunctionObject(scope, QStringLiteral("Error"))
{
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
}
ErrorCtor::ErrorCtor(ExecutionContext *scope, const QString &name)
: FunctionObject(scope, name)
{
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
}
ReturnedValue ErrorCtor::construct(Managed *m, CallData *callData)
ReturnedValue ErrorCtor::call(Managed *that, CallData *callData)
{
- return that->construct(callData);
+ return static_cast<Object *>(that)->construct(callData);
}
EvalErrorCtor::EvalErrorCtor(ExecutionContext *scope)
: ErrorCtor(scope, QStringLiteral("EvalError"))
{
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
}
ReturnedValue EvalErrorCtor::construct(Managed *m, CallData *callData)
RangeErrorCtor::RangeErrorCtor(ExecutionContext *scope)
: ErrorCtor(scope, QStringLiteral("RangeError"))
{
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
}
ReturnedValue RangeErrorCtor::construct(Managed *m, CallData *callData)
ReferenceErrorCtor::ReferenceErrorCtor(ExecutionContext *scope)
: ErrorCtor(scope, QStringLiteral("ReferenceError"))
{
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
}
ReturnedValue ReferenceErrorCtor::construct(Managed *m, CallData *callData)
SyntaxErrorCtor::SyntaxErrorCtor(ExecutionContext *scope)
: ErrorCtor(scope, QStringLiteral("SyntaxError"))
{
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
}
ReturnedValue SyntaxErrorCtor::construct(Managed *m, CallData *callData)
TypeErrorCtor::TypeErrorCtor(ExecutionContext *scope)
: ErrorCtor(scope, QStringLiteral("TypeError"))
{
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
}
ReturnedValue TypeErrorCtor::construct(Managed *m, CallData *callData)
URIErrorCtor::URIErrorCtor(ExecutionContext *scope)
: ErrorCtor(scope, QStringLiteral("URIError"))
{
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
}
ReturnedValue URIErrorCtor::construct(Managed *m, CallData *callData)
struct SyntaxErrorObject;
struct ErrorObject: Object {
- Q_MANAGED
+ V4_OBJECT
Q_MANAGED_TYPE(ErrorObject)
enum {
IsErrorObject = true
};
struct SyntaxErrorObject: ErrorObject {
- Q_MANAGED
+ V4_OBJECT
SyntaxErrorObject(ExecutionEngine *engine, const ValueRef msg);
SyntaxErrorObject(ExecutionEngine *engine, const QString &msg, const QString &fileName, int lineNumber, int columnNumber);
};
struct ErrorCtor: FunctionObject
{
- Q_MANAGED
+ V4_OBJECT
ErrorCtor(ExecutionContext *scope);
ErrorCtor(ExecutionContext *scope, const QString &name);
struct EvalErrorCtor: ErrorCtor
{
- Q_MANAGED
+ V4_OBJECT
EvalErrorCtor(ExecutionContext *scope);
static ReturnedValue construct(Managed *m, CallData *callData);
struct RangeErrorCtor: ErrorCtor
{
- Q_MANAGED
+ V4_OBJECT
RangeErrorCtor(ExecutionContext *scope);
static ReturnedValue construct(Managed *m, CallData *callData);
struct ReferenceErrorCtor: ErrorCtor
{
- Q_MANAGED
+ V4_OBJECT
ReferenceErrorCtor(ExecutionContext *scope);
static ReturnedValue construct(Managed *m, CallData *callData);
struct SyntaxErrorCtor: ErrorCtor
{
- Q_MANAGED
+ V4_OBJECT
SyntaxErrorCtor(ExecutionContext *scope);
static ReturnedValue construct(Managed *m, CallData *callData);
struct TypeErrorCtor: ErrorCtor
{
- Q_MANAGED
+ V4_OBJECT
TypeErrorCtor(ExecutionContext *scope);
static ReturnedValue construct(Managed *m, CallData *callData);
struct URIErrorCtor: ErrorCtor
{
- Q_MANAGED
+ V4_OBJECT
URIErrorCtor(ExecutionContext *scope);
static ReturnedValue construct(Managed *m, CallData *callData);
struct EvalErrorPrototype: ErrorObject
{
- EvalErrorPrototype(InternalClass *ic): ErrorObject(ic) { setVTable(&static_vtbl); }
+ EvalErrorPrototype(InternalClass *ic): ErrorObject(ic) { setVTable(staticVTable()); }
void init(ExecutionEngine *engine, ObjectRef ctor) { ErrorPrototype::init(engine, ctor, this); }
};
struct RangeErrorPrototype: ErrorObject
{
- RangeErrorPrototype(InternalClass *ic): ErrorObject(ic) { setVTable(&static_vtbl); }
+ RangeErrorPrototype(InternalClass *ic): ErrorObject(ic) { setVTable(staticVTable()); }
void init(ExecutionEngine *engine, ObjectRef ctor) { ErrorPrototype::init(engine, ctor, this); }
};
struct ReferenceErrorPrototype: ErrorObject
{
- ReferenceErrorPrototype(InternalClass *ic): ErrorObject(ic) { setVTable(&static_vtbl); }
+ ReferenceErrorPrototype(InternalClass *ic): ErrorObject(ic) { setVTable(staticVTable()); }
void init(ExecutionEngine *engine, ObjectRef ctor) { ErrorPrototype::init(engine, ctor, this); }
};
struct SyntaxErrorPrototype: ErrorObject
{
- SyntaxErrorPrototype(InternalClass *ic): ErrorObject(ic) { setVTable(&static_vtbl); }
+ SyntaxErrorPrototype(InternalClass *ic): ErrorObject(ic) { setVTable(staticVTable()); }
void init(ExecutionEngine *engine, ObjectRef ctor) { ErrorPrototype::init(engine, ctor, this); }
};
struct TypeErrorPrototype: ErrorObject
{
- TypeErrorPrototype(InternalClass *ic): ErrorObject(ic) { setVTable(&static_vtbl); }
+ TypeErrorPrototype(InternalClass *ic): ErrorObject(ic) { setVTable(staticVTable()); }
void init(ExecutionEngine *engine, ObjectRef ctor) { ErrorPrototype::init(engine, ctor, this); }
};
struct URIErrorPrototype: ErrorObject
{
- URIErrorPrototype(InternalClass *ic): ErrorObject(ic) { setVTable(&static_vtbl); }
+ URIErrorPrototype(InternalClass *ic): ErrorObject(ic) { setVTable(staticVTable()); }
void init(ExecutionEngine *engine, ObjectRef ctor) { ErrorPrototype::init(engine, ctor, this); }
};
using namespace QV4;
-DEFINE_MANAGED_VTABLE(FunctionObject);
+DEFINE_OBJECT_VTABLE(FunctionObject);
FunctionObject::FunctionObject(ExecutionContext *scope, const StringRef name, bool createProto)
: Object(createProto ? scope->engine->functionWithProtoClass : scope->engine->functionClass)
Scope scope(internalClass->engine);
ScopedObject p(scope, proto);
if (p)
- classForConstructor = InternalClass::create(scope.engine, &Object::static_vtbl, p.getPointer());
+ classForConstructor = InternalClass::create(scope.engine, Object::staticVTable(), p.getPointer());
else
classForConstructor = scope.engine->objectClass;
return classForConstructor;
}
-DEFINE_MANAGED_VTABLE(FunctionCtor);
+DEFINE_OBJECT_VTABLE(FunctionCtor);
FunctionCtor::FunctionCtor(ExecutionContext *scope)
: FunctionObject(scope, QStringLiteral("Function"))
{
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
}
// 15.3.2
return ctx->engine->newBoundFunction(ctx->engine->rootContext, target, boundThis, boundArgs)->asReturnedValue();
}
-DEFINE_MANAGED_VTABLE(ScriptFunction);
+DEFINE_OBJECT_VTABLE(ScriptFunction);
ScriptFunction::ScriptFunction(ExecutionContext *scope, Function *function)
: FunctionObject(scope, function->name, true)
{
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
Scope s(scope);
ScopedValue protectThis(s, this);
return f->function->code(ctx, f->function->codeData);
}
-DEFINE_MANAGED_VTABLE(SimpleScriptFunction);
+DEFINE_OBJECT_VTABLE(SimpleScriptFunction);
SimpleScriptFunction::SimpleScriptFunction(ExecutionContext *scope, Function *function)
: FunctionObject(scope, function->name, true)
{
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
Scope s(scope);
ScopedValue protectThis(s, this);
-DEFINE_MANAGED_VTABLE(BuiltinFunction);
+DEFINE_OBJECT_VTABLE(BuiltinFunction);
BuiltinFunction::BuiltinFunction(ExecutionContext *scope, const StringRef name, ReturnedValue (*code)(CallContext *))
: FunctionObject(scope, name)
, code(code)
{
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
}
ReturnedValue BuiltinFunction::construct(Managed *f, CallData *)
return f->code(&ctx, f->index);
}
-DEFINE_MANAGED_VTABLE(IndexedBuiltinFunction);
+DEFINE_OBJECT_VTABLE(IndexedBuiltinFunction);
-DEFINE_MANAGED_VTABLE(BoundFunction);
+DEFINE_OBJECT_VTABLE(BoundFunction);
BoundFunction::BoundFunction(ExecutionContext *scope, FunctionObjectRef target, const ValueRef boundThis, const QVector<SafeValue> &boundArgs)
: FunctionObject(scope, QStringLiteral("__bound function__"))
, target(target)
, boundArgs(boundArgs)
{
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
subtype = FunctionObject::BoundFunction;
this->boundThis = boundThis;
struct Lookup;
struct Q_QML_EXPORT FunctionObject: Object {
- Q_MANAGED
+ V4_OBJECT
Q_MANAGED_TYPE(FunctionObject)
enum {
IsFunctionObject = true
ReturnedValue newInstance();
+ using Object::construct;
+ using Object::call;
static ReturnedValue construct(Managed *that, CallData *);
static ReturnedValue call(Managed *that, CallData *d);
- inline ReturnedValue construct(CallData *callData) {
- return internalClass->vtable->construct(this, callData);
- }
- inline ReturnedValue call(CallData *callData) {
- return internalClass->vtable->call(this, callData);
- }
static FunctionObject *cast(const Value &v) {
return v.asFunctionObject();
struct FunctionCtor: FunctionObject
{
- Q_MANAGED
+ V4_OBJECT
FunctionCtor(ExecutionContext *scope);
static ReturnedValue construct(Managed *that, CallData *callData);
};
struct BuiltinFunction: FunctionObject {
- Q_MANAGED
+ V4_OBJECT
ReturnedValue (*code)(CallContext *);
BuiltinFunction(ExecutionContext *scope, const StringRef name, ReturnedValue (*code)(CallContext *));
struct IndexedBuiltinFunction: FunctionObject
{
- Q_MANAGED
+ V4_OBJECT
ReturnedValue (*code)(CallContext *ctx, uint index);
uint index;
, code(code)
, index(index)
{
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
}
static ReturnedValue construct(Managed *m, CallData *)
struct ScriptFunction: FunctionObject {
- Q_MANAGED
+ V4_OBJECT
ScriptFunction(ExecutionContext *scope, Function *function);
static ReturnedValue construct(Managed *, CallData *callData);
};
struct SimpleScriptFunction: FunctionObject {
- Q_MANAGED
+ V4_OBJECT
SimpleScriptFunction(ExecutionContext *scope, Function *function);
static ReturnedValue construct(Managed *, CallData *callData);
};
struct BoundFunction: FunctionObject {
- Q_MANAGED
+ V4_OBJECT
FunctionObject *target;
SafeValue boundThis;
QVector<SafeValue> boundArgs;
return QString();
}
-DEFINE_MANAGED_VTABLE(EvalFunction);
+DEFINE_OBJECT_VTABLE(EvalFunction);
EvalFunction::EvalFunction(ExecutionContext *scope)
: FunctionObject(scope, scope->engine->id_eval)
{
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
defineReadonlyProperty(scope->engine->id_length, Primitive::fromInt32(1));
}
struct Q_QML_EXPORT EvalFunction : FunctionObject
{
- Q_MANAGED
+ V4_OBJECT
EvalFunction(ExecutionContext *scope);
ReturnedValue evalCall(CallData *callData, bool directCall);
- using Managed::construct;
+ using Object::construct;
static ReturnedValue call(Managed *that, CallData *callData);
};
#endif
-DEFINE_MANAGED_VTABLE(JsonObject);
+DEFINE_OBJECT_VTABLE(JsonObject);
class JsonParser
{
struct JsonObject : Object {
Q_MANAGED_TYPE(JsonObject)
- Q_MANAGED
+ V4_OBJECT
private:
typedef QSet<QV4::Object *> V4ObjectSet;
public:
"Managed",
destroy,
0 /*markObjects*/,
- call,
- construct,
- 0 /*collectDeletables*/,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- isEqualTo,
- 0,
- 0
+ isEqualTo
};
internalClass = internalClass->changeVTable(vt);
}
-ReturnedValue Managed::construct(Managed *m, CallData *)
-{
- return m->engine()->currentContext()->throwTypeError();
-}
-
-ReturnedValue Managed::call(Managed *m, CallData *)
-{
- return m->engine()->currentContext()->throwTypeError();
-}
-
-ReturnedValue Managed::getLookup(Managed *m, Lookup *)
-{
- return m->engine()->currentContext()->throwTypeError();
-}
-
-void Managed::setLookup(Managed *m, Lookup *, const ValueRef)
-{
- m->engine()->currentContext()->throwTypeError();
-}
-
bool Managed::isEqualTo(Managed *, Managed *)
{
return false;
}
-
-ReturnedValue Managed::get(const StringRef name, bool *hasProperty)
-{
- return internalClass->vtable->get(this, name, hasProperty);
-}
-
-ReturnedValue Managed::getIndexed(uint index, bool *hasProperty)
-{
- return internalClass->vtable->getIndexed(this, index, hasProperty);
-}
-
-void Managed::put(const StringRef name, const ValueRef value)
-{
- internalClass->vtable->put(this, name, value);
-}
-
-void Managed::setLookup(Lookup *l, const ValueRef v)
-{
- internalClass->vtable->setLookup(this, l, v);
-}
-
-void Managed::putIndexed(uint index, const ValueRef value)
-{
- internalClass->vtable->putIndexed(this, index, value);
-}
-
-PropertyAttributes Managed::query(StringRef name) const
-{
- return internalClass->vtable->query(this, name);
-}
-
-bool Managed::deleteProperty(const StringRef name)
-{
- return internalClass->vtable->deleteProperty(this, name);
-}
-
-void Managed::advanceIterator(ObjectIterator *it, StringRef name, uint *index, Property *p, PropertyAttributes *attributes)
-{
- internalClass->vtable->advanceIterator(this, it, name, index, p, attributes);
-}
template <typename T1, typename T2>
inline void qYouForgotTheQ_MANAGED_Macro(T1, T2) {}
-#define Q_MANAGED \
+#define V4_MANAGED \
public: \
Q_MANAGED_CHECK \
static const QV4::ManagedVTable static_vtbl; \
+ static inline const QV4::ManagedVTable *staticVTable() { return &static_vtbl; } \
+ template <typename T> \
+ QV4::Returned<T> *asReturned() { return QV4::Returned<T>::create(this); } \
+
+#define V4_OBJECT \
+ public: \
+ Q_MANAGED_CHECK \
+ static const QV4::ObjectVTable static_vtbl; \
+ static inline const QV4::ManagedVTable *staticVTable() { return &static_vtbl.managedVTable; } \
template <typename T> \
QV4::Returned<T> *asReturned() { return QV4::Returned<T>::create(this); } \
const char *className;
void (*destroy)(Managed *);
void (*markObjects)(Managed *, ExecutionEngine *e);
+ bool (*isEqualTo)(Managed *m, Managed *other);
+};
+
+struct ObjectVTable
+{
+ ManagedVTable managedVTable;
ReturnedValue (*call)(Managed *, CallData *data);
ReturnedValue (*construct)(Managed *, CallData *data);
void (*collectDeletables)(Managed *, GCDeletable **deletable);
bool (*deleteIndexedProperty)(Managed *m, uint index);
ReturnedValue (*getLookup)(Managed *m, Lookup *l);
void (*setLookup)(Managed *m, Lookup *l, const ValueRef v);
- bool (*isEqualTo)(Managed *m, Managed *other);
uint (*getLength)(const Managed *m);
void (*advanceIterator)(Managed *m, ObjectIterator *it, StringRef name, uint *index, Property *p, PropertyAttributes *attributes);
};
#define DEFINE_MANAGED_VTABLE(classname) \
const QV4::ManagedVTable classname::static_vtbl = \
-{ \
+{ \
classname::IsExecutionContext, \
classname::IsString, \
classname::IsObject, \
#classname, \
destroy, \
markObjects, \
+ isEqualTo, \
+}
+
+
+#define DEFINE_OBJECT_VTABLE(classname) \
+const QV4::ObjectVTable classname::static_vtbl = \
+{ \
+ { \
+ classname::IsExecutionContext, \
+ classname::IsString, \
+ classname::IsObject, \
+ classname::IsFunctionObject, \
+ classname::IsErrorObject, \
+ 0, \
+ classname::MyType, \
+ #classname, \
+ destroy, \
+ markObjects, \
+ isEqualTo, \
+ }, \
call, \
construct, \
0, \
deleteIndexedProperty, \
getLookup, \
setLookup, \
- isEqualTo, \
getLength, \
advanceIterator \
}
#define DEFINE_MANAGED_VTABLE_WITH_NAME(classname, name) \
-const QV4::ManagedVTable classname::static_vtbl = \
+const QV4::ObjectVTable classname::static_vtbl = \
{ \
- classname::IsExecutionContext, \
- classname::IsString, \
- classname::IsObject, \
- classname::IsFunctionObject, \
- classname::IsErrorObject, \
- 0, \
- classname::MyType, \
- #name, \
- destroy, \
- markObjects, \
+ { \
+ classname::IsExecutionContext, \
+ classname::IsString, \
+ classname::IsObject, \
+ classname::IsFunctionObject, \
+ classname::IsErrorObject, \
+ 0, \
+ classname::MyType, \
+ #name, \
+ destroy, \
+ markObjects, \
+ isEqualTo, \
+ }, \
call, \
construct, \
0, \
deleteIndexedProperty, \
getLookup, \
setLookup, \
- isEqualTo, \
getLength, \
advanceIterator \
}
#define DEFINE_MANAGED_VTABLE_WITH_DELETABLES(classname) \
-const QV4::ManagedVTable classname::static_vtbl = \
+const QV4::ObjectVTable classname::static_vtbl = \
{ \
- classname::IsExecutionContext, \
- classname::IsString, \
- classname::IsObject, \
- classname::IsFunctionObject, \
- classname::IsErrorObject, \
- 0, \
- classname::MyType, \
- #classname, \
- destroy, \
- markObjects, \
+ { \
+ classname::IsExecutionContext, \
+ classname::IsString, \
+ classname::IsObject, \
+ classname::IsFunctionObject, \
+ classname::IsErrorObject, \
+ 0, \
+ classname::MyType, \
+ #classname, \
+ destroy, \
+ markObjects, \
+ isEqualTo, \
+ }, \
call, \
construct, \
collectDeletables, \
deleteIndexedProperty, \
getLookup, \
setLookup, \
- isEqualTo, \
getLength, \
advanceIterator \
}
struct Q_QML_EXPORT Managed
{
- Q_MANAGED
+ V4_MANAGED
enum {
IsExecutionContext = false,
IsString = false,
#if !defined(QT_NO_QOBJECT_CHECK)
static_cast<T *>(this)->qt_check_for_QMANAGED_macro(static_cast<T *>(this));
#endif
- return internalClass->vtable == &T::static_vtbl ? static_cast<T *>(this) : 0;
+ return internalClass->vtable == T::staticVTable() ? static_cast<T *>(this) : 0;
}
template <typename T>
const T *as() const {
#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::static_vtbl ? static_cast<const T *>(this) : 0;
+ return internalClass->vtable == T::staticVTable() ? static_cast<const T *>(this) : 0;
}
String *asString() { return internalClass->vtable->isString ? reinterpret_cast<String *>(this) : 0; }
void setVTable(const ManagedVTable *vt);
- ReturnedValue construct(CallData *d);
- ReturnedValue call(CallData *d);
- ReturnedValue get(const StringRef name, bool *hasProperty = 0);
- ReturnedValue getIndexed(uint index, bool *hasProperty = 0);
- void put(const StringRef name, const ValueRef value);
- void putIndexed(uint index, const ValueRef value);
- PropertyAttributes query(StringRef name) const;
- PropertyAttributes queryIndexed(uint index) const
- { return internalClass->vtable->queryIndexed(this, index); }
-
- bool deleteProperty(const StringRef name);
- bool deleteIndexedProperty(uint index)
- { return internalClass->vtable->deleteIndexedProperty(this, index); }
- ReturnedValue getLookup(Lookup *l)
- { return internalClass->vtable->getLookup(this, l); }
- void setLookup(Lookup *l, const ValueRef v);
-
bool isEqualTo(Managed *other)
{ return internalClass->vtable->isEqualTo(this, other); }
- uint getLength() const { return internalClass->vtable->getLength(this); }
- void advanceIterator(ObjectIterator *it, StringRef name, uint *index, Property *p, PropertyAttributes *attributes);
static void destroy(Managed *that) { that->_data = 0; }
- static ReturnedValue construct(Managed *m, CallData *d);
- static ReturnedValue call(Managed *m, CallData *);
- static ReturnedValue getLookup(Managed *m, Lookup *);
- static void setLookup(Managed *m, Lookup *l, const ValueRef v);
static bool isEqualTo(Managed *m, Managed *other);
- static uint getLength(const Managed *) { return 0; }
ReturnedValue asReturnedValue() { return Value::fromManaged(this).asReturnedValue(); }
}
-inline ReturnedValue Managed::construct(CallData *d) {
- return internalClass->vtable->construct(this, d);
-}
-inline ReturnedValue Managed::call(CallData *d) {
- return internalClass->vtable->call(this, d);
-}
-
}
using namespace QV4;
-DEFINE_MANAGED_VTABLE(MathObject);
+DEFINE_OBJECT_VTABLE(MathObject);
static const double qt_PI = 2.0 * ::asin(1.0);
struct MathObject: Object
{
- Q_MANAGED
+ V4_OBJECT
Q_MANAGED_TYPE(MathObject)
MathObject(InternalClass *ic);
#ifdef V4_USE_VALGRIND
VALGRIND_ENABLE_ERROR_REPORTING;
#endif
- if (m->internalClass->vtable->collectDeletables)
- m->internalClass->vtable->collectDeletables(m, deletable);
+ Object *o = m->asObject();
+ if (o && o->vtable()->collectDeletables)
+ o->vtable()->collectDeletables(m, deletable);
m->internalClass->vtable->destroy(m);
memset(m, 0, size);
using namespace QV4;
-DEFINE_MANAGED_VTABLE(NumberCtor);
-DEFINE_MANAGED_VTABLE(NumberObject);
+DEFINE_OBJECT_VTABLE(NumberCtor);
+DEFINE_OBJECT_VTABLE(NumberObject);
NumberCtor::NumberCtor(ExecutionContext *scope)
: FunctionObject(scope, QStringLiteral("Number"))
{
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
}
ReturnedValue NumberCtor::construct(Managed *m, CallData *callData)
struct NumberCtor: FunctionObject
{
- Q_MANAGED
+ V4_OBJECT
NumberCtor(ExecutionContext *scope);
static ReturnedValue construct(Managed *that, CallData *callData);
using namespace QV4;
-DEFINE_MANAGED_VTABLE(Object);
+DEFINE_OBJECT_VTABLE(Object);
Object::Object(ExecutionEngine *engine)
: Managed(engine->objectClass)
return false;
}
+ReturnedValue Object::construct(Managed *m, CallData *)
+{
+ return m->engine()->currentContext()->throwTypeError();
+}
+
+ReturnedValue Object::call(Managed *m, CallData *)
+{
+ return m->engine()->currentContext()->throwTypeError();
+}
+
ReturnedValue Object::get(Managed *m, const StringRef name, bool *hasProperty)
{
return static_cast<Object *>(m)->internalGet(name, hasProperty);
uint Object::getLength(const Managed *m)
{
Scope scope(m->engine());
- ScopedValue v(scope, const_cast<Managed *>(m)->get(scope.engine->id_length));
+ ScopedValue v(scope, static_cast<Object *>(const_cast<Managed *>(m))->get(scope.engine->id_length));
return v->toUInt32();
}
}
-DEFINE_MANAGED_VTABLE(ArrayObject);
+DEFINE_OBJECT_VTABLE(ArrayObject);
ArrayObject::ArrayObject(ExecutionEngine *engine, const QStringList &list)
: Object(engine->arrayClass)
struct Q_QML_EXPORT Object: Managed {
- Q_MANAGED
+ V4_OBJECT
Q_MANAGED_TYPE(Object)
enum {
IsObject = true
Object(InternalClass *internalClass);
~Object();
+ const ObjectVTable *vtable() const { return reinterpret_cast<const ObjectVTable *>(internalClass->vtable); }
Object *prototype() const { return internalClass->prototype; }
bool setPrototype(Object *proto);
void ensureMemberIndex(uint idx);
inline ReturnedValue get(const StringRef name, bool *hasProperty = 0)
- { return internalClass->vtable->get(this, name, hasProperty); }
+ { return vtable()->get(this, name, hasProperty); }
inline ReturnedValue getIndexed(uint idx, bool *hasProperty = 0)
- { return internalClass->vtable->getIndexed(this, idx, hasProperty); }
+ { return vtable()->getIndexed(this, idx, hasProperty); }
inline void put(const StringRef name, const ValueRef v)
- { internalClass->vtable->put(this, name, v); }
+ { vtable()->put(this, name, v); }
inline void putIndexed(uint idx, const ValueRef v)
- { internalClass->vtable->putIndexed(this, idx, v); }
- using Managed::get;
- using Managed::getIndexed;
- using Managed::put;
- using Managed::putIndexed;
- using Managed::query;
- using Managed::queryIndexed;
- using Managed::deleteProperty;
- using Managed::deleteIndexedProperty;
- using Managed::getLookup;
- using Managed::setLookup;
- using Managed::advanceIterator;
- using Managed::getLength;
+ { vtable()->putIndexed(this, idx, v); }
+ PropertyAttributes query(StringRef name) const
+ { return vtable()->query(this, name); }
+ PropertyAttributes queryIndexed(uint index) const
+ { return vtable()->queryIndexed(this, index); }
+ bool deleteProperty(const StringRef name)
+ { return vtable()->deleteProperty(this, name); }
+ bool deleteIndexedProperty(uint index)
+ { return vtable()->deleteIndexedProperty(this, index); }
+ ReturnedValue getLookup(Lookup *l)
+ { return vtable()->getLookup(this, l); }
+ void setLookup(Lookup *l, const ValueRef v)
+ { vtable()->setLookup(this, l, v); }
+ void advanceIterator(ObjectIterator *it, StringRef name, uint *index, Property *p, PropertyAttributes *attributes)
+ { vtable()->advanceIterator(this, it, name, index, p, attributes); }
+ uint getLength() const { return vtable()->getLength(this); }
+
+ inline ReturnedValue construct(CallData *d)
+ { return vtable()->construct(this, d); }
+ inline ReturnedValue call(CallData *d)
+ { return vtable()->call(this, d); }
protected:
static void destroy(Managed *that);
static void markObjects(Managed *that, ExecutionEngine *e);
+ static ReturnedValue construct(Managed *m, CallData *);
+ static ReturnedValue call(Managed *m, CallData *);
static ReturnedValue get(Managed *m, const StringRef name, bool *hasProperty);
static ReturnedValue getIndexed(Managed *m, uint index, bool *hasProperty);
static void put(Managed *m, const StringRef name, const ValueRef value);
};
struct BooleanObject: Object {
- Q_MANAGED
+ V4_OBJECT
Q_MANAGED_TYPE(BooleanObject)
SafeValue value;
BooleanObject(ExecutionEngine *engine, const ValueRef val)
protected:
BooleanObject(InternalClass *ic)
: Object(ic) {
- Q_ASSERT(internalClass->vtable == &static_vtbl);
+ Q_ASSERT(internalClass->vtable == staticVTable());
value = Encode(false);
}
};
struct NumberObject: Object {
- Q_MANAGED
+ V4_OBJECT
Q_MANAGED_TYPE(NumberObject)
SafeValue value;
NumberObject(ExecutionEngine *engine, const ValueRef val)
protected:
NumberObject(InternalClass *ic)
: Object(ic) {
- Q_ASSERT(internalClass->vtable == &static_vtbl);
+ Q_ASSERT(internalClass->vtable == staticVTable());
value = Encode((int)0);
}
};
struct ArrayObject: Object {
- Q_MANAGED
+ V4_OBJECT
Q_MANAGED_TYPE(ArrayObject)
enum {
LengthPropertyIndex = 0
void init(ExecutionEngine *engine);
static ReturnedValue getLookup(Managed *m, Lookup *l);
- using Managed::getLength;
+ using Object::getLength;
static uint getLength(const Managed *m);
QStringList toQStringList() const;
}
-DEFINE_MANAGED_VTABLE(ForEachIteratorObject);
+DEFINE_OBJECT_VTABLE(ForEachIteratorObject);
void ForEachIteratorObject::markObjects(Managed *that, ExecutionEngine *e)
{
};
struct ForEachIteratorObject: Object {
- Q_MANAGED
+ V4_OBJECT
Q_MANAGED_TYPE(ForeachIteratorObject)
ObjectIterator it;
ForEachIteratorObject(ExecutionContext *ctx, const ObjectRef o)
: Object(ctx->engine), it(workArea, workArea + 1, o, ObjectIterator::EnumerableOnly|ObjectIterator::WithProtoChain) {
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
}
ReturnedValue nextPropertyName() { return it.nextPropertyNameAsString(); }
using namespace QV4;
-DEFINE_MANAGED_VTABLE(ObjectCtor);
+DEFINE_OBJECT_VTABLE(ObjectCtor);
ObjectCtor::ObjectCtor(ExecutionContext *scope)
: FunctionObject(scope, QStringLiteral("Object"))
{
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
}
ReturnedValue ObjectCtor::construct(Managed *that, CallData *callData)
struct ObjectCtor: FunctionObject
{
- Q_MANAGED
+ V4_OBJECT
ObjectCtor(ExecutionContext *scope);
static ReturnedValue construct(Managed *that, CallData *callData);
: Object(engine)
, m_object(object)
{
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
Scope scope(engine);
ScopedObject protectThis(scope, this);
, m_object(object)
, m_index(index)
{
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
subtype = WrappedQtMethod;
m_qmlGlobal = qmlGlobal;
}
}
}
-DEFINE_MANAGED_VTABLE(QObjectMethod);
+DEFINE_OBJECT_VTABLE(QObjectMethod);
QmlSignalHandler::QmlSignalHandler(ExecutionEngine *engine, QObject *object, int signalIndex)
: Object(engine)
, m_object(object)
, m_signalIndex(signalIndex)
{
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
}
-DEFINE_MANAGED_VTABLE(QmlSignalHandler);
+DEFINE_OBJECT_VTABLE(QmlSignalHandler);
void MultiplyWrappedQObjectMap::insert(QObject *key, Object *value)
{
struct Q_QML_EXPORT QObjectWrapper : public QV4::Object
{
- Q_MANAGED
+ V4_OBJECT
enum RevisionMode { IgnoreRevision, CheckRevision };
struct QObjectMethod : public QV4::FunctionObject
{
- Q_MANAGED
+ V4_OBJECT
enum { DestroyMethod = -1, ToStringMethod = -2 };
struct QmlSignalHandler : public QV4::Object
{
- Q_MANAGED
+ V4_OBJECT
QmlSignalHandler(ExecutionEngine *engine, QObject *object, int signalIndex);
Q_UNUSED(that);
Q_UNUSED(e);
}
-
-ReturnedValue RegExp::get(Managed *, const StringRef, bool *)
-{
- return Encode::undefined();
-}
-
-ReturnedValue RegExp::getIndexed(Managed *m, uint index, bool *hasProperty)
-{
- Q_UNUSED(m);
- Q_UNUSED(index);
- Q_UNUSED(hasProperty);
-
- return Encode::undefined();
-}
-
-void RegExp::put(Managed *m, const StringRef name, const ValueRef value)
-{
- Q_UNUSED(m);
- Q_UNUSED(name);
- Q_UNUSED(value);
-}
-
-void RegExp::putIndexed(Managed *m, uint index, const ValueRef value)
-{
- Q_UNUSED(m);
- Q_UNUSED(index);
- Q_UNUSED(value);
-}
-
-PropertyAttributes RegExp::query(const Managed *m, StringRef name)
-{
- Q_UNUSED(m);
- Q_UNUSED(name);
-
- return Attr_Invalid;
-}
-
-PropertyAttributes RegExp::queryIndexed(const Managed *m, uint index)
-{
- Q_UNUSED(m);
- Q_UNUSED(index);
-
- return Attr_Invalid;
-}
-
-bool RegExp::deleteProperty(Managed *, const StringRef)
-{
- return false;
-}
-
-bool RegExp::deleteIndexedProperty(Managed *m, uint index)
-{
- Q_UNUSED(m);
- Q_UNUSED(index);
-
- return false;
-}
-
-void RegExp::advanceIterator(Managed *m, ObjectIterator *it, StringRef name, uint *index, Property *, PropertyAttributes *attributes)
-{
- Q_UNUSED(m);
- Q_UNUSED(it);
- Q_UNUSED(name);
- Q_UNUSED(index);
- Q_UNUSED(attributes);
-
- return;
-}
class RegExp : public Managed
{
- Q_MANAGED
+ V4_MANAGED
Q_MANAGED_TYPE(RegExp)
public:
static RegExp* create(ExecutionEngine* engine, const QString& pattern, bool ignoreCase = false, bool multiline = false);
protected:
static void destroy(Managed *that);
static void markObjects(Managed *that, QV4::ExecutionEngine *e);
- static ReturnedValue get(Managed *, const StringRef, bool *);
- static ReturnedValue getIndexed(Managed *m, uint index, bool *hasProperty);
- static void put(Managed *m, const StringRef name, const ValueRef value);
- static void putIndexed(Managed *m, uint index, const ValueRef value);
- static PropertyAttributes query(const Managed *m, StringRef name);
- static PropertyAttributes queryIndexed(const Managed *m, uint index);
- static bool deleteProperty(Managed *, const StringRef);
- static bool deleteIndexedProperty(Managed *m, uint index);
- static void advanceIterator(Managed *m, ObjectIterator *it, StringRef name, uint *index, Property *, PropertyAttributes *attributes);
private:
friend class RegExpCache;
using namespace QV4;
-DEFINE_MANAGED_VTABLE(RegExpObject);
+DEFINE_OBJECT_VTABLE(RegExpObject);
RegExpObject::RegExpObject(InternalClass *ic)
: Object(ic)
, value(RegExp::create(ic->engine, QString(), false, false))
, global(false)
{
- Q_ASSERT(internalClass->vtable == &static_vtbl);
+ Q_ASSERT(internalClass->vtable == staticVTable());
init(ic->engine);
}
void RegExpObject::init(ExecutionEngine *engine)
{
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
Scope scope(engine);
ScopedObject protectThis(scope, this);
return f;
}
-DEFINE_MANAGED_VTABLE(RegExpCtor);
+DEFINE_OBJECT_VTABLE(RegExpCtor);
RegExpCtor::RegExpCtor(ExecutionContext *scope)
: FunctionObject(scope, QStringLiteral("RegExp"))
{
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
}
ReturnedValue RegExpCtor::construct(Managed *m, CallData *callData)
class RegExp;
struct RegExpObject: Object {
- Q_MANAGED
+ V4_OBJECT
Q_MANAGED_TYPE(RegExpObject)
// needs to be compatible with the flags in qv4jsir_p.h
enum Flags {
struct RegExpCtor: FunctionObject
{
- Q_MANAGED
+ V4_OBJECT
RegExpCtor(ExecutionContext *scope);
static ReturnedValue construct(Managed *m, CallData *callData);
Lookup *l = context->lookups + index;
SafeValue v;
v = l->getter(l, callData->thisObject);
- if (!v.isManaged())
+ if (!v.isObject())
return context->throwTypeError();
- return v.managed()->call(callData);
+ return v.objectValue()->call(callData);
}
ReturnedValue __qmljs_call_element(ExecutionContext *context, const ValueRef index, CallDataRef callData)
ReturnedValue __qmljs_call_value(ExecutionContext *context, const ValueRef func, CallDataRef callData)
{
- if (!func->isManaged())
+ if (!func->isObject())
return context->throwTypeError();
- return func->managed()->call(callData);
+ return func->objectValue()->call(callData);
}
Lookup *l = context->lookups + index;
SafeValue v;
v = l->getter(l, callData->thisObject);
- if (!v.isManaged())
+ if (!v.isObject())
return context->throwTypeError();
- return v.managed()->construct(callData);
+ return v.objectValue()->construct(callData);
}
{
Q_ASSERT(scope->inUse);
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
function = f;
function->compilationUnit->ref();
needsActivation = function->needsActivation();
{
Q_ASSERT(scope->inUse);
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
function = 0;
needsActivation = false;
wrapper->qmlContext->mark(e);
}
-DEFINE_MANAGED_VTABLE(QmlBindingWrapper);
+DEFINE_OBJECT_VTABLE(QmlBindingWrapper);
struct CompilationUnitHolder : public QV4::Object
{
- Q_MANAGED
+ V4_OBJECT
CompilationUnitHolder(ExecutionEngine *engine, CompiledData::CompilationUnit *unit)
: Object(engine)
, unit(unit)
{
unit->ref();
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
}
~CompilationUnitHolder()
{
QV4::CompiledData::CompilationUnit *unit;
};
-DEFINE_MANAGED_VTABLE(CompilationUnitHolder);
+DEFINE_OBJECT_VTABLE(CompilationUnitHolder);
Script::Script(ExecutionEngine *v4, ObjectRef qml, CompiledData::CompilationUnit *compilationUnit)
: line(0), column(0), scope(v4->rootContext), strictMode(false), inheritContext(true), parsed(false)
struct ExecutionContext;
struct QmlBindingWrapper : FunctionObject {
- Q_MANAGED
+ V4_OBJECT
QmlBindingWrapper(ExecutionContext *scope, Function *f, ObjectRef qml);
// Constructor for QML functions and signal handlers, resulting binding wrapper is not callable!
template <typename Container>
class QQmlSequence : public QV4::Object
{
- Q_MANAGED
+ V4_OBJECT
Q_MANAGED_TYPE(QmlSequence)
public:
QQmlSequence(QV4::ExecutionEngine *engine, const Container &container)
- : QV4::Object(InternalClass::create(engine, &static_vtbl, engine->sequencePrototype.asObject()))
+ : QV4::Object(InternalClass::create(engine, staticVTable(), engine->sequencePrototype.asObject()))
, m_container(container)
, m_object(0)
, m_propertyIndex(-1)
}
QQmlSequence(QV4::ExecutionEngine *engine, QObject *object, int propertyIndex)
- : QV4::Object(InternalClass::create(engine, &static_vtbl, engine->sequencePrototype.asObject()))
+ : QV4::Object(InternalClass::create(engine, staticVTable(), engine->sequencePrototype.asObject()))
, m_object(object)
, m_propertyIndex(propertyIndex)
, m_isReference(true)
typedef QQmlSequence<QStringList> QQmlQStringList;
template<>
-DEFINE_MANAGED_VTABLE(QQmlQStringList);
+DEFINE_OBJECT_VTABLE(QQmlQStringList);
typedef QQmlSequence<QList<QString> > QQmlStringList;
template<>
-DEFINE_MANAGED_VTABLE(QQmlStringList);
+DEFINE_OBJECT_VTABLE(QQmlStringList);
typedef QQmlSequence<QList<int> > QQmlIntList;
template<>
-DEFINE_MANAGED_VTABLE(QQmlIntList);
+DEFINE_OBJECT_VTABLE(QQmlIntList);
typedef QQmlSequence<QList<QUrl> > QQmlUrlList;
template<>
-DEFINE_MANAGED_VTABLE(QQmlUrlList);
+DEFINE_OBJECT_VTABLE(QQmlUrlList);
typedef QQmlSequence<QList<bool> > QQmlBoolList;
template<>
-DEFINE_MANAGED_VTABLE(QQmlBoolList);
+DEFINE_OBJECT_VTABLE(QQmlBoolList);
typedef QQmlSequence<QList<qreal> > QQmlRealList;
template<>
-DEFINE_MANAGED_VTABLE(QQmlRealList);
+DEFINE_OBJECT_VTABLE(QQmlRealList);
#define REGISTER_QML_SEQUENCE_METATYPE(unused, unused2, SequenceType, unused3) qRegisterMetaType<SequenceType>(#SequenceType);
SequencePrototype::SequencePrototype(InternalClass *ic)
}
-const ManagedVTable String::static_vtbl =
+const ObjectVTable String::static_vtbl =
{
- String::IsExecutionContext,
- String::IsString,
- String::IsObject,
- String::IsFunctionObject,
- String::IsErrorObject,
+ {
+ String::IsExecutionContext,
+ String::IsString,
+ String::IsObject,
+ String::IsFunctionObject,
+ String::IsErrorObject,
+ 0,
+ String::MyType,
+ "String",
+ destroy,
+ markObjects,
+ isEqualTo
+ },
+ 0,
0,
- String::MyType,
- "String",
- destroy,
- markObjects,
- call,
- construct,
0 /*collectDeletables*/,
get,
getIndexed,
deleteIndexedProperty,
0 /*getLookup*/,
0 /*setLookup*/,
- isEqualTo,
0,
0 /*advanceIterator*/,
};
struct Identifier;
struct Q_QML_EXPORT String : public Managed {
- Q_MANAGED
+ // ### FIXME: Should this be a V4_OBJECT
+ V4_OBJECT
Q_MANAGED_TYPE(String)
enum {
IsString = true
using namespace QV4;
-DEFINE_MANAGED_VTABLE(StringObject);
+DEFINE_OBJECT_VTABLE(StringObject);
StringObject::StringObject(InternalClass *ic)
: Object(ic)
{
- Q_ASSERT(internalClass->vtable == &static_vtbl);
+ Q_ASSERT(internalClass->vtable == staticVTable());
Scope scope(engine());
ScopedObject protectThis(scope, this);
StringObject::StringObject(ExecutionEngine *engine, const ValueRef val)
: Object(engine->stringObjectClass)
{
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
Scope scope(engine);
ScopedObject protectThis(scope, this);
Object::markObjects(that, e);
}
-DEFINE_MANAGED_VTABLE(StringCtor);
+DEFINE_OBJECT_VTABLE(StringCtor);
StringCtor::StringCtor(ExecutionContext *scope)
: FunctionObject(scope, QStringLiteral("String"))
{
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
}
ReturnedValue StringCtor::construct(Managed *m, CallData *callData)
namespace QV4 {
struct StringObject: Object {
- Q_MANAGED
+ V4_OBJECT
Q_MANAGED_TYPE(StringObject)
SafeValue value;
struct StringCtor: FunctionObject
{
- Q_MANAGED
+ V4_OBJECT
StringCtor(ExecutionContext *scope);
static ReturnedValue construct(Managed *m, CallData *callData);
using namespace QV4;
-DEFINE_MANAGED_VTABLE(VariantObject);
+DEFINE_OBJECT_VTABLE(VariantObject);
VariantObject::VariantObject(InternalClass *ic)
: Object(ic)
struct VariantObject : Object, public ExecutionEngine::ScarceResourceData
{
- Q_MANAGED
+ V4_OBJECT
public:
VariantObject(InternalClass *ic);
VariantObject(ExecutionEngine *engine, const QVariant &value);
class QmlIncubatorObject : public QV4::Object
{
- Q_MANAGED
+ V4_OBJECT
public:
QmlIncubatorObject(QV8Engine *engine, QQmlIncubator::IncubationMode = QQmlIncubator::Asynchronous);
void setInitialState(QObject *);
};
-DEFINE_MANAGED_VTABLE(QmlIncubatorObject);
+DEFINE_OBJECT_VTABLE(QmlIncubatorObject);
class QQmlComponentIncubator : public QQmlIncubator
{
{
incubator.reset(new QQmlComponentIncubator(this, m));
v8 = engine;
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
valuemap = QV4::Primitive::undefinedValue();
qmlGlobal = QV4::Primitive::undefinedValue();
using namespace QV4;
-DEFINE_MANAGED_VTABLE(QmlContextWrapper);
+DEFINE_OBJECT_VTABLE(QmlContextWrapper);
QmlContextWrapper::QmlContextWrapper(QV8Engine *engine, QQmlContextData *context, QObject *scopeObject, bool ownsContext)
: Object(QV8Engine::getV4(engine)),
v8(engine), readOnly(true), ownsContext(ownsContext), isNullWrapper(false),
context(context), scopeObject(scopeObject), idObjectsWrapper(0)
{
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
}
QmlContextWrapper::~QmlContextWrapper()
return QJSValuePrivate::get(siinfo->scriptApi(e))->getValue(engine());
}
-DEFINE_MANAGED_VTABLE(QQmlIdObjectsArray);
+DEFINE_OBJECT_VTABLE(QQmlIdObjectsArray);
QQmlIdObjectsArray::QQmlIdObjectsArray(ExecutionEngine *engine, QmlContextWrapper *contextWrapper)
: Object(engine)
, contextWrapper(contextWrapper)
{
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
}
ReturnedValue QQmlIdObjectsArray::getIndexed(Managed *m, uint index, bool *hasProperty)
struct Q_QML_EXPORT QmlContextWrapper : Object
{
- Q_MANAGED
+ V4_OBJECT
QmlContextWrapper(QV8Engine *engine, QQmlContextData *context, QObject *scopeObject, bool ownsContext = false);
~QmlContextWrapper();
struct QQmlIdObjectsArray : public Object
{
- Q_MANAGED
+ V4_OBJECT
QQmlIdObjectsArray(ExecutionEngine *engine, QmlContextWrapper *contextWrapper);
static ReturnedValue getIndexed(Managed *m, uint index, bool *hasProperty);
using namespace QV4;
-DEFINE_MANAGED_VTABLE(QmlListWrapper);
+DEFINE_OBJECT_VTABLE(QmlListWrapper);
QmlListWrapper::QmlListWrapper(QV8Engine *engine)
: Object(QV8Engine::getV4(engine)),
v8(engine)
{
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
setArrayType(ArrayData::Custom);
}
struct Q_QML_EXPORT QmlListWrapper : Object
{
- Q_MANAGED
+ V4_OBJECT
protected:
QmlListWrapper(QV8Engine *engine);
~QmlListWrapper();
QT_BEGIN_NAMESPACE
-DEFINE_MANAGED_VTABLE(QQmlLocaleData);
+DEFINE_OBJECT_VTABLE(QQmlLocaleData);
#define GET_LOCALE_DATA_RESOURCE(OBJECT) \
QV4::Scoped<QQmlLocaleData> r(scope, OBJECT.as<QQmlLocaleData>()); \
class QQmlLocaleData : public QV4::Object
{
- Q_MANAGED
+ V4_OBJECT
public:
QQmlLocaleData(QV4::ExecutionEngine *engine)
: QV4::Object(engine)
{
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
}
QLocale locale;
using namespace QV4;
-DEFINE_MANAGED_VTABLE(QmlTypeWrapper);
+DEFINE_OBJECT_VTABLE(QmlTypeWrapper);
QmlTypeWrapper::QmlTypeWrapper(QV8Engine *engine)
: Object(QV8Engine::getV4(engine)),
v8(engine), mode(IncludeEnums), type(0), typeNamespace(0), importNamespace(0)
{
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
}
QmlTypeWrapper::~QmlTypeWrapper()
Scope scope(m->engine());
ScopedString n(scope, name);
bool hasProperty = false;
- const_cast<Managed*>(m)->get(n, &hasProperty);
+ static_cast<Object *>(const_cast<Managed*>(m))->get(n, &hasProperty);
return hasProperty ? Attr_Data : Attr_Invalid;
}
struct Q_QML_EXPORT QmlTypeWrapper : Object
{
- Q_MANAGED
+ V4_OBJECT
private:
QmlTypeWrapper(QV8Engine *engine);
~QmlTypeWrapper();
using namespace QV4;
-DEFINE_MANAGED_VTABLE(QmlValueTypeWrapper);
+DEFINE_OBJECT_VTABLE(QmlValueTypeWrapper);
class QmlValueTypeReference : public QmlValueTypeWrapper
{
: Object(QV8Engine::getV4(engine)), objectType(objectType)
{
v8 = engine;
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
}
QmlValueTypeWrapper::~QmlValueTypeWrapper()
struct Q_QML_EXPORT QmlValueTypeWrapper : Object
{
- Q_MANAGED
+ V4_OBJECT
protected:
enum ObjectType { Reference, Copy };
QmlValueTypeWrapper(QV8Engine *engine, ObjectType type);
class NamedNodeMap : public Object
{
- Q_MANAGED
+ V4_OBJECT
public:
NamedNodeMap(ExecutionEngine *engine, NodeImpl *data, const QList<NodeImpl *> &list)
: Object(engine)
, list(list)
, d(data)
{
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
if (d)
d->addref();
NodeImpl *d;
};
-DEFINE_MANAGED_VTABLE(NamedNodeMap);
+DEFINE_OBJECT_VTABLE(NamedNodeMap);
class NodeList : public Object
{
- Q_MANAGED
+ V4_OBJECT
public:
NodeList(ExecutionEngine *engine, NodeImpl *data)
: Object(engine)
, d(data)
{
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
if (d)
d->addref();
NodeImpl *d;
};
-DEFINE_MANAGED_VTABLE(NodeList);
+DEFINE_OBJECT_VTABLE(NodeList);
class NodePrototype : public Object
{
- Q_MANAGED
+ V4_OBJECT
public:
NodePrototype(ExecutionEngine *engine)
: Object(engine)
{
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
Scope scope(engine);
ScopedObject protectThis(scope, this);
};
-DEFINE_MANAGED_VTABLE(NodePrototype);
+DEFINE_OBJECT_VTABLE(NodePrototype);
class Node : public Object
{
- Q_MANAGED
+ V4_OBJECT
Node(ExecutionEngine *engine, NodeImpl *data)
: Object(engine)
, d(data)
{
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
if (d)
d->addref();
Node &operator=(const Node &);
};
-DEFINE_MANAGED_VTABLE(Node);
+DEFINE_OBJECT_VTABLE(Node);
class Element : public Node
{
struct QQmlXMLHttpRequestWrapper : public Object
{
- Q_MANAGED
+ V4_OBJECT
QQmlXMLHttpRequestWrapper(ExecutionEngine *engine, QQmlXMLHttpRequest *request)
: Object(engine)
, request(request)
{
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
}
~QQmlXMLHttpRequestWrapper() {
delete request;
QQmlXMLHttpRequest *request;
};
-DEFINE_MANAGED_VTABLE(QQmlXMLHttpRequestWrapper);
+DEFINE_OBJECT_VTABLE(QQmlXMLHttpRequestWrapper);
struct QQmlXMLHttpRequestCtor : public FunctionObject
{
- Q_MANAGED
+ V4_OBJECT
QQmlXMLHttpRequestCtor(ExecutionEngine *engine)
: FunctionObject(engine->rootContext, QStringLiteral("XMLHttpRequest"))
{
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
Scope scope(engine);
ScopedValue protectThis(scope, this);
Object *proto;
};
-DEFINE_MANAGED_VTABLE(QQmlXMLHttpRequestCtor);
+DEFINE_OBJECT_VTABLE(QQmlXMLHttpRequestCtor);
void QQmlXMLHttpRequestCtor::setupProto()
{
using namespace QV4;
-DEFINE_MANAGED_VTABLE(QtObject);
+DEFINE_OBJECT_VTABLE(QtObject);
struct StaticQtMetaObject : public QObject
{
, m_platform(0)
, m_application(0)
{
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
Scope scope(v4);
ScopedObject protectThis(scope, this);
struct BindingFunction : public QV4::FunctionObject
{
- Q_MANAGED
+ V4_OBJECT
BindingFunction(FunctionObject *originalFunction)
: QV4::FunctionObject(originalFunction->scope, originalFunction->name)
, originalFunction(originalFunction)
{
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
bindingKeyFlag = true;
}
QV4::FunctionObject *originalFunction;
};
-DEFINE_MANAGED_VTABLE(BindingFunction);
+DEFINE_OBJECT_VTABLE(BindingFunction);
}
struct QtObject : Object
{
- Q_MANAGED
+ V4_OBJECT
QtObject(ExecutionEngine *v4, QQmlEngine *qmlEngine);
static ReturnedValue method_isQtObject(CallContext *ctx);
struct DelegateModelGroupFunction: QV4::FunctionObject
{
- Q_MANAGED
+ V4_OBJECT
QV4::ReturnedValue (*code)(QQmlDelegateModelItem *item, uint flag, const QV4::ValueRef arg);
uint flag;
, code(code)
, flag(flag)
{
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
}
static QV4::ReturnedValue construct(QV4::Managed *m, QV4::CallData *)
}
};
-DEFINE_MANAGED_VTABLE(DelegateModelGroupFunction);
+DEFINE_OBJECT_VTABLE(DelegateModelGroupFunction);
//---------------------------------------------------------------------------
-DEFINE_MANAGED_VTABLE(QQmlDelegateModelItemObject);
+DEFINE_OBJECT_VTABLE(QQmlDelegateModelItemObject);
QQmlDelegateModelItemObject::~QQmlDelegateModelItemObject()
{
struct QQmlDelegateModelGroupChange : QV4::Object
{
- Q_MANAGED
+ V4_OBJECT
QQmlDelegateModelGroupChange(QV4::ExecutionEngine *engine)
: Object(engine)
{
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
}
static QV4::ReturnedValue method_get_index(QV4::CallContext *ctx) {
QQmlChangeSet::Change change;
};
-DEFINE_MANAGED_VTABLE(QQmlDelegateModelGroupChange);
+DEFINE_OBJECT_VTABLE(QQmlDelegateModelGroupChange);
class QQmlDelegateModelGroupChangeArray : public QV4::Object
{
- Q_MANAGED
+ V4_OBJECT
public:
QQmlDelegateModelGroupChangeArray(QV4::ExecutionEngine *engine)
: Object(engine)
{
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
setArrayType(QV4::ArrayData::Custom);
}
virtual ~QQmlDelegateModelGroupChangeArray() {}
};
-DEFINE_MANAGED_VTABLE(QQmlDelegateModelGroupChangeArray);
+DEFINE_OBJECT_VTABLE(QQmlDelegateModelGroupChangeArray);
class QQmlDelegateModelGroupRemoveArray : public QQmlDelegateModelGroupChangeArray
{
struct QQmlDelegateModelItemObject : QV4::Object
{
- Q_MANAGED;
+ V4_OBJECT;
QQmlDelegateModelItemObject(QV4::ExecutionEngine *engine, QQmlDelegateModelItem *item)
: Object(engine)
, item(item)
- { setVTable(&static_vtbl); }
+ { setVTable(staticVTable()); }
~QQmlDelegateModelItemObject();
static void destroy(Managed *that);
class QQuickJSContext2D : public QV4::Object
{
- Q_MANAGED
+ V4_OBJECT
public:
QQuickJSContext2D(QV4::ExecutionEngine *engine)
: QV4::Object(engine)
{
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
}
QQuickContext2D* context;
}
};
-DEFINE_MANAGED_VTABLE(QQuickJSContext2D);
+DEFINE_OBJECT_VTABLE(QQuickJSContext2D);
struct QQuickJSContext2DPrototype : public QV4::Object
{
- Q_MANAGED
+ V4_OBJECT
public:
QQuickJSContext2DPrototype(QV4::ExecutionEngine *engine)
: QV4::Object(engine)
};
-DEFINE_MANAGED_VTABLE(QQuickJSContext2DPrototype);
+DEFINE_OBJECT_VTABLE(QQuickJSContext2DPrototype);
class QQuickContext2DStyle : public QV4::Object
{
- Q_MANAGED
+ V4_OBJECT
public:
QQuickContext2DStyle(QV4::ExecutionEngine *e)
: QV4::Object(e)
, patternRepeatX(false)
, patternRepeatY(false)
{
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
}
QBrush brush;
bool patternRepeatX:1;
}
};
-DEFINE_MANAGED_VTABLE(QQuickContext2DStyle);
+DEFINE_OBJECT_VTABLE(QQuickContext2DStyle);
QImage qt_image_convolute_filter(const QImage& src, const QVector<qreal>& weights, int radius = 0)
{
struct QQuickJSContext2DPixelData : public QV4::Object
{
- Q_MANAGED
+ V4_OBJECT
QQuickJSContext2DPixelData(QV4::ExecutionEngine *engine)
: QV4::Object(engine)
{
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
setArrayType(QV4::ArrayData::Custom);
}
QImage image;
};
-DEFINE_MANAGED_VTABLE(QQuickJSContext2DPixelData);
+DEFINE_OBJECT_VTABLE(QQuickJSContext2DPixelData);
struct QQuickJSContext2DImageData : public QV4::Object
{
- Q_MANAGED
+ V4_OBJECT
QQuickJSContext2DImageData(QV4::ExecutionEngine *engine)
: QV4::Object(engine)
{
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
pixelData = QV4::Primitive::undefinedValue();
QV4::Scope scope(engine);
QV4::SafeValue pixelData;
};
-DEFINE_MANAGED_VTABLE(QQuickJSContext2DImageData);
+DEFINE_OBJECT_VTABLE(QQuickJSContext2DImageData);
static QV4::ReturnedValue qt_create_image_data(qreal w, qreal h, QV8Engine* engine, const QImage& image)
{
QT_BEGIN_NAMESPACE
-DEFINE_MANAGED_VTABLE(QQuickRootItemMarker);
+DEFINE_OBJECT_VTABLE(QQuickRootItemMarker);
QQuickRootItemMarker::QQuickRootItemMarker(QQuickViewPrivate *view)
: QV4::Object(QQmlEnginePrivate::getV4Engine(view->engine.data()))
, view(view)
{
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
}
void QQuickRootItemMarker::markObjects(QV4::Managed *that, QV4::ExecutionEngine *e)
struct QQuickRootItemMarker : public QV4::Object
{
- Q_MANAGED
+ V4_OBJECT
QQuickRootItemMarker(QQuickViewPrivate *view);
struct Print: FunctionObject
{
+ V4_OBJECT
Print(ExecutionContext *scope): FunctionObject(scope, QStringLiteral("print")) {
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
}
static ReturnedValue call(Managed *, CallData *callData)
std::cout << std::endl;
return Encode::undefined();
}
-
- static const ManagedVTable static_vtbl;
};
-DEFINE_MANAGED_VTABLE(Print);
+DEFINE_OBJECT_VTABLE(Print);
struct GC: public FunctionObject
{
+ V4_OBJECT
GC(ExecutionContext* scope)
: FunctionObject(scope, QStringLiteral("gc"))
{
- setVTable(&static_vtbl);
+ setVTable(staticVTable());
}
static ReturnedValue call(Managed *m, CallData *)
{
m->engine()->memoryManager->runGC();
return Encode::undefined();
}
-
- static const ManagedVTable static_vtbl;
};
-DEFINE_MANAGED_VTABLE(GC);
+DEFINE_OBJECT_VTABLE(GC);
} // builtins