diff options
author | Lars Knoll <lars.knoll@theqtcompany.com> | 2015-08-24 16:47:48 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@theqtcompany.com> | 2015-09-15 19:12:40 +0000 |
commit | fb52dab6b41ddd6955cb14e1474f90ee5333dac9 (patch) | |
tree | a6cfe97160f1f9b1b48ba35977b13e6bdce52b47 /src/qml/jsruntime | |
parent | da705f4036356a3203957c2a7852fa396227fc78 (diff) |
Further cleanups
Reduce usage of ScopedContext.
Change-Id: I84a6a7478065de3398fd0b21596ca1308e78ceb3
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/qml/jsruntime')
-rw-r--r-- | src/qml/jsruntime/qv4engine.cpp | 4 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4functionobject.cpp | 6 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4object.cpp | 6 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4objectproto.cpp | 2 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4qobjectwrapper.cpp | 4 |
5 files changed, 11 insertions, 11 deletions
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp index 59962da1c3..58193fd68f 100644 --- a/src/qml/jsruntime/qv4engine.cpp +++ b/src/qml/jsruntime/qv4engine.cpp @@ -350,7 +350,7 @@ ExecutionEngine::ExecutionEngine(EvalISelFactory *factory) Scope scope(this); jsObjects[SequenceProto] = ScopedValue(scope, memoryManager->alloc<SequencePrototype>(arrayClass, arrayPrototype())); - ScopedContext global(scope, rootContext()); + ExecutionContext *global = rootContext(); jsObjects[Object_Ctor] = memoryManager->alloc<ObjectCtor>(global); jsObjects[String_Ctor] = memoryManager->alloc<StringCtor>(global); jsObjects[Number_Ctor] = memoryManager->alloc<NumberCtor>(global); @@ -927,7 +927,7 @@ void ExecutionEngine::requireArgumentsAccessors(int n) memcpy(argumentsAccessors, oldAccessors, oldSize*sizeof(Property)); delete [] oldAccessors; } - ScopedContext global(scope, scope.engine->rootContext()); + ExecutionContext *global = rootContext(); for (int i = oldSize; i < nArgumentsAccessors; ++i) { argumentsAccessors[i].value = ScopedValue(scope, memoryManager->alloc<ArgumentsGetterFunction>(global, i)); argumentsAccessors[i].set = ScopedValue(scope, memoryManager->alloc<ArgumentsSetterFunction>(global, i)); diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp index acb0342fc2..738d5728f2 100644 --- a/src/qml/jsruntime/qv4functionobject.cpp +++ b/src/qml/jsruntime/qv4functionobject.cpp @@ -210,7 +210,7 @@ Heap::FunctionObject *FunctionObject::createQmlFunction(QQmlContextData *qmlCont { ExecutionEngine *engine = QQmlEnginePrivate::getV4Engine(qmlContext->engine); QV4::Scope valueScope(engine); - ScopedContext global(valueScope, valueScope.engine->rootContext()); + ExecutionContext *global = valueScope.engine->rootContext(); QV4::Scoped<QmlContext> wrapperContext(valueScope, global->newQmlContext(qmlContext, scopeObject)); if (!signalParameters.isEmpty()) { @@ -299,7 +299,7 @@ ReturnedValue FunctionCtor::construct(const Managed *that, CallData *callData) QQmlRefPointer<CompiledData::CompilationUnit> compilationUnit = isel->compile(); Function *vmf = compilationUnit->linkToEngine(scope.engine); - ScopedContext global(scope, scope.engine->rootContext()); + ExecutionContext *global = scope.engine->rootContext(); return FunctionObject::createScriptFunction(global, vmf)->asReturnedValue(); } @@ -415,7 +415,7 @@ ReturnedValue FunctionPrototype::method_bind(CallContext *ctx) memcpy(boundArgs->data(), ctx->args() + 1, (ctx->argc() - 1)*sizeof(Value)); } - ScopedContext global(scope, scope.engine->rootContext()); + ExecutionContext *global = scope.engine->rootContext(); return BoundFunction::create(global, target, boundThis, boundArgs)->asReturnedValue(); } diff --git a/src/qml/jsruntime/qv4object.cpp b/src/qml/jsruntime/qv4object.cpp index 9bdb047e6e..1cb544d205 100644 --- a/src/qml/jsruntime/qv4object.cpp +++ b/src/qml/jsruntime/qv4object.cpp @@ -137,7 +137,7 @@ void Object::defineDefaultProperty(const QString &name, ReturnedValue (*code)(Ca ExecutionEngine *e = engine(); Scope scope(e); ScopedString s(scope, e->newIdentifier(name)); - ScopedContext global(scope, e->rootContext()); + ExecutionContext *global = e->rootContext(); ScopedFunctionObject function(scope, BuiltinFunction::create(global, s, code)); function->defineReadonlyProperty(e->id_length(), Primitive::fromInt32(argumentCount)); defineDefaultProperty(s, function); @@ -147,7 +147,7 @@ void Object::defineDefaultProperty(String *name, ReturnedValue (*code)(CallConte { ExecutionEngine *e = engine(); Scope scope(e); - ScopedContext global(scope, e->rootContext()); + ExecutionContext *global = e->rootContext(); ScopedFunctionObject function(scope, BuiltinFunction::create(global, name, code)); function->defineReadonlyProperty(e->id_length(), Primitive::fromInt32(argumentCount)); defineDefaultProperty(name, function); @@ -166,7 +166,7 @@ void Object::defineAccessorProperty(String *name, ReturnedValue (*getter)(CallCo ExecutionEngine *v4 = engine(); QV4::Scope scope(v4); ScopedProperty p(scope); - ScopedContext global(scope, scope.engine->rootContext()); + ExecutionContext *global = v4->rootContext(); p->setGetter(ScopedFunctionObject(scope, (getter ? BuiltinFunction::create(global, name, getter) : 0))); p->setSetter(ScopedFunctionObject(scope, (setter ? BuiltinFunction::create(global, name, setter) : 0))); insertMember(name, p, QV4::Attr_Accessor|QV4::Attr_NotConfigurable|QV4::Attr_NotEnumerable); diff --git a/src/qml/jsruntime/qv4objectproto.cpp b/src/qml/jsruntime/qv4objectproto.cpp index 3c6729c1fe..5183cbf033 100644 --- a/src/qml/jsruntime/qv4objectproto.cpp +++ b/src/qml/jsruntime/qv4objectproto.cpp @@ -108,7 +108,7 @@ void ObjectPrototype::init(ExecutionEngine *v4, Object *ctor) defineDefaultProperty(QStringLiteral("__defineGetter__"), method_defineGetter, 2); defineDefaultProperty(QStringLiteral("__defineSetter__"), method_defineSetter, 2); - ScopedContext global(scope, scope.engine->rootContext()); + ExecutionContext *global = v4->rootContext(); ScopedProperty p(scope); p->value = BuiltinFunction::create(global, v4->id___proto__(), method_get_proto); p->set = BuiltinFunction::create(global, v4->id___proto__(), method_set_proto); diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp index 7553e46e9b..f977b00bc3 100644 --- a/src/qml/jsruntime/qv4qobjectwrapper.cpp +++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp @@ -269,7 +269,7 @@ ReturnedValue QObjectWrapper::getQmlProperty(QQmlContextData *qmlContext, String if (name->equals(scope.engine->id_destroy()) || name->equals(scope.engine->id_toString())) { int index = name->equals(scope.engine->id_destroy()) ? QV4::QObjectMethod::DestroyMethod : QV4::QObjectMethod::ToStringMethod; - ScopedContext global(scope, scope.engine->rootContext()); + ExecutionContext *global = scope.engine->rootContext(); QV4::ScopedValue method(scope, QV4::QObjectMethod::create(global, d()->object, index)); if (hasProperty) *hasProperty = true; @@ -345,7 +345,7 @@ ReturnedValue QObjectWrapper::getProperty(ExecutionEngine *engine, QObject *obje return handler.asReturnedValue(); } else { - ScopedContext global(scope, scope.engine->rootContext()); + ExecutionContext *global = scope.engine->rootContext(); return QV4::QObjectMethod::create(global, object, property->coreIndex); } } |