diff options
68 files changed, 390 insertions, 407 deletions
diff --git a/src/imports/localstorage/plugin.cpp b/src/imports/localstorage/plugin.cpp index c47441cf1d..af32ead571 100644 --- a/src/imports/localstorage/plugin.cpp +++ b/src/imports/localstorage/plugin.cpp @@ -147,7 +147,7 @@ public: ~QQmlSqlDatabaseWrapper() { } - static ReturnedValue get(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty); + static ReturnedValue virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty); }; } @@ -237,16 +237,16 @@ static ReturnedValue qmlsqldatabase_rows_index(const QQmlSqlDatabaseWrapper *r, } } -ReturnedValue QQmlSqlDatabaseWrapper::get(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty) +ReturnedValue QQmlSqlDatabaseWrapper::virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty) { if (!id.isArrayIndex()) - return Object::get(m, id, receiver, hasProperty); + return Object::virtualGet(m, id, receiver, hasProperty); uint index = id.asArrayIndex(); Q_ASSERT(m->as<QQmlSqlDatabaseWrapper>()); const QQmlSqlDatabaseWrapper *r = static_cast<const QQmlSqlDatabaseWrapper *>(m); if (!r || r->d()->type != Heap::QQmlSqlDatabaseWrapper::Rows) - return Object::get(m, id, receiver, hasProperty); + return Object::virtualGet(m, id, receiver, hasProperty); return qmlsqldatabase_rows_index(r, r->engine(), index, hasProperty); } diff --git a/src/qml/jsruntime/qv4argumentsobject.cpp b/src/qml/jsruntime/qv4argumentsobject.cpp index 5b04c9f60b..7b501b9fbb 100644 --- a/src/qml/jsruntime/qv4argumentsobject.cpp +++ b/src/qml/jsruntime/qv4argumentsobject.cpp @@ -120,10 +120,10 @@ void ArgumentsObject::fullyCreate() d()->fullyCreated = true; } -bool ArgumentsObject::defineOwnProperty(Managed *m, PropertyKey id, const Property *desc, PropertyAttributes attrs) +bool ArgumentsObject::virtualDefineOwnProperty(Managed *m, PropertyKey id, const Property *desc, PropertyAttributes attrs) { if (!id.isArrayIndex()) - return Object::defineOwnProperty(m, id, desc, attrs); + return Object::virtualDefineOwnProperty(m, id, desc, attrs); ArgumentsObject *a = static_cast<ArgumentsObject *>(m); a->fullyCreate(); @@ -148,7 +148,7 @@ bool ArgumentsObject::defineOwnProperty(Managed *m, PropertyKey id, const Proper arrayIndex.set(scope.engine, a->d()->mappedArguments->values[index]); } - bool result = Object::defineOwnProperty(m, id, desc, attrs); + bool result = Object::virtualDefineOwnProperty(m, id, desc, attrs); if (!result) return false; @@ -169,7 +169,7 @@ bool ArgumentsObject::defineOwnProperty(Managed *m, PropertyKey id, const Proper return result; } -ReturnedValue ArgumentsObject::get(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty) +ReturnedValue ArgumentsObject::virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty) { const ArgumentsObject *args = static_cast<const ArgumentsObject *>(m); if (id.isArrayIndex() && !args->fullyCreated()) { @@ -180,10 +180,10 @@ ReturnedValue ArgumentsObject::get(const Managed *m, PropertyKey id, const Value return args->context()->args()[index].asReturnedValue(); } } - return Object::get(m, id, receiver, hasProperty); + return Object::virtualGet(m, id, receiver, hasProperty); } -bool ArgumentsObject::put(Managed *m, PropertyKey id, const Value &value, Value *receiver) +bool ArgumentsObject::virtualPut(Managed *m, PropertyKey id, const Value &value, Value *receiver) { ArgumentsObject *args = static_cast<ArgumentsObject *>(m); if (id.isArrayIndex()) { @@ -196,22 +196,22 @@ bool ArgumentsObject::put(Managed *m, PropertyKey id, const Value &value, Value return true; } } - return Object::put(m, id, value, receiver); + return Object::virtualPut(m, id, value, receiver); } -bool ArgumentsObject::deleteProperty(Managed *m, PropertyKey id) +bool ArgumentsObject::virtualDeleteProperty(Managed *m, PropertyKey id) { ArgumentsObject *args = static_cast<ArgumentsObject *>(m); if (!args->fullyCreated()) args->fullyCreate(); - return Object::deleteProperty(m, id); + return Object::virtualDeleteProperty(m, id); } -PropertyAttributes ArgumentsObject::getOwnProperty(Managed *m, PropertyKey id, Property *p) +PropertyAttributes ArgumentsObject::virtualGetOwnProperty(Managed *m, PropertyKey id, Property *p) { const ArgumentsObject *args = static_cast<const ArgumentsObject *>(m); if (!id.isArrayIndex() || args->fullyCreated()) - return Object::getOwnProperty(m, id, p); + return Object::virtualGetOwnProperty(m, id, p); uint index = id.asArrayIndex(); uint argCount = args->context()->argc(); @@ -224,7 +224,7 @@ PropertyAttributes ArgumentsObject::getOwnProperty(Managed *m, PropertyKey id, P DEFINE_OBJECT_VTABLE(ArgumentsGetterFunction); -ReturnedValue ArgumentsGetterFunction::call(const FunctionObject *getter, const Value *thisObject, const Value *, int) +ReturnedValue ArgumentsGetterFunction::virtualCall(const FunctionObject *getter, const Value *thisObject, const Value *, int) { ExecutionEngine *v4 = getter->engine(); Scope scope(v4); @@ -239,7 +239,7 @@ ReturnedValue ArgumentsGetterFunction::call(const FunctionObject *getter, const DEFINE_OBJECT_VTABLE(ArgumentsSetterFunction); -ReturnedValue ArgumentsSetterFunction::call(const FunctionObject *setter, const Value *thisObject, const Value *argv, int argc) +ReturnedValue ArgumentsSetterFunction::virtualCall(const FunctionObject *setter, const Value *thisObject, const Value *argv, int argc) { ExecutionEngine *v4 = setter->engine(); Scope scope(v4); @@ -253,7 +253,7 @@ ReturnedValue ArgumentsSetterFunction::call(const FunctionObject *setter, const return Encode::undefined(); } -qint64 ArgumentsObject::getLength(const Managed *m) +qint64 ArgumentsObject::virtualGetLength(const Managed *m) { const ArgumentsObject *a = static_cast<const ArgumentsObject *>(m); return a->propertyData(Heap::ArgumentsObject::LengthPropertyIndex)->toLength(); diff --git a/src/qml/jsruntime/qv4argumentsobject_p.h b/src/qml/jsruntime/qv4argumentsobject_p.h index 54d41e7749..9ac9ac5d8b 100644 --- a/src/qml/jsruntime/qv4argumentsobject_p.h +++ b/src/qml/jsruntime/qv4argumentsobject_p.h @@ -109,7 +109,7 @@ struct ArgumentsGetterFunction: FunctionObject V4_OBJECT2(ArgumentsGetterFunction, FunctionObject) uint index() const { return d()->index; } - static ReturnedValue call(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue virtualCall(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc); }; inline void @@ -124,7 +124,7 @@ struct ArgumentsSetterFunction: FunctionObject V4_OBJECT2(ArgumentsSetterFunction, FunctionObject) uint index() const { return d()->index; } - static ReturnedValue call(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue virtualCall(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc); }; inline void @@ -146,12 +146,12 @@ struct ArgumentsObject: Object { return m->vtable() == staticVTable(); } - static bool defineOwnProperty(Managed *m, PropertyKey id, const Property *desc, PropertyAttributes attrs); - static ReturnedValue get(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty); - static bool put(Managed *m, PropertyKey id, const Value &value, Value *receiver); - static bool deleteProperty(Managed *m, PropertyKey id); - static PropertyAttributes getOwnProperty(Managed *m, PropertyKey id, Property *p); - static qint64 getLength(const Managed *m); + static bool virtualDefineOwnProperty(Managed *m, PropertyKey id, const Property *desc, PropertyAttributes attrs); + static ReturnedValue virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty); + static bool virtualPut(Managed *m, PropertyKey id, const Value &value, Value *receiver); + static bool virtualDeleteProperty(Managed *m, PropertyKey id); + static PropertyAttributes virtualGetOwnProperty(Managed *m, PropertyKey id, Property *p); + static qint64 virtualGetLength(const Managed *m); void fullyCreate(); diff --git a/src/qml/jsruntime/qv4arraybuffer.cpp b/src/qml/jsruntime/qv4arraybuffer.cpp index b0c2ba597a..a70fd26a6c 100644 --- a/src/qml/jsruntime/qv4arraybuffer.cpp +++ b/src/qml/jsruntime/qv4arraybuffer.cpp @@ -53,7 +53,7 @@ void Heap::ArrayBufferCtor::init(QV4::ExecutionContext *scope) Heap::FunctionObject::init(scope, QStringLiteral("ArrayBuffer")); } -ReturnedValue ArrayBufferCtor::callAsConstructor(const FunctionObject *f, const Value *argv, int argc) +ReturnedValue ArrayBufferCtor::virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc) { ExecutionEngine *v4 = f->engine(); Scope scope(v4); @@ -74,9 +74,9 @@ ReturnedValue ArrayBufferCtor::callAsConstructor(const FunctionObject *f, const } -ReturnedValue ArrayBufferCtor::call(const FunctionObject *f, const Value *, const Value *argv, int argc) +ReturnedValue ArrayBufferCtor::virtualCall(const FunctionObject *f, const Value *, const Value *argv, int argc) { - return callAsConstructor(f, argv, argc); + return virtualCallAsConstructor(f, argv, argc); } ReturnedValue ArrayBufferCtor::method_isView(const FunctionObject *, const Value *, const Value *argv, int argc) diff --git a/src/qml/jsruntime/qv4arraybuffer_p.h b/src/qml/jsruntime/qv4arraybuffer_p.h index 59e78ee85f..4ace74a92e 100644 --- a/src/qml/jsruntime/qv4arraybuffer_p.h +++ b/src/qml/jsruntime/qv4arraybuffer_p.h @@ -78,8 +78,8 @@ struct ArrayBufferCtor: FunctionObject { V4_OBJECT2(ArrayBufferCtor, FunctionObject) - static ReturnedValue callAsConstructor(const FunctionObject *f, const Value *argv, int argc); - static ReturnedValue call(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc); + static ReturnedValue virtualCall(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc); static ReturnedValue method_isView(const FunctionObject *, const Value *thisObject, const Value *argv, int argc); diff --git a/src/qml/jsruntime/qv4arraydata_p.h b/src/qml/jsruntime/qv4arraydata_p.h index 35a9488f1f..ac5b430356 100644 --- a/src/qml/jsruntime/qv4arraydata_p.h +++ b/src/qml/jsruntime/qv4arraydata_p.h @@ -215,17 +215,6 @@ struct Q_QML_EXPORT ArrayData : public Managed static void sort(ExecutionEngine *engine, Object *thisObject, const Value &comparefn, uint dataLen); static uint append(Object *obj, ArrayObject *otherObj, uint n); static void insert(Object *o, uint index, const Value *v, bool isAccessor = false); - -protected: - // Vtable methods required to get things to compile - static ReturnedValue get(const Managed *, PropertyKey, const Value *, bool *) { - Q_UNREACHABLE(); - return Encode::undefined(); - } - static bool put(Managed *, PropertyKey, const Value &, Value *) { - Q_UNREACHABLE(); - return false; - } }; struct Q_QML_EXPORT SimpleArrayData : public ArrayData @@ -250,10 +239,6 @@ struct Q_QML_EXPORT SimpleArrayData : public ArrayData static ReturnedValue pop_front(Object *o); static uint truncate(Object *o, uint newLen); static uint length(const Heap::ArrayData *d); - -protected: - using ArrayData::get; - using ArrayData::put; }; struct Q_QML_EXPORT SparseArrayData : public ArrayData @@ -280,10 +265,6 @@ struct Q_QML_EXPORT SparseArrayData : public ArrayData static ReturnedValue pop_front(Object *o); static uint truncate(Object *o, uint newLen); static uint length(const Heap::ArrayData *d); - -protected: - using ArrayData::get; - using ArrayData::put; }; namespace Heap { diff --git a/src/qml/jsruntime/qv4arrayobject.cpp b/src/qml/jsruntime/qv4arrayobject.cpp index 39c0fe2150..1cfeadeb89 100644 --- a/src/qml/jsruntime/qv4arrayobject.cpp +++ b/src/qml/jsruntime/qv4arrayobject.cpp @@ -59,7 +59,7 @@ void Heap::ArrayCtor::init(QV4::ExecutionContext *scope) Heap::FunctionObject::init(scope, QStringLiteral("Array")); } -ReturnedValue ArrayCtor::callAsConstructor(const FunctionObject *f, const Value *argv, int argc) +ReturnedValue ArrayCtor::virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc) { ExecutionEngine *v4 = static_cast<const ArrayCtor *>(f)->engine(); Scope scope(v4); @@ -84,9 +84,9 @@ ReturnedValue ArrayCtor::callAsConstructor(const FunctionObject *f, const Value return a.asReturnedValue(); } -ReturnedValue ArrayCtor::call(const FunctionObject *f, const Value *, const Value *argv, int argc) +ReturnedValue ArrayCtor::virtualCall(const FunctionObject *f, const Value *, const Value *argv, int argc) { - return callAsConstructor(f, argv, argc); + return virtualCallAsConstructor(f, argv, argc); } void ArrayPrototype::init(ExecutionEngine *engine, Object *ctor) diff --git a/src/qml/jsruntime/qv4arrayobject_p.h b/src/qml/jsruntime/qv4arrayobject_p.h index f1acfed7e7..9fc0b62e48 100644 --- a/src/qml/jsruntime/qv4arrayobject_p.h +++ b/src/qml/jsruntime/qv4arrayobject_p.h @@ -70,8 +70,8 @@ struct ArrayCtor: FunctionObject { V4_OBJECT2(ArrayCtor, FunctionObject) - static ReturnedValue callAsConstructor(const FunctionObject *f, const Value *argv, int argc); - static ReturnedValue call(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc); + static ReturnedValue virtualCall(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc); }; struct ArrayPrototype: ArrayObject diff --git a/src/qml/jsruntime/qv4booleanobject.cpp b/src/qml/jsruntime/qv4booleanobject.cpp index 80b95a71d4..13c486e9b3 100644 --- a/src/qml/jsruntime/qv4booleanobject.cpp +++ b/src/qml/jsruntime/qv4booleanobject.cpp @@ -50,13 +50,13 @@ void Heap::BooleanCtor::init(QV4::ExecutionContext *scope) Heap::FunctionObject::init(scope, QStringLiteral("Boolean")); } -ReturnedValue BooleanCtor::callAsConstructor(const FunctionObject *that, const Value *argv, int argc) +ReturnedValue BooleanCtor::virtualCallAsConstructor(const FunctionObject *that, const Value *argv, int argc) { bool n = argc ? argv[0].toBoolean() : false; return Encode(that->engine()->newBooleanObject(n)); } -ReturnedValue BooleanCtor::call(const FunctionObject *, const Value *, const Value *argv, int argc) +ReturnedValue BooleanCtor::virtualCall(const FunctionObject *, const Value *, const Value *argv, int argc) { bool value = argc ? argv[0].toBoolean() : 0; return Encode(value); diff --git a/src/qml/jsruntime/qv4booleanobject_p.h b/src/qml/jsruntime/qv4booleanobject_p.h index 3cf09b2667..288da49512 100644 --- a/src/qml/jsruntime/qv4booleanobject_p.h +++ b/src/qml/jsruntime/qv4booleanobject_p.h @@ -70,8 +70,8 @@ struct BooleanCtor: FunctionObject { V4_OBJECT2(BooleanCtor, FunctionObject) - static ReturnedValue callAsConstructor(const FunctionObject *, const Value *argv, int argc); - static ReturnedValue call(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue virtualCallAsConstructor(const FunctionObject *, const Value *argv, int argc); + static ReturnedValue virtualCall(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc); }; struct BooleanPrototype: BooleanObject diff --git a/src/qml/jsruntime/qv4context_p.h b/src/qml/jsruntime/qv4context_p.h index fb1f647ced..657945b1a6 100644 --- a/src/qml/jsruntime/qv4context_p.h +++ b/src/qml/jsruntime/qv4context_p.h @@ -206,7 +206,7 @@ struct Q_QML_EXPORT ExecutionContext : public Managed protected: // vtable method required for compilation - static bool deleteProperty(Managed *, PropertyKey) { + static bool virtualDeleteProperty(Managed *, PropertyKey) { Q_UNREACHABLE(); } }; diff --git a/src/qml/jsruntime/qv4dataview.cpp b/src/qml/jsruntime/qv4dataview.cpp index 354eaad7dc..23ea40dcf9 100644 --- a/src/qml/jsruntime/qv4dataview.cpp +++ b/src/qml/jsruntime/qv4dataview.cpp @@ -55,7 +55,7 @@ void Heap::DataViewCtor::init(QV4::ExecutionContext *scope) Heap::FunctionObject::init(scope, QStringLiteral("DataView")); } -ReturnedValue DataViewCtor::callAsConstructor(const FunctionObject *f, const Value *argv, int argc) +ReturnedValue DataViewCtor::virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc) { Scope scope(f->engine()); Scoped<ArrayBuffer> buffer(scope, argc ? argv[0] : Primitive::undefinedValue()); @@ -77,9 +77,9 @@ ReturnedValue DataViewCtor::callAsConstructor(const FunctionObject *f, const Val return a.asReturnedValue(); } -ReturnedValue DataViewCtor::call(const FunctionObject *f, const Value *, const Value *argv, int argc) +ReturnedValue DataViewCtor::virtualCall(const FunctionObject *f, const Value *, const Value *argv, int argc) { - return callAsConstructor(f, argv, argc); + return virtualCallAsConstructor(f, argv, argc); } void DataViewPrototype::init(ExecutionEngine *engine, Object *ctor) diff --git a/src/qml/jsruntime/qv4dataview_p.h b/src/qml/jsruntime/qv4dataview_p.h index 1e07d85118..50b31a4568 100644 --- a/src/qml/jsruntime/qv4dataview_p.h +++ b/src/qml/jsruntime/qv4dataview_p.h @@ -79,8 +79,8 @@ struct DataViewCtor: FunctionObject { V4_OBJECT2(DataViewCtor, FunctionObject) - static ReturnedValue callAsConstructor(const FunctionObject *f, const Value *argv, int argc); - static ReturnedValue call(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc); + static ReturnedValue virtualCall(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc); }; struct DataView : Object diff --git a/src/qml/jsruntime/qv4dateobject.cpp b/src/qml/jsruntime/qv4dateobject.cpp index 12649c0860..80221465ef 100644 --- a/src/qml/jsruntime/qv4dateobject.cpp +++ b/src/qml/jsruntime/qv4dateobject.cpp @@ -743,7 +743,7 @@ void Heap::DateCtor::init(QV4::ExecutionContext *scope) Heap::FunctionObject::init(scope, QStringLiteral("Date")); } -ReturnedValue DateCtor::callAsConstructor(const FunctionObject *that, const Value *argv, int argc) +ReturnedValue DateCtor::virtualCallAsConstructor(const FunctionObject *that, const Value *argv, int argc) { ExecutionEngine *e = that->engine(); double t = 0; @@ -783,7 +783,7 @@ ReturnedValue DateCtor::callAsConstructor(const FunctionObject *that, const Valu return Encode(e->newDateObject(Primitive::fromDouble(t))); } -ReturnedValue DateCtor::call(const FunctionObject *m, const Value *, const Value *, int) +ReturnedValue DateCtor::virtualCall(const FunctionObject *m, const Value *, const Value *, int) { ExecutionEngine *e = m->engine(); double t = currentTime(); diff --git a/src/qml/jsruntime/qv4dateobject_p.h b/src/qml/jsruntime/qv4dateobject_p.h index 0a5a3954d1..e1e0cccb11 100644 --- a/src/qml/jsruntime/qv4dateobject_p.h +++ b/src/qml/jsruntime/qv4dateobject_p.h @@ -108,8 +108,8 @@ struct DateCtor: FunctionObject { V4_OBJECT2(DateCtor, FunctionObject) - static ReturnedValue callAsConstructor(const FunctionObject *, const Value *argv, int argc); - static ReturnedValue call(const FunctionObject *f, const Value *thisObject, const Value *argv, int); + static ReturnedValue virtualCallAsConstructor(const FunctionObject *, const Value *argv, int argc); + static ReturnedValue virtualCall(const FunctionObject *f, const Value *thisObject, const Value *argv, int); }; struct DatePrototype: Object diff --git a/src/qml/jsruntime/qv4errorobject.cpp b/src/qml/jsruntime/qv4errorobject.cpp index 6541f00c8a..71604447db 100644 --- a/src/qml/jsruntime/qv4errorobject.cpp +++ b/src/qml/jsruntime/qv4errorobject.cpp @@ -229,13 +229,13 @@ void Heap::ErrorCtor::init(QV4::ExecutionContext *scope, const QString &name) Heap::FunctionObject::init(scope, name); } -ReturnedValue ErrorCtor::callAsConstructor(const FunctionObject *f, const Value *argv, int argc) +ReturnedValue ErrorCtor::virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc) { Value v = argc ? *argv : Primitive::undefinedValue(); return ErrorObject::create<ErrorObject>(f->engine(), v)->asReturnedValue(); } -ReturnedValue ErrorCtor::call(const FunctionObject *f, const Value *, const Value *argv, int argc) +ReturnedValue ErrorCtor::virtualCall(const FunctionObject *f, const Value *, const Value *argv, int argc) { return f->callAsConstructor(argv, argc); } @@ -245,7 +245,7 @@ void Heap::EvalErrorCtor::init(QV4::ExecutionContext *scope) Heap::ErrorCtor::init(scope, QStringLiteral("EvalError")); } -ReturnedValue EvalErrorCtor::callAsConstructor(const FunctionObject *f, const Value *argv, int argc) +ReturnedValue EvalErrorCtor::virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc) { Value v = argc ? *argv : Primitive::undefinedValue(); return ErrorObject::create<EvalErrorObject>(f->engine(), v)->asReturnedValue(); @@ -256,7 +256,7 @@ void Heap::RangeErrorCtor::init(QV4::ExecutionContext *scope) Heap::ErrorCtor::init(scope, QStringLiteral("RangeError")); } -ReturnedValue RangeErrorCtor::callAsConstructor(const FunctionObject *f, const Value *argv, int argc) +ReturnedValue RangeErrorCtor::virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc) { Value v = argc ? *argv : Primitive::undefinedValue(); return ErrorObject::create<RangeErrorObject>(f->engine(), v)->asReturnedValue(); @@ -267,7 +267,7 @@ void Heap::ReferenceErrorCtor::init(QV4::ExecutionContext *scope) Heap::ErrorCtor::init(scope, QStringLiteral("ReferenceError")); } -ReturnedValue ReferenceErrorCtor::callAsConstructor(const FunctionObject *f, const Value *argv, int argc) +ReturnedValue ReferenceErrorCtor::virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc) { Value v = argc ? *argv : Primitive::undefinedValue(); return ErrorObject::create<ReferenceErrorObject>(f->engine(), v)->asReturnedValue(); @@ -278,7 +278,7 @@ void Heap::SyntaxErrorCtor::init(QV4::ExecutionContext *scope) Heap::ErrorCtor::init(scope, QStringLiteral("SyntaxError")); } -ReturnedValue SyntaxErrorCtor::callAsConstructor(const FunctionObject *f, const Value *argv, int argc) +ReturnedValue SyntaxErrorCtor::virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc) { Value v = argc ? *argv : Primitive::undefinedValue(); return ErrorObject::create<SyntaxErrorObject>(f->engine(), v)->asReturnedValue(); @@ -289,7 +289,7 @@ void Heap::TypeErrorCtor::init(QV4::ExecutionContext *scope) Heap::ErrorCtor::init(scope, QStringLiteral("TypeError")); } -ReturnedValue TypeErrorCtor::callAsConstructor(const FunctionObject *f, const Value *argv, int argc) +ReturnedValue TypeErrorCtor::virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc) { Value v = argc ? *argv : Primitive::undefinedValue(); return ErrorObject::create<TypeErrorObject>(f->engine(), v)->asReturnedValue(); @@ -300,7 +300,7 @@ void Heap::URIErrorCtor::init(QV4::ExecutionContext *scope) Heap::ErrorCtor::init(scope, QStringLiteral("URIError")); } -ReturnedValue URIErrorCtor::callAsConstructor(const FunctionObject *f, const Value *argv, int argc) +ReturnedValue URIErrorCtor::virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc) { Value v = argc ? *argv : Primitive::undefinedValue(); return ErrorObject::create<URIErrorObject>(f->engine(), v)->asReturnedValue(); diff --git a/src/qml/jsruntime/qv4errorobject_p.h b/src/qml/jsruntime/qv4errorobject_p.h index 44b88f0d31..969c39739a 100644 --- a/src/qml/jsruntime/qv4errorobject_p.h +++ b/src/qml/jsruntime/qv4errorobject_p.h @@ -229,50 +229,50 @@ struct ErrorCtor: FunctionObject { V4_OBJECT2(ErrorCtor, FunctionObject) - static ReturnedValue callAsConstructor(const FunctionObject *f, const Value *argv, int argc); - static ReturnedValue call(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc); + static ReturnedValue virtualCall(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc); }; struct EvalErrorCtor: ErrorCtor { V4_OBJECT2(EvalErrorCtor, ErrorCtor) - static ReturnedValue callAsConstructor(const FunctionObject *f, const Value *argv, int argc); + static ReturnedValue virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc); }; struct RangeErrorCtor: ErrorCtor { V4_OBJECT2(RangeErrorCtor, ErrorCtor) - static ReturnedValue callAsConstructor(const FunctionObject *f, const Value *argv, int argc); + static ReturnedValue virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc); }; struct ReferenceErrorCtor: ErrorCtor { V4_OBJECT2(ReferenceErrorCtor, ErrorCtor) - static ReturnedValue callAsConstructor(const FunctionObject *f, const Value *argv, int argc); + static ReturnedValue virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc); }; struct SyntaxErrorCtor: ErrorCtor { V4_OBJECT2(SyntaxErrorCtor, ErrorCtor) - static ReturnedValue callAsConstructor(const FunctionObject *f, const Value *argv, int argc); + static ReturnedValue virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc); }; struct TypeErrorCtor: ErrorCtor { V4_OBJECT2(TypeErrorCtor, ErrorCtor) - static ReturnedValue callAsConstructor(const FunctionObject *f, const Value *argv, int argc); + static ReturnedValue virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc); }; struct URIErrorCtor: ErrorCtor { V4_OBJECT2(URIErrorCtor, ErrorCtor) - static ReturnedValue callAsConstructor(const FunctionObject *f, const Value *argv, int argc); + static ReturnedValue virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc); }; diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp index 69be9a8c84..8b912d16a9 100644 --- a/src/qml/jsruntime/qv4functionobject.cpp +++ b/src/qml/jsruntime/qv4functionobject.cpp @@ -73,7 +73,7 @@ void Heap::FunctionObject::init(QV4::ExecutionContext *scope, QV4::String *name, ReturnedValue (*code)(const QV4::FunctionObject *, const Value *thisObject, const Value *argv, int argc)) { jsCall = code; - jsConstruct = QV4::FunctionObject::callAsConstructor; + jsConstruct = QV4::FunctionObject::virtualCallAsConstructor; Object::init(); this->scope.set(scope->engine(), scope->d()); @@ -168,12 +168,12 @@ ReturnedValue FunctionObject::name() const return get(scope()->internalClass->engine->id_name()); } -ReturnedValue FunctionObject::callAsConstructor(const FunctionObject *f, const Value *, int) +ReturnedValue FunctionObject::virtualCallAsConstructor(const FunctionObject *f, const Value *, int) { return f->engine()->throwTypeError(); } -ReturnedValue FunctionObject::call(const FunctionObject *, const Value *, const Value *, int) +ReturnedValue FunctionObject::virtualCall(const FunctionObject *, const Value *, const Value *, int) { return Encode::undefined(); } @@ -275,7 +275,7 @@ QQmlRefPointer<CompiledData::CompilationUnit> FunctionCtor::parse(ExecutionEngin return cg.generateCompilationUnit(); } -ReturnedValue FunctionCtor::callAsConstructor(const FunctionObject *f, const Value *argv, int argc) +ReturnedValue FunctionCtor::virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc) { ExecutionEngine *engine = f->engine(); @@ -289,9 +289,9 @@ ReturnedValue FunctionCtor::callAsConstructor(const FunctionObject *f, const Val } // 15.3.1: This is equivalent to new Function(...) -ReturnedValue FunctionCtor::call(const FunctionObject *f, const Value *, const Value *argv, int argc) +ReturnedValue FunctionCtor::virtualCall(const FunctionObject *f, const Value *, const Value *argv, int argc) { - return callAsConstructor(f, argv, argc); + return virtualCallAsConstructor(f, argv, argc); } DEFINE_OBJECT_VTABLE(FunctionPrototype); @@ -445,12 +445,12 @@ ReturnedValue FunctionPrototype::method_hasInstance(const FunctionObject *f, con if (!o) return f->engine()->throwTypeError(); - return Object::instanceOf(o, argv[0]); + return Object::virtualInstanceOf(o, argv[0]); } DEFINE_OBJECT_VTABLE(ScriptFunction); -ReturnedValue ScriptFunction::callAsConstructor(const FunctionObject *fo, const Value *argv, int argc) +ReturnedValue ScriptFunction::virtualCallAsConstructor(const FunctionObject *fo, const Value *argv, int argc) { ExecutionEngine *v4 = fo->engine(); const ScriptFunction *f = static_cast<const ScriptFunction *>(fo); @@ -467,7 +467,7 @@ ReturnedValue ScriptFunction::callAsConstructor(const FunctionObject *fo, const return result; } -ReturnedValue ScriptFunction::call(const FunctionObject *fo, const Value *thisObject, const Value *argv, int argc) +ReturnedValue ScriptFunction::virtualCall(const FunctionObject *fo, const Value *thisObject, const Value *argv, int argc) { return Moth::VME::exec(fo, thisObject, argv, argc); } @@ -509,21 +509,21 @@ Heap::InternalClass *ScriptFunction::classForConstructor() const DEFINE_OBJECT_VTABLE(ConstructorFunction); -ReturnedValue ConstructorFunction::call(const FunctionObject *f, const Value *, const Value *, int) +ReturnedValue ConstructorFunction::virtualCall(const FunctionObject *f, const Value *, const Value *, int) { return f->engine()->throwTypeError(QStringLiteral("Cannot call a class constructor without |new|")); } DEFINE_OBJECT_VTABLE(MemberFunction); -ReturnedValue MemberFunction::callAsConstructor(const FunctionObject *f, const Value *, int) +ReturnedValue MemberFunction::virtualCallAsConstructor(const FunctionObject *f, const Value *, int) { return f->engine()->throwTypeError(QStringLiteral("Function is not a constructor.")); } DEFINE_OBJECT_VTABLE(DefaultClassConstructorFunction); -ReturnedValue DefaultClassConstructorFunction::callAsConstructor(const FunctionObject *f, const Value *, int) +ReturnedValue DefaultClassConstructorFunction::virtualCallAsConstructor(const FunctionObject *f, const Value *, int) { Scope scope(f); ScopedObject proto(scope, f->get(scope.engine->id_prototype())); @@ -532,7 +532,7 @@ ReturnedValue DefaultClassConstructorFunction::callAsConstructor(const FunctionO return c->asReturnedValue(); } -ReturnedValue DefaultClassConstructorFunction::call(const FunctionObject *f, const Value *, const Value *, int) +ReturnedValue DefaultClassConstructorFunction::virtualCall(const FunctionObject *f, const Value *, const Value *, int) { return f->engine()->throwTypeError(QStringLiteral("Cannot call a class constructor without |new|")); } @@ -567,7 +567,7 @@ void Heap::BoundFunction::init(QV4::ExecutionContext *scope, QV4::FunctionObject f->insertMember(s.engine->id_caller(), pd, Attr_Accessor|Attr_NotConfigurable|Attr_NotEnumerable); } -ReturnedValue BoundFunction::call(const FunctionObject *fo, const Value *, const Value *argv, int argc) +ReturnedValue BoundFunction::virtualCall(const FunctionObject *fo, const Value *, const Value *argv, int argc) { const BoundFunction *f = static_cast<const BoundFunction *>(fo); Scope scope(f->engine()); @@ -588,7 +588,7 @@ ReturnedValue BoundFunction::call(const FunctionObject *fo, const Value *, const return target->call(jsCallData); } -ReturnedValue BoundFunction::callAsConstructor(const FunctionObject *fo, const Value *argv, int argc) +ReturnedValue BoundFunction::virtualCallAsConstructor(const FunctionObject *fo, const Value *argv, int argc) { const BoundFunction *f = static_cast<const BoundFunction *>(fo); Scope scope(f->engine()); diff --git a/src/qml/jsruntime/qv4functionobject_p.h b/src/qml/jsruntime/qv4functionobject_p.h index 02b75216d8..2cfc6fc764 100644 --- a/src/qml/jsruntime/qv4functionobject_p.h +++ b/src/qml/jsruntime/qv4functionobject_p.h @@ -176,8 +176,8 @@ struct Q_QML_EXPORT FunctionObject: Object { ReturnedValue call(const Value *thisObject, const Value *argv, int argc) const { return d()->jsCall(this, thisObject, argv, argc); } - static ReturnedValue callAsConstructor(const FunctionObject *f, const Value *argv, int argc); - static ReturnedValue call(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc); + static ReturnedValue virtualCall(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc); static Heap::FunctionObject *createScriptFunction(ExecutionContext *scope, Function *function); static Heap::FunctionObject *createConstructorFunction(ExecutionContext *scope, Function *function); @@ -201,8 +201,8 @@ struct FunctionCtor: FunctionObject { V4_OBJECT2(FunctionCtor, FunctionObject) - static ReturnedValue callAsConstructor(const FunctionObject *f, const Value *argv, int argc); - static ReturnedValue call(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc); + static ReturnedValue virtualCall(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc); protected: enum Type { Type_Function, @@ -243,8 +243,8 @@ struct ScriptFunction : FunctionObject { V4_INTERNALCLASS(ScriptFunction) enum { NInlineProperties = 3 }; - static ReturnedValue callAsConstructor(const FunctionObject *, const Value *argv, int argc); - static ReturnedValue call(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue virtualCallAsConstructor(const FunctionObject *, const Value *argv, int argc); + static ReturnedValue virtualCall(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc); Heap::InternalClass *classForConstructor() const; }; @@ -252,20 +252,20 @@ struct ScriptFunction : FunctionObject { struct ConstructorFunction : ScriptFunction { V4_OBJECT2(ConstructorFunction, ScriptFunction) V4_INTERNALCLASS(ConstructorFunction) - static ReturnedValue call(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue virtualCall(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc); }; struct MemberFunction : ScriptFunction { V4_OBJECT2(MemberFunction, ScriptFunction) V4_INTERNALCLASS(MemberFunction) - static ReturnedValue callAsConstructor(const FunctionObject *, const Value *argv, int argc); + static ReturnedValue virtualCallAsConstructor(const FunctionObject *, const Value *argv, int argc); }; struct DefaultClassConstructorFunction : FunctionObject { V4_OBJECT2(DefaultClassConstructorFunction, FunctionObject) - static ReturnedValue callAsConstructor(const FunctionObject *, const Value *argv, int argc); - static ReturnedValue call(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue virtualCallAsConstructor(const FunctionObject *, const Value *argv, int argc); + static ReturnedValue virtualCall(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc); }; struct BoundFunction: FunctionObject { @@ -280,8 +280,8 @@ struct BoundFunction: FunctionObject { Value boundThis() const { return d()->boundThis; } Heap::MemberData *boundArgs() const { return d()->boundArgs; } - static ReturnedValue callAsConstructor(const FunctionObject *, const Value *argv, int argc); - static ReturnedValue call(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue virtualCallAsConstructor(const FunctionObject *, const Value *argv, int argc); + static ReturnedValue virtualCall(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc); }; } diff --git a/src/qml/jsruntime/qv4generatorobject.cpp b/src/qml/jsruntime/qv4generatorobject.cpp index 1c4c970c2e..d08a6248b8 100644 --- a/src/qml/jsruntime/qv4generatorobject.cpp +++ b/src/qml/jsruntime/qv4generatorobject.cpp @@ -54,7 +54,7 @@ void Heap::GeneratorFunctionCtor::init(QV4::ExecutionContext *scope) Heap::FunctionObject::init(scope, QStringLiteral("GeneratorFunction")); } -ReturnedValue GeneratorFunctionCtor::callAsConstructor(const FunctionObject *f, const Value *argv, int argc) +ReturnedValue GeneratorFunctionCtor::virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc) { ExecutionEngine *engine = f->engine(); @@ -68,9 +68,9 @@ ReturnedValue GeneratorFunctionCtor::callAsConstructor(const FunctionObject *f, } // 15.3.1: This is equivalent to new Function(...) -ReturnedValue GeneratorFunctionCtor::call(const FunctionObject *f, const Value *, const Value *argv, int argc) +ReturnedValue GeneratorFunctionCtor::virtualCall(const FunctionObject *f, const Value *, const Value *argv, int argc) { - return callAsConstructor(f, argv, argc); + return virtualCallAsConstructor(f, argv, argc); } Heap::FunctionObject *GeneratorFunction::create(ExecutionContext *context, Function *function) @@ -84,12 +84,12 @@ Heap::FunctionObject *GeneratorFunction::create(ExecutionContext *context, Funct return g->d(); } -ReturnedValue GeneratorFunction::callAsConstructor(const FunctionObject *f, const Value *, int) +ReturnedValue GeneratorFunction::virtualCallAsConstructor(const FunctionObject *f, const Value *, int) { return f->engine()->throwTypeError(); } -ReturnedValue GeneratorFunction::call(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc) +ReturnedValue GeneratorFunction::virtualCall(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc) { const GeneratorFunction *gf = static_cast<const GeneratorFunction *>(f); Function *function = gf->function(); diff --git a/src/qml/jsruntime/qv4generatorobject_p.h b/src/qml/jsruntime/qv4generatorobject_p.h index 62ffcbbad1..00ac366a44 100644 --- a/src/qml/jsruntime/qv4generatorobject_p.h +++ b/src/qml/jsruntime/qv4generatorobject_p.h @@ -95,8 +95,8 @@ struct GeneratorFunctionCtor : FunctionCtor { V4_OBJECT2(GeneratorFunctionCtor, FunctionCtor) - static ReturnedValue callAsConstructor(const FunctionObject *f, const Value *argv, int argc); - static ReturnedValue call(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc); + static ReturnedValue virtualCall(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc); }; struct GeneratorFunction : ScriptFunction @@ -105,8 +105,8 @@ struct GeneratorFunction : ScriptFunction V4_INTERNALCLASS(GeneratorFunction) static Heap::FunctionObject *create(ExecutionContext *scope, Function *function); - static ReturnedValue callAsConstructor(const FunctionObject *f, const Value *argv, int argc); - static ReturnedValue call(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc); + static ReturnedValue virtualCall(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc); }; struct GeneratorPrototype : Object diff --git a/src/qml/jsruntime/qv4globalobject.cpp b/src/qml/jsruntime/qv4globalobject.cpp index 95f65c47c0..43895011f3 100644 --- a/src/qml/jsruntime/qv4globalobject.cpp +++ b/src/qml/jsruntime/qv4globalobject.cpp @@ -384,7 +384,7 @@ ReturnedValue EvalFunction::evalCall(const Value *, const Value *argv, int argc, } -ReturnedValue EvalFunction::call(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc) +ReturnedValue EvalFunction::virtualCall(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc) { // indirect call return static_cast<const EvalFunction *>(f)->evalCall(thisObject, argv, argc, false); diff --git a/src/qml/jsruntime/qv4globalobject_p.h b/src/qml/jsruntime/qv4globalobject_p.h index fd1820c23c..021b445955 100644 --- a/src/qml/jsruntime/qv4globalobject_p.h +++ b/src/qml/jsruntime/qv4globalobject_p.h @@ -71,7 +71,7 @@ struct Q_QML_EXPORT EvalFunction : FunctionObject ReturnedValue evalCall(const Value *thisObject, const Value *argv, int argc, bool directCall) const; - static ReturnedValue call(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue virtualCall(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc); }; struct GlobalFunctions diff --git a/src/qml/jsruntime/qv4managed.cpp b/src/qml/jsruntime/qv4managed.cpp index 05d37c85f5..bb7b8086e4 100644 --- a/src/qml/jsruntime/qv4managed.cpp +++ b/src/qml/jsruntime/qv4managed.cpp @@ -138,7 +138,7 @@ QString Managed::className() const return QString::fromLatin1(s); } -bool Managed::isEqualTo(Managed *, Managed *) +bool Managed::virtualIsEqualTo(Managed *, Managed *) { return false; } diff --git a/src/qml/jsruntime/qv4managed_p.h b/src/qml/jsruntime/qv4managed_p.h index da365f706f..cacb262ba7 100644 --- a/src/qml/jsruntime/qv4managed_p.h +++ b/src/qml/jsruntime/qv4managed_p.h @@ -73,7 +73,7 @@ inline void qYouForgotTheQ_MANAGED_Macro(T1, T2) {} #define V4_MANAGED_SIZE_TEST void __dataTest() { static_assert (sizeof(*this) == sizeof(Managed), "Classes derived from Managed can't have own data members."); } -#define V4_NEEDS_DESTROY static void destroy(QV4::Heap::Base *b) { static_cast<Data *>(b)->destroy(); } +#define V4_NEEDS_DESTROY static void virtualDestroy(QV4::Heap::Base *b) { static_cast<Data *>(b)->destroy(); } #define V4_MANAGED_ITSELF(DataClass, superClass) \ @@ -175,8 +175,6 @@ public: bool isEqualTo(const Managed *other) const { return d()->internalClass->vtable->isEqualTo(const_cast<Managed *>(this), const_cast<Managed *>(other)); } - static bool isEqualTo(Managed *m, Managed *other); - bool inUse() const { return d()->inUse(); } bool markBit() const { return d()->isMarked(); } inline void mark(MarkStack *markStack); @@ -192,6 +190,9 @@ public: return static_cast<const T *>(this); } +protected: + static bool virtualIsEqualTo(Managed *m, Managed *other); + private: friend class MemoryManager; friend struct Identifiers; diff --git a/src/qml/jsruntime/qv4mapobject.cpp b/src/qml/jsruntime/qv4mapobject.cpp index a311e92402..00de381c33 100644 --- a/src/qml/jsruntime/qv4mapobject.cpp +++ b/src/qml/jsruntime/qv4mapobject.cpp @@ -53,7 +53,7 @@ void Heap::MapCtor::init(QV4::ExecutionContext *scope) Heap::FunctionObject::init(scope, QStringLiteral("Map")); } -ReturnedValue MapCtor::callAsConstructor(const FunctionObject *f, const Value *argv, int argc) +ReturnedValue MapCtor::virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc) { Scope scope(f); Scoped<MapObject> a(scope, scope.engine->memoryManager->allocate<MapObject>()); @@ -98,7 +98,7 @@ ReturnedValue MapCtor::callAsConstructor(const FunctionObject *f, const Value *a return a.asReturnedValue(); } -ReturnedValue MapCtor::call(const FunctionObject *f, const Value *, const Value *, int) +ReturnedValue MapCtor::virtualCall(const FunctionObject *f, const Value *, const Value *, int) { Scope scope(f); return scope.engine->throwTypeError(QString::fromLatin1("Map requires new")); diff --git a/src/qml/jsruntime/qv4mapobject_p.h b/src/qml/jsruntime/qv4mapobject_p.h index 9543c69928..96717cfce9 100644 --- a/src/qml/jsruntime/qv4mapobject_p.h +++ b/src/qml/jsruntime/qv4mapobject_p.h @@ -81,8 +81,8 @@ struct MapCtor: FunctionObject { V4_OBJECT2(MapCtor, FunctionObject) - static ReturnedValue callAsConstructor(const FunctionObject *f, const Value *argv, int argc); - static ReturnedValue call(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc); + static ReturnedValue virtualCall(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc); }; struct MapObject : Object diff --git a/src/qml/jsruntime/qv4numberobject.cpp b/src/qml/jsruntime/qv4numberobject.cpp index de24ec8181..a6b636c6e3 100644 --- a/src/qml/jsruntime/qv4numberobject.cpp +++ b/src/qml/jsruntime/qv4numberobject.cpp @@ -78,13 +78,13 @@ void Heap::NumberCtor::init(QV4::ExecutionContext *scope) Heap::FunctionObject::init(scope, QStringLiteral("Number")); } -ReturnedValue NumberCtor::callAsConstructor(const FunctionObject *f, const Value *argv, int argc) +ReturnedValue NumberCtor::virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc) { double dbl = argc ? argv[0].toNumber() : 0.; return Encode(f->engine()->newNumberObject(dbl)); } -ReturnedValue NumberCtor::call(const FunctionObject *, const Value *, const Value *argv, int argc) +ReturnedValue NumberCtor::virtualCall(const FunctionObject *, const Value *, const Value *argv, int argc) { double dbl = argc ? argv[0].toNumber() : 0.; return Encode(dbl); diff --git a/src/qml/jsruntime/qv4numberobject_p.h b/src/qml/jsruntime/qv4numberobject_p.h index cfdcf9bc1d..5407bf4989 100644 --- a/src/qml/jsruntime/qv4numberobject_p.h +++ b/src/qml/jsruntime/qv4numberobject_p.h @@ -79,8 +79,8 @@ struct NumberCtor: FunctionObject { V4_OBJECT2(NumberCtor, FunctionObject) - static ReturnedValue callAsConstructor(const FunctionObject *f, const Value *argv, int argc); - static ReturnedValue call(const FunctionObject *, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc); + static ReturnedValue virtualCall(const FunctionObject *, const Value *thisObject, const Value *argv, int argc); }; struct NumberPrototype: NumberObject diff --git a/src/qml/jsruntime/qv4object.cpp b/src/qml/jsruntime/qv4object.cpp index 5481b36aa2..3d65eeafb6 100644 --- a/src/qml/jsruntime/qv4object.cpp +++ b/src/qml/jsruntime/qv4object.cpp @@ -307,17 +307,17 @@ PropertyIndex Object::getValueOrSetter(PropertyKey id, PropertyAttributes *attrs return { nullptr, nullptr }; } -ReturnedValue Object::callAsConstructor(const FunctionObject *f, const Value *, int) +ReturnedValue Object::virtualCallAsConstructor(const FunctionObject *f, const Value *, int) { return f->engine()->throwTypeError(); } -ReturnedValue Object::call(const FunctionObject *f, const Value *, const Value *, int) +ReturnedValue Object::virtualCall(const FunctionObject *f, const Value *, const Value *, int) { return f->engine()->throwTypeError(); } -ReturnedValue Object::get(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty) +ReturnedValue Object::virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty) { if (id.isArrayIndex()) return static_cast<const Object *>(m)->internalGetIndexed(id.asArrayIndex(), receiver, hasProperty); @@ -326,17 +326,17 @@ ReturnedValue Object::get(const Managed *m, PropertyKey id, const Value *receive return static_cast<const Object *>(m)->internalGet(name, receiver, hasProperty); } -bool Object::put(Managed *m, PropertyKey id, const Value &value, Value *receiver) +bool Object::virtualPut(Managed *m, PropertyKey id, const Value &value, Value *receiver) { return static_cast<Object *>(m)->internalPut(id, value, receiver); } -bool Object::deleteProperty(Managed *m, PropertyKey id) +bool Object::virtualDeleteProperty(Managed *m, PropertyKey id) { return static_cast<Object *>(m)->internalDeleteProperty(id); } -void Object::advanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *pd, PropertyAttributes *attrs) +void Object::virtualAdvanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *pd, PropertyAttributes *attrs) { Object *o = static_cast<Object *>(m); name->setM(nullptr); @@ -715,7 +715,7 @@ void Object::copyArrayData(Object *other) setArrayLengthUnchecked(other->getLength()); } -qint64 Object::getLength(const Managed *m) +qint64 Object::virtualGetLength(const Managed *m) { Scope scope(static_cast<const Object *>(m)->engine()); ScopedValue v(scope, static_cast<Object *>(const_cast<Managed *>(m))->get(scope.engine->id_length())); @@ -723,7 +723,7 @@ qint64 Object::getLength(const Managed *m) } // 'var' is 'V' in 15.3.5.3. -ReturnedValue Object::instanceOf(const Object *typeObject, const Value &var) +ReturnedValue Object::virtualInstanceOf(const Object *typeObject, const Value &var) { QV4::ExecutionEngine *engine = typeObject->internalClass()->engine; @@ -765,7 +765,7 @@ ReturnedValue Object::instanceOf(const Object *typeObject, const Value &var) return Encode(false); } -bool Object::hasProperty(const Managed *m, PropertyKey id) +bool Object::virtualHasProperty(const Managed *m, PropertyKey id) { Scope scope(m->engine()); ScopedObject o(scope, m); @@ -780,7 +780,7 @@ bool Object::hasProperty(const Managed *m, PropertyKey id) return false; } -PropertyAttributes Object::getOwnProperty(Managed *m, PropertyKey id, Property *p) +PropertyAttributes Object::virtualGetOwnProperty(Managed *m, PropertyKey id, Property *p) { PropertyAttributes attrs; Object *o = static_cast<Object *>(m); @@ -808,7 +808,7 @@ PropertyAttributes Object::getOwnProperty(Managed *m, PropertyKey id, Property * return Attr_Invalid; } -bool Object::defineOwnProperty(Managed *m, PropertyKey id, const Property *p, PropertyAttributes attrs) +bool Object::virtualDefineOwnProperty(Managed *m, PropertyKey id, const Property *p, PropertyAttributes attrs) { Object *o = static_cast<Object *>(m); Scope scope(o); @@ -860,12 +860,12 @@ bool Object::defineOwnProperty(Managed *m, PropertyKey id, const Property *p, Pr return o->internalDefineOwnProperty(scope.engine, memberIndex, name, p, attrs); } -bool Object::isExtensible(const Managed *m) +bool Object::virtualIsExtensible(const Managed *m) { return m->d()->internalClass->extensible; } -bool Object::preventExtensions(Managed *m) +bool Object::virtualPreventExtensions(Managed *m) { Q_ASSERT(m->isObject()); Object *o = static_cast<Object *>(m); @@ -873,12 +873,12 @@ bool Object::preventExtensions(Managed *m) return true; } -Heap::Object *Object::getPrototypeOf(const Managed *m) +Heap::Object *Object::virtualGetPrototypeOf(const Managed *m) { return m->internalClass()->prototype; } -bool Object::setPrototypeOf(Managed *m, const Object *proto) +bool Object::virtualSetPrototypeOf(Managed *m, const Object *proto) { Q_ASSERT(m->isObject()); Object *o = static_cast<Object *>(m); @@ -952,7 +952,7 @@ void Heap::ArrayObject::init(const QStringList &list) a->setArrayLengthUnchecked(len); } -qint64 ArrayObject::getLength(const Managed *m) +qint64 ArrayObject::virtualGetLength(const Managed *m) { const ArrayObject *a = static_cast<const ArrayObject *>(m); return a->propertyData(Heap::ArrayObject::LengthPropertyIndex)->toLength(); @@ -974,7 +974,7 @@ QStringList ArrayObject::toQStringList() const return result; } -bool ArrayObject::defineOwnProperty(Managed *m, PropertyKey id, const Property *p, PropertyAttributes attrs) +bool ArrayObject::virtualDefineOwnProperty(Managed *m, PropertyKey id, const Property *p, PropertyAttributes attrs) { Q_ASSERT(m->isArrayObject()); ArrayObject *a = static_cast<ArrayObject *>(m); @@ -985,7 +985,7 @@ bool ArrayObject::defineOwnProperty(Managed *m, PropertyKey id, const Property * if (index >= len && !a->internalClass()->propertyData[Heap::ArrayObject::LengthPropertyIndex].isWritable()) return false; - bool succeeded = Object::defineOwnProperty(m, id, p, attrs); + bool succeeded = Object::virtualDefineOwnProperty(m, id, p, attrs); if (!succeeded) return false; @@ -1025,5 +1025,5 @@ bool ArrayObject::defineOwnProperty(Managed *m, PropertyKey id, const Property * return false; return true; } - return Object::defineOwnProperty(m, id, p, attrs); + return Object::virtualDefineOwnProperty(m, id, p, attrs); } diff --git a/src/qml/jsruntime/qv4object_p.h b/src/qml/jsruntime/qv4object_p.h index 56f3c3f881..ffd753564f 100644 --- a/src/qml/jsruntime/qv4object_p.h +++ b/src/qml/jsruntime/qv4object_p.h @@ -360,21 +360,21 @@ public: { return vtable()->instanceOf(this, var); } protected: - static ReturnedValue callAsConstructor(const FunctionObject *f, const Value *argv, int argc); - static ReturnedValue call(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc); - static ReturnedValue get(const Managed *m, PropertyKey id, const Value *receiver,bool *hasProperty); - static bool put(Managed *m, PropertyKey id, const Value &value, Value *receiver); - static bool deleteProperty(Managed *m, PropertyKey id); - static bool hasProperty(const Managed *m, PropertyKey id); - static PropertyAttributes getOwnProperty(Managed *m, PropertyKey id, Property *p); - static bool defineOwnProperty(Managed *m, PropertyKey id, const Property *p, PropertyAttributes attrs); - static bool isExtensible(const Managed *m); - static bool preventExtensions(Managed *); - static Heap::Object *getPrototypeOf(const Managed *); - static bool setPrototypeOf(Managed *, const Object *); - static void advanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attributes); - static qint64 getLength(const Managed *m); - static ReturnedValue instanceOf(const Object *typeObject, const Value &var); + static ReturnedValue virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc); + static ReturnedValue virtualCall(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue virtualGet(const Managed *m, PropertyKey id, const Value *receiver,bool *hasProperty); + static bool virtualPut(Managed *m, PropertyKey id, const Value &value, Value *receiver); + static bool virtualDeleteProperty(Managed *m, PropertyKey id); + static bool virtualHasProperty(const Managed *m, PropertyKey id); + static PropertyAttributes virtualGetOwnProperty(Managed *m, PropertyKey id, Property *p); + static bool virtualDefineOwnProperty(Managed *m, PropertyKey id, const Property *p, PropertyAttributes attrs); + static bool virtualIsExtensible(const Managed *m); + static bool virtualPreventExtensions(Managed *); + static Heap::Object *virtualGetPrototypeOf(const Managed *); + static bool virtualSetPrototypeOf(Managed *, const Object *); + static void virtualAdvanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attributes); + static qint64 virtualGetLength(const Managed *m); + static ReturnedValue virtualInstanceOf(const Object *typeObject, const Value &var); private: bool internalDefineOwnProperty(ExecutionEngine *engine, uint index, StringOrSymbol *member, const Property *p, PropertyAttributes attrs); @@ -453,12 +453,11 @@ struct ArrayObject: Object { void init(ExecutionEngine *engine); - using Object::getLength; - static qint64 getLength(const Managed *m); + static qint64 virtualGetLength(const Managed *m); QStringList toQStringList() const; protected: - static bool defineOwnProperty(Managed *m, PropertyKey id, const Property *p, PropertyAttributes attrs); + static bool virtualDefineOwnProperty(Managed *m, PropertyKey id, const Property *p, PropertyAttributes attrs); }; diff --git a/src/qml/jsruntime/qv4objectproto.cpp b/src/qml/jsruntime/qv4objectproto.cpp index 81d50a01db..4c57e617ae 100644 --- a/src/qml/jsruntime/qv4objectproto.cpp +++ b/src/qml/jsruntime/qv4objectproto.cpp @@ -63,7 +63,7 @@ void Heap::ObjectCtor::init(QV4::ExecutionContext *scope) Heap::FunctionObject::init(scope, QStringLiteral("Object")); } -ReturnedValue ObjectCtor::callAsConstructor(const FunctionObject *f, const Value *argv, int argc) +ReturnedValue ObjectCtor::virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc) { ExecutionEngine *v4 = f->engine(); const ObjectCtor *ctor = static_cast<const ObjectCtor *>(f); @@ -79,7 +79,7 @@ ReturnedValue ObjectCtor::callAsConstructor(const FunctionObject *f, const Value } } -ReturnedValue ObjectCtor::call(const FunctionObject *m, const Value *, const Value *argv, int argc) +ReturnedValue ObjectCtor::virtualCall(const FunctionObject *m, const Value *, const Value *argv, int argc) { ExecutionEngine *v4 = m->engine(); if (!argc || argv[0].isUndefined() || argv[0].isNull()) { diff --git a/src/qml/jsruntime/qv4objectproto_p.h b/src/qml/jsruntime/qv4objectproto_p.h index 1a93685093..d1c65a4895 100644 --- a/src/qml/jsruntime/qv4objectproto_p.h +++ b/src/qml/jsruntime/qv4objectproto_p.h @@ -70,8 +70,8 @@ struct ObjectCtor: FunctionObject { V4_OBJECT2(ObjectCtor, FunctionObject) - static ReturnedValue callAsConstructor(const FunctionObject *f, const Value *argv, int argc); - static ReturnedValue call(const FunctionObject *m, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc); + static ReturnedValue virtualCall(const FunctionObject *m, const Value *thisObject, const Value *argv, int argc); }; struct ObjectPrototype: Object diff --git a/src/qml/jsruntime/qv4proxy.cpp b/src/qml/jsruntime/qv4proxy.cpp index ee660e7ebf..082438fc26 100644 --- a/src/qml/jsruntime/qv4proxy.cpp +++ b/src/qml/jsruntime/qv4proxy.cpp @@ -55,7 +55,7 @@ void Heap::ProxyObject::init(const QV4::Object *target, const QV4::Object *handl this->handler.set(e, handler->d()); } -ReturnedValue ProxyObject::get(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty) +ReturnedValue ProxyObject::virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty) { Scope scope(m); const ProxyObject *o = static_cast<const ProxyObject *>(m); @@ -96,7 +96,7 @@ ReturnedValue ProxyObject::get(const Managed *m, PropertyKey id, const Value *re return trapResult->asReturnedValue(); } -bool ProxyObject::put(Managed *m, PropertyKey id, const Value &value, Value *receiver) +bool ProxyObject::virtualPut(Managed *m, PropertyKey id, const Value &value, Value *receiver) { Scope scope(m); const ProxyObject *o = static_cast<const ProxyObject *>(m); @@ -136,7 +136,7 @@ bool ProxyObject::put(Managed *m, PropertyKey id, const Value &value, Value *rec return true; } -bool ProxyObject::deleteProperty(Managed *m, PropertyKey id) +bool ProxyObject::virtualDeleteProperty(Managed *m, PropertyKey id) { Scope scope(m); const ProxyObject *o = static_cast<const ProxyObject *>(m); @@ -172,7 +172,7 @@ bool ProxyObject::deleteProperty(Managed *m, PropertyKey id) return true; } -bool ProxyObject::hasProperty(const Managed *m, PropertyKey id) +bool ProxyObject::virtualHasProperty(const Managed *m, PropertyKey id) { Scope scope(m); const ProxyObject *o = static_cast<const ProxyObject *>(m); @@ -187,7 +187,7 @@ bool ProxyObject::hasProperty(const Managed *m, PropertyKey id) if (scope.hasException()) return Encode::undefined(); if (trap->isNullOrUndefined()) - return target->hasProperty(m, id); + return target->hasProperty(id); if (!trap->isFunctionObject()) return scope.engine->throwTypeError(); @@ -208,7 +208,7 @@ bool ProxyObject::hasProperty(const Managed *m, PropertyKey id) return result; } -PropertyAttributes ProxyObject::getOwnProperty(Managed *m, PropertyKey id, Property *p) +PropertyAttributes ProxyObject::virtualGetOwnProperty(Managed *m, PropertyKey id, Property *p) { Scope scope(m); const ProxyObject *o = static_cast<const ProxyObject *>(m); @@ -278,7 +278,7 @@ PropertyAttributes ProxyObject::getOwnProperty(Managed *m, PropertyKey id, Prope return resultAttributes; } -bool ProxyObject::defineOwnProperty(Managed *m, PropertyKey id, const Property *p, PropertyAttributes attrs) +bool ProxyObject::virtualDefineOwnProperty(Managed *m, PropertyKey id, const Property *p, PropertyAttributes attrs) { Scope scope(m); const ProxyObject *o = static_cast<const ProxyObject *>(m); @@ -332,7 +332,7 @@ bool ProxyObject::defineOwnProperty(Managed *m, PropertyKey id, const Property * return true; } -bool ProxyObject::isExtensible(const Managed *m) +bool ProxyObject::virtualIsExtensible(const Managed *m) { Scope scope(m); const ProxyObject *o = static_cast<const ProxyObject *>(m); @@ -363,7 +363,7 @@ bool ProxyObject::isExtensible(const Managed *m) return result; } -bool ProxyObject::preventExtensions(Managed *m) +bool ProxyObject::virtualPreventExtensions(Managed *m) { Scope scope(m); const ProxyObject *o = static_cast<const ProxyObject *>(m); @@ -394,7 +394,7 @@ bool ProxyObject::preventExtensions(Managed *m) return result; } -Heap::Object *ProxyObject::getPrototypeOf(const Managed *m) +Heap::Object *ProxyObject::virtualGetPrototypeOf(const Managed *m) { Scope scope(m); const ProxyObject *o = static_cast<const ProxyObject *>(m); @@ -436,7 +436,7 @@ Heap::Object *ProxyObject::getPrototypeOf(const Managed *m) return proto; } -bool ProxyObject::setPrototypeOf(Managed *m, const Object *p) +bool ProxyObject::virtualSetPrototypeOf(Managed *m, const Object *p) { Scope scope(m); const ProxyObject *o = static_cast<const ProxyObject *>(m); @@ -477,7 +477,7 @@ bool ProxyObject::setPrototypeOf(Managed *m, const Object *p) return true; } -//ReturnedValue ProxyObject::callAsConstructor(const FunctionObject *f, const Value *argv, int argc) +//ReturnedValue ProxyObject::virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc) //{ //} @@ -499,7 +499,7 @@ void Heap::Proxy::init(QV4::ExecutionContext *ctx) ctor->defineReadonlyConfigurableProperty(scope.engine->id_length(), Primitive::fromInt32(2)); } -ReturnedValue Proxy::callAsConstructor(const FunctionObject *f, const Value *argv, int argc) +ReturnedValue Proxy::virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc) { Scope scope(f); if (argc < 2 || !argv[0].isObject() || !argv[1].isObject()) @@ -518,7 +518,7 @@ ReturnedValue Proxy::callAsConstructor(const FunctionObject *f, const Value *arg return o->asReturnedValue(); } -ReturnedValue Proxy::call(const FunctionObject *f, const Value *, const Value *, int) +ReturnedValue Proxy::virtualCall(const FunctionObject *f, const Value *, const Value *, int) { return f->engine()->throwTypeError(); } @@ -526,7 +526,7 @@ ReturnedValue Proxy::call(const FunctionObject *f, const Value *, const Value *, ReturnedValue Proxy::method_revocable(const FunctionObject *f, const Value *, const Value *argv, int argc) { Scope scope(f); - ScopedObject proxy(scope, Proxy::callAsConstructor(f, argv, argc)); + ScopedObject proxy(scope, Proxy::virtualCallAsConstructor(f, argv, argc)); if (scope.hasException()) return Encode::undefined(); diff --git a/src/qml/jsruntime/qv4proxy_p.h b/src/qml/jsruntime/qv4proxy_p.h index 5d99dbad22..7c00ede834 100644 --- a/src/qml/jsruntime/qv4proxy_p.h +++ b/src/qml/jsruntime/qv4proxy_p.h @@ -85,29 +85,28 @@ struct ProxyObject: Object { Q_MANAGED_TYPE(ProxyObject) V4_INTERNALCLASS(ProxyObject) - static ReturnedValue get(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty); - static ReturnedValue get(const Managed *m, uint index, bool *hasProperty); - static bool put(Managed *m, PropertyKey id, const Value &value, Value *receiver); - static bool deleteProperty(Managed *m, PropertyKey id); - static bool hasProperty(const Managed *m, PropertyKey id); - static PropertyAttributes getOwnProperty(Managed *m, PropertyKey id, Property *p); - static bool defineOwnProperty(Managed *m, PropertyKey id, const Property *p, PropertyAttributes attrs); - static bool isExtensible(const Managed *m); - static bool preventExtensions(Managed *); - static Heap::Object *getPrototypeOf(const Managed *); - static bool setPrototypeOf(Managed *, const Object *); + static ReturnedValue virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty); + static bool virtualPut(Managed *m, PropertyKey id, const Value &value, Value *receiver); + static bool virtualDeleteProperty(Managed *m, PropertyKey id); + static bool virtualHasProperty(const Managed *m, PropertyKey id); + static PropertyAttributes virtualGetOwnProperty(Managed *m, PropertyKey id, Property *p); + static bool virtualDefineOwnProperty(Managed *m, PropertyKey id, const Property *p, PropertyAttributes attrs); + static bool virtualIsExtensible(const Managed *m); + static bool virtualPreventExtensions(Managed *); + static Heap::Object *virtualGetPrototypeOf(const Managed *); + static bool virtualSetPrototypeOf(Managed *, const Object *); // those might require a second proxy object that derives from FunctionObject... -// static ReturnedValue callAsConstructor(const FunctionObject *f, const Value *argv, int argc); -// static ReturnedValue call(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc); +// static ReturnedValue virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc); +// static ReturnedValue virtualCall(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc); }; struct Proxy : FunctionObject { V4_OBJECT2(Proxy, FunctionObject) - static ReturnedValue callAsConstructor(const FunctionObject *f, const Value *argv, int argc); - static ReturnedValue call(const FunctionObject *, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc); + static ReturnedValue virtualCall(const FunctionObject *, const Value *thisObject, const Value *argv, int argc); static ReturnedValue method_revocable(const FunctionObject *, const Value *thisObject, const Value *argv, int argc); diff --git a/src/qml/jsruntime/qv4qmlcontext.cpp b/src/qml/jsruntime/qv4qmlcontext.cpp index aa607c2d9a..dc69016559 100644 --- a/src/qml/jsruntime/qv4qmlcontext.cpp +++ b/src/qml/jsruntime/qv4qmlcontext.cpp @@ -78,25 +78,25 @@ void Heap::QQmlContextWrapper::destroy() Object::destroy(); } -ReturnedValue QQmlContextWrapper::get(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty) +ReturnedValue QQmlContextWrapper::virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty) { Q_ASSERT(m->as<QQmlContextWrapper>()); if (!id.isString()) - return Object::get(m, id, receiver, hasProperty); + return Object::virtualGet(m, id, receiver, hasProperty); const QQmlContextWrapper *resource = static_cast<const QQmlContextWrapper *>(m); QV4::ExecutionEngine *v4 = resource->engine(); QV4::Scope scope(v4); if (resource->d()->isNullWrapper) - return Object::get(m, id, receiver, hasProperty); + return Object::virtualGet(m, id, receiver, hasProperty); if (v4->callingQmlContext() != *resource->d()->context) - return Object::get(m, id, receiver, hasProperty); + return Object::virtualGet(m, id, receiver, hasProperty); bool hasProp = false; - ScopedValue result(scope, Object::get(m, id, receiver, &hasProp)); + ScopedValue result(scope, Object::virtualGet(m, id, receiver, &hasProp)); if (hasProp) { if (hasProperty) *hasProperty = hasProp; @@ -229,12 +229,12 @@ ReturnedValue QQmlContextWrapper::get(const Managed *m, PropertyKey id, const Va return Encode::undefined(); } -bool QQmlContextWrapper::put(Managed *m, PropertyKey id, const Value &value, Value *receiver) +bool QQmlContextWrapper::virtualPut(Managed *m, PropertyKey id, const Value &value, Value *receiver) { Q_ASSERT(m->as<QQmlContextWrapper>()); if (id.isSymbol() || id.isArrayIndex()) - return Object::put(m, id, value, receiver); + return Object::virtualPut(m, id, value, receiver); QQmlContextWrapper *resource = static_cast<QQmlContextWrapper *>(m); ExecutionEngine *v4 = resource->engine(); @@ -256,7 +256,7 @@ bool QQmlContextWrapper::put(Managed *m, PropertyKey id, const Value &value, Val return false; } - return Object::put(m, id, value, receiver); + return Object::virtualPut(m, id, value, receiver); } // It's possible we could delay the calculation of the "actual" context (in the case @@ -301,7 +301,7 @@ bool QQmlContextWrapper::put(Managed *m, PropertyKey id, const Value &value, Val return false; } - return Object::put(m, id, value, receiver); + return Object::virtualPut(m, id, value, receiver); } void Heap::QmlContext::init(QV4::ExecutionContext *outerContext, QV4::QQmlContextWrapper *qml) diff --git a/src/qml/jsruntime/qv4qmlcontext_p.h b/src/qml/jsruntime/qv4qmlcontext_p.h index 2f76b8efd7..b9061a3f58 100644 --- a/src/qml/jsruntime/qv4qmlcontext_p.h +++ b/src/qml/jsruntime/qv4qmlcontext_p.h @@ -98,8 +98,8 @@ struct Q_QML_EXPORT QQmlContextWrapper : Object void setReadOnly(bool b) { d()->readOnly = b; } - static ReturnedValue get(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty); - static bool put(Managed *m, PropertyKey id, const Value &value, Value *receiver); + static ReturnedValue virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty); + static bool virtualPut(Managed *m, PropertyKey id, const Value &value, Value *receiver); }; struct Q_QML_EXPORT QmlContext : public ExecutionContext diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp index a47bd3731d..32a4f57b7e 100644 --- a/src/qml/jsruntime/qv4qobjectwrapper.cpp +++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp @@ -314,7 +314,7 @@ ReturnedValue QObjectWrapper::getQmlProperty(QQmlContextData *qmlContext, String } } } - return QV4::Object::get(this, name->propertyKey(), this, hasProperty); + return QV4::Object::virtualGet(this, name->propertyKey(), this, hasProperty); } QQmlData *ddata = QQmlData::get(d()->object(), false); @@ -667,7 +667,7 @@ void QObjectWrapper::setProperty(ExecutionEngine *engine, QObject *object, int p return setProperty(engine, object, property, value); } -bool QObjectWrapper::isEqualTo(Managed *a, Managed *b) +bool QObjectWrapper::virtualIsEqualTo(Managed *a, Managed *b) { Q_ASSERT(a->as<QV4::QObjectWrapper>()); QV4::QObjectWrapper *qobjectWrapper = static_cast<QV4::QObjectWrapper *>(a); @@ -693,10 +693,10 @@ ReturnedValue QObjectWrapper::create(ExecutionEngine *engine, QObject *object) return (engine->memoryManager->allocate<QV4::QObjectWrapper>(object))->asReturnedValue(); } -QV4::ReturnedValue QObjectWrapper::get(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty) +QV4::ReturnedValue QObjectWrapper::virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty) { if (!id.isString()) - return Object::get(m, id, receiver, hasProperty); + return Object::virtualGet(m, id, receiver, hasProperty); const QObjectWrapper *that = static_cast<const QObjectWrapper*>(m); Scope scope(that); @@ -705,10 +705,10 @@ QV4::ReturnedValue QObjectWrapper::get(const Managed *m, PropertyKey id, const V return that->getQmlProperty(qmlContext, n, IgnoreRevision, hasProperty, /*includeImports*/ true); } -bool QObjectWrapper::put(Managed *m, PropertyKey id, const Value &value, Value *receiver) +bool QObjectWrapper::virtualPut(Managed *m, PropertyKey id, const Value &value, Value *receiver) { if (!id.isString()) - return Object::put(m, id, value, receiver); + return Object::virtualPut(m, id, value, receiver); Scope scope(m); QObjectWrapper *that = static_cast<QObjectWrapper*>(m); @@ -728,14 +728,14 @@ bool QObjectWrapper::put(Managed *m, PropertyKey id, const Value &value, Value * scope.engine->throwError(error); return false; } else { - return QV4::Object::put(m, id, value, receiver); + return QV4::Object::virtualPut(m, id, value, receiver); } } return true; } -PropertyAttributes QObjectWrapper::getOwnProperty(Managed *m, PropertyKey id, Property *p) +PropertyAttributes QObjectWrapper::virtualGetOwnProperty(Managed *m, PropertyKey id, Property *p) { if (id.isString()) { QObjectWrapper *that = static_cast<QObjectWrapper*>(m); @@ -757,10 +757,10 @@ PropertyAttributes QObjectWrapper::getOwnProperty(Managed *m, PropertyKey id, Pr } } - return QV4::Object::getOwnProperty(m, id, p); + return QV4::Object::virtualGetOwnProperty(m, id, p); } -void QObjectWrapper::advanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attributes) +void QObjectWrapper::virtualAdvanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attributes) { // Used to block access to QObject::destroyed() and QObject::deleteLater() from QML static const int destroyedIdx1 = QObject::staticMetaObject.indexOfSignal("destroyed(QObject*)"); @@ -811,7 +811,7 @@ void QObjectWrapper::advanceIterator(Managed *m, ObjectIterator *it, Value *name return; } } - QV4::Object::advanceIterator(m, it, name, index, p, attributes); + QV4::Object::virtualAdvanceIterator(m, it, name, index, p, attributes); } namespace QV4 { @@ -1933,7 +1933,7 @@ QV4::ReturnedValue QObjectMethod::method_destroy(QV4::ExecutionEngine *engine, c return Encode::undefined(); } -ReturnedValue QObjectMethod::call(const FunctionObject *m, const Value *thisObject, const Value *argv, int argc) +ReturnedValue QObjectMethod::virtualCall(const FunctionObject *m, const Value *thisObject, const Value *argv, int argc) { const QObjectMethod *This = static_cast<const QObjectMethod*>(m); return This->callInternal(thisObject, argv, argc); @@ -2064,7 +2064,7 @@ void QMetaObjectWrapper::init(ExecutionEngine *) { } } -ReturnedValue QMetaObjectWrapper::callAsConstructor(const FunctionObject *f, const Value *argv, int argc) +ReturnedValue QMetaObjectWrapper::virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc) { const QMetaObjectWrapper *This = static_cast<const QMetaObjectWrapper*>(f); return This->constructInternal(argv, argc); @@ -2170,7 +2170,7 @@ ReturnedValue QMetaObjectWrapper::callOverloadedConstructor(QV4::ExecutionEngine } } -bool QMetaObjectWrapper::isEqualTo(Managed *a, Managed *b) +bool QMetaObjectWrapper::virtualIsEqualTo(Managed *a, Managed *b) { Q_ASSERT(a->as<QMetaObjectWrapper>()); QMetaObjectWrapper *aMetaObject = a->as<QMetaObjectWrapper>(); diff --git a/src/qml/jsruntime/qv4qobjectwrapper_p.h b/src/qml/jsruntime/qv4qobjectwrapper_p.h index da5eb4db81..398d2f8556 100644 --- a/src/qml/jsruntime/qv4qobjectwrapper_p.h +++ b/src/qml/jsruntime/qv4qobjectwrapper_p.h @@ -183,7 +183,7 @@ struct Q_QML_EXPORT QObjectWrapper : public Object void destroyObject(bool lastCall); protected: - static bool isEqualTo(Managed *that, Managed *o); + static bool virtualIsEqualTo(Managed *that, Managed *o); static ReturnedValue getProperty(ExecutionEngine *engine, QObject *object, QQmlPropertyData *property, bool captureRequired = true); static void setProperty(ExecutionEngine *engine, QObject *object, QQmlPropertyData *property, const Value &value); @@ -193,10 +193,10 @@ protected: static QQmlPropertyData *findProperty(ExecutionEngine *engine, QObject *o, QQmlContextData *qmlContext, String *name, RevisionMode revisionMode, QQmlPropertyData *local); QQmlPropertyData *findProperty(ExecutionEngine *engine, QQmlContextData *qmlContext, String *name, RevisionMode revisionMode, QQmlPropertyData *local) const; - static ReturnedValue get(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty); - static bool put(Managed *m, PropertyKey id, const Value &value, Value *receiver); - static PropertyAttributes getOwnProperty(Managed *m, PropertyKey id, Property *p); - static void advanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attributes); + static ReturnedValue virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty); + static bool virtualPut(Managed *m, PropertyKey id, const Value &value, Value *receiver); + static PropertyAttributes virtualGetOwnProperty(Managed *m, PropertyKey id, Property *p); + static void virtualAdvanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attributes); static ReturnedValue method_connect(const FunctionObject *, const Value *thisObject, const Value *argv, int argc); static ReturnedValue method_disconnect(const FunctionObject *, const Value *thisObject, const Value *argv, int argc); @@ -237,7 +237,7 @@ struct Q_QML_EXPORT QObjectMethod : public QV4::FunctionObject QV4::ReturnedValue method_toString(QV4::ExecutionEngine *engine) const; QV4::ReturnedValue method_destroy(QV4::ExecutionEngine *ctx, const Value *args, int argc) const; - static ReturnedValue call(const FunctionObject *, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue virtualCall(const FunctionObject *, const Value *thisObject, const Value *argv, int argc); ReturnedValue callInternal(const Value *thisObject, const Value *argv, int argc) const; @@ -251,11 +251,12 @@ struct Q_QML_EXPORT QMetaObjectWrapper : public QV4::FunctionObject V4_NEEDS_DESTROY static ReturnedValue create(ExecutionEngine *engine, const QMetaObject* metaObject); - static ReturnedValue callAsConstructor(const FunctionObject *, const Value *argv, int argc); - static bool isEqualTo(Managed *a, Managed *b); - const QMetaObject *metaObject() const { return d()->metaObject; } +protected: + static ReturnedValue virtualCallAsConstructor(const FunctionObject *, const Value *argv, int argc); + static bool virtualIsEqualTo(Managed *a, Managed *b); + private: void init(ExecutionEngine *engine); ReturnedValue constructInternal(const Value *argv, int argc) const; diff --git a/src/qml/jsruntime/qv4regexpobject.cpp b/src/qml/jsruntime/qv4regexpobject.cpp index 2978a5e913..0b3d85960b 100644 --- a/src/qml/jsruntime/qv4regexpobject.cpp +++ b/src/qml/jsruntime/qv4regexpobject.cpp @@ -210,7 +210,7 @@ void Heap::RegExpCtor::clearLastMatch() lastMatchEnd = 0; } -ReturnedValue RegExpCtor::callAsConstructor(const FunctionObject *fo, const Value *argv, int argc) +ReturnedValue RegExpCtor::virtualCallAsConstructor(const FunctionObject *fo, const Value *argv, int argc) { Scope scope(fo->engine()); ScopedValue r(scope, argc ? argv[0] : Primitive::undefinedValue()); @@ -259,14 +259,14 @@ ReturnedValue RegExpCtor::callAsConstructor(const FunctionObject *fo, const Valu return Encode(scope.engine->newRegExpObject(regexp)); } -ReturnedValue RegExpCtor::call(const FunctionObject *f, const Value *, const Value *argv, int argc) +ReturnedValue RegExpCtor::virtualCall(const FunctionObject *f, const Value *, const Value *argv, int argc) { if (argc > 0 && argv[0].as<RegExpObject>()) { if (argc == 1 || argv[1].isUndefined()) return Encode(argv[0]); } - return callAsConstructor(f, argv, argc); + return virtualCallAsConstructor(f, argv, argc); } void RegExpPrototype::init(ExecutionEngine *engine, Object *constructor) diff --git a/src/qml/jsruntime/qv4regexpobject_p.h b/src/qml/jsruntime/qv4regexpobject_p.h index 2ff40a18df..15809dfaf6 100644 --- a/src/qml/jsruntime/qv4regexpobject_p.h +++ b/src/qml/jsruntime/qv4regexpobject_p.h @@ -152,8 +152,8 @@ struct RegExpCtor: FunctionObject int lastMatchStart() { return d()->lastMatchStart; } int lastMatchEnd() { return d()->lastMatchEnd; } - static ReturnedValue callAsConstructor(const FunctionObject *f, const Value *argv, int argc); - static ReturnedValue call(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc); + static ReturnedValue virtualCall(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc); }; struct RegExpPrototype: RegExpObject diff --git a/src/qml/jsruntime/qv4sequenceobject.cpp b/src/qml/jsruntime/qv4sequenceobject.cpp index d5e6ed3612..1ba889ee82 100644 --- a/src/qml/jsruntime/qv4sequenceobject.cpp +++ b/src/qml/jsruntime/qv4sequenceobject.cpp @@ -349,7 +349,7 @@ public: if (d()->isReference) { if (!d()->object) { - QV4::Object::advanceIterator(this, it, name, index, p, attrs); + QV4::Object::virtualAdvanceIterator(this, it, name, index, p, attrs); return; } loadReference(); @@ -362,7 +362,7 @@ public: p->value = convertElementToValue(engine(), d()->container->at(*index)); return; } - QV4::Object::advanceIterator(this, it, name, index, p, attrs); + QV4::Object::virtualAdvanceIterator(this, it, name, index, p, attrs); } bool containerDeleteIndexedProperty(uint index) @@ -563,31 +563,31 @@ public: QMetaObject::metacall(d()->object, QMetaObject::WriteProperty, d()->propertyIndex, a); } - static QV4::ReturnedValue get(const QV4::Managed *that, PropertyKey id, const Value *receiver, bool *hasProperty) + static QV4::ReturnedValue virtualGet(const QV4::Managed *that, PropertyKey id, const Value *receiver, bool *hasProperty) { if (!id.isArrayIndex()) - return Object::get(that, id, receiver, hasProperty); + return Object::virtualGet(that, id, receiver, hasProperty); return static_cast<const QQmlSequence<Container> *>(that)->containerGetIndexed(id.asArrayIndex(), hasProperty); } - static bool put(Managed *that, PropertyKey id, const QV4::Value &value, Value *receiver) + static bool virtualPut(Managed *that, PropertyKey id, const QV4::Value &value, Value *receiver) { if (id.isArrayIndex()) return static_cast<QQmlSequence<Container> *>(that)->containerPutIndexed(id.asArrayIndex(), value); - return Object::put(that, id, value, receiver); + return Object::virtualPut(that, id, value, receiver); } static QV4::PropertyAttributes queryIndexed(const QV4::Managed *that, uint index) { return static_cast<const QQmlSequence<Container> *>(that)->containerQueryIndexed(index); } - static bool deleteProperty(QV4::Managed *that, PropertyKey id) + static bool virtualDeleteProperty(QV4::Managed *that, PropertyKey id) { if (id.isArrayIndex()) { uint index = id.asArrayIndex(); return static_cast<QQmlSequence<Container> *>(that)->containerDeleteIndexedProperty(index); } - return Object::deleteProperty(that, id); + return Object::virtualDeleteProperty(that, id); } - static bool isEqualTo(Managed *that, Managed *other) + static bool virtualIsEqualTo(Managed *that, Managed *other) { return static_cast<QQmlSequence<Container> *>(that)->containerIsEqualTo(other); } - static void advanceIterator(Managed *that, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attrs) + static void virtualAdvanceIterator(Managed *that, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attrs) { return static_cast<QQmlSequence<Container> *>(that)->containerAdvanceIterator(it, name, index, p, attrs); } }; diff --git a/src/qml/jsruntime/qv4setobject.cpp b/src/qml/jsruntime/qv4setobject.cpp index a4614e7c2e..1d8261845a 100644 --- a/src/qml/jsruntime/qv4setobject.cpp +++ b/src/qml/jsruntime/qv4setobject.cpp @@ -53,7 +53,7 @@ void Heap::SetCtor::init(QV4::ExecutionContext *scope) Heap::FunctionObject::init(scope, QStringLiteral("Set")); } -ReturnedValue SetCtor::callAsConstructor(const FunctionObject *f, const Value *argv, int argc) +ReturnedValue SetCtor::virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc) { Scope scope(f); Scoped<SetObject> a(scope, scope.engine->memoryManager->allocate<SetObject>()); @@ -89,7 +89,7 @@ ReturnedValue SetCtor::callAsConstructor(const FunctionObject *f, const Value *a return a.asReturnedValue(); } -ReturnedValue SetCtor::call(const FunctionObject *f, const Value *, const Value *, int) +ReturnedValue SetCtor::virtualCall(const FunctionObject *f, const Value *, const Value *, int) { Scope scope(f); return scope.engine->throwTypeError(QString::fromLatin1("Set requires new")); diff --git a/src/qml/jsruntime/qv4setobject_p.h b/src/qml/jsruntime/qv4setobject_p.h index 1335a9a712..4c81737db8 100644 --- a/src/qml/jsruntime/qv4setobject_p.h +++ b/src/qml/jsruntime/qv4setobject_p.h @@ -81,8 +81,8 @@ struct SetCtor: FunctionObject { V4_OBJECT2(SetCtor, FunctionObject) - static ReturnedValue callAsConstructor(const FunctionObject *f, const Value *argv, int argc); - static ReturnedValue call(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc); + static ReturnedValue virtualCall(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc); }; struct SetObject : Object diff --git a/src/qml/jsruntime/qv4string.cpp b/src/qml/jsruntime/qv4string.cpp index 2fcdd02bd2..911103c05d 100644 --- a/src/qml/jsruntime/qv4string.cpp +++ b/src/qml/jsruntime/qv4string.cpp @@ -81,7 +81,7 @@ DEFINE_MANAGED_VTABLE(StringOrSymbol); DEFINE_MANAGED_VTABLE(String); -bool String::isEqualTo(Managed *t, Managed *o) +bool String::virtualIsEqualTo(Managed *t, Managed *o) { if (t == o) return true; @@ -257,7 +257,7 @@ PropertyKey StringOrSymbol::toPropertyKey() const { return propertyKey(); } -qint64 String::getLength(const Managed *m) +qint64 String::virtualGetLength(const Managed *m) { return static_cast<const String *>(m)->d()->length(); } diff --git a/src/qml/jsruntime/qv4string_p.h b/src/qml/jsruntime/qv4string_p.h index 23319eefb1..8a4dc08693 100644 --- a/src/qml/jsruntime/qv4string_p.h +++ b/src/qml/jsruntime/qv4string_p.h @@ -237,8 +237,8 @@ struct Q_QML_PRIVATE_EXPORT String : public StringOrSymbol { bool startsWithUpper() const { return d()->startsWithUpper(); } protected: - static bool isEqualTo(Managed *that, Managed *o); - static qint64 getLength(const Managed *m); + static bool virtualIsEqualTo(Managed *that, Managed *o); + static qint64 virtualGetLength(const Managed *m); #endif public: diff --git a/src/qml/jsruntime/qv4stringobject.cpp b/src/qml/jsruntime/qv4stringobject.cpp index 8294e6cf36..7750bf4aea 100644 --- a/src/qml/jsruntime/qv4stringobject.cpp +++ b/src/qml/jsruntime/qv4stringobject.cpp @@ -97,7 +97,7 @@ uint Heap::StringObject::length() const return string->length(); } -bool StringObject::deleteProperty(Managed *m, PropertyKey id) +bool StringObject::virtualDeleteProperty(Managed *m, PropertyKey id) { Q_ASSERT(m->as<StringObject>()); if (id.isArrayIndex()) { @@ -106,10 +106,10 @@ bool StringObject::deleteProperty(Managed *m, PropertyKey id) if (index < static_cast<uint>(o->d()->string->toQString().length())) return false; } - return Object::deleteProperty(m, id); + return Object::virtualDeleteProperty(m, id); } -void StringObject::advanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attrs) +void StringObject::virtualAdvanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attrs) { name->setM(nullptr); StringObject *s = static_cast<StringObject *>(m); @@ -134,12 +134,12 @@ void StringObject::advanceIterator(Managed *m, ObjectIterator *it, Value *name, } } - return Object::advanceIterator(m, it, name, index, p, attrs); + return Object::virtualAdvanceIterator(m, it, name, index, p, attrs); } -PropertyAttributes StringObject::getOwnProperty(Managed *m, PropertyKey id, Property *p) +PropertyAttributes StringObject::virtualGetOwnProperty(Managed *m, PropertyKey id, Property *p) { - PropertyAttributes attributes = Object::getOwnProperty(m, id, p); + PropertyAttributes attributes = Object::virtualGetOwnProperty(m, id, p); if (attributes != Attr_Invalid) return attributes; @@ -164,7 +164,7 @@ void Heap::StringCtor::init(QV4::ExecutionContext *scope) Heap::FunctionObject::init(scope, QStringLiteral("String")); } -ReturnedValue StringCtor::callAsConstructor(const FunctionObject *f, const Value *argv, int argc) +ReturnedValue StringCtor::virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc) { ExecutionEngine *v4 = static_cast<const Object *>(f)->engine(); Scope scope(v4); @@ -177,7 +177,7 @@ ReturnedValue StringCtor::callAsConstructor(const FunctionObject *f, const Value return Encode(v4->newStringObject(value)); } -ReturnedValue StringCtor::call(const FunctionObject *m, const Value *, const Value *argv, int argc) +ReturnedValue StringCtor::virtualCall(const FunctionObject *m, const Value *, const Value *argv, int argc) { ExecutionEngine *v4 = m->engine(); if (!argc) @@ -514,7 +514,7 @@ ReturnedValue StringPrototype::method_match(const FunctionObject *b, const Value Scoped<RegExpObject> that(scope, argc ? argv[0] : Primitive::undefinedValue()); if (!that) { // convert args[0] to a regexp - that = RegExpCtor::callAsConstructor(b, argv, argc); + that = RegExpCtor::virtualCallAsConstructor(b, argv, argc); if (v4->hasException) return Encode::undefined(); } diff --git a/src/qml/jsruntime/qv4stringobject_p.h b/src/qml/jsruntime/qv4stringobject_p.h index 6b3861d6ed..3a50de8127 100644 --- a/src/qml/jsruntime/qv4stringobject_p.h +++ b/src/qml/jsruntime/qv4stringobject_p.h @@ -100,17 +100,17 @@ struct StringObject: Object { using Object::getOwnProperty; protected: - static bool deleteProperty(Managed *m, PropertyKey id); - static void advanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attrs); - static PropertyAttributes getOwnProperty(Managed *m, PropertyKey id, Property *p); + static bool virtualDeleteProperty(Managed *m, PropertyKey id); + static void virtualAdvanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attrs); + static PropertyAttributes virtualGetOwnProperty(Managed *m, PropertyKey id, Property *p); }; struct StringCtor: FunctionObject { V4_OBJECT2(StringCtor, FunctionObject) - static ReturnedValue callAsConstructor(const FunctionObject *f, const Value *argv, int argc); - static ReturnedValue call(const FunctionObject *, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc); + static ReturnedValue virtualCall(const FunctionObject *, const Value *thisObject, const Value *argv, int argc); static ReturnedValue method_fromCharCode(const FunctionObject *, const Value *thisObject, const Value *argv, int argc); static ReturnedValue method_fromCodePoint(const FunctionObject *, const Value *thisObject, const Value *argv, int argc); diff --git a/src/qml/jsruntime/qv4symbol.cpp b/src/qml/jsruntime/qv4symbol.cpp index c53cea36c6..bdefe1eb9e 100644 --- a/src/qml/jsruntime/qv4symbol.cpp +++ b/src/qml/jsruntime/qv4symbol.cpp @@ -67,7 +67,7 @@ void Heap::SymbolObject::init(const QV4::Symbol *s) symbol.set(internalClass->engine, s->d()); } -ReturnedValue QV4::SymbolCtor::call(const QV4::FunctionObject *f, const QV4::Value *, const QV4::Value *argv, int argc) +ReturnedValue QV4::SymbolCtor::virtualCall(const QV4::FunctionObject *f, const QV4::Value *, const QV4::Value *argv, int argc) { Scope scope(f); QString desc = QChar::fromLatin1('@'); diff --git a/src/qml/jsruntime/qv4symbol_p.h b/src/qml/jsruntime/qv4symbol_p.h index 7673fab549..46fa2979f8 100644 --- a/src/qml/jsruntime/qv4symbol_p.h +++ b/src/qml/jsruntime/qv4symbol_p.h @@ -82,7 +82,7 @@ struct SymbolCtor : FunctionObject { V4_OBJECT2(SymbolCtor, FunctionObject) - static ReturnedValue call(const FunctionObject *, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue virtualCall(const FunctionObject *, const Value *thisObject, const Value *argv, int argc); static ReturnedValue method_for(const FunctionObject *, const Value *thisObject, const Value *argv, int argc); static ReturnedValue method_keyFor(const FunctionObject *, const Value *thisObject, const Value *argv, int argc); }; @@ -117,7 +117,7 @@ struct SymbolObject : Object V4_INTERNALCLASS(SymbolObject) V4_PROTOTYPE(symbolPrototype) - static bool put(Managed *, PropertyKey, const Value &, Value *) { return false; } + static bool virtualPut(Managed *, PropertyKey, const Value &, Value *) { return false; } }; } diff --git a/src/qml/jsruntime/qv4typedarray.cpp b/src/qml/jsruntime/qv4typedarray.cpp index 09865b55f3..1f2f6ff5b4 100644 --- a/src/qml/jsruntime/qv4typedarray.cpp +++ b/src/qml/jsruntime/qv4typedarray.cpp @@ -214,7 +214,7 @@ void Heap::TypedArrayCtor::init(QV4::ExecutionContext *scope, TypedArray::Type t type = t; } -ReturnedValue TypedArrayCtor::callAsConstructor(const FunctionObject *f, const Value *argv, int argc) +ReturnedValue TypedArrayCtor::virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc) { Scope scope(f->engine()); const TypedArrayCtor *that = static_cast<const TypedArrayCtor *>(f); @@ -348,7 +348,7 @@ ReturnedValue TypedArrayCtor::callAsConstructor(const FunctionObject *f, const V return array.asReturnedValue(); } -ReturnedValue TypedArrayCtor::call(const FunctionObject *f, const Value *, const Value *, int) +ReturnedValue TypedArrayCtor::virtualCall(const FunctionObject *f, const Value *, const Value *, int) { return f->engine()->throwTypeError(QStringLiteral("calling a TypedArray constructor without new is invalid")); } @@ -367,10 +367,10 @@ Heap::TypedArray *TypedArray::create(ExecutionEngine *e, Heap::TypedArray::Type return e->memoryManager->allocObject<TypedArray>(ic->d(), t); } -ReturnedValue TypedArray::get(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty) +ReturnedValue TypedArray::virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty) { if (!id.isArrayIndex()) - return Object::get(m, id, receiver, hasProperty); + return Object::virtualGet(m, id, receiver, hasProperty); uint index = id.asArrayIndex(); Scope scope(static_cast<const Object *>(m)->engine()); @@ -388,10 +388,10 @@ ReturnedValue TypedArray::get(const Managed *m, PropertyKey id, const Value *rec return a->d()->type->read(a->d()->buffer->data->data(), byteOffset); } -bool TypedArray::put(Managed *m, PropertyKey id, const Value &value, Value *receiver) +bool TypedArray::virtualPut(Managed *m, PropertyKey id, const Value &value, Value *receiver) { if (!id.isArrayIndex()) - return Object::put(m, id, value, receiver); + return Object::virtualPut(m, id, value, receiver); uint index = id.asArrayIndex(); ExecutionEngine *v4 = static_cast<Object *>(m)->engine(); @@ -640,12 +640,12 @@ ReturnedValue IntrinsicTypedArrayPrototype::method_get_toStringTag(const Functio return a->engine()->newString(QString::fromLatin1(a->d()->type->name))->asReturnedValue(); } -ReturnedValue IntrinsicTypedArrayCtor::callAsConstructor(const FunctionObject *f, const Value *, int) +ReturnedValue IntrinsicTypedArrayCtor::virtualCallAsConstructor(const FunctionObject *f, const Value *, int) { return f->engine()->throwTypeError(); } -ReturnedValue IntrinsicTypedArrayCtor::call(const FunctionObject *f, const Value *, const Value *, int) +ReturnedValue IntrinsicTypedArrayCtor::virtualCall(const FunctionObject *f, const Value *, const Value *, int) { return f->engine()->throwTypeError(); } diff --git a/src/qml/jsruntime/qv4typedarray_p.h b/src/qml/jsruntime/qv4typedarray_p.h index f08dfc8101..d0c6b1c935 100644 --- a/src/qml/jsruntime/qv4typedarray_p.h +++ b/src/qml/jsruntime/qv4typedarray_p.h @@ -140,24 +140,24 @@ struct Q_QML_PRIVATE_EXPORT TypedArray : Object } using Object::get; - static ReturnedValue get(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty); - static bool put(Managed *m, PropertyKey id, const Value &value, Value *receiver); + static ReturnedValue virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty); + static bool virtualPut(Managed *m, PropertyKey id, const Value &value, Value *receiver); }; struct IntrinsicTypedArrayCtor: FunctionObject { V4_OBJECT2(IntrinsicTypedArrayCtor, FunctionObject) - static ReturnedValue callAsConstructor(const FunctionObject *f, const Value *argv, int argc); - static ReturnedValue call(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc); + static ReturnedValue virtualCall(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc); }; struct TypedArrayCtor: FunctionObject { V4_OBJECT2(TypedArrayCtor, FunctionObject) - static ReturnedValue callAsConstructor(const FunctionObject *f, const Value *argv, int argc); - static ReturnedValue call(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc); + static ReturnedValue virtualCall(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc); }; struct IntrinsicTypedArrayPrototype : Object diff --git a/src/qml/jsruntime/qv4variantobject.cpp b/src/qml/jsruntime/qv4variantobject.cpp index bee17e0390..ef0877dbd0 100644 --- a/src/qml/jsruntime/qv4variantobject.cpp +++ b/src/qml/jsruntime/qv4variantobject.cpp @@ -70,7 +70,7 @@ bool VariantObject::Data::isScarce() const return t == QVariant::Pixmap || t == QVariant::Image; } -bool VariantObject::isEqualTo(Managed *m, Managed *other) +bool VariantObject::virtualIsEqualTo(Managed *m, Managed *other) { Q_ASSERT(m->as<QV4::VariantObject>()); QV4::VariantObject *lv = static_cast<QV4::VariantObject *>(m); diff --git a/src/qml/jsruntime/qv4variantobject_p.h b/src/qml/jsruntime/qv4variantobject_p.h index 62fa7ff9a8..78e0a5373a 100644 --- a/src/qml/jsruntime/qv4variantobject_p.h +++ b/src/qml/jsruntime/qv4variantobject_p.h @@ -99,7 +99,8 @@ struct VariantObject : Object void addVmePropertyReference() const; void removeVmePropertyReference() const; - static bool isEqualTo(Managed *m, Managed *other); +protected: + static bool virtualIsEqualTo(Managed *m, Managed *other); }; struct VariantPrototype : VariantObject diff --git a/src/qml/jsruntime/qv4vtable_p.h b/src/qml/jsruntime/qv4vtable_p.h index 2acc868d3e..daf971e581 100644 --- a/src/qml/jsruntime/qv4vtable_p.h +++ b/src/qml/jsruntime/qv4vtable_p.h @@ -118,25 +118,25 @@ struct VTable struct VTableBase { protected: - static constexpr VTable::Destroy destroy = nullptr; - static constexpr VTable::IsEqualTo isEqualTo = nullptr; - - static constexpr VTable::Get get = nullptr; - static constexpr VTable::Put put = nullptr; - static constexpr VTable::DeleteProperty deleteProperty = nullptr; - static constexpr VTable::HasProperty hasProperty = nullptr; - static constexpr VTable::GetOwnProperty getOwnProperty = nullptr; - static constexpr VTable::DefineOwnProperty defineOwnProperty = nullptr; - static constexpr VTable::IsExtensible isExtensible = nullptr; - static constexpr VTable::PreventExtensions preventExtensions = nullptr; - static constexpr VTable::GetPrototypeOf getPrototypeOf = nullptr; - static constexpr VTable::SetPrototypeOf setPrototypeOf = nullptr; - static constexpr VTable::GetLength getLength = nullptr; - static constexpr VTable::AdvanceIterator advanceIterator = nullptr; - static constexpr VTable::InstanceOf instanceOf = nullptr; - - static constexpr VTable::Call call = nullptr; - static constexpr VTable::CallAsConstructor callAsConstructor = nullptr; + static constexpr VTable::Destroy virtualDestroy = nullptr; + static constexpr VTable::IsEqualTo virtualIsEqualTo = nullptr; + + static constexpr VTable::Get virtualGet = nullptr; + static constexpr VTable::Put virtualPut = nullptr; + static constexpr VTable::DeleteProperty virtualDeleteProperty = nullptr; + static constexpr VTable::HasProperty virtualHasProperty = nullptr; + static constexpr VTable::GetOwnProperty virtualGetOwnProperty = nullptr; + static constexpr VTable::DefineOwnProperty virtualDefineOwnProperty = nullptr; + static constexpr VTable::IsExtensible virtualIsExtensible = nullptr; + static constexpr VTable::PreventExtensions virtualPreventExtensions = nullptr; + static constexpr VTable::GetPrototypeOf virtualGetPrototypeOf = nullptr; + static constexpr VTable::SetPrototypeOf virtualSetPrototypeOf = nullptr; + static constexpr VTable::GetLength virtualGetLength = nullptr; + static constexpr VTable::AdvanceIterator virtualAdvanceIterator = nullptr; + static constexpr VTable::InstanceOf virtualInstanceOf = nullptr; + + static constexpr VTable::Call virtualCall = nullptr; + static constexpr VTable::CallAsConstructor virtualCallAsConstructor = nullptr; }; #define DEFINE_MANAGED_VTABLE_INT(classname, parentVTable) \ @@ -156,26 +156,26 @@ protected: { 0, 0, 0, 0 }, \ #classname, \ \ - classname::destroy, \ + classname::virtualDestroy, \ classname::Data::markObjects, \ - classname::isEqualTo, \ + classname::virtualIsEqualTo, \ \ - classname::get, \ - classname::put, \ - classname::deleteProperty, \ - classname::hasProperty, \ - classname::getOwnProperty, \ - classname::defineOwnProperty, \ - classname::isExtensible, \ - classname::preventExtensions, \ - classname::getPrototypeOf, \ - classname::setPrototypeOf, \ - classname::getLength, \ - classname::advanceIterator, \ - classname::instanceOf, \ + classname::virtualGet, \ + classname::virtualPut, \ + classname::virtualDeleteProperty, \ + classname::virtualHasProperty, \ + classname::virtualGetOwnProperty, \ + classname::virtualDefineOwnProperty, \ + classname::virtualIsExtensible, \ + classname::virtualPreventExtensions, \ + classname::virtualGetPrototypeOf, \ + classname::virtualSetPrototypeOf, \ + classname::virtualGetLength, \ + classname::virtualAdvanceIterator, \ + classname::virtualInstanceOf, \ \ - classname::call, \ - classname::callAsConstructor, \ + classname::virtualCall, \ + classname::virtualCallAsConstructor, \ } #define DEFINE_MANAGED_VTABLE(classname) \ diff --git a/src/qml/qml/qqmllistwrapper.cpp b/src/qml/qml/qqmllistwrapper.cpp index 82eb08ddc9..7c35f73e6c 100644 --- a/src/qml/qml/qqmllistwrapper.cpp +++ b/src/qml/qml/qqmllistwrapper.cpp @@ -102,7 +102,7 @@ QVariant QmlListWrapper::toVariant() const } -ReturnedValue QmlListWrapper::get(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty) +ReturnedValue QmlListWrapper::virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty) { Q_ASSERT(m->as<QmlListWrapper>()); const QmlListWrapper *w = static_cast<const QmlListWrapper *>(m); @@ -127,10 +127,10 @@ ReturnedValue QmlListWrapper::get(const Managed *m, PropertyKey id, const Value } } - return Object::get(m, id, receiver, hasProperty); + return Object::virtualGet(m, id, receiver, hasProperty); } -bool QmlListWrapper::put(Managed *m, PropertyKey id, const Value &value, Value *receiver) +bool QmlListWrapper::virtualPut(Managed *m, PropertyKey id, const Value &value, Value *receiver) { // doesn't do anything. Should we throw? Q_UNUSED(m); @@ -140,7 +140,7 @@ bool QmlListWrapper::put(Managed *m, PropertyKey id, const Value &value, Value * return false; } -void QmlListWrapper::advanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attrs) +void QmlListWrapper::virtualAdvanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attrs) { name->setM(nullptr); *index = UINT_MAX; @@ -154,7 +154,7 @@ void QmlListWrapper::advanceIterator(Managed *m, ObjectIterator *it, Value *name p->value = QV4::QObjectWrapper::wrap(w->engine(), w->d()->property().at(&w->d()->property(), *index)); return; } - return QV4::Object::advanceIterator(m, it, name, index, p, attrs); + return QV4::Object::virtualAdvanceIterator(m, it, name, index, p, attrs); } void PropertyListPrototype::init(ExecutionEngine *) diff --git a/src/qml/qml/qqmllistwrapper_p.h b/src/qml/qml/qqmllistwrapper_p.h index 16dabed764..2d6a0880e3 100644 --- a/src/qml/qml/qqmllistwrapper_p.h +++ b/src/qml/qml/qqmllistwrapper_p.h @@ -93,9 +93,9 @@ struct Q_QML_EXPORT QmlListWrapper : Object QVariant toVariant() const; - static ReturnedValue get(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty); - static bool put(Managed *m, PropertyKey id, const Value &value, Value *receiver); - static void advanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attributes); + static ReturnedValue virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty); + static bool virtualPut(Managed *m, PropertyKey id, const Value &value, Value *receiver); + static void virtualAdvanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attributes); }; struct PropertyListPrototype : Object diff --git a/src/qml/qml/qqmltypewrapper.cpp b/src/qml/qml/qqmltypewrapper.cpp index 51df0a1fa6..c6affcb79c 100644 --- a/src/qml/qml/qqmltypewrapper.cpp +++ b/src/qml/qml/qqmltypewrapper.cpp @@ -167,12 +167,12 @@ static ReturnedValue throwLowercaseEnumError(QV4::ExecutionEngine *v4, String *n return v4->throwTypeError(message); } -ReturnedValue QQmlTypeWrapper::get(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty) +ReturnedValue QQmlTypeWrapper::virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty) { Q_ASSERT(m->as<QQmlTypeWrapper>()); if (!id.isString()) - return Object::get(m, id, receiver, hasProperty); + return Object::virtualGet(m, id, receiver, hasProperty); QV4::ExecutionEngine *v4 = static_cast<const QQmlTypeWrapper *>(m)->engine(); QV4::Scope scope(v4); @@ -288,7 +288,7 @@ ReturnedValue QQmlTypeWrapper::get(const Managed *m, PropertyKey id, const Value } bool ok = false; - const ReturnedValue result = Object::get(m, id, receiver, &ok); + const ReturnedValue result = Object::virtualGet(m, id, receiver, &ok); if (hasProperty) *hasProperty = ok; @@ -304,10 +304,10 @@ ReturnedValue QQmlTypeWrapper::get(const Managed *m, PropertyKey id, const Value } -bool QQmlTypeWrapper::put(Managed *m, PropertyKey id, const Value &value, Value *receiver) +bool QQmlTypeWrapper::virtualPut(Managed *m, PropertyKey id, const Value &value, Value *receiver) { if (!id.isString()) - return Object::put(m, id, value, receiver); + return Object::virtualPut(m, id, value, receiver); Q_ASSERT(m->as<QQmlTypeWrapper>()); @@ -350,7 +350,7 @@ bool QQmlTypeWrapper::put(Managed *m, PropertyKey id, const Value &value, Value return false; } -PropertyAttributes QQmlTypeWrapper::getOwnProperty(Managed *m, PropertyKey id, Property *p) +PropertyAttributes QQmlTypeWrapper::virtualGetOwnProperty(Managed *m, PropertyKey id, Property *p) { if (id.isString()) { Scope scope(m); @@ -361,10 +361,10 @@ PropertyAttributes QQmlTypeWrapper::getOwnProperty(Managed *m, PropertyKey id, P return hasProperty ? Attr_Data : Attr_Invalid; } - return QV4::Object::getOwnProperty(m, id, p); + return QV4::Object::virtualGetOwnProperty(m, id, p); } -bool QQmlTypeWrapper::isEqualTo(Managed *a, Managed *b) +bool QQmlTypeWrapper::virtualIsEqualTo(Managed *a, Managed *b) { Q_ASSERT(a->as<QV4::QQmlTypeWrapper>()); QV4::QQmlTypeWrapper *qmlTypeWrapperA = static_cast<QV4::QQmlTypeWrapper *>(a); @@ -376,7 +376,7 @@ bool QQmlTypeWrapper::isEqualTo(Managed *a, Managed *b) return false; } -ReturnedValue QQmlTypeWrapper::instanceOf(const Object *typeObject, const Value &var) +ReturnedValue QQmlTypeWrapper::virtualInstanceOf(const Object *typeObject, const Value &var) { Q_ASSERT(typeObject->as<QV4::QQmlTypeWrapper>()); const QV4::QQmlTypeWrapper *typeWrapper = static_cast<const QV4::QQmlTypeWrapper *>(typeObject); @@ -428,11 +428,11 @@ QQmlType Heap::QQmlScopedEnumWrapper::type() const return QQmlType(typePrivate); } -ReturnedValue QQmlScopedEnumWrapper::get(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty) +ReturnedValue QQmlScopedEnumWrapper::virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty) { Q_ASSERT(m->as<QQmlScopedEnumWrapper>()); if (!id.isString()) - return Object::get(m, id, receiver, hasProperty); + return Object::virtualGet(m, id, receiver, hasProperty); const QQmlScopedEnumWrapper *resource = static_cast<const QQmlScopedEnumWrapper *>(m); QV4::ExecutionEngine *v4 = resource->engine(); diff --git a/src/qml/qml/qqmltypewrapper_p.h b/src/qml/qml/qqmltypewrapper_p.h index 01c3f8b0d0..c0eb534d36 100644 --- a/src/qml/qml/qqmltypewrapper_p.h +++ b/src/qml/qml/qqmltypewrapper_p.h @@ -111,12 +111,12 @@ struct Q_QML_EXPORT QQmlTypeWrapper : Object static ReturnedValue create(ExecutionEngine *, QObject *, const QQmlRefPointer<QQmlTypeNameCache> &, const QQmlImportRef *, Heap::QQmlTypeWrapper::TypeNameMode = Heap::QQmlTypeWrapper::IncludeEnums); - - static ReturnedValue get(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty); - static bool put(Managed *m, PropertyKey id, const Value &value, Value *receiver); - static PropertyAttributes getOwnProperty(Managed *m, PropertyKey id, Property *p); - static bool isEqualTo(Managed *that, Managed *o); - static ReturnedValue instanceOf(const Object *typeObject, const Value &var); +protected: + static ReturnedValue virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty); + static bool virtualPut(Managed *m, PropertyKey id, const Value &value, Value *receiver); + static PropertyAttributes virtualGetOwnProperty(Managed *m, PropertyKey id, Property *p); + static bool virtualIsEqualTo(Managed *that, Managed *o); + static ReturnedValue virtualInstanceOf(const Object *typeObject, const Value &var); }; struct Q_QML_EXPORT QQmlScopedEnumWrapper : Object @@ -124,7 +124,7 @@ struct Q_QML_EXPORT QQmlScopedEnumWrapper : Object V4_OBJECT2(QQmlScopedEnumWrapper, Object) V4_NEEDS_DESTROY - static ReturnedValue get(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty); + static ReturnedValue virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty); }; } diff --git a/src/qml/qml/qqmlvaluetypewrapper.cpp b/src/qml/qml/qqmlvaluetypewrapper.cpp index 2dd76ccd84..8f61e2377d 100644 --- a/src/qml/qml/qqmlvaluetypewrapper.cpp +++ b/src/qml/qml/qqmlvaluetypewrapper.cpp @@ -227,7 +227,7 @@ bool QQmlValueTypeWrapper::toGadget(void *data) const return true; } -bool QQmlValueTypeWrapper::isEqualTo(Managed *m, Managed *other) +bool QQmlValueTypeWrapper::virtualIsEqualTo(Managed *m, Managed *other) { Q_ASSERT(m && m->as<QQmlValueTypeWrapper>() && other); QV4::QQmlValueTypeWrapper *lv = static_cast<QQmlValueTypeWrapper *>(m); @@ -241,7 +241,7 @@ bool QQmlValueTypeWrapper::isEqualTo(Managed *m, Managed *other) return false; } -PropertyAttributes QQmlValueTypeWrapper::getOwnProperty(Managed *m, PropertyKey id, Property *p) +PropertyAttributes QQmlValueTypeWrapper::virtualGetOwnProperty(Managed *m, PropertyKey id, Property *p) { if (id.isString()) { Scope scope(m); @@ -251,10 +251,10 @@ PropertyAttributes QQmlValueTypeWrapper::getOwnProperty(Managed *m, PropertyKey return result ? Attr_Data : Attr_Invalid; } - return QV4::Object::getOwnProperty(m, id, p); + return QV4::Object::virtualGetOwnProperty(m, id, p); } -void QQmlValueTypeWrapper::advanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attributes) +void QQmlValueTypeWrapper::virtualAdvanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attributes) { name->setM(nullptr); *index = UINT_MAX; @@ -279,7 +279,7 @@ void QQmlValueTypeWrapper::advanceIterator(Managed *m, ObjectIterator *it, Value return; } } - QV4::Object::advanceIterator(m, it, name, index, p, attributes); + QV4::Object::virtualAdvanceIterator(m, it, name, index, p, attributes); } bool QQmlValueTypeWrapper::isEqual(const QVariant& value) const @@ -359,12 +359,12 @@ ReturnedValue QQmlValueTypeWrapper::method_toString(const FunctionObject *b, con return Encode(b->engine()->newString(result)); } -ReturnedValue QQmlValueTypeWrapper::get(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty) +ReturnedValue QQmlValueTypeWrapper::virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty) { Q_ASSERT(m->as<QQmlValueTypeWrapper>()); if (!id.isString()) - return Object::get(m, id, receiver, hasProperty); + return Object::virtualGet(m, id, receiver, hasProperty); const QQmlValueTypeWrapper *r = static_cast<const QQmlValueTypeWrapper *>(m); QV4::ExecutionEngine *v4 = r->engine(); @@ -379,7 +379,7 @@ ReturnedValue QQmlValueTypeWrapper::get(const Managed *m, PropertyKey id, const QQmlPropertyData *result = r->d()->propertyCache()->property(name.getPointer(), nullptr, nullptr); if (!result) - return Object::get(m, id, receiver, hasProperty); + return Object::virtualGet(m, id, receiver, hasProperty); if (hasProperty) *hasProperty = true; @@ -423,10 +423,10 @@ ReturnedValue QQmlValueTypeWrapper::get(const Managed *m, PropertyKey id, const #undef VALUE_TYPE_ACCESSOR } -bool QQmlValueTypeWrapper::put(Managed *m, PropertyKey id, const Value &value, Value *receiver) +bool QQmlValueTypeWrapper::virtualPut(Managed *m, PropertyKey id, const Value &value, Value *receiver) { if (!id.isString()) - return Object::put(m, id, value, receiver); + return Object::virtualPut(m, id, value, receiver); Q_ASSERT(m->as<QQmlValueTypeWrapper>()); ExecutionEngine *v4 = static_cast<QQmlValueTypeWrapper *>(m)->engine(); diff --git a/src/qml/qml/qqmlvaluetypewrapper_p.h b/src/qml/qml/qqmlvaluetypewrapper_p.h index 655530725e..ff8ab98bb6 100644 --- a/src/qml/qml/qqmlvaluetypewrapper_p.h +++ b/src/qml/qml/qqmlvaluetypewrapper_p.h @@ -106,11 +106,11 @@ public: int typeId() const; bool write(QObject *target, int propertyIndex) const; - static ReturnedValue get(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty); - static bool put(Managed *m, PropertyKey id, const Value &value, Value *receiver); - static bool isEqualTo(Managed *m, Managed *other); - static PropertyAttributes getOwnProperty(Managed *m, PropertyKey id, Property *p); - static void advanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attributes); + static ReturnedValue virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty); + static bool virtualPut(Managed *m, PropertyKey id, const Value &value, Value *receiver); + static bool virtualIsEqualTo(Managed *m, Managed *other); + static PropertyAttributes virtualGetOwnProperty(Managed *m, PropertyKey id, Property *p); + static void virtualAdvanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attributes); static ReturnedValue method_toString(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc); diff --git a/src/qml/qml/qqmlxmlhttprequest.cpp b/src/qml/qml/qqmlxmlhttprequest.cpp index c6f85069c3..53581c2ccb 100644 --- a/src/qml/qml/qqmlxmlhttprequest.cpp +++ b/src/qml/qml/qqmlxmlhttprequest.cpp @@ -228,7 +228,7 @@ public: static ReturnedValue create(ExecutionEngine *, NodeImpl *, const QList<NodeImpl *> &); // JS API - static ReturnedValue get(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty); + static ReturnedValue virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty); }; void Heap::NamedNodeMap::init(NodeImpl *data, const QList<NodeImpl *> &list) @@ -249,7 +249,7 @@ public: V4_NEEDS_DESTROY // JS API - static ReturnedValue get(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty); + static ReturnedValue virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty); // C++ API static ReturnedValue create(ExecutionEngine *, NodeImpl *); @@ -886,7 +886,7 @@ bool Node::isNull() const return d()->d == nullptr; } -ReturnedValue NamedNodeMap::get(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty) +ReturnedValue NamedNodeMap::virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty) { Q_ASSERT(m->as<NamedNodeMap>()); @@ -907,7 +907,7 @@ ReturnedValue NamedNodeMap::get(const Managed *m, PropertyKey id, const Value *r } if (id.isSymbol()) - return Object::get(m, id, receiver, hasProperty); + return Object::virtualGet(m, id, receiver, hasProperty); if (id == v4->id_length()->propertyKey()) return Primitive::fromInt32(r->d()->list().count()).asReturnedValue(); @@ -931,7 +931,7 @@ ReturnedValue NamedNodeMap::create(ExecutionEngine *v4, NodeImpl *data, const QL return (v4->memoryManager->allocate<NamedNodeMap>(data, list))->asReturnedValue(); } -ReturnedValue NodeList::get(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty) +ReturnedValue NodeList::virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty) { Q_ASSERT(m->as<NodeList>()); const NodeList *r = static_cast<const NodeList *>(m); @@ -951,7 +951,7 @@ ReturnedValue NodeList::get(const Managed *m, PropertyKey id, const Value *recei if (id == v4->id_length()->propertyKey()) return Primitive::fromInt32(r->d()->d->children.count()).asReturnedValue(); - return Object::get(m, id, receiver, hasProperty); + return Object::virtualGet(m, id, receiver, hasProperty); } ReturnedValue NodeList::create(ExecutionEngine *v4, NodeImpl *data) @@ -1629,7 +1629,7 @@ struct QQmlXMLHttpRequestCtor : public FunctionObject { V4_OBJECT2(QQmlXMLHttpRequestCtor, FunctionObject) - static ReturnedValue callAsConstructor(const FunctionObject *f, const Value *, int) + static ReturnedValue virtualCallAsConstructor(const FunctionObject *f, const Value *, int) { Scope scope(f->engine()); const QQmlXMLHttpRequestCtor *ctor = static_cast<const QQmlXMLHttpRequestCtor *>(f); @@ -1641,7 +1641,7 @@ struct QQmlXMLHttpRequestCtor : public FunctionObject return w.asReturnedValue(); } - static ReturnedValue call(const FunctionObject *, const Value *, const Value *, int) { + static ReturnedValue virtualCall(const FunctionObject *, const Value *, const Value *, int) { return Encode::undefined(); } diff --git a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp index b3b63ff8a6..e8e35f5e61 100644 --- a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp +++ b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp @@ -197,14 +197,14 @@ ReturnedValue QtObject::findAndAdd(const QString *name, bool &foundProperty) con return Encode::undefined(); } -ReturnedValue QtObject::get(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty) +ReturnedValue QtObject::virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty) { bool hasProp = false; if (hasProperty == nullptr) { hasProperty = &hasProp; } - ReturnedValue ret = QV4::Object::get(m, id, receiver, hasProperty); + ReturnedValue ret = QV4::Object::virtualGet(m, id, receiver, hasProperty); if (*hasProperty) { return ret; } @@ -218,14 +218,14 @@ ReturnedValue QtObject::get(const Managed *m, PropertyKey id, const Value *recei return ret; } -void QtObject::advanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attributes) +void QtObject::virtualAdvanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attributes) { auto that = static_cast<QtObject*>(m); if (!that->d()->isComplete()) { that->addAll(); } - QV4::Object::advanceIterator(m, it, name, index, p, attributes); + QV4::Object::virtualAdvanceIterator(m, it, name, index, p, attributes); } /*! diff --git a/src/qml/qml/v8/qqmlbuiltinfunctions_p.h b/src/qml/qml/v8/qqmlbuiltinfunctions_p.h index 95d51135c6..4b3814c8b8 100644 --- a/src/qml/qml/v8/qqmlbuiltinfunctions_p.h +++ b/src/qml/qml/v8/qqmlbuiltinfunctions_p.h @@ -93,8 +93,8 @@ struct QtObject : Object { V4_OBJECT2(QtObject, Object) - static ReturnedValue get(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty); - static void advanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attributes); + static ReturnedValue virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty); + static void virtualAdvanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attributes); static ReturnedValue method_isQtObject(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc); static ReturnedValue method_rgba(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc); diff --git a/src/qml/types/qqmldelegatemodel.cpp b/src/qml/types/qqmldelegatemodel.cpp index 3058ac2069..0dbd9731c9 100644 --- a/src/qml/types/qqmldelegatemodel.cpp +++ b/src/qml/types/qqmldelegatemodel.cpp @@ -96,7 +96,7 @@ struct DelegateModelGroupFunction : QV4::FunctionObject return scope->engine()->memoryManager->allocate<DelegateModelGroupFunction>(scope, flag, code); } - static ReturnedValue call(const QV4::FunctionObject *that, const Value *thisObject, const Value *argv, int argc) + static ReturnedValue virtualCall(const QV4::FunctionObject *that, const Value *thisObject, const Value *argv, int argc) { QV4::Scope scope(that->engine()); QV4::Scoped<DelegateModelGroupFunction> f(scope, static_cast<const DelegateModelGroupFunction *>(that)); @@ -3383,7 +3383,7 @@ public: quint32 count() const { return d()->changes->count(); } const QQmlChangeSet::Change &at(int index) const { return d()->changes->at(index); } - static QV4::ReturnedValue get(const QV4::Managed *m, QV4::PropertyKey id, const QV4::Value *receiver, bool *hasProperty) + static QV4::ReturnedValue virtualGet(const QV4::Managed *m, QV4::PropertyKey id, const QV4::Value *receiver, bool *hasProperty) { if (id.isArrayIndex()) { uint index = id.asArrayIndex(); @@ -3419,7 +3419,7 @@ public: return QV4::Encode(array->count()); } - return Object::get(m, id, receiver, hasProperty); + return Object::virtualGet(m, id, receiver, hasProperty); } }; diff --git a/src/qml/types/qqmllistmodel.cpp b/src/qml/types/qqmllistmodel.cpp index 27e9df0c0b..2325eca469 100644 --- a/src/qml/types/qqmllistmodel.cpp +++ b/src/qml/types/qqmllistmodel.cpp @@ -1564,10 +1564,10 @@ void ModelNodeMetaObject::emitDirectNotifies(const int *changedRoles, int roleCo namespace QV4 { -bool ModelObject::put(Managed *m, PropertyKey id, const Value &value, Value *receiver) +bool ModelObject::virtualPut(Managed *m, PropertyKey id, const Value &value, Value *receiver) { if (!id.isString()) - return Object::put(m, id, value, receiver); + return Object::virtualPut(m, id, value, receiver); QString propName = id.toQString(); ModelObject *that = static_cast<ModelObject*>(m); @@ -1584,17 +1584,17 @@ bool ModelObject::put(Managed *m, PropertyKey id, const Value &value, Value *rec return true; } -ReturnedValue ModelObject::get(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty) +ReturnedValue ModelObject::virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty) { if (!id.isString()) - return Object::get(m, id, receiver, hasProperty); + return QObjectWrapper::virtualGet(m, id, receiver, hasProperty); const ModelObject *that = static_cast<const ModelObject*>(m); Scope scope(that); ScopedString name(scope, id.asStringOrSymbol()); const ListLayout::Role *role = that->d()->m_model->m_listModel->getExistingRole(name); if (!role) - return QObjectWrapper::get(m, id, receiver, hasProperty); + return QObjectWrapper::virtualGet(m, id, receiver, hasProperty); if (hasProperty) *hasProperty = true; @@ -1610,7 +1610,7 @@ ReturnedValue ModelObject::get(const Managed *m, PropertyKey id, const Value *re return that->engine()->fromVariant(value); } -void ModelObject::advanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attributes) +void ModelObject::virtualAdvanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attributes) { ModelObject *that = static_cast<ModelObject*>(m); ExecutionEngine *v4 = that->engine(); @@ -1630,7 +1630,7 @@ void ModelObject::advanceIterator(Managed *m, ObjectIterator *it, Value *name, u // Fall back to QV4::Object as opposed to QV4::QObjectWrapper otherwise it will add // unnecessary entries that relate to the roles used. These just create extra work // later on as they will just be ignored. - QV4::Object::advanceIterator(m, it, name, index, p, attributes); + QV4::Object::virtualAdvanceIterator(m, it, name, index, p, attributes); } DEFINE_OBJECT_VTABLE(ModelObject); diff --git a/src/qml/types/qqmllistmodel_p_p.h b/src/qml/types/qqmllistmodel_p_p.h index fe88877837..e4a850e8a5 100644 --- a/src/qml/types/qqmllistmodel_p_p.h +++ b/src/qml/types/qqmllistmodel_p_p.h @@ -173,12 +173,13 @@ struct ModelObject : public QObjectWrapper { struct ModelObject : public QObjectWrapper { - static bool put(Managed *m, PropertyKey id, const Value& value, Value *receiver); - static ReturnedValue get(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty); - static void advanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attributes); - V4_OBJECT2(ModelObject, QObjectWrapper) V4_NEEDS_DESTROY + +protected: + static bool virtualPut(Managed *m, PropertyKey id, const Value& value, Value *receiver); + static ReturnedValue virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty); + static void virtualAdvanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attributes); }; } // namespace QV4 diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp index 416675aec6..5af2a7169c 100644 --- a/src/quick/items/context2d/qquickcontext2d.cpp +++ b/src/quick/items/context2d/qquickcontext2d.cpp @@ -908,8 +908,8 @@ struct QQuickJSContext2DPixelData : public QV4::Object V4_OBJECT2(QQuickJSContext2DPixelData, QV4::Object) V4_NEEDS_DESTROY - static QV4::ReturnedValue get(const QV4::Managed *m, QV4::PropertyKey id, const QV4::Value *receiver, bool *hasProperty); - static bool put(QV4::Managed *m, QV4::PropertyKey id, const QV4::Value &value, Value *receiver); + static QV4::ReturnedValue virtualGet(const QV4::Managed *m, QV4::PropertyKey id, const QV4::Value *receiver, bool *hasProperty); + static bool virtualPut(QV4::Managed *m, QV4::PropertyKey id, const QV4::Value &value, Value *receiver); static QV4::ReturnedValue proto_get_length(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc); }; @@ -3130,10 +3130,10 @@ QV4::ReturnedValue QQuickJSContext2DPixelData::proto_get_length(const QV4::Funct RETURN_RESULT(QV4::Encode(r->d()->image->width() * r->d()->image->height() * 4)); } -QV4::ReturnedValue QQuickJSContext2DPixelData::get(const QV4::Managed *m, QV4::PropertyKey id, const QV4::Value *receiver, bool *hasProperty) +QV4::ReturnedValue QQuickJSContext2DPixelData::virtualGet(const QV4::Managed *m, QV4::PropertyKey id, const QV4::Value *receiver, bool *hasProperty) { if (!id.isArrayIndex()) - return QV4::Object::get(m, id, receiver, hasProperty); + return QV4::Object::virtualGet(m, id, receiver, hasProperty); uint index = id.asArrayIndex(); Q_ASSERT(m->as<QQuickJSContext2DPixelData>()); @@ -3166,10 +3166,10 @@ QV4::ReturnedValue QQuickJSContext2DPixelData::get(const QV4::Managed *m, QV4::P return QV4::Encode::undefined(); } -bool QQuickJSContext2DPixelData::put(QV4::Managed *m, QV4::PropertyKey id, const QV4::Value &value, QV4::Value *receiver) +bool QQuickJSContext2DPixelData::virtualPut(QV4::Managed *m, QV4::PropertyKey id, const QV4::Value &value, QV4::Value *receiver) { if (!id.isArrayIndex()) - return Object::put(m, id, value, receiver); + return Object::virtualPut(m, id, value, receiver); Q_ASSERT(m->as<QQuickJSContext2DPixelData>()); QV4::ExecutionEngine *v4 = static_cast<QQuickJSContext2DPixelData *>(m)->engine(); |