diff options
author | Lars Knoll <[email protected]> | 2013-11-14 11:08:41 +0100 |
---|---|---|
committer | The Qt Project <[email protected]> | 2013-11-22 14:54:12 +0100 |
commit | ce26bfcb3952dcd1238e7aa07b9ab1d9585c9871 (patch) | |
tree | e639703f38ff6b7a9407b7951f815ba9e2f11da8 /src/qml/jsruntime/qv4objectiterator.cpp | |
parent | 9bf5e87ef0abd3c4612baca66c79e2d33f8fbfb9 (diff) |
Speed up arguments object
Don't fully create the arguments object unless required.
In the 95% use case, we can avoid creating any array based
data structures for the arguments object and directly
manipulate the functions arguments. only create the full
data structure for the other 5%.
Speeds up the raytrace test by 50%, gives around 10% overall
on v8-bench.
Change-Id: If727d28b96585e83314f544031a6c3ca1817ea19
Reviewed-by: Simon Hausmann <[email protected]>
Diffstat (limited to 'src/qml/jsruntime/qv4objectiterator.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4objectiterator.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4objectiterator.cpp b/src/qml/jsruntime/qv4objectiterator.cpp index 62595b5176..04fa504991 100644 --- a/src/qml/jsruntime/qv4objectiterator.cpp +++ b/src/qml/jsruntime/qv4objectiterator.cpp @@ -42,6 +42,7 @@ #include "qv4object_p.h" #include "qv4stringobject_p.h" #include "qv4identifier_p.h" +#include "qv4argumentsobject_p.h" using namespace QV4; @@ -56,6 +57,11 @@ ObjectIterator::ObjectIterator(SafeObject *scratch1, SafeObject *scratch2, const object = o; current = o; tmpDynamicProperty.value = Primitive::undefinedValue(); + + if (object && object->isNonStrictArgumentsObject) { + Scope scope(object->engine()); + Scoped<ArgumentsObject> (scope, object->asReturnedValue())->fullyCreate(); + } } ObjectIterator::ObjectIterator(Scope &scope, const ObjectRef o, uint flags) @@ -69,6 +75,11 @@ ObjectIterator::ObjectIterator(Scope &scope, const ObjectRef o, uint flags) object = o; current = o; tmpDynamicProperty.value = Primitive::undefinedValue(); + + if (object && object->isNonStrictArgumentsObject) { + Scope scope(object->engine()); + Scoped<ArgumentsObject> (scope, object->asReturnedValue())->fullyCreate(); + } } Property *ObjectIterator::next(StringRef name, uint *index, PropertyAttributes *attrs) |