diff options
author | Lars Knoll <[email protected]> | 2014-05-09 12:15:23 +0200 |
---|---|---|
committer | Simon Hausmann <[email protected]> | 2014-07-22 13:49:18 +0200 |
commit | dba56a752c932670c0e9461f106d2bc084276b6f (patch) | |
tree | 3a669663fa85dd3d61a83c29e8961b70ac53f046 /src/qml | |
parent | 00fa9049112385f65ccdcad02b8712a32626d20c (diff) |
Convert remaining FunctionObject's to new constructor scheme
Change-Id: I440d5b128d0ee28566ebfa82c2505a4bd97bba6b
Reviewed-by: Simon Hausmann <[email protected]>
Diffstat (limited to 'src/qml')
22 files changed, 130 insertions, 141 deletions
diff --git a/src/qml/jsruntime/qv4argumentsobject_p.h b/src/qml/jsruntime/qv4argumentsobject_p.h index b32e935cb4..3b03008b69 100644 --- a/src/qml/jsruntime/qv4argumentsobject_p.h +++ b/src/qml/jsruntime/qv4argumentsobject_p.h @@ -51,6 +51,12 @@ namespace QV4 { struct ArgumentsGetterFunction: FunctionObject { struct Data : FunctionObject::Data { + Data(ExecutionContext *scope, uint index) + : FunctionObject::Data(scope) + , index(index) + { + setVTable(staticVTable()); + } uint index; }; struct { @@ -60,19 +66,18 @@ struct ArgumentsGetterFunction: FunctionObject uint index() const { return d()->index; } - ArgumentsGetterFunction(ExecutionContext *scope, uint index) - : FunctionObject(scope) - { - d()->index = index; - setVTable(staticVTable()); - } - static ReturnedValue call(Managed *that, CallData *d); }; struct ArgumentsSetterFunction: FunctionObject { struct Data : FunctionObject::Data { + Data(ExecutionContext *scope, uint index) + : FunctionObject::Data(scope) + , index(index) + { + setVTable(staticVTable()); + } uint index; }; struct { @@ -82,13 +87,6 @@ struct ArgumentsSetterFunction: FunctionObject uint index() const { return d()->index; } - ArgumentsSetterFunction(ExecutionContext *scope, uint index) - : FunctionObject(scope) - { - d()->index = index; - setVTable(staticVTable()); - } - static ReturnedValue call(Managed *that, CallData *callData); }; diff --git a/src/qml/jsruntime/qv4arrayobject.cpp b/src/qml/jsruntime/qv4arrayobject.cpp index 1b0a5bf723..6fba53a563 100644 --- a/src/qml/jsruntime/qv4arrayobject.cpp +++ b/src/qml/jsruntime/qv4arrayobject.cpp @@ -48,8 +48,8 @@ using namespace QV4; DEFINE_OBJECT_VTABLE(ArrayCtor); -ArrayCtor::ArrayCtor(ExecutionContext *scope) - : FunctionObject(scope, QStringLiteral("Array")) +ArrayCtor::Data::Data(ExecutionContext *scope) + : FunctionObject::Data(scope, QStringLiteral("Array")) { setVTable(staticVTable()); } diff --git a/src/qml/jsruntime/qv4arrayobject_p.h b/src/qml/jsruntime/qv4arrayobject_p.h index 341b7be581..97cffb398d 100644 --- a/src/qml/jsruntime/qv4arrayobject_p.h +++ b/src/qml/jsruntime/qv4arrayobject_p.h @@ -51,8 +51,11 @@ namespace QV4 { struct ArrayCtor: FunctionObject { + struct Data : FunctionObject::Data { + Data(ExecutionContext *scope); + }; + V4_OBJECT - ArrayCtor(ExecutionContext *scope); static ReturnedValue construct(Managed *m, CallData *callData); static ReturnedValue call(Managed *that, CallData *callData); diff --git a/src/qml/jsruntime/qv4booleanobject.cpp b/src/qml/jsruntime/qv4booleanobject.cpp index 305f80a415..38a0f7f549 100644 --- a/src/qml/jsruntime/qv4booleanobject.cpp +++ b/src/qml/jsruntime/qv4booleanobject.cpp @@ -46,8 +46,8 @@ using namespace QV4; DEFINE_OBJECT_VTABLE(BooleanCtor); DEFINE_OBJECT_VTABLE(BooleanObject); -BooleanCtor::BooleanCtor(ExecutionContext *scope) - : FunctionObject(scope, QStringLiteral("Boolean")) +BooleanCtor::Data::Data(ExecutionContext *scope) + : FunctionObject::Data(scope, QStringLiteral("Boolean")) { setVTable(staticVTable()); } diff --git a/src/qml/jsruntime/qv4booleanobject_p.h b/src/qml/jsruntime/qv4booleanobject_p.h index 3dc4a3d59e..3ff0569bc2 100644 --- a/src/qml/jsruntime/qv4booleanobject_p.h +++ b/src/qml/jsruntime/qv4booleanobject_p.h @@ -51,8 +51,11 @@ namespace QV4 { struct BooleanCtor: FunctionObject { + struct Data : FunctionObject::Data { + Data(ExecutionContext *scope); + }; + V4_OBJECT - BooleanCtor(ExecutionContext *scope); static ReturnedValue construct(Managed *, CallData *callData); static ReturnedValue call(Managed *that, CallData *callData); diff --git a/src/qml/jsruntime/qv4dateobject.cpp b/src/qml/jsruntime/qv4dateobject.cpp index b27d08eb8c..e14523deb9 100644 --- a/src/qml/jsruntime/qv4dateobject.cpp +++ b/src/qml/jsruntime/qv4dateobject.cpp @@ -657,8 +657,8 @@ QDateTime DateObject::toQDateTime() const DEFINE_OBJECT_VTABLE(DateCtor); -DateCtor::DateCtor(ExecutionContext *scope) - : FunctionObject(scope, QStringLiteral("Date")) +DateCtor::Data::Data(ExecutionContext *scope) + : FunctionObject::Data(scope, QStringLiteral("Date")) { setVTable(staticVTable()); } diff --git a/src/qml/jsruntime/qv4dateobject_p.h b/src/qml/jsruntime/qv4dateobject_p.h index 85e85e29ed..3e8bdc3edf 100644 --- a/src/qml/jsruntime/qv4dateobject_p.h +++ b/src/qml/jsruntime/qv4dateobject_p.h @@ -84,8 +84,10 @@ protected: struct DateCtor: FunctionObject { + struct Data : FunctionObject::Data { + Data(ExecutionContext *scope); + }; V4_OBJECT - DateCtor(ExecutionContext *scope); static ReturnedValue construct(Managed *, CallData *callData); static ReturnedValue call(Managed *that, CallData *); diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp index 1f7d7565e2..863f4b22f7 100644 --- a/src/qml/jsruntime/qv4engine.cpp +++ b/src/qml/jsruntime/qv4engine.cpp @@ -295,7 +295,7 @@ ExecutionEngine::ExecutionEngine(EvalISelFactory *factory) uint index; functionProtoClass = functionProtoClass->addMember(id_prototype, Attr_NotEnumerable, &index); Q_ASSERT(index == FunctionObject::Index_Prototype); - FunctionPrototype *functionPrototype = new (memoryManager) FunctionPrototype(functionProtoClass); + Scoped<FunctionPrototype> functionPrototype(scope, new (this) FunctionPrototype::Data(functionProtoClass)); functionClass = InternalClass::create(this, FunctionObject::staticVTable(), functionPrototype); functionClass = functionClass->addMember(id_prototype, Attr_NotEnumerable|Attr_NotConfigurable, &index); Q_ASSERT(index == FunctionObject::Index_Prototype); @@ -331,21 +331,21 @@ ExecutionEngine::ExecutionEngine(EvalISelFactory *factory) sequencePrototype = new (memoryManager) SequencePrototype(arrayClass); - objectCtor = new (memoryManager) ObjectCtor(rootContext); - stringCtor = new (memoryManager) StringCtor(rootContext); - numberCtor = new (memoryManager) NumberCtor(rootContext); - booleanCtor = new (memoryManager) BooleanCtor(rootContext); - arrayCtor = new (memoryManager) ArrayCtor(rootContext); + objectCtor = static_cast<HeapObject *>(new (this) ObjectCtor::Data(rootContext)); + stringCtor = static_cast<HeapObject *>(new (this) StringCtor::Data(rootContext)); + numberCtor = static_cast<HeapObject *>(new (this) NumberCtor::Data(rootContext)); + booleanCtor = static_cast<HeapObject *>(new (this) BooleanCtor::Data(rootContext)); + arrayCtor = static_cast<HeapObject *>(new (this) ArrayCtor::Data(rootContext)); functionCtor = static_cast<HeapObject *>(new (this) FunctionCtor::Data(rootContext)); - dateCtor = new (memoryManager) DateCtor(rootContext); - regExpCtor = new (memoryManager) RegExpCtor(rootContext); - errorCtor = new (memoryManager) ErrorCtor(rootContext); - evalErrorCtor = new (memoryManager) EvalErrorCtor(rootContext); - rangeErrorCtor = new (memoryManager) RangeErrorCtor(rootContext); - referenceErrorCtor = new (memoryManager) ReferenceErrorCtor(rootContext); - syntaxErrorCtor = new (memoryManager) SyntaxErrorCtor(rootContext); - typeErrorCtor = new (memoryManager) TypeErrorCtor(rootContext); - uRIErrorCtor = new (memoryManager) URIErrorCtor(rootContext); + dateCtor = static_cast<HeapObject *>(new (this) DateCtor::Data(rootContext)); + regExpCtor = static_cast<HeapObject *>(new (this) RegExpCtor::Data(rootContext)); + errorCtor = static_cast<HeapObject *>(new (this) ErrorCtor::Data(rootContext)); + evalErrorCtor = static_cast<HeapObject *>(new (this) EvalErrorCtor::Data(rootContext)); + rangeErrorCtor = static_cast<HeapObject *>(new (this) RangeErrorCtor::Data(rootContext)); + referenceErrorCtor = static_cast<HeapObject *>(new (this) ReferenceErrorCtor::Data(rootContext)); + syntaxErrorCtor = static_cast<HeapObject *>(new (this) SyntaxErrorCtor::Data(rootContext)); + typeErrorCtor = static_cast<HeapObject *>(new (this) TypeErrorCtor::Data(rootContext)); + uRIErrorCtor = static_cast<HeapObject *>(new (this) URIErrorCtor::Data(rootContext)); objectPrototype->init(this, objectCtor.asObject()); stringPrototype->init(this, stringCtor.asObject()); @@ -397,7 +397,8 @@ ExecutionEngine::ExecutionEngine(EvalISelFactory *factory) globalObject->defineReadonlyProperty(QStringLiteral("NaN"), Primitive::fromDouble(std::numeric_limits<double>::quiet_NaN())); globalObject->defineReadonlyProperty(QStringLiteral("Infinity"), Primitive::fromDouble(Q_INFINITY)); - evalFunction = new (memoryManager) EvalFunction(rootContext); + + evalFunction = Scoped<EvalFunction>(scope, new (this) EvalFunction::Data(rootContext)); globalObject->defineDefaultProperty(QStringLiteral("eval"), (o = evalFunction)); globalObject->defineDefaultProperty(QStringLiteral("parseInt"), GlobalFunctions::method_parseInt, 2); @@ -807,8 +808,8 @@ void ExecutionEngine::requireArgumentsAccessors(int n) delete [] oldAccessors; } for (int i = oldSize; i < nArgumentsAccessors; ++i) { - argumentsAccessors[i].value = Value::fromManaged(new (memoryManager) ArgumentsGetterFunction(rootContext, i)); - argumentsAccessors[i].set = Value::fromManaged(new (memoryManager) ArgumentsSetterFunction(rootContext, i)); + argumentsAccessors[i].value = ScopedValue(scope, new (scope.engine) ArgumentsGetterFunction::Data(rootContext, i)); + argumentsAccessors[i].set = ScopedValue(scope, new (scope.engine) ArgumentsSetterFunction::Data(rootContext, i)); } } } diff --git a/src/qml/jsruntime/qv4errorobject.cpp b/src/qml/jsruntime/qv4errorobject.cpp index 666353fa6e..03ad40e307 100644 --- a/src/qml/jsruntime/qv4errorobject.cpp +++ b/src/qml/jsruntime/qv4errorobject.cpp @@ -253,14 +253,14 @@ DEFINE_OBJECT_VTABLE(SyntaxErrorCtor); DEFINE_OBJECT_VTABLE(TypeErrorCtor); DEFINE_OBJECT_VTABLE(URIErrorCtor); -ErrorCtor::ErrorCtor(ExecutionContext *scope) - : FunctionObject(scope, QStringLiteral("Error")) +ErrorCtor::Data::Data(ExecutionContext *scope) + : FunctionObject::Data(scope, QStringLiteral("Error")) { setVTable(staticVTable()); } -ErrorCtor::ErrorCtor(ExecutionContext *scope, const QString &name) - : FunctionObject(scope, name) +ErrorCtor::Data::Data(ExecutionContext *scope, const QString &name) + : FunctionObject::Data(scope, name) { setVTable(staticVTable()); } @@ -277,8 +277,8 @@ ReturnedValue ErrorCtor::call(Managed *that, CallData *callData) return static_cast<Object *>(that)->construct(callData); } -EvalErrorCtor::EvalErrorCtor(ExecutionContext *scope) - : ErrorCtor(scope, QStringLiteral("EvalError")) +EvalErrorCtor::Data::Data(ExecutionContext *scope) + : ErrorCtor::Data(scope, QStringLiteral("EvalError")) { setVTable(staticVTable()); } @@ -290,8 +290,8 @@ ReturnedValue EvalErrorCtor::construct(Managed *m, CallData *callData) return (new (m->engine()->memoryManager) EvalErrorObject(m->engine(), v))->asReturnedValue(); } -RangeErrorCtor::RangeErrorCtor(ExecutionContext *scope) - : ErrorCtor(scope, QStringLiteral("RangeError")) +RangeErrorCtor::Data::Data(ExecutionContext *scope) + : ErrorCtor::Data(scope, QStringLiteral("RangeError")) { setVTable(staticVTable()); } @@ -303,8 +303,8 @@ ReturnedValue RangeErrorCtor::construct(Managed *m, CallData *callData) return (new (m->engine()->memoryManager) RangeErrorObject(scope.engine, v))->asReturnedValue(); } -ReferenceErrorCtor::ReferenceErrorCtor(ExecutionContext *scope) - : ErrorCtor(scope, QStringLiteral("ReferenceError")) +ReferenceErrorCtor::Data::Data(ExecutionContext *scope) + : ErrorCtor::Data(scope, QStringLiteral("ReferenceError")) { setVTable(staticVTable()); } @@ -316,8 +316,8 @@ ReturnedValue ReferenceErrorCtor::construct(Managed *m, CallData *callData) return (new (m->engine()->memoryManager) ReferenceErrorObject(scope.engine, v))->asReturnedValue(); } -SyntaxErrorCtor::SyntaxErrorCtor(ExecutionContext *scope) - : ErrorCtor(scope, QStringLiteral("SyntaxError")) +SyntaxErrorCtor::Data::Data(ExecutionContext *scope) + : ErrorCtor::Data(scope, QStringLiteral("SyntaxError")) { setVTable(staticVTable()); } @@ -329,8 +329,8 @@ ReturnedValue SyntaxErrorCtor::construct(Managed *m, CallData *callData) return (new (m->engine()->memoryManager) SyntaxErrorObject(scope.engine, v))->asReturnedValue(); } -TypeErrorCtor::TypeErrorCtor(ExecutionContext *scope) - : ErrorCtor(scope, QStringLiteral("TypeError")) +TypeErrorCtor::Data::Data(ExecutionContext *scope) + : ErrorCtor::Data(scope, QStringLiteral("TypeError")) { setVTable(staticVTable()); } @@ -342,8 +342,8 @@ ReturnedValue TypeErrorCtor::construct(Managed *m, CallData *callData) return (new (m->engine()->memoryManager) TypeErrorObject(scope.engine, v))->asReturnedValue(); } -URIErrorCtor::URIErrorCtor(ExecutionContext *scope) - : ErrorCtor(scope, QStringLiteral("URIError")) +URIErrorCtor::Data::Data(ExecutionContext *scope) + : ErrorCtor::Data(scope, QStringLiteral("URIError")) { setVTable(staticVTable()); } diff --git a/src/qml/jsruntime/qv4errorobject_p.h b/src/qml/jsruntime/qv4errorobject_p.h index 949ac3b3ae..2bfdd4972d 100644 --- a/src/qml/jsruntime/qv4errorobject_p.h +++ b/src/qml/jsruntime/qv4errorobject_p.h @@ -125,9 +125,12 @@ struct URIErrorObject: ErrorObject { struct ErrorCtor: FunctionObject { + struct Data : FunctionObject::Data { + Data(ExecutionContext *scope); + Data(ExecutionContext *scope, const QString &name); + }; + V4_OBJECT - ErrorCtor(ExecutionContext *scope); - ErrorCtor(ExecutionContext *scope, const QString &name); static ReturnedValue construct(Managed *, CallData *callData); static ReturnedValue call(Managed *that, CallData *callData); @@ -135,49 +138,60 @@ struct ErrorCtor: FunctionObject struct EvalErrorCtor: ErrorCtor { + struct Data : ErrorCtor::Data { + Data(ExecutionContext *scope); + }; V4_OBJECT - EvalErrorCtor(ExecutionContext *scope); - static ReturnedValue construct(Managed *m, CallData *callData); }; struct RangeErrorCtor: ErrorCtor { + struct Data : ErrorCtor::Data { + Data(ExecutionContext *scope); + }; V4_OBJECT - RangeErrorCtor(ExecutionContext *scope); static ReturnedValue construct(Managed *m, CallData *callData); }; struct ReferenceErrorCtor: ErrorCtor { + struct Data : ErrorCtor::Data { + Data(ExecutionContext *scope); + }; V4_OBJECT - ReferenceErrorCtor(ExecutionContext *scope); static ReturnedValue construct(Managed *m, CallData *callData); }; struct SyntaxErrorCtor: ErrorCtor { + struct Data : ErrorCtor::Data { + Data(ExecutionContext *scope); + }; V4_OBJECT - SyntaxErrorCtor(ExecutionContext *scope); static ReturnedValue construct(Managed *m, CallData *callData); }; struct TypeErrorCtor: ErrorCtor { + struct Data : ErrorCtor::Data { + Data(ExecutionContext *scope); + }; V4_OBJECT - TypeErrorCtor(ExecutionContext *scope); static ReturnedValue construct(Managed *m, CallData *callData); }; struct URIErrorCtor: ErrorCtor { + struct Data : ErrorCtor::Data { + Data(ExecutionContext *scope); + }; V4_OBJECT - URIErrorCtor(ExecutionContext *scope); static ReturnedValue construct(Managed *m, CallData *callData); }; diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp index c3b4860730..1cbc803ebd 100644 --- a/src/qml/jsruntime/qv4functionobject.cpp +++ b/src/qml/jsruntime/qv4functionobject.cpp @@ -112,48 +112,6 @@ FunctionObject::Data::Data(InternalClass *ic) memberData[Index_Prototype] = Encode::undefined(); } -FunctionObject::FunctionObject(ExecutionContext *scope, String *name, bool createProto) - : Object(scope->d()->engine->functionClass) -{ - d()->scope = scope; - d()->function = 0; - init(name, createProto); -} - -FunctionObject::FunctionObject(ExecutionContext *scope, const QString &name, bool createProto) - : Object(scope->d()->engine->functionClass) -{ - d()->scope = scope; - d()->function = 0; - - Scope s(scope); - ScopedValue protectThis(s, this); - ScopedString n(s, s.engine->newString(name)); - init(n.getPointer(), createProto); -} - -FunctionObject::FunctionObject(ExecutionContext *scope, const ReturnedValue name) - : Object(scope->d()->engine->functionClass) -{ - d()->scope = scope; - d()->function = 0; - - Scope s(scope); - ScopedValue protectThis(s, this); - ScopedString n(s, name); - init(n.getPointer(), false); -} - -FunctionObject::FunctionObject(InternalClass *ic) - : Object(ic) -{ - d()->scope = ic->engine->rootContext; - d()->function = 0; - - d()->needsActivation = false; - d()->strictMode = false; - memberData()[Index_Prototype] = Encode::undefined(); -} FunctionObject::Data::~Data() { @@ -288,8 +246,10 @@ ReturnedValue FunctionCtor::call(Managed *that, CallData *callData) return construct(that, callData); } -FunctionPrototype::FunctionPrototype(InternalClass *ic) - : FunctionObject(ic) +DEFINE_OBJECT_VTABLE(FunctionPrototype); + +FunctionPrototype::Data::Data(InternalClass *ic) + : FunctionObject::Data(ic) { } diff --git a/src/qml/jsruntime/qv4functionobject_p.h b/src/qml/jsruntime/qv4functionobject_p.h index 970df4408e..16377aaac5 100644 --- a/src/qml/jsruntime/qv4functionobject_p.h +++ b/src/qml/jsruntime/qv4functionobject_p.h @@ -134,10 +134,6 @@ struct Q_QML_EXPORT FunctionObject: Object { unsigned int formalParameterCount() { return function() ? function()->compiledFunction->nFormals : 0; } unsigned int varCount() { return function() ? function()->compiledFunction->nLocals : 0; } - FunctionObject(ExecutionContext *scope, String *name, bool createProto = false); - FunctionObject(ExecutionContext *scope, const QString &name = QString(), bool createProto = false); - FunctionObject(ExecutionContext *scope, const ReturnedValue name); - void init(String *name, bool createProto); ReturnedValue newInstance(); @@ -162,9 +158,6 @@ struct Q_QML_EXPORT FunctionObject: Object { bool strictMode() const { return d()->strictMode; } bool bindingKeyFlag() const { return d()->bindingKeyFlag; } -protected: - FunctionObject(InternalClass *ic); - static void markObjects(Managed *that, ExecutionEngine *e); }; @@ -187,7 +180,11 @@ struct FunctionCtor: FunctionObject struct FunctionPrototype: FunctionObject { - FunctionPrototype(InternalClass *ic); + struct Data : FunctionObject::Data { + Data(InternalClass *ic); + }; + V4_OBJECT + void init(ExecutionEngine *engine, Object *ctor); static ReturnedValue method_toString(CallContext *ctx); diff --git a/src/qml/jsruntime/qv4globalobject.cpp b/src/qml/jsruntime/qv4globalobject.cpp index 1be9561193..fc4a097915 100644 --- a/src/qml/jsruntime/qv4globalobject.cpp +++ b/src/qml/jsruntime/qv4globalobject.cpp @@ -346,11 +346,13 @@ static QString decode(const QString &input, DecodeMode decodeMode, bool *ok) DEFINE_OBJECT_VTABLE(EvalFunction); -EvalFunction::EvalFunction(ExecutionContext *scope) - : FunctionObject(scope, scope->d()->engine->id_eval) +EvalFunction::Data::Data(ExecutionContext *scope) + : FunctionObject::Data(scope, scope->d()->engine->id_eval) { setVTable(staticVTable()); - defineReadonlyProperty(scope->d()->engine->id_length, Primitive::fromInt32(1)); + Scope s(scope); + ScopedFunctionObject f(s, this); + f->defineReadonlyProperty(s.engine->id_length, Primitive::fromInt32(1)); } ReturnedValue EvalFunction::evalCall(CallData *callData, bool directCall) diff --git a/src/qml/jsruntime/qv4globalobject_p.h b/src/qml/jsruntime/qv4globalobject_p.h index 63823acc19..d973adc847 100644 --- a/src/qml/jsruntime/qv4globalobject_p.h +++ b/src/qml/jsruntime/qv4globalobject_p.h @@ -50,8 +50,11 @@ namespace QV4 { struct Q_QML_EXPORT EvalFunction : FunctionObject { + struct Data : FunctionObject::Data { + Data(ExecutionContext *scope); + }; + V4_OBJECT - EvalFunction(ExecutionContext *scope); ReturnedValue evalCall(CallData *callData, bool directCall); diff --git a/src/qml/jsruntime/qv4numberobject.cpp b/src/qml/jsruntime/qv4numberobject.cpp index 1c8552cf03..f1bac1109a 100644 --- a/src/qml/jsruntime/qv4numberobject.cpp +++ b/src/qml/jsruntime/qv4numberobject.cpp @@ -51,8 +51,8 @@ using namespace QV4; DEFINE_OBJECT_VTABLE(NumberCtor); DEFINE_OBJECT_VTABLE(NumberObject); -NumberCtor::NumberCtor(ExecutionContext *scope) - : FunctionObject(scope, QStringLiteral("Number")) +NumberCtor::Data::Data(ExecutionContext *scope) + : FunctionObject::Data(scope, QStringLiteral("Number")) { setVTable(staticVTable()); } diff --git a/src/qml/jsruntime/qv4numberobject_p.h b/src/qml/jsruntime/qv4numberobject_p.h index 6a7b54e815..0a76159269 100644 --- a/src/qml/jsruntime/qv4numberobject_p.h +++ b/src/qml/jsruntime/qv4numberobject_p.h @@ -51,8 +51,10 @@ namespace QV4 { struct NumberCtor: FunctionObject { + struct Data : FunctionObject::Data { + Data(ExecutionContext *scope); + }; V4_OBJECT - NumberCtor(ExecutionContext *scope); static ReturnedValue construct(Managed *that, CallData *callData); static ReturnedValue call(Managed *, CallData *callData); diff --git a/src/qml/jsruntime/qv4objectproto.cpp b/src/qml/jsruntime/qv4objectproto.cpp index 5ac90dbf1d..6b8a19c7e6 100644 --- a/src/qml/jsruntime/qv4objectproto.cpp +++ b/src/qml/jsruntime/qv4objectproto.cpp @@ -74,8 +74,8 @@ using namespace QV4; DEFINE_OBJECT_VTABLE(ObjectCtor); -ObjectCtor::ObjectCtor(ExecutionContext *scope) - : FunctionObject(scope, QStringLiteral("Object")) +ObjectCtor::Data::Data(ExecutionContext *scope) + : FunctionObject::Data(scope, QStringLiteral("Object")) { setVTable(staticVTable()); } diff --git a/src/qml/jsruntime/qv4objectproto_p.h b/src/qml/jsruntime/qv4objectproto_p.h index 3f7c21ef2c..495fe3e755 100644 --- a/src/qml/jsruntime/qv4objectproto_p.h +++ b/src/qml/jsruntime/qv4objectproto_p.h @@ -51,8 +51,10 @@ namespace QV4 { struct ObjectCtor: FunctionObject { + struct Data : FunctionObject::Data { + Data(ExecutionContext *scope); + }; V4_OBJECT - ObjectCtor(ExecutionContext *scope); static ReturnedValue construct(Managed *that, CallData *callData); static ReturnedValue call(Managed *that, CallData *callData); diff --git a/src/qml/jsruntime/qv4regexpobject.cpp b/src/qml/jsruntime/qv4regexpobject.cpp index f7135d9608..6a592ee792 100644 --- a/src/qml/jsruntime/qv4regexpobject.cpp +++ b/src/qml/jsruntime/qv4regexpobject.cpp @@ -237,19 +237,19 @@ uint RegExpObject::flags() const DEFINE_OBJECT_VTABLE(RegExpCtor); -RegExpCtor::RegExpCtor(ExecutionContext *scope) - : FunctionObject(scope, QStringLiteral("RegExp")) +RegExpCtor::Data::Data(ExecutionContext *scope) + : FunctionObject::Data(scope, QStringLiteral("RegExp")) { setVTable(staticVTable()); clearLastMatch(); } -void RegExpCtor::clearLastMatch() +void RegExpCtor::Data::clearLastMatch() { - d()->lastMatch = Primitive::nullValue(); - d()->lastInput = engine()->id_empty; - d()->lastMatchStart = 0; - d()->lastMatchEnd = 0; + lastMatch = Primitive::nullValue(); + lastInput = internalClass->engine->id_empty; + lastMatchStart = 0; + lastMatchEnd = 0; } ReturnedValue RegExpCtor::construct(Managed *m, CallData *callData) @@ -379,7 +379,7 @@ ReturnedValue RegExpPrototype::method_exec(CallContext *ctx) const int result = r->value()->match(s, offset, matchOffsets); Scoped<RegExpCtor> regExpCtor(scope, ctx->d()->engine->regExpCtor); - regExpCtor->clearLastMatch(); + regExpCtor->d()->clearLastMatch(); if (result == -1) { r->lastIndexProperty(ctx)->value = Primitive::fromInt32(0); diff --git a/src/qml/jsruntime/qv4regexpobject_p.h b/src/qml/jsruntime/qv4regexpobject_p.h index 90ff8caf7d..238ce8a759 100644 --- a/src/qml/jsruntime/qv4regexpobject_p.h +++ b/src/qml/jsruntime/qv4regexpobject_p.h @@ -110,10 +110,12 @@ protected: struct RegExpCtor: FunctionObject { struct Data : FunctionObject::Data { + Data(ExecutionContext *scope); Value lastMatch; StringValue lastInput; int lastMatchStart; int lastMatchEnd; + void clearLastMatch(); }; struct { Value lastMatch; @@ -123,13 +125,11 @@ struct RegExpCtor: FunctionObject } __data; V4_OBJECT - RegExpCtor(ExecutionContext *scope); Value lastMatch() { return d()->lastMatch; } StringValue lastInput() { return d()->lastInput; } int lastMatchStart() { return d()->lastMatchStart; } int lastMatchEnd() { return d()->lastMatchEnd; } - void clearLastMatch(); static ReturnedValue construct(Managed *m, CallData *callData); static ReturnedValue call(Managed *that, CallData *callData); diff --git a/src/qml/jsruntime/qv4stringobject.cpp b/src/qml/jsruntime/qv4stringobject.cpp index 3969de35f9..c47e1ae5b9 100644 --- a/src/qml/jsruntime/qv4stringobject.cpp +++ b/src/qml/jsruntime/qv4stringobject.cpp @@ -173,8 +173,8 @@ void StringObject::markObjects(Managed *that, ExecutionEngine *e) DEFINE_OBJECT_VTABLE(StringCtor); -StringCtor::StringCtor(ExecutionContext *scope) - : FunctionObject(scope, QStringLiteral("String")) +StringCtor::Data::Data(ExecutionContext *scope) + : FunctionObject::Data(scope, QStringLiteral("String")) { setVTable(staticVTable()); } diff --git a/src/qml/jsruntime/qv4stringobject_p.h b/src/qml/jsruntime/qv4stringobject_p.h index 5999a4f30a..6656e297a5 100644 --- a/src/qml/jsruntime/qv4stringobject_p.h +++ b/src/qml/jsruntime/qv4stringobject_p.h @@ -76,8 +76,10 @@ protected: struct StringCtor: FunctionObject { + struct Data : FunctionObject::Data { + Data(ExecutionContext *scope); + }; V4_OBJECT - StringCtor(ExecutionContext *scope); static ReturnedValue construct(Managed *m, CallData *callData); static ReturnedValue call(Managed *that, CallData *callData); |