diff options
author | Lars Knoll <lars.knoll@theqtcompany.com> | 2015-01-11 16:30:29 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@digia.com> | 2015-01-21 13:18:55 +0100 |
commit | 47fbcb47771a36ab9fd0a4d5ede7b7504ab1410d (patch) | |
tree | 57f058746bcc842e2dda628ab5daa5d3096fae71 /src/qml/jsruntime | |
parent | 36662b60b09f636c3623057f8116e862f94ff440 (diff) |
Get rid of all uses of Managed::engine()
Change-Id: I596f14554d81f5e9af9996294d96047f2e810bef
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime')
-rw-r--r-- | src/qml/jsruntime/qv4argumentsobject.cpp | 4 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4arraybuffer.cpp | 2 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4arrayobject.cpp | 2 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4booleanobject.cpp | 4 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4context_p.h | 2 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4dataview.cpp | 2 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4dateobject.cpp | 6 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4errorobject.cpp | 28 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4functionobject.cpp | 8 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4functionobject_p.h | 2 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4managed.cpp | 5 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4managed_p.h | 2 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4numberobject.cpp | 4 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4object.cpp | 16 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4objectproto.cpp | 10 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4qobjectwrapper.cpp | 4 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4regexpobject.cpp | 2 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4script.cpp | 2 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4stringobject.cpp | 11 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4typedarray.cpp | 9 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4value.cpp | 9 |
21 files changed, 66 insertions, 68 deletions
diff --git a/src/qml/jsruntime/qv4argumentsobject.cpp b/src/qml/jsruntime/qv4argumentsobject.cpp index 48e8bb67d4..5e002446ed 100644 --- a/src/qml/jsruntime/qv4argumentsobject.cpp +++ b/src/qml/jsruntime/qv4argumentsobject.cpp @@ -201,7 +201,7 @@ DEFINE_OBJECT_VTABLE(ArgumentsGetterFunction); ReturnedValue ArgumentsGetterFunction::call(Managed *getter, CallData *callData) { - ExecutionEngine *v4 = getter->engine(); + ExecutionEngine *v4 = static_cast<ArgumentsGetterFunction *>(getter)->engine(); Scope scope(v4); Scoped<ArgumentsGetterFunction> g(scope, static_cast<ArgumentsGetterFunction *>(getter)); Scoped<ArgumentsObject> o(scope, callData->thisObject.as<ArgumentsObject>()); @@ -216,7 +216,7 @@ DEFINE_OBJECT_VTABLE(ArgumentsSetterFunction); ReturnedValue ArgumentsSetterFunction::call(Managed *setter, CallData *callData) { - ExecutionEngine *v4 = setter->engine(); + ExecutionEngine *v4 = static_cast<ArgumentsSetterFunction *>(setter)->engine(); Scope scope(v4); Scoped<ArgumentsSetterFunction> s(scope, static_cast<ArgumentsSetterFunction *>(setter)); Scoped<ArgumentsObject> o(scope, callData->thisObject.as<ArgumentsObject>()); diff --git a/src/qml/jsruntime/qv4arraybuffer.cpp b/src/qml/jsruntime/qv4arraybuffer.cpp index 60ab527a42..5d2c95bed4 100644 --- a/src/qml/jsruntime/qv4arraybuffer.cpp +++ b/src/qml/jsruntime/qv4arraybuffer.cpp @@ -46,7 +46,7 @@ Heap::ArrayBufferCtor::ArrayBufferCtor(QV4::ExecutionContext *scope) ReturnedValue ArrayBufferCtor::construct(Managed *m, CallData *callData) { - ExecutionEngine *v4 = m->engine(); + ExecutionEngine *v4 = static_cast<Object *>(m)->engine(); Scope scope(v4); ScopedValue l(scope, callData->argument(0)); diff --git a/src/qml/jsruntime/qv4arrayobject.cpp b/src/qml/jsruntime/qv4arrayobject.cpp index 078b7fee70..6c677e856f 100644 --- a/src/qml/jsruntime/qv4arrayobject.cpp +++ b/src/qml/jsruntime/qv4arrayobject.cpp @@ -49,7 +49,7 @@ Heap::ArrayCtor::ArrayCtor(QV4::ExecutionContext *scope) ReturnedValue ArrayCtor::construct(Managed *m, CallData *callData) { - ExecutionEngine *v4 = m->engine(); + ExecutionEngine *v4 = static_cast<ArrayCtor *>(m)->engine(); Scope scope(v4); ScopedArrayObject a(scope, v4->newArrayObject()); uint len; diff --git a/src/qml/jsruntime/qv4booleanobject.cpp b/src/qml/jsruntime/qv4booleanobject.cpp index 0b3ae4e705..c606e37310 100644 --- a/src/qml/jsruntime/qv4booleanobject.cpp +++ b/src/qml/jsruntime/qv4booleanobject.cpp @@ -45,10 +45,10 @@ Heap::BooleanCtor::BooleanCtor(QV4::ExecutionContext *scope) ReturnedValue BooleanCtor::construct(Managed *m, CallData *callData) { - Scope scope(m->engine()); + Scope scope(static_cast<BooleanCtor *>(m)->engine()); bool n = callData->argc ? callData->args[0].toBoolean() : false; ScopedValue b(scope, QV4::Primitive::fromBoolean(n)); - return Encode(m->engine()->newBooleanObject(b)); + return Encode(scope.engine->newBooleanObject(b)); } ReturnedValue BooleanCtor::call(Managed *, CallData *callData) diff --git a/src/qml/jsruntime/qv4context_p.h b/src/qml/jsruntime/qv4context_p.h index 48319c7444..0b70677cb3 100644 --- a/src/qml/jsruntime/qv4context_p.h +++ b/src/qml/jsruntime/qv4context_p.h @@ -140,6 +140,8 @@ struct Q_QML_EXPORT ExecutionContext : public Managed V4_MANAGED(ExecutionContext, Managed) Q_MANAGED_TYPE(ExecutionContext) + ExecutionEngine *engine() const { return d()->engine; } + Heap::CallContext *newCallContext(FunctionObject *f, CallData *callData); Heap::WithContext *newWithContext(Object *with); Heap::CatchContext *newCatchContext(String *exceptionVarName, const ValueRef exceptionValue); diff --git a/src/qml/jsruntime/qv4dataview.cpp b/src/qml/jsruntime/qv4dataview.cpp index f50ce768ae..55a41a7c6c 100644 --- a/src/qml/jsruntime/qv4dataview.cpp +++ b/src/qml/jsruntime/qv4dataview.cpp @@ -48,7 +48,7 @@ Heap::DataViewCtor::DataViewCtor(QV4::ExecutionContext *scope) ReturnedValue DataViewCtor::construct(Managed *m, CallData *callData) { - Scope scope(m->engine()); + Scope scope(static_cast<Object *>(m)->engine()); Scoped<ArrayBuffer> buffer(scope, callData->argument(0)); if (!buffer) return scope.engine->throwTypeError(); diff --git a/src/qml/jsruntime/qv4dateobject.cpp b/src/qml/jsruntime/qv4dateobject.cpp index bfc97b12af..fde0818f0e 100644 --- a/src/qml/jsruntime/qv4dateobject.cpp +++ b/src/qml/jsruntime/qv4dateobject.cpp @@ -650,13 +650,13 @@ Heap::DateCtor::DateCtor(QV4::ExecutionContext *scope) ReturnedValue DateCtor::construct(Managed *m, CallData *callData) { + Scope scope(static_cast<DateCtor *>(m)->engine()); double t = 0; if (callData->argc == 0) t = currentTime(); else if (callData->argc == 1) { - Scope scope(m->engine()); ScopedValue arg(scope, callData->args[0]); if (DateObject *d = arg->asDateObject()) arg = d->date(); @@ -683,13 +683,13 @@ ReturnedValue DateCtor::construct(Managed *m, CallData *callData) t = TimeClip(UTC(t)); } - return Encode(m->engine()->newDateObject(Primitive::fromDouble(t))); + return Encode(scope.engine->newDateObject(Primitive::fromDouble(t))); } ReturnedValue DateCtor::call(Managed *m, CallData *) { double t = currentTime(); - return m->engine()->newString(ToString(t))->asReturnedValue(); + return static_cast<DateCtor *>(m)->engine()->newString(ToString(t))->asReturnedValue(); } void DatePrototype::init(ExecutionEngine *engine, Object *ctor) diff --git a/src/qml/jsruntime/qv4errorobject.cpp b/src/qml/jsruntime/qv4errorobject.cpp index bf966e5028..30c7fe188a 100644 --- a/src/qml/jsruntime/qv4errorobject.cpp +++ b/src/qml/jsruntime/qv4errorobject.cpp @@ -257,9 +257,9 @@ Heap::ErrorCtor::ErrorCtor(QV4::ExecutionContext *scope, const QString &name) ReturnedValue ErrorCtor::construct(Managed *m, CallData *callData) { - Scope scope(m->engine()); + Scope scope(static_cast<ErrorCtor *>(m)->engine()); ScopedValue v(scope, callData->argument(0)); - return Encode(m->engine()->newErrorObject(v)); + return Encode(scope.engine->newErrorObject(v)); } ReturnedValue ErrorCtor::call(Managed *that, CallData *callData) @@ -274,9 +274,9 @@ Heap::EvalErrorCtor::EvalErrorCtor(QV4::ExecutionContext *scope) ReturnedValue EvalErrorCtor::construct(Managed *m, CallData *callData) { - Scope scope(m->engine()); + Scope scope(static_cast<EvalErrorCtor *>(m)->engine()); ScopedValue v(scope, callData->argument(0)); - return (m->engine()->memoryManager->alloc<EvalErrorObject>(m->engine(), v))->asReturnedValue(); + return (scope.engine->memoryManager->alloc<EvalErrorObject>(scope.engine, v))->asReturnedValue(); } Heap::RangeErrorCtor::RangeErrorCtor(QV4::ExecutionContext *scope) @@ -286,9 +286,9 @@ Heap::RangeErrorCtor::RangeErrorCtor(QV4::ExecutionContext *scope) ReturnedValue RangeErrorCtor::construct(Managed *m, CallData *callData) { - Scope scope(m->engine()); + Scope scope(static_cast<RangeErrorCtor *>(m)->engine()); ScopedValue v(scope, callData->argument(0)); - return (m->engine()->memoryManager->alloc<RangeErrorObject>(scope.engine, v))->asReturnedValue(); + return (scope.engine->memoryManager->alloc<RangeErrorObject>(scope.engine, v))->asReturnedValue(); } Heap::ReferenceErrorCtor::ReferenceErrorCtor(QV4::ExecutionContext *scope) @@ -298,9 +298,9 @@ Heap::ReferenceErrorCtor::ReferenceErrorCtor(QV4::ExecutionContext *scope) ReturnedValue ReferenceErrorCtor::construct(Managed *m, CallData *callData) { - Scope scope(m->engine()); + Scope scope(static_cast<ReferenceErrorCtor *>(m)->engine()); ScopedValue v(scope, callData->argument(0)); - return (m->engine()->memoryManager->alloc<ReferenceErrorObject>(scope.engine, v))->asReturnedValue(); + return (scope.engine->memoryManager->alloc<ReferenceErrorObject>(scope.engine, v))->asReturnedValue(); } Heap::SyntaxErrorCtor::SyntaxErrorCtor(QV4::ExecutionContext *scope) @@ -310,9 +310,9 @@ Heap::SyntaxErrorCtor::SyntaxErrorCtor(QV4::ExecutionContext *scope) ReturnedValue SyntaxErrorCtor::construct(Managed *m, CallData *callData) { - Scope scope(m->engine()); + Scope scope(static_cast<SyntaxErrorCtor *>(m)->engine()); ScopedValue v(scope, callData->argument(0)); - return (m->engine()->memoryManager->alloc<SyntaxErrorObject>(scope.engine, v))->asReturnedValue(); + return (scope.engine->memoryManager->alloc<SyntaxErrorObject>(scope.engine, v))->asReturnedValue(); } Heap::TypeErrorCtor::TypeErrorCtor(QV4::ExecutionContext *scope) @@ -322,9 +322,9 @@ Heap::TypeErrorCtor::TypeErrorCtor(QV4::ExecutionContext *scope) ReturnedValue TypeErrorCtor::construct(Managed *m, CallData *callData) { - Scope scope(m->engine()); + Scope scope(static_cast<TypeErrorCtor *>(m)->engine()); ScopedValue v(scope, callData->argument(0)); - return (m->engine()->memoryManager->alloc<TypeErrorObject>(scope.engine, v))->asReturnedValue(); + return (scope.engine->memoryManager->alloc<TypeErrorObject>(scope.engine, v))->asReturnedValue(); } Heap::URIErrorCtor::URIErrorCtor(QV4::ExecutionContext *scope) @@ -334,9 +334,9 @@ Heap::URIErrorCtor::URIErrorCtor(QV4::ExecutionContext *scope) ReturnedValue URIErrorCtor::construct(Managed *m, CallData *callData) { - Scope scope(m->engine()); + Scope scope(static_cast<URIErrorCtor *>(m)->engine()); ScopedValue v(scope, callData->argument(0)); - return (m->engine()->memoryManager->alloc<URIErrorObject>(scope.engine, v))->asReturnedValue(); + return (scope.engine->memoryManager->alloc<URIErrorObject>(scope.engine, v))->asReturnedValue(); } void ErrorPrototype::init(ExecutionEngine *engine, Object *ctor, Object *obj) diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp index 5c5674d380..4f55929193 100644 --- a/src/qml/jsruntime/qv4functionobject.cpp +++ b/src/qml/jsruntime/qv4functionobject.cpp @@ -221,7 +221,7 @@ Heap::FunctionCtor::FunctionCtor(QV4::ExecutionContext *scope) // 15.3.2 ReturnedValue FunctionCtor::construct(Managed *that, CallData *callData) { - Scope scope(that->engine()); + Scope scope(static_cast<Object *>(that)->engine()); Scoped<FunctionCtor> f(scope, static_cast<FunctionCtor *>(that)); ScopedContext ctx(scope, scope.engine->currentContext()); QString arguments; @@ -393,7 +393,7 @@ Heap::ScriptFunction::ScriptFunction(QV4::ExecutionContext *scope, Function *fun ReturnedValue ScriptFunction::construct(Managed *that, CallData *callData) { - ExecutionEngine *v4 = that->engine(); + ExecutionEngine *v4 = static_cast<Object *>(that)->engine(); if (v4->hasException) return Encode::undefined(); CHECK_STACK_LIMITS(v4); @@ -425,7 +425,7 @@ ReturnedValue ScriptFunction::construct(Managed *that, CallData *callData) ReturnedValue ScriptFunction::call(Managed *that, CallData *callData) { - ExecutionEngine *v4 = that->engine(); + ExecutionEngine *v4 = static_cast<Object *>(that)->engine(); if (v4->hasException) return Encode::undefined(); CHECK_STACK_LIMITS(v4); @@ -475,7 +475,7 @@ Heap::SimpleScriptFunction::SimpleScriptFunction(QV4::ExecutionContext *scope, F ReturnedValue SimpleScriptFunction::construct(Managed *that, CallData *callData) { - ExecutionEngine *v4 = that->engine(); + ExecutionEngine *v4 = static_cast<Object *>(that)->engine(); if (v4->hasException) return Encode::undefined(); CHECK_STACK_LIMITS(v4); diff --git a/src/qml/jsruntime/qv4functionobject_p.h b/src/qml/jsruntime/qv4functionobject_p.h index c00597d469..b971ca6568 100644 --- a/src/qml/jsruntime/qv4functionobject_p.h +++ b/src/qml/jsruntime/qv4functionobject_p.h @@ -186,7 +186,7 @@ struct IndexedBuiltinFunction: FunctionObject static ReturnedValue construct(Managed *m, CallData *) { - return m->engine()->throwTypeError(); + return static_cast<IndexedBuiltinFunction *>(m)->engine()->throwTypeError(); } static ReturnedValue call(Managed *that, CallData *callData); diff --git a/src/qml/jsruntime/qv4managed.cpp b/src/qml/jsruntime/qv4managed.cpp index b783d70163..e2bbda82b6 100644 --- a/src/qml/jsruntime/qv4managed.cpp +++ b/src/qml/jsruntime/qv4managed.cpp @@ -56,11 +56,6 @@ const ManagedVTable Managed::static_vtbl = }; -ExecutionEngine *Managed::engine() const -{ - return internalClass()->engine; -} - QString Managed::className() const { const char *s = 0; diff --git a/src/qml/jsruntime/qv4managed_p.h b/src/qml/jsruntime/qv4managed_p.h index 99d6cdafbb..a23785837e 100644 --- a/src/qml/jsruntime/qv4managed_p.h +++ b/src/qml/jsruntime/qv4managed_p.h @@ -229,8 +229,6 @@ public: }; Q_MANAGED_TYPE(Invalid) - ExecutionEngine *engine() const; - template <typename T> T *as() { Q_ASSERT(internalClass()); diff --git a/src/qml/jsruntime/qv4numberobject.cpp b/src/qml/jsruntime/qv4numberobject.cpp index 67bf92d552..dcde8f13f3 100644 --- a/src/qml/jsruntime/qv4numberobject.cpp +++ b/src/qml/jsruntime/qv4numberobject.cpp @@ -52,10 +52,10 @@ Heap::NumberCtor::NumberCtor(QV4::ExecutionContext *scope) ReturnedValue NumberCtor::construct(Managed *m, CallData *callData) { - Scope scope(m->engine()); + Scope scope(static_cast<NumberCtor *>(m)->engine()); double dbl = callData->argc ? callData->args[0].toNumber() : 0.; ScopedValue d(scope, QV4::Primitive::fromDouble(dbl)); - return Encode(m->engine()->newNumberObject(d)); + return Encode(scope.engine->newNumberObject(d)); } ReturnedValue NumberCtor::call(Managed *, CallData *callData) diff --git a/src/qml/jsruntime/qv4object.cpp b/src/qml/jsruntime/qv4object.cpp index 020607a2d0..64cfc24724 100644 --- a/src/qml/jsruntime/qv4object.cpp +++ b/src/qml/jsruntime/qv4object.cpp @@ -367,12 +367,12 @@ bool Object::hasOwnProperty(uint index) const ReturnedValue Object::construct(Managed *m, CallData *) { - return m->engine()->throwTypeError(); + return static_cast<Object *>(m)->engine()->throwTypeError(); } ReturnedValue Object::call(Managed *m, CallData *) { - return m->engine()->throwTypeError(); + return static_cast<Object *>(m)->engine()->throwTypeError(); } ReturnedValue Object::get(Managed *m, String *name, bool *hasProperty) @@ -466,7 +466,7 @@ ReturnedValue Object::getLookup(Managed *m, Lookup *l) void Object::setLookup(Managed *m, Lookup *l, const ValueRef value) { - Scope scope(m->engine()); + Scope scope(static_cast<Object *>(m)->engine()); ScopedObject o(scope, static_cast<Object *>(m)); ScopedString name(scope, scope.engine->currentContext()->compilationUnit->runtimeStrings[l->nameIndex]); @@ -574,7 +574,7 @@ void Object::advanceIterator(Managed *m, ObjectIterator *it, Heap::String **name PropertyAttributes a = o->internalClass()->propertyData[it->memberIndex]; ++it->memberIndex; if (!(it->flags & ObjectIterator::EnumerableOnly) || a.isEnumerable()) { - *name = m->engine()->newString(n->string); + *name = o->engine()->newString(n->string); *attrs = a; pd->copy(p, a); return; @@ -1096,7 +1096,7 @@ void Object::copyArrayData(Object *other) uint Object::getLength(const Managed *m) { - Scope scope(m->engine()); + Scope scope(static_cast<const Object *>(m)->engine()); ScopedValue v(scope, static_cast<Object *>(const_cast<Managed *>(m))->get(scope.engine->id_length)); return v->toUInt32(); } @@ -1157,9 +1157,9 @@ Heap::ArrayObject::ArrayObject(ExecutionEngine *engine, const QStringList &list) ReturnedValue ArrayObject::getLookup(Managed *m, Lookup *l) { - Scope scope(m->engine()); - ScopedString name(scope, m->engine()->currentContext()->compilationUnit->runtimeStrings[l->nameIndex]); - if (name->equals(m->engine()->id_length)) { + Scope scope(static_cast<Object *>(m)->engine()); + ScopedString name(scope, scope.engine->currentContext()->compilationUnit->runtimeStrings[l->nameIndex]); + if (name->equals(scope.engine->id_length)) { // special case, as the property is on the object itself l->getter = Lookup::arrayLengthGetter; ArrayObject *a = static_cast<ArrayObject *>(m); diff --git a/src/qml/jsruntime/qv4objectproto.cpp b/src/qml/jsruntime/qv4objectproto.cpp index 8762935268..b1bc6ab5c0 100644 --- a/src/qml/jsruntime/qv4objectproto.cpp +++ b/src/qml/jsruntime/qv4objectproto.cpp @@ -56,9 +56,9 @@ Heap::ObjectCtor::ObjectCtor(QV4::ExecutionContext *scope) ReturnedValue ObjectCtor::construct(Managed *that, CallData *callData) { - ExecutionEngine *v4 = that->engine(); - Scope scope(v4); ObjectCtor *ctor = static_cast<ObjectCtor *>(that); + ExecutionEngine *v4 = ctor->engine(); + Scope scope(v4); if (!callData->argc || callData->args[0].isUndefined() || callData->args[0].isNull()) { ScopedObject obj(scope, v4->newObject()); ScopedObject proto(scope, ctor->get(v4->id_prototype)); @@ -71,9 +71,11 @@ ReturnedValue ObjectCtor::construct(Managed *that, CallData *callData) ReturnedValue ObjectCtor::call(Managed *m, CallData *callData) { + ObjectCtor *ctor = static_cast<ObjectCtor *>(m); + ExecutionEngine *v4 = ctor->engine(); if (!callData->argc || callData->args[0].isUndefined() || callData->args[0].isNull()) - return m->engine()->newObject()->asReturnedValue(); - return RuntimeHelpers::toObject(m->engine(), ValueRef(&callData->args[0])); + return v4->newObject()->asReturnedValue(); + return RuntimeHelpers::toObject(v4, ValueRef(&callData->args[0])); } void ObjectPrototype::init(ExecutionEngine *v4, Object *ctor) diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp index 1d6a89a647..e4c141c15d 100644 --- a/src/qml/jsruntime/qv4qobjectwrapper.cpp +++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp @@ -677,14 +677,14 @@ ReturnedValue QObjectWrapper::create(ExecutionEngine *engine, QObject *object) QV4::ReturnedValue QObjectWrapper::get(Managed *m, String *name, bool *hasProperty) { QObjectWrapper *that = static_cast<QObjectWrapper*>(m); - QQmlContextData *qmlContext = QV4::QmlContextWrapper::callingContext(m->engine()); + QQmlContextData *qmlContext = QV4::QmlContextWrapper::callingContext(that->engine()); return that->getQmlProperty(qmlContext, name, IgnoreRevision, hasProperty, /*includeImports*/ true); } void QObjectWrapper::put(Managed *m, String *name, const ValueRef value) { QObjectWrapper *that = static_cast<QObjectWrapper*>(m); - ExecutionEngine *v4 = m->engine(); + ExecutionEngine *v4 = that->engine(); if (v4->hasException || QQmlData::wasDeleted(that->d()->object)) return; diff --git a/src/qml/jsruntime/qv4regexpobject.cpp b/src/qml/jsruntime/qv4regexpobject.cpp index cd1d1563fa..b9d22794bb 100644 --- a/src/qml/jsruntime/qv4regexpobject.cpp +++ b/src/qml/jsruntime/qv4regexpobject.cpp @@ -239,7 +239,7 @@ void Heap::RegExpCtor::clearLastMatch() ReturnedValue RegExpCtor::construct(Managed *m, CallData *callData) { - Scope scope(m->engine()); + Scope scope(static_cast<Object *>(m)->engine()); ScopedContext ctx(scope, scope.engine->currentContext()); ScopedValue r(scope, callData->argument(0)); diff --git a/src/qml/jsruntime/qv4script.cpp b/src/qml/jsruntime/qv4script.cpp index f7afd004b9..9f49678a3e 100644 --- a/src/qml/jsruntime/qv4script.cpp +++ b/src/qml/jsruntime/qv4script.cpp @@ -124,7 +124,7 @@ Heap::QmlBindingWrapper::QmlBindingWrapper(QV4::ExecutionContext *scope, QV4::Ob ReturnedValue QmlBindingWrapper::call(Managed *that, CallData *) { - ExecutionEngine *engine = that->engine(); + ExecutionEngine *engine = static_cast<Object *>(that)->engine(); CHECK_STACK_LIMITS(engine); Scope scope(engine); diff --git a/src/qml/jsruntime/qv4stringobject.cpp b/src/qml/jsruntime/qv4stringobject.cpp index 5ce4b5b33c..aab1505832 100644 --- a/src/qml/jsruntime/qv4stringobject.cpp +++ b/src/qml/jsruntime/qv4stringobject.cpp @@ -105,13 +105,10 @@ Property *Heap::StringObject::getIndex(uint index) const bool StringObject::deleteIndexedProperty(Managed *m, uint index) { - ExecutionEngine *v4 = m->engine(); + ExecutionEngine *v4 = static_cast<StringObject *>(m)->engine(); Scope scope(v4); Scoped<StringObject> o(scope, m->asStringObject()); - if (!o) { - v4->throwTypeError(); - return false; - } + Q_ASSERT(!!o); if (index < static_cast<uint>(o->d()->value.stringValue()->toQString().length())) { if (v4->currentContext()->strictMode) @@ -166,7 +163,7 @@ Heap::StringCtor::StringCtor(QV4::ExecutionContext *scope) ReturnedValue StringCtor::construct(Managed *m, CallData *callData) { - ExecutionEngine *v4 = m->engine(); + ExecutionEngine *v4 = static_cast<Object *>(m)->engine(); Scope scope(v4); ScopedValue value(scope); if (callData->argc) @@ -178,7 +175,7 @@ ReturnedValue StringCtor::construct(Managed *m, CallData *callData) ReturnedValue StringCtor::call(Managed *m, CallData *callData) { - ExecutionEngine *v4 = m->engine(); + ExecutionEngine *v4 = static_cast<Object *>(m)->engine(); Scope scope(v4); ScopedValue value(scope); if (callData->argc) diff --git a/src/qml/jsruntime/qv4typedarray.cpp b/src/qml/jsruntime/qv4typedarray.cpp index 11b675646d..2277d37876 100644 --- a/src/qml/jsruntime/qv4typedarray.cpp +++ b/src/qml/jsruntime/qv4typedarray.cpp @@ -201,7 +201,7 @@ Heap::TypedArrayCtor::TypedArrayCtor(QV4::ExecutionContext *scope, TypedArray::T ReturnedValue TypedArrayCtor::construct(Managed *m, CallData *callData) { - Scope scope(m->engine()); + Scope scope(static_cast<Object *>(m)->engine()); Scoped<TypedArrayCtor> that(scope, static_cast<TypedArrayCtor *>(m)); if (!callData->argc || !callData->args[0].isObject()) { @@ -346,7 +346,7 @@ void TypedArray::markObjects(Heap::Base *that, ExecutionEngine *e) ReturnedValue TypedArray::getIndexed(Managed *m, uint index, bool *hasProperty) { - Scope scope(m->engine()); + Scope scope(static_cast<Object *>(m)->engine()); Scoped<TypedArray> a(scope, static_cast<TypedArray *>(m)); uint bytesPerElement = a->d()->type->bytesPerElement; @@ -363,10 +363,11 @@ ReturnedValue TypedArray::getIndexed(Managed *m, uint index, bool *hasProperty) void TypedArray::putIndexed(Managed *m, uint index, const ValueRef value) { - if (m->engine()->hasException) + ExecutionEngine *v4 = static_cast<Object *>(m)->engine(); + if (v4->hasException) return; - Scope scope(m->engine()); + Scope scope(v4); Scoped<TypedArray> a(scope, static_cast<TypedArray *>(m)); uint bytesPerElement = a->d()->type->bytesPerElement; diff --git a/src/qml/jsruntime/qv4value.cpp b/src/qml/jsruntime/qv4value.cpp index d1289bba7f..784628071b 100644 --- a/src/qml/jsruntime/qv4value.cpp +++ b/src/qml/jsruntime/qv4value.cpp @@ -88,7 +88,8 @@ double Value::toNumberImpl() const if (isString()) return RuntimeHelpers::stringToNumber(stringValue()->toQString()); { - Scope scope(managed()->engine()); + Q_ASSERT(isObject()); + Scope scope(objectValue()->engine()); ScopedValue prim(scope, RuntimeHelpers::toPrimitive(ValueRef::fromRawValue(this), NUMBER_HINT)); if (scope.engine->hasException) return 0; @@ -123,7 +124,8 @@ QString Value::toQStringNoThrow() const if (isString()) return stringValue()->toQString(); { - Scope scope(managed()->engine()); + Q_ASSERT(isObject()); + Scope scope(objectValue()->engine()); ScopedValue ex(scope); bool caughtException = false; ScopedValue prim(scope, RuntimeHelpers::toPrimitive(ValueRef::fromRawValue(this), STRING_HINT)); @@ -175,7 +177,8 @@ QString Value::toQString() const if (isString()) return stringValue()->toQString(); { - Scope scope(managed()->engine()); + Q_ASSERT(isObject()); + Scope scope(objectValue()->engine()); ScopedValue prim(scope, RuntimeHelpers::toPrimitive(ValueRef::fromRawValue(this), STRING_HINT)); return prim->toQString(); } |