diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-08-30 11:22:00 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-02 17:27:36 +0200 |
commit | 4dbb2ab600930d476a6f279dc73befdf56220359 (patch) | |
tree | ced1a9a71ad7e7b1679f2beed0ffe3051bb40477 /src | |
parent | 3bf081203e713330aa1e5e92bc8b30fcc420e228 (diff) |
Remove more usages of Object::setPrototype()
Change-Id: I33383baf14e764ce79252a100a6d769bde75331a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/qml/jsruntime/qv4engine.cpp | 14 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4engine_p.h | 8 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4functionobject.cpp | 17 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4jsonobject.cpp | 1 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4mathobject.cpp | 1 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4qobjectwrapper.cpp | 2 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4runtime.cpp | 1 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4sequenceobject.cpp | 6 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4variantobject.cpp | 3 | ||||
-rw-r--r-- | src/qml/qml/qqmlcontextwrapper.cpp | 2 | ||||
-rw-r--r-- | src/qml/qml/qqmllistwrapper.cpp | 1 | ||||
-rw-r--r-- | src/qml/qml/qqmltypewrapper.cpp | 2 | ||||
-rw-r--r-- | src/qml/qml/qqmlxmlhttprequest.cpp | 2 | ||||
-rw-r--r-- | src/qml/qml/v8/qqmlbuiltinfunctions.cpp | 2 | ||||
-rw-r--r-- | src/quick/items/context2d/qquickcontext2d.cpp | 1 |
15 files changed, 23 insertions, 40 deletions
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp index b7215d06a2..e6a4932c2d 100644 --- a/src/qml/jsruntime/qv4engine.cpp +++ b/src/qml/jsruntime/qv4engine.cpp @@ -136,7 +136,7 @@ ExecutionEngine::ExecutionEngine(QQmlJS::EvalISelFactory *factory) id_uintMax = newIdentifier(QStringLiteral("4294967295")); id_name = newIdentifier(QStringLiteral("name")); - objectPrototype = new (memoryManager) ObjectPrototype(emptyClass); + ObjectPrototype *objectPrototype = new (memoryManager) ObjectPrototype(emptyClass); objectClass = emptyClass->changePrototype(objectPrototype); arrayClass = objectClass->addMember(id_length, Attr_NotConfigurable|Attr_NotEnumerable); @@ -182,8 +182,11 @@ ExecutionEngine::ExecutionEngine(QQmlJS::EvalISelFactory *factory) URIErrorPrototype *uRIErrorPrototype = new (memoryManager) URIErrorPrototype(errorClass); uriErrorClass = emptyClass->changePrototype(uRIErrorPrototype); - variantPrototype = new (memoryManager) VariantPrototype(objectClass); - sequencePrototype = new (memoryManager) SequencePrototype(arrayClass->changePrototype(arrayPrototype)); + VariantPrototype *variantPrototype = new (memoryManager) VariantPrototype(objectClass); + variantClass = emptyClass->changePrototype(variantPrototype); + + SequencePrototype *sequencePrototype = new (memoryManager) SequencePrototype(arrayClass->changePrototype(arrayPrototype)); + sequenceClass = emptyClass->changePrototype(sequencePrototype); objectCtor = Value::fromObject(new (memoryManager) ObjectCtor(rootContext)); stringCtor = Value::fromObject(new (memoryManager) StringCtor(rootContext)); @@ -670,11 +673,6 @@ void ExecutionEngine::markObjects() typeErrorCtor.mark(); uRIErrorCtor.mark(); - objectPrototype->mark(); - - variantPrototype->mark(); - sequencePrototype->mark(); - if (m_qmlExtensions) m_qmlExtensions->markObjects(); diff --git a/src/qml/jsruntime/qv4engine_p.h b/src/qml/jsruntime/qv4engine_p.h index 21763ca898..5a399ebcd9 100644 --- a/src/qml/jsruntime/qv4engine_p.h +++ b/src/qml/jsruntime/qv4engine_p.h @@ -149,11 +149,6 @@ struct Q_QML_EXPORT ExecutionEngine Value typeErrorCtor; Value uRIErrorCtor; - ObjectPrototype *objectPrototype; - - VariantPrototype *variantPrototype; - SequencePrototype *sequencePrototype; - QQmlJS::MemoryPool classPool; InternalClass *emptyClass; InternalClass *objectClass; @@ -174,6 +169,9 @@ struct Q_QML_EXPORT ExecutionEngine InternalClass *argumentsObjectClass; InternalClass *strictArgumentsObjectClass; + InternalClass *variantClass; + InternalClass *sequenceClass; + EvalFunction *evalFunction; QVector<Property> argumentsAccessors; diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp index 94c4b81b40..ff59db350d 100644 --- a/src/qml/jsruntime/qv4functionobject.cpp +++ b/src/qml/jsruntime/qv4functionobject.cpp @@ -150,10 +150,11 @@ Value FunctionObject::construct(Managed *that, const CallData &) FunctionObject *f = static_cast<FunctionObject *>(that); ExecutionEngine *v4 = f->engine(); - Object *obj = v4->newObject(); + InternalClass *ic = v4->objectClass; Value proto = f->get(v4->id_prototype); if (proto.isObject()) - obj->setPrototype(proto.objectValue()); + ic = v4->emptyClass->changePrototype(proto.objectValue()); + Object *obj = v4->newObject(ic); return Value::fromObject(obj); } @@ -386,10 +387,12 @@ Value ScriptFunction::construct(Managed *that, const CallData &d) { ScriptFunction *f = static_cast<ScriptFunction *>(that); ExecutionEngine *v4 = f->engine(); - Object *obj = v4->newObject(); + + InternalClass *ic = v4->objectClass; Value proto = f->get(v4->id_prototype); if (proto.isObject()) - obj->setPrototype(proto.objectValue()); + ic = v4->emptyClass->changePrototype(proto.objectValue()); + Object *obj = v4->newObject(ic); ExecutionContext *context = v4->current; CallData dd = d; @@ -480,10 +483,12 @@ Value SimpleScriptFunction::construct(Managed *that, const CallData &d) { SimpleScriptFunction *f = static_cast<SimpleScriptFunction *>(that); ExecutionEngine *v4 = f->engine(); - Object *obj = v4->newObject(); + + InternalClass *ic = v4->objectClass; Value proto = f->get(v4->id_prototype); if (proto.isObject()) - obj->setPrototype(proto.objectValue()); + ic = v4->emptyClass->changePrototype(proto.objectValue()); + Object *obj = v4->newObject(ic); ExecutionContext *context = v4->current; void *stackSpace = alloca(requiredMemoryForExecutionContectSimple(f)); diff --git a/src/qml/jsruntime/qv4jsonobject.cpp b/src/qml/jsruntime/qv4jsonobject.cpp index 740f30f061..9c98d78743 100644 --- a/src/qml/jsruntime/qv4jsonobject.cpp +++ b/src/qml/jsruntime/qv4jsonobject.cpp @@ -861,7 +861,6 @@ JsonObject::JsonObject(ExecutionContext *context) : Object(context->engine) { type = Type_JSONObject; - setPrototype(context->engine->objectPrototype); defineDefaultProperty(context, QStringLiteral("parse"), method_parse, 2); defineDefaultProperty(context, QStringLiteral("stringify"), method_stringify, 3); diff --git a/src/qml/jsruntime/qv4mathobject.cpp b/src/qml/jsruntime/qv4mathobject.cpp index ac9833264a..0e7b32d429 100644 --- a/src/qml/jsruntime/qv4mathobject.cpp +++ b/src/qml/jsruntime/qv4mathobject.cpp @@ -54,7 +54,6 @@ MathObject::MathObject(ExecutionContext *ctx) : Object(ctx->engine) { type = Type_MathObject; - setPrototype(ctx->engine->objectPrototype); defineReadonlyProperty(ctx->engine, QStringLiteral("E"), Value::fromDouble(::exp(1.0))); defineReadonlyProperty(ctx->engine, QStringLiteral("LN2"), Value::fromDouble(::log(2.0))); diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp index 1c160edd7a..9e80c82165 100644 --- a/src/qml/jsruntime/qv4qobjectwrapper.cpp +++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp @@ -246,7 +246,6 @@ QObjectWrapper::QObjectWrapper(ExecutionEngine *engine, QObject *object) , m_object(object) { vtbl = &static_vtbl; - setPrototype(engine->objectPrototype); m_destroy = engine->newIdentifier(QStringLiteral("destroy")); m_toString = engine->newIdentifier(QStringLiteral("toString")); @@ -1759,7 +1758,6 @@ QmlSignalHandler::QmlSignalHandler(ExecutionEngine *engine, QObject *object, int , m_signalIndex(signalIndex) { vtbl = &static_vtbl; - setPrototype(engine->objectPrototype); } DEFINE_MANAGED_VTABLE(QmlSignalHandler); diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp index b1ae59f648..4f195670b2 100644 --- a/src/qml/jsruntime/qv4runtime.cpp +++ b/src/qml/jsruntime/qv4runtime.cpp @@ -1242,7 +1242,6 @@ void __qmljs_builtin_setup_arguments_object(ExecutionContext *ctx, Value *result assert(ctx->type >= ExecutionContext::Type_CallContext); CallContext *c = static_cast<CallContext *>(ctx); ArgumentsObject *args = new (c->engine->memoryManager) ArgumentsObject(c); - args->setPrototype(c->engine->objectPrototype); *result = Value::fromObject(args); } diff --git a/src/qml/jsruntime/qv4sequenceobject.cpp b/src/qml/jsruntime/qv4sequenceobject.cpp index cc5e2d626a..b7f7317c76 100644 --- a/src/qml/jsruntime/qv4sequenceobject.cpp +++ b/src/qml/jsruntime/qv4sequenceobject.cpp @@ -164,7 +164,7 @@ class QQmlSequence : public QV4::Object Q_MANAGED public: QQmlSequence(QV4::ExecutionEngine *engine, const Container &container) - : QV4::Object(engine) + : QV4::Object(engine->sequenceClass) , m_container(container) , m_object(0) , m_propertyIndex(-1) @@ -172,19 +172,17 @@ public: { type = Type_QmlSequence; vtbl = &static_vtbl; - setPrototype(engine->sequencePrototype); init(engine); } QQmlSequence(QV4::ExecutionEngine *engine, QObject *object, int propertyIndex) - : QV4::Object(engine) + : QV4::Object(engine->sequenceClass) , m_object(object) , m_propertyIndex(propertyIndex) , m_isReference(true) { type = Type_QmlSequence; vtbl = &static_vtbl; - setPrototype(engine->sequencePrototype); loadReference(); init(engine); } diff --git a/src/qml/jsruntime/qv4variantobject.cpp b/src/qml/jsruntime/qv4variantobject.cpp index 1989e3dcf5..574f612f74 100644 --- a/src/qml/jsruntime/qv4variantobject.cpp +++ b/src/qml/jsruntime/qv4variantobject.cpp @@ -60,12 +60,11 @@ VariantObject::VariantObject(InternalClass *ic) } VariantObject::VariantObject(ExecutionEngine *engine, const QVariant &value) - : Object(engine) + : Object(engine->variantClass) , ExecutionEngine::ScarceResourceData(value) , m_vmePropertyReferenceCount(0) { vtbl = &static_vtbl; - setPrototype(engine->variantPrototype); if (isScarce()) internalClass->engine->scarceResources.insert(this); } diff --git a/src/qml/qml/qqmlcontextwrapper.cpp b/src/qml/qml/qqmlcontextwrapper.cpp index 7c99bbcf9f..bd0b211403 100644 --- a/src/qml/qml/qqmlcontextwrapper.cpp +++ b/src/qml/qml/qqmlcontextwrapper.cpp @@ -78,7 +78,6 @@ QV4::Value QmlContextWrapper::qmlScope(QV8Engine *v8, QQmlContextData *ctxt, QOb ExecutionEngine *v4 = QV8Engine::getV4(v8); QmlContextWrapper *w = new (v4->memoryManager) QmlContextWrapper(v8, ctxt, scope); - w->setPrototype(v4->objectPrototype); return Value::fromObject(w); } @@ -93,7 +92,6 @@ QV4::Value QmlContextWrapper::urlScope(QV8Engine *v8, const QUrl &url) QmlContextWrapper *w = new (v4->memoryManager) QmlContextWrapper(v8, context, 0); w->isNullWrapper = true; - w->setPrototype(v4->objectPrototype); return Value::fromObject(w); } diff --git a/src/qml/qml/qqmllistwrapper.cpp b/src/qml/qml/qqmllistwrapper.cpp index 8b135f2ea9..1c1386d5b7 100644 --- a/src/qml/qml/qqmllistwrapper.cpp +++ b/src/qml/qml/qqmllistwrapper.cpp @@ -57,7 +57,6 @@ QmlListWrapper::QmlListWrapper(QV8Engine *engine) v8(engine) { vtbl = &static_vtbl; - setPrototype(QV8Engine::getV4(engine)->objectPrototype); } QmlListWrapper::~QmlListWrapper() diff --git a/src/qml/qml/qqmltypewrapper.cpp b/src/qml/qml/qqmltypewrapper.cpp index ab64fe1efb..33b8fb8e7a 100644 --- a/src/qml/qml/qqmltypewrapper.cpp +++ b/src/qml/qml/qqmltypewrapper.cpp @@ -93,7 +93,6 @@ Value QmlTypeWrapper::create(QV8Engine *v8, QObject *o, QQmlType *t, TypeNameMod ExecutionEngine *v4 = QV8Engine::getV4(v8); QmlTypeWrapper *w = new (v4->memoryManager) QmlTypeWrapper(v8); - w->setPrototype(v4->objectPrototype); w->mode = mode; w->object = o; w->type = t; return Value::fromObject(w); } @@ -107,7 +106,6 @@ Value QmlTypeWrapper::create(QV8Engine *v8, QObject *o, QQmlTypeNameCache *t, co ExecutionEngine *v4 = QV8Engine::getV4(v8); QmlTypeWrapper *w = new (v4->memoryManager) QmlTypeWrapper(v8); - w->setPrototype(v4->objectPrototype); w->mode = mode; w->object = o; w->typeNamespace = t; w->importNamespace = importNamespace; t->addref(); return Value::fromObject(w); diff --git a/src/qml/qml/qqmlxmlhttprequest.cpp b/src/qml/qml/qqmlxmlhttprequest.cpp index 2f93ad5582..211383ae58 100644 --- a/src/qml/qml/qqmlxmlhttprequest.cpp +++ b/src/qml/qml/qqmlxmlhttprequest.cpp @@ -893,7 +893,6 @@ Value NamedNodeMap::create(QV8Engine *engine, NodeImpl *data, const QList<NodeIm ExecutionEngine *v4 = QV8Engine::getV4(engine); NamedNodeMap *instance = new (v4->memoryManager) NamedNodeMap(v4, data, list); - instance->setPrototype(v4->objectPrototype); return Value::fromObject(instance); } @@ -935,7 +934,6 @@ Value NodeList::create(QV8Engine *engine, NodeImpl *data) QQmlXMLHttpRequestData *d = xhrdata(engine); ExecutionEngine *v4 = QV8Engine::getV4(engine); NodeList *instance = new (v4->memoryManager) NodeList(v4, data); - instance->setPrototype(v4->objectPrototype); return Value::fromObject(instance); } diff --git a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp index 35b0b84f46..8a636cdb99 100644 --- a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp +++ b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp @@ -1309,8 +1309,6 @@ Value QtObject::method_get_inputMethod(SimpleCallContext *ctx) QV4::ConsoleObject::ConsoleObject(ExecutionEngine *v4) : Object(v4) { - setPrototype(v4->objectPrototype); - defineDefaultProperty(v4, QStringLiteral("debug"), method_log); defineDefaultProperty(v4, QStringLiteral("log"), method_log); defineDefaultProperty(v4, QStringLiteral("info"), method_log); diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp index 7a95a1c425..84c4578946 100644 --- a/src/quick/items/context2d/qquickcontext2d.cpp +++ b/src/quick/items/context2d/qquickcontext2d.cpp @@ -544,7 +544,6 @@ public: QQuickJSContext2DPrototype(QV4::ExecutionEngine *engine) : QV4::Object(engine) { - setPrototype(engine->objectPrototype); defineDefaultProperty(engine, QStringLiteral("quadraticCurveTo"), method_quadraticCurveTo, 0); defineDefaultProperty(engine, QStringLiteral("restore"), method_restore, 0); defineDefaultProperty(engine, QStringLiteral("moveTo"), method_moveTo, 0); |