diff options
author | Lars Knoll <lars.knoll@qt.io> | 2016-12-09 10:47:57 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2016-12-11 17:00:29 +0000 |
commit | 4dd13bb4c3b8da79c7ae7f68d930cabff381ead0 (patch) | |
tree | 0fd13507bba269420dfb89e9d134065d2d8a4c7c /src/qml/jsruntime/qv4functionobject_p.h | |
parent | 8c322d89ee13f15141f3115dcb5ee9567270ba32 (diff) |
Get rid of SimpleScriptFunction
Now that the code paths are very similar, we can simply to the
check whether to do a fast or slow function call in
ScriptFunction::call/contruct. To make this fast, cache the
result of the required check in QV4::Function
Change-Id: I03085ca2beb83b1721b60b0d7b2ab4c9266d1e48
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4functionobject_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4functionobject_p.h | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/src/qml/jsruntime/qv4functionobject_p.h b/src/qml/jsruntime/qv4functionobject_p.h index 56e3cb92f7..ee11d3c07e 100644 --- a/src/qml/jsruntime/qv4functionobject_p.h +++ b/src/qml/jsruntime/qv4functionobject_p.h @@ -105,15 +105,12 @@ struct IndexedBuiltinFunction : FunctionObject { uint index; }; -struct SimpleScriptFunction : FunctionObject { +struct ScriptFunction : FunctionObject { enum { Index_Name = FunctionObject::Index_Prototype + 1, Index_Length }; - void init(QV4::ExecutionContext *scope, Function *function, bool createProto = true); -}; - -struct ScriptFunction : SimpleScriptFunction { + void init(QV4::ExecutionContext *scope, Function *function); }; struct BoundFunction : FunctionObject { @@ -149,7 +146,7 @@ struct Q_QML_EXPORT FunctionObject: Object { static void construct(const Managed *that, Scope &scope, CallData *); static void call(const Managed *that, Scope &scope, CallData *d); - static Heap::FunctionObject *createScriptFunction(ExecutionContext *scope, Function *function, bool createProto = true); + static Heap::FunctionObject *createScriptFunction(ExecutionContext *scope, Function *function); ReturnedValue protoProperty() const { return propertyData(Heap::FunctionObject::Index_Prototype)->asReturnedValue(); } @@ -222,9 +219,9 @@ void Heap::IndexedBuiltinFunction::init(QV4::ExecutionContext *scope, uint index } -struct SimpleScriptFunction: FunctionObject { - V4_OBJECT2(SimpleScriptFunction, FunctionObject) - V4_INTERNALCLASS(simpleScriptFunctionClass) +struct ScriptFunction : FunctionObject { + V4_OBJECT2(ScriptFunction, FunctionObject) + V4_INTERNALCLASS(scriptFunctionClass) static void construct(const Managed *, Scope &scope, CallData *callData); static void call(const Managed *that, Scope &scope, CallData *callData); @@ -232,13 +229,6 @@ struct SimpleScriptFunction: FunctionObject { Heap::Object *protoForConstructor() const; }; -struct ScriptFunction: SimpleScriptFunction { - V4_OBJECT2(ScriptFunction, FunctionObject) - - static void construct(const Managed *, Scope &scope, CallData *callData); - static void call(const Managed *that, Scope &scope, CallData *callData); -}; - struct BoundFunction: FunctionObject { V4_OBJECT2(BoundFunction, FunctionObject) |