diff options
author | Erik Verbruggen <erik.verbruggen@qt.io> | 2016-12-01 15:23:01 +0100 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@qt.io> | 2016-12-01 14:51:47 +0000 |
commit | c4e248f101c3989bc06678c6b2089c49d0bf47d9 (patch) | |
tree | 88757a17e5b02d974453096a88e44f305e0036aa /src/qml/jsruntime | |
parent | 973bace494e6694c90dc3e52f7cb230a7d428ac0 (diff) |
Reorder CallData building for better gcc codegen
GCC6 with LTO will assume that the then-part is the common path. For
ArrayData-to-CallData "conversion" this is not the case, so reorder
that.
Change-Id: I856ef9b5747e9858a35f15a23159cf7c12fd75ef
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime')
-rw-r--r-- | src/qml/jsruntime/qv4functionobject.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp index 2521ff32e1..848b578dea 100644 --- a/src/qml/jsruntime/qv4functionobject.cpp +++ b/src/qml/jsruntime/qv4functionobject.cpp @@ -367,17 +367,18 @@ ReturnedValue FunctionPrototype::method_apply(CallContext *ctx) ScopedCallData callData(scope, len); if (len) { - if (arr->arrayType() != Heap::ArrayData::Simple || arr->protoHasArray()) { - for (quint32 i = 0; i < len; ++i) - callData->args[i] = arr->getIndexed(i); - } else { - uint alen = arr->arrayData() ? arr->arrayData()->len : 0; + if (arr->arrayType() == Heap::ArrayData::Simple && !arr->protoHasArray()) { + auto sad = static_cast<Heap::SimpleArrayData *>(arr->arrayData()); + uint alen = sad ? sad->len : 0; if (alen > len) alen = len; for (uint i = 0; i < alen; ++i) - callData->args[i] = static_cast<Heap::SimpleArrayData *>(arr->arrayData())->data(i); + callData->args[i] = sad->data(i); for (quint32 i = alen; i < len; ++i) callData->args[i] = Primitive::undefinedValue(); + } else { + for (quint32 i = 0; i < len; ++i) + callData->args[i] = arr->getIndexed(i); } } |