aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4value_p.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2017-11-07 13:45:28 +0100
committerLars Knoll <lars.knoll@qt.io>2017-11-15 18:47:03 +0000
commit1a3464f232e35a0570eb810022bb8326c846d24b (patch)
treecb39ec27fb5c24a007e2bfed41a3c166f1b05e47 /src/qml/jsruntime/qv4value_p.h
parentae1b7bf75705962f361b34a352094e7006ccde8a (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.h4
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);