diff options
author | Lars Knoll <lars.knoll@qt.io> | 2016-12-12 09:26:36 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2016-12-13 08:27:48 +0000 |
commit | 612ad6b08db2d96f6adad26c6b04d56b3bd01271 (patch) | |
tree | dd0c07396e11390f4c26114e082f12c7bee1daf7 /src/qml/jsruntime/qv4argumentsobject.cpp | |
parent | f893d66382549b4d1285ae98b66a1fdd4719036a (diff) |
Optimize Arguments Object
Avoid creation of the Array in most cases. Fix FunctionObject::method_apply
so that it correctly recognizes this case and does the right thing.
Add a getLength() method to ArgumentsObject to speed up the lookup of that
property.
Improves the RayTrace benchmark by around 15%.
Change-Id: I53eb34a1f9515e59a191ee6f0eb23a3f4c6882d1
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4argumentsobject.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4argumentsobject.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/qml/jsruntime/qv4argumentsobject.cpp b/src/qml/jsruntime/qv4argumentsobject.cpp index 74fcd30632..5a190d6690 100644 --- a/src/qml/jsruntime/qv4argumentsobject.cpp +++ b/src/qml/jsruntime/qv4argumentsobject.cpp @@ -57,8 +57,6 @@ void Heap::ArgumentsObject::init(QV4::CallContext *context) Scope scope(v4); Scoped<QV4::ArgumentsObject> args(scope, this); - args->setArrayType(Heap::ArrayData::Complex); - if (context->d()->strictMode) { Q_ASSERT(CalleePropertyIndex == args->internalClass()->find(context->d()->engine->id_callee())); Q_ASSERT(CallerPropertyIndex == args->internalClass()->find(context->d()->engine->id_caller())); @@ -246,3 +244,11 @@ void ArgumentsObject::markObjects(Heap::Base *that, ExecutionEngine *e) Object::markObjects(that, e); } + +uint ArgumentsObject::getLength(const Managed *m) +{ + const ArgumentsObject *a = static_cast<const ArgumentsObject *>(m); + if (a->propertyData(Heap::ArgumentsObject::LengthPropertyIndex)->isInteger()) + return a->propertyData(Heap::ArgumentsObject::LengthPropertyIndex)->integerValue(); + return Primitive::toUInt32(a->propertyData(Heap::ArgumentsObject::LengthPropertyIndex)->doubleValue()); +} |