aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4context_p.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2017-08-13 19:43:24 +0200
committerErik Verbruggen <erik.verbruggen@qt.io>2017-08-18 10:02:28 +0000
commit8437954c1ca0e019831423dcc5847f45cd7368ad (patch)
treef1d51cb94796e2632a4191f1152ebbdb9727d3fa /src/qml/jsruntime/qv4context_p.h
parent661f9203c411b080fce6abf606ec8fb5c17a6bfe (diff)
Get rid of CallData in the ExecutionContext
Part 1, where the callData member is moved to CallContext. We'll get rid of it there in a subsequent commit. Change-Id: I6218992802133913f7766ebb3d2f47bd29f33907 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4context_p.h')
-rw-r--r--src/qml/jsruntime/qv4context_p.h37
1 files changed, 16 insertions, 21 deletions
diff --git a/src/qml/jsruntime/qv4context_p.h b/src/qml/jsruntime/qv4context_p.h
index d93511ba00..dfe0645f9d 100644
--- a/src/qml/jsruntime/qv4context_p.h
+++ b/src/qml/jsruntime/qv4context_p.h
@@ -103,7 +103,6 @@ namespace Heap {
struct QmlContext;
#define ExecutionContextMembers(class, Member) \
- Member(class, NoMark, CallData *, callData) \
Member(class, Pointer, ExecutionContext *, outer) \
Member(class, Pointer, Object *, activation) \
Member(class, NoMark, QV4::Function *, v4Function) \
@@ -137,12 +136,12 @@ V4_ASSERT_IS_TRIVIAL(ExecutionContext)
Q_STATIC_ASSERT(sizeof(ExecutionContext) == sizeof(Base) + sizeof(ExecutionContextData) + QT_POINTER_SIZE);
Q_STATIC_ASSERT(std::is_standard_layout<ExecutionContextData>::value);
-Q_STATIC_ASSERT(offsetof(ExecutionContextData, callData) == 0);
-Q_STATIC_ASSERT(offsetof(ExecutionContextData, outer) == offsetof(ExecutionContextData, callData) + QT_POINTER_SIZE);
+Q_STATIC_ASSERT(offsetof(ExecutionContextData, outer) == 0);
Q_STATIC_ASSERT(offsetof(ExecutionContextData, activation) == offsetof(ExecutionContextData, outer) + QT_POINTER_SIZE);
Q_STATIC_ASSERT(offsetof(ExecutionContextData, v4Function) == offsetof(ExecutionContextData, activation) + QT_POINTER_SIZE);
#define CallContextMembers(class, Member) \
+ Member(class, NoMark, CallData *, callData) \
Member(class, Pointer, FunctionObject *, function) \
Member(class, ValueArray, ValueArray, locals)
@@ -159,7 +158,8 @@ DECLARE_HEAP_OBJECT(CallContext, ExecutionContext) {
};
V4_ASSERT_IS_TRIVIAL(CallContext)
Q_STATIC_ASSERT(std::is_standard_layout<CallContextData>::value);
-Q_STATIC_ASSERT(offsetof(CallContextData, function) == 0);
+Q_STATIC_ASSERT(offsetof(CallContextData, callData) == 0);
+Q_STATIC_ASSERT(offsetof(CallContextData, function) == offsetof(CallContextData, callData) + QT_POINTER_SIZE);
Q_STATIC_ASSERT(offsetof(CallContextData, locals) == offsetof(CallContextData, function) + QT_POINTER_SIZE);
//### The following size check fails on Win8. With the ValueArray at the end of the
// CallContextMembers, it doesn't look very useful.
@@ -215,18 +215,6 @@ struct Q_QML_EXPORT ExecutionContext : public Managed
Function *getFunction() const;
- Value &thisObject() const {
- return d()->callData->thisObject;
- }
- int argc() const {
- return d()->callData->argc;
- }
- const Value *args() const {
- return d()->callData->args;
- }
- ReturnedValue argument(int i) const {
- return d()->callData->argument(i);
- }
};
struct Q_QML_EXPORT CallContext : public ExecutionContext
@@ -240,13 +228,20 @@ struct Q_QML_EXPORT CallContext : public ExecutionContext
Identifier * const *variables() const;
unsigned int variableCount() const;
- inline ReturnedValue argument(int i) const;
+ Value &thisObject() const {
+ return d()->callData->thisObject;
+ }
+ int argc() const {
+ return d()->callData->argc;
+ }
+ const Value *args() const {
+ return d()->callData->args;
+ }
+ ReturnedValue argument(int i) const {
+ return d()->callData->argument(i);
+ }
};
-inline ReturnedValue CallContext::argument(int i) const {
- return i < argc() ? args()[i].asReturnedValue() : Primitive::undefinedValue().asReturnedValue();
-}
-
struct CatchContext : public ExecutionContext
{
V4_MANAGED(CatchContext, ExecutionContext)