diff options
author | Lars Knoll <lars.knoll@qt.io> | 2017-08-27 22:04:46 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2017-08-28 13:20:12 +0000 |
commit | c11dbcca433158b454b2f3cd514fee3e6be8aa7c (patch) | |
tree | ff472f89d657da0632889042a9c2125945fbd44c /src/qml/jsruntime/qv4value_p.h | |
parent | f8864acdcb21f32f7872d4a3cde0a1922fea3147 (diff) |
Fix calling convention for some often used functions in QV4::Value
Calling a non inline memberfunction does force the this argument
onto the stack. Replacing those functions with static member
functions taking the object by Value avoids that problem and
allows the QV4::Value to be passed in registers.
Change-Id: I9cf1c220e1dc0f958b416a7216d9ba1ae79a4b3e
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 | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/qml/jsruntime/qv4value_p.h b/src/qml/jsruntime/qv4value_p.h index 3f7f7a09e1..c17caed8d6 100644 --- a/src/qml/jsruntime/qv4value_p.h +++ b/src/qml/jsruntime/qv4value_p.h @@ -413,14 +413,27 @@ public: inline int toInt32() const; inline unsigned int toUInt32() const; - bool toBoolean() const; + bool toBoolean() const { + if (integerCompatible()) + return static_cast<bool>(int_32()); + + return toBooleanImpl(*this); + } + static bool toBooleanImpl(Value val); double toInteger() const; inline double toNumber() const; - double toNumberImpl() const; + static double toNumberImpl(Value v); + double toNumberImpl() const { return toNumberImpl(*this); } QString toQStringNoThrow() const; QString toQString() const; - Heap::String *toString(ExecutionEngine *e) const; - Heap::Object *toObject(ExecutionEngine *e) const; + Heap::String *toString(ExecutionEngine *e) const { + return toString(e, *this); + } + static Heap::String *toString(ExecutionEngine *e, Value val); + Heap::Object *toObject(ExecutionEngine *e) const { + return toObject(e, *this); + } + static Heap::Object *toObject(ExecutionEngine *e, Value val); inline bool isPrimitive() const; inline bool tryIntegerConversion() { |