diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-06-23 23:47:25 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2018-07-02 19:29:52 +0000 |
commit | 32c33ee9abec1ef2f05233c3a613689431f6654b (patch) | |
tree | c5ddd9cae6019ffb052e104b2a24c528460fc01a /src/qml/jsruntime/qv4value_p.h | |
parent | f1703895e2fc9ec5da3a38a3ffef927a8f4ed86c (diff) |
Get rid of Value::asArrayIndex()
It was only used in a few places now, that can be replaced by
either using a PropertyKey, or by limiting the fast path
optimization in the runtime to array indices smaller than
INT_MAX. Since there are less branches this should even be
faster for pretty much all use cases.
Change-Id: Ib4f2f2f3e27f14ad180b810546e82ac83170b106
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4value_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4value_p.h | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/src/qml/jsruntime/qv4value_p.h b/src/qml/jsruntime/qv4value_p.h index ac0a52f7a8..7c9ca9c0bf 100644 --- a/src/qml/jsruntime/qv4value_p.h +++ b/src/qml/jsruntime/qv4value_p.h @@ -465,8 +465,6 @@ public: return static_cast<const T *>(managed()); } - inline uint asArrayIndex() const; - inline bool asArrayIndex(uint &idx) const; #ifndef V4_BOOTSTRAP uint asArrayLength(bool *ok) const; #endif @@ -553,36 +551,6 @@ inline double Value::toNumber() const return toNumberImpl(); } - -#ifndef V4_BOOTSTRAP -inline uint Value::asArrayIndex() const -{ - if (Q_LIKELY(isPositiveInt())) { - return (uint)int_32(); - } - if (Q_UNLIKELY(!isDouble())) - return UINT_MAX; - double d = doubleValue(); - uint idx = (uint)d; - if (idx == d) - return idx; - return UINT_MAX; -} - -inline bool Value::asArrayIndex(uint &idx) const -{ - if (Q_LIKELY(isPositiveInt())) { - idx = (uint)int_32(); - return true; - } - if (Q_UNLIKELY(!isDouble())) - return false; - double d = doubleValue(); - idx = (uint)d; - return (idx == d && idx != UINT_MAX); -} -#endif - inline ReturnedValue Heap::Base::asReturnedValue() const { |