aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4lookup.cpp
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@qt.io>2016-06-22 10:12:13 +0200
committerErik Verbruggen <erik.verbruggen@qt.io>2016-06-22 11:07:05 +0000
commit702c4247d74ffb7e4fb1aaca96d70f4591203ba2 (patch)
tree6c0a41332cf4a8ab0051600efdd27b0746574795 /src/qml/jsruntime/qv4lookup.cpp
parentfd0e3c6d569a7410fff33974ce9f908dc2de0e22 (diff)
V4: Pass scope around as parameters inside the runtime.
The implementation of many (or all) runtime functions consist of first creating a QV4::Scope, which saves and restores the JS stack pointer. It also prevents tail-calls because of that restoring behavior. In many cases it suffices to do that at the entry-point of the runtime. The return value of a JS function call is now also stored in the scope. Previously, all return values were stored in a ScopedValue, got loaded on return, and immediately stored in another ScopedValue in the caller. This resulted in a lot of stores, where now there is only one store needed, and no extra ScopedValue for every function. Change-Id: I13d80fc0ce72c5702ef1536d41d12f710c5914fa Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4lookup.cpp')
-rw-r--r--src/qml/jsruntime/qv4lookup.cpp24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/qml/jsruntime/qv4lookup.cpp b/src/qml/jsruntime/qv4lookup.cpp
index 46e47307ef..42e561bc7c 100644
--- a/src/qml/jsruntime/qv4lookup.cpp
+++ b/src/qml/jsruntime/qv4lookup.cpp
@@ -451,7 +451,8 @@ ReturnedValue Lookup::getterAccessor0(Lookup *l, ExecutionEngine *engine, const
ScopedCallData callData(scope, 0);
callData->thisObject = object;
- return getter->call(callData);
+ getter->call(scope, callData);
+ return scope.result.asReturnedValue();
}
}
l->getter = getterFallback;
@@ -473,7 +474,8 @@ ReturnedValue Lookup::getterAccessor1(Lookup *l, ExecutionEngine *engine, const
ScopedCallData callData(scope, 0);
callData->thisObject = object;
- return getter->call(callData);
+ getter->call(scope, callData);
+ return scope.result.asReturnedValue();
}
}
l->getter = getterFallback;
@@ -498,7 +500,8 @@ ReturnedValue Lookup::getterAccessor2(Lookup *l, ExecutionEngine *engine, const
ScopedCallData callData(scope, 0);
callData->thisObject = object;
- return getter->call(callData);
+ getter->call(scope, callData);
+ return scope.result.asReturnedValue();
}
}
}
@@ -542,7 +545,8 @@ ReturnedValue Lookup::primitiveGetterAccessor0(Lookup *l, ExecutionEngine *engin
ScopedCallData callData(scope, 0);
callData->thisObject = object;
- return getter->call(callData);
+ getter->call(scope, callData);
+ return scope.result.asReturnedValue();
}
}
l->getter = getterGeneric;
@@ -562,7 +566,8 @@ ReturnedValue Lookup::primitiveGetterAccessor1(Lookup *l, ExecutionEngine *engin
ScopedCallData callData(scope, 0);
callData->thisObject = object;
- return getter->call(callData);
+ getter->call(scope, callData);
+ return scope.result.asReturnedValue();
}
}
l->getter = getterGeneric;
@@ -665,7 +670,8 @@ ReturnedValue Lookup::globalGetterAccessor0(Lookup *l, ExecutionEngine *engine)
ScopedCallData callData(scope, 0);
callData->thisObject = Primitive::undefinedValue();
- return getter->call(callData);
+ getter->call(scope, callData);
+ return scope.result.asReturnedValue();
}
l->globalGetter = globalGetterGeneric;
return globalGetterGeneric(l, engine);
@@ -683,7 +689,8 @@ ReturnedValue Lookup::globalGetterAccessor1(Lookup *l, ExecutionEngine *engine)
ScopedCallData callData(scope, 0);
callData->thisObject = Primitive::undefinedValue();
- return getter->call(callData);
+ getter->call(scope, callData);
+ return scope.result.asReturnedValue();
}
l->globalGetter = globalGetterGeneric;
return globalGetterGeneric(l, engine);
@@ -704,7 +711,8 @@ ReturnedValue Lookup::globalGetterAccessor2(Lookup *l, ExecutionEngine *engine)
ScopedCallData callData(scope, 0);
callData->thisObject = Primitive::undefinedValue();
- return getter->call(callData);
+ getter->call(scope, callData);
+ return scope.result.asReturnedValue();
}
}
}