diff options
| author | Lars Knoll <lars.knoll@qt.io> | 2017-08-05 00:03:52 +0200 |
|---|---|---|
| committer | Lars Knoll <lars.knoll@qt.io> | 2017-08-08 18:58:37 +0000 |
| commit | f284d73ccece0490b4a227c788b9415a59a38d9c (patch) | |
| tree | 729d1b8ef68c941bdda322fa6dc3c17b62d1a69e /src/qml/jsruntime/qv4functionobject.cpp | |
| parent | 68a717a9cd5a5b092268eaddd3552becc55c74ab (diff) | |
Avoid creating a separate Scope in the ExecutionContextSaver
There's no reason this class should create a scope on it's own.
Change-Id: I93bddea8be42a908a1aca1bcb0ec867aae0d29f8
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4functionobject.cpp')
| -rw-r--r-- | src/qml/jsruntime/qv4functionobject.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp index 344c38ee79..f09772115c 100644 --- a/src/qml/jsruntime/qv4functionobject.cpp +++ b/src/qml/jsruntime/qv4functionobject.cpp @@ -360,14 +360,11 @@ ReturnedValue ScriptFunction::construct(const Managed *that, CallData *callData) CHECK_STACK_LIMITS(v4); Scope scope(v4); - ExecutionContextSaver ctxSaver(scope); - Scoped<ScriptFunction> f(scope, static_cast<const ScriptFunction *>(that)); InternalClass *ic = f->classForConstructor(); ScopedObject proto(scope, ic->prototype); - ScopedObject obj(scope, v4->newObject(ic, proto)); - callData->thisObject = obj.asReturnedValue(); + callData->thisObject = v4->newObject(ic, proto); QV4::Function *v4Function = f->function(); Q_ASSERT(v4Function); @@ -382,7 +379,7 @@ ReturnedValue ScriptFunction::construct(const Managed *that, CallData *callData) if (Q_UNLIKELY(v4->hasException)) return Encode::undefined(); else if (!result->isObject()) - return obj.asReturnedValue(); + return callData->thisObject.asReturnedValue(); return result->asReturnedValue(); } @@ -393,12 +390,11 @@ ReturnedValue ScriptFunction::call(const Managed *that, CallData *callData) return Encode::undefined(); CHECK_STACK_LIMITS(v4); - Scope scope(v4); - Scoped<ScriptFunction> f(scope, static_cast<const ScriptFunction *>(that)); - + const ScriptFunction *f = static_cast<const ScriptFunction *>(that); QV4::Function *v4Function = f->function(); Q_ASSERT(v4Function); + Scope scope(v4); ScopedContext c(scope, f->scope()); if (v4Function->canUseSimpleCall) return c->simpleCall(scope, callData, v4Function); |
