diff options
author | Lars Knoll <lars.knoll@qt.io> | 2017-11-07 13:45:28 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2017-11-15 18:47:03 +0000 |
commit | 1a3464f232e35a0570eb810022bb8326c846d24b (patch) | |
tree | cb39ec27fb5c24a007e2bfed41a3c166f1b05e47 /src/qml/jsruntime/qv4value_p.h | |
parent | ae1b7bf75705962f361b34a352094e7006ccde8a (diff) |
Optimize Value::toObject/toString
Change-Id: Iccfe50c967560deee9e2903bbe3a293b13fe8b48
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4value_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4value_p.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4value_p.h b/src/qml/jsruntime/qv4value_p.h index 0608252082..14ef62da36 100644 --- a/src/qml/jsruntime/qv4value_p.h +++ b/src/qml/jsruntime/qv4value_p.h @@ -428,10 +428,14 @@ public: QString toQStringNoThrow() const; QString toQString() const; Heap::String *toString(ExecutionEngine *e) const { + if (isString()) + return reinterpret_cast<Heap::String *>(m()); return toString(e, *this); } static Heap::String *toString(ExecutionEngine *e, Value val); Heap::Object *toObject(ExecutionEngine *e) const { + if (isObject()) + return reinterpret_cast<Heap::Object *>(m()); return toObject(e, *this); } static Heap::Object *toObject(ExecutionEngine *e, Value val); |