aboutsummaryrefslogtreecommitdiffstats
path: root/qmljs_objects.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qmljs_objects.cpp')
-rw-r--r--qmljs_objects.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/qmljs_objects.cpp b/qmljs_objects.cpp
index 4f831b01bf..290a4f793c 100644
--- a/qmljs_objects.cpp
+++ b/qmljs_objects.cpp
@@ -487,6 +487,22 @@ Value EvalFunction::call(ExecutionContext *context, Value thisObject, Value *arg
ctx->leaveCallContext();
}
+/// isNaN [15.1.2.4]
+Value IsNaNFunction::call(ExecutionContext * /*context*/, Value /*thisObject*/, Value *args, int /*argc*/, bool /*strictMode*/)
+{
+ // TODO: see if we can generate code for this directly
+ const Value &v = args[0];
+ return Value::fromBoolean(v.isDouble() ? std::isnan(v.doubleValue()) : false);
+}
+
+/// isFinite [15.1.2.5]
+Value IsFiniteFunction::call(ExecutionContext * /*context*/, Value /*thisObject*/, Value *args, int /*argc*/, bool /*strictMode*/)
+{
+ // TODO: see if we can generate code for this directly
+ const Value &v = args[0];
+ return Value::fromBoolean(v.isDouble() ? std::isfinite(v.doubleValue()) : true);
+}
+
static inline bool protect(const void *addr, size_t size)
{
size_t pageSize = sysconf(_SC_PAGESIZE);