diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-09-18 17:01:59 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2018-09-23 17:27:43 +0000 |
commit | a97d118bf55e1c44ded9bbcd143b0f0725db8268 (patch) | |
tree | e0f22b61ba294199758eaf25c7e4f3c71bae7470 /src/qml/jsruntime/qv4engine.cpp | |
parent | 3440b8f9c5b198be4124ee1defd69d807bb972c6 (diff) |
Better inheritance structure for functions
Give Arrow functions their own representation. This also prepares
for further optimizations especially for the instanceof operator.
Change-Id: I1f70c0271169a237e1acdeb7fe855be957ba2ea5
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4engine.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4engine.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp index 672196dd3f..bf8a91f6e1 100644 --- a/src/qml/jsruntime/qv4engine.cpp +++ b/src/qml/jsruntime/qv4engine.cpp @@ -347,10 +347,11 @@ ExecutionEngine::ExecutionEngine(QJSEngine *jsEngine) ic = newInternalClass(FunctionObject::staticVTable(), functionPrototype()); classes[Class_FunctionObject] = ic->d(); ic = ic->addMember(id_name()->propertyKey(), Attr_ReadOnly, &index); - Q_ASSERT(index == Heap::ScriptFunction::Index_Name); - ic = ic->changeVTable(ScriptFunction::staticVTable()); + Q_ASSERT(index == Heap::ArrowFunction::Index_Name); ic = ic->addMember(id_length()->propertyKey(), Attr_ReadOnly_ButConfigurable, &index); - Q_ASSERT(index == Heap::ScriptFunction::Index_Length); + Q_ASSERT(index == Heap::ArrowFunction::Index_Length); + classes[Class_ArrowFunction] = ic->changeVTable(ArrowFunction::staticVTable()); + ic = ic->changeVTable(ScriptFunction::staticVTable()); classes[Class_ScriptFunction] = ic->d(); ic = ic->changeVTable(ConstructorFunction::staticVTable()); classes[Class_ConstructorFunction] = ic->d(); |