aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4functionobject_p.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2014-03-05 08:40:11 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-07 16:55:12 +0100
commitb8ca4132433c2d1eef0a6cda8be8a1754786702b (patch)
tree4ace1513d0aaaa09b98bcc39f2a4fb2e08e0d59d /src/qml/jsruntime/qv4functionobject_p.h
parentf836b9837dda09c09c2ee3307300998ca5dff5c4 (diff)
Better way of retrieving the prototype property for FunctionObjects
Make sure FunctionObjects always have the prototype property at index 0. This way we can speed up the instanceOf operator even more, and at the same time save 16-28 bytes of memory per FunctionObject. Change-Id: I8527bc8f9dc7b04a9db8395b5f05bab47ddc21ce Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4functionobject_p.h')
-rw-r--r--src/qml/jsruntime/qv4functionobject_p.h18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/qml/jsruntime/qv4functionobject_p.h b/src/qml/jsruntime/qv4functionobject_p.h
index 3f432c2f26..a08dc603ff 100644
--- a/src/qml/jsruntime/qv4functionobject_p.h
+++ b/src/qml/jsruntime/qv4functionobject_p.h
@@ -116,10 +116,6 @@ struct Q_QML_EXPORT FunctionObject: Object {
unsigned int formalParameterCount() { return function ? function->compiledFunction->nFormals : 0; }
unsigned int varCount() { return function ? function->compiledFunction->nLocals : 0; }
Function *function;
- InternalClass *protoCacheClass;
- uint protoCacheIndex;
- ReturnedValue protoValue;
- InternalClass *classForConstructor;
FunctionObject(ExecutionContext *scope, const StringRef name, bool createProto = false);
FunctionObject(ExecutionContext *scope, const QString &name = QString(), bool createProto = false);
@@ -141,8 +137,7 @@ struct Q_QML_EXPORT FunctionObject: Object {
static FunctionObject *creatScriptFunction(ExecutionContext *scope, Function *function, bool createProto = true);
- ReturnedValue protoProperty();
- InternalClass *internalClassForConstructor();
+ ReturnedValue protoProperty() { return memberData[Index_Prototype].value.asReturnedValue(); }
protected:
FunctionObject(InternalClass *ic);
@@ -213,22 +208,25 @@ struct IndexedBuiltinFunction: FunctionObject
};
-struct ScriptFunction: FunctionObject {
+struct SimpleScriptFunction: FunctionObject {
V4_OBJECT
- ScriptFunction(ExecutionContext *scope, Function *function);
+ SimpleScriptFunction(ExecutionContext *scope, Function *function, bool createProto);
static ReturnedValue construct(Managed *, CallData *callData);
static ReturnedValue call(Managed *that, CallData *callData);
+
+ InternalClass *internalClassForConstructor();
};
-struct SimpleScriptFunction: FunctionObject {
+struct ScriptFunction: SimpleScriptFunction {
V4_OBJECT
- SimpleScriptFunction(ExecutionContext *scope, Function *function, bool createProto);
+ ScriptFunction(ExecutionContext *scope, Function *function);
static ReturnedValue construct(Managed *, CallData *callData);
static ReturnedValue call(Managed *that, CallData *callData);
};
+
struct BoundFunction: FunctionObject {
V4_OBJECT
FunctionObject *target;