aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4context_p.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-11-03 15:23:05 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-11-09 02:01:17 +0100
commit412eb94de4cae754130ae855236420ebd5c42482 (patch)
tree901af6051691c65a96abe3f69fcd3d5fc57ff80a /src/qml/jsruntime/qv4context_p.h
parente367f75d7285d2bcd10cbb35d088c96f33c02aff (diff)
Simplify & speed up function calling
Get rid of the SimpleCallContext, instead simply use the CallContext data structure, but don't initialize the unused variables. Change-Id: I11b311986da180c62c815b516a2c55844156d0ab Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4context_p.h')
-rw-r--r--src/qml/jsruntime/qv4context_p.h29
1 files changed, 14 insertions, 15 deletions
diff --git a/src/qml/jsruntime/qv4context_p.h b/src/qml/jsruntime/qv4context_p.h
index de5b8f9530..9a7b9a61b2 100644
--- a/src/qml/jsruntime/qv4context_p.h
+++ b/src/qml/jsruntime/qv4context_p.h
@@ -62,6 +62,7 @@ struct Function;
};
struct CallContext;
+struct CallContext;
struct CatchContext;
struct WithContext;
@@ -114,7 +115,6 @@ struct Q_QML_EXPORT ExecutionContext
jitInstructionPointer = 0;
}
- CallContext *newCallContext(void *stackSpace, SafeValue *locals, FunctionObject *f, CallData *callData);
CallContext *newCallContext(FunctionObject *f, CallData *callData);
WithContext *newWithContext(ObjectRef with);
CatchContext *newCatchContext(const StringRef exceptionVarName, const ValueRef exceptionValue);
@@ -153,22 +153,23 @@ struct Q_QML_EXPORT ExecutionContext
inline const CallContext *asCallContext() const;
};
-struct SimpleCallContext : public ExecutionContext
+struct CallContext : public ExecutionContext
{
- void initSimpleCallContext(ExecutionEngine *engine);
FunctionObject *function;
int realArgumentCount;
+ SafeValue *locals;
+ Object *activation;
- inline ReturnedValue argument(int i);
-};
-
-struct CallContext : public SimpleCallContext
-{
+ void initSimpleCallContext(ExecutionEngine *engine, ExecutionContext *parent) {
+ initBaseContext(Type_SimpleCallContext, engine, parent);
+ function = 0;
+ locals = 0;
+ activation = 0;
+ }
void initQmlContext(ExecutionContext *parentContext, ObjectRef qml, QV4::FunctionObject *function);
- bool needsOwnArguments() const;
- SafeValue *locals;
- Object *activation;
+ inline ReturnedValue argument(int i);
+ bool needsOwnArguments() const;
};
struct GlobalContext : public ExecutionContext
@@ -195,19 +196,17 @@ struct WithContext : public ExecutionContext
inline CallContext *ExecutionContext::asCallContext()
{
- return type >= Type_CallContext ? static_cast<CallContext *>(this) : 0;
+ return type >= Type_SimpleCallContext ? static_cast<CallContext *>(this) : 0;
}
inline const CallContext *ExecutionContext::asCallContext() const
{
- return type >= Type_CallContext ? static_cast<const CallContext *>(this) : 0;
+ return type >= Type_SimpleCallContext ? static_cast<const CallContext *>(this) : 0;
}
/* Function *f, int argc */
#define requiredMemoryForExecutionContect(f, argc) \
sizeof(CallContext) + sizeof(Value) * (f->varCount + qMax((uint)argc, f->formalParameterCount)) + sizeof(CallData)
-#define requiredMemoryForExecutionContectSimple(f) \
- sizeof(CallContext)
} // namespace QV4