diff options
| author | Lars Knoll <lars.knoll@qt.io> | 2017-08-05 00:15:44 +0200 |
|---|---|---|
| committer | Lars Knoll <lars.knoll@qt.io> | 2017-08-08 18:58:42 +0000 |
| commit | 99783cd6dec326058b8db345145b1f8f71cfb6f0 (patch) | |
| tree | c0daf2d2947cbd224a35f227cd41e79f1d0390cf /src/qml/jsruntime/qv4functionobject.cpp | |
| parent | f284d73ccece0490b4a227c788b9415a59a38d9c (diff) | |
Completely avoid intermediate scopes for simple functions
Change-Id: I1fe2ff987e79cf590ad5ad3fc520b17925f8b616
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, 6 insertions, 6 deletions
diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp index f09772115c..10118ea403 100644 --- a/src/qml/jsruntime/qv4functionobject.cpp +++ b/src/qml/jsruntime/qv4functionobject.cpp @@ -372,9 +372,9 @@ ReturnedValue ScriptFunction::construct(const Managed *that, CallData *callData) ScopedContext c(scope, f->scope()); ScopedValue result(scope); if (v4Function->canUseSimpleCall) - result = c->simpleCall(scope, callData, v4Function); + result = c->simpleCall(scope.engine, callData, v4Function); else - result = c->call(scope, callData, v4Function, f); + result = c->call(scope.engine, callData, v4Function, f); if (Q_UNLIKELY(v4->hasException)) return Encode::undefined(); @@ -394,12 +394,12 @@ ReturnedValue ScriptFunction::call(const Managed *that, CallData *callData) QV4::Function *v4Function = f->function(); Q_ASSERT(v4Function); - Scope scope(v4); - ScopedContext c(scope, f->scope()); + Value s = Value::fromHeapObject(f->scope()); + ExecutionContext *outer = static_cast<ExecutionContext *>(&s); if (v4Function->canUseSimpleCall) - return c->simpleCall(scope, callData, v4Function); + return outer->simpleCall(v4, callData, v4Function); else - return c->call(scope, callData, v4Function, f); + return outer->call(v4, callData, v4Function, f); } void Heap::ScriptFunction::init(QV4::ExecutionContext *scope, Function *function) |
