aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4mathobject.cpp
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@qt.io>2018-07-06 14:36:11 +0200
committerErik Verbruggen <erik.verbruggen@qt.io>2018-07-13 10:20:07 +0000
commit8fdfd9ff5ded388a3d29c917aebb795485abfbfd (patch)
treee9b614f90adbd7943a4c6190e8e1ba39cec37d40 /src/qml/jsruntime/qv4mathobject.cpp
parenteab3371b91a2a752a123c4995d977a36ff952168 (diff)
JS: Encode result of Math.min and Math.max as int when possible
So now Math.max(array1.length, array2.length) won't return a double anymore. This improves the score in the crypto benchmark by ~10% Change-Id: I8453a671d28d7f2a39ba74b18b3155f031d9b12f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4mathobject.cpp')
-rw-r--r--src/qml/jsruntime/qv4mathobject.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/qml/jsruntime/qv4mathobject.cpp b/src/qml/jsruntime/qv4mathobject.cpp
index 652f6c603e..e176235786 100644
--- a/src/qml/jsruntime/qv4mathobject.cpp
+++ b/src/qml/jsruntime/qv4mathobject.cpp
@@ -399,7 +399,7 @@ ReturnedValue MathObject::method_max(const FunctionObject *, const Value *, cons
if (x > mx || std::isnan(x))
mx = x;
}
- RETURN_RESULT(Encode(mx));
+ RETURN_RESULT(Encode::smallestNumber(mx));
}
ReturnedValue MathObject::method_min(const FunctionObject *, const Value *, const Value *argv, int argc)
@@ -412,7 +412,7 @@ ReturnedValue MathObject::method_min(const FunctionObject *, const Value *, cons
mx = x;
}
}
- RETURN_RESULT(Encode(mx));
+ RETURN_RESULT(Encode::smallestNumber(mx));
}
ReturnedValue MathObject::method_pow(const FunctionObject *, const Value *, const Value *argv, int argc)