diff options
author | Lars Knoll <lars.knoll@digia.com> | 2014-05-09 12:15:23 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2014-07-22 13:49:18 +0200 |
commit | dba56a752c932670c0e9461f106d2bc084276b6f (patch) | |
tree | 3a669663fa85dd3d61a83c29e8961b70ac53f046 /src/qml/jsruntime/qv4engine.cpp | |
parent | 00fa9049112385f65ccdcad02b8712a32626d20c (diff) | |
download | qtdeclarative-dba56a752c932670c0e9461f106d2bc084276b6f.tar.gz |
Convert remaining FunctionObject's to new constructor scheme
Change-Id: I440d5b128d0ee28566ebfa82c2505a4bd97bba6b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4engine.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4engine.cpp | 37 |
1 files changed, 19 insertions, 18 deletions
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)); } } } |