Title: [274313] trunk/Source/WebCore
Revision
274313
Author
mark....@apple.com
Date
2021-03-11 16:56:28 -0800 (Thu, 11 Mar 2021)

Log Message

[BigSur wk1 arm64] platform/mac/fast/objc/longlongTest.html is a consistent failure.
https://bugs.webkit.org/show_bug.cgi?id=223051

Reviewed by Chris Dumez and Yusuke Suzuki.

The issue is that the test is expecting convertValueToObjcValue()'s conversion of
double to long long to follow x86_64 semantics.  I don't think there's a
specification for this behavior (falls under undefined behavior).  I'll just
change the code such that it emulates x86_64 behavior to placate the test.

Test covered by platform/mac/fast/objc/longlongTest.html.

* bridge/objc/objc_utility.mm:
(JSC::Bindings::convertDoubleToLongLong):
(JSC::Bindings::convertValueToObjcValue):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (274312 => 274313)


--- trunk/Source/WebCore/ChangeLog	2021-03-12 00:47:20 UTC (rev 274312)
+++ trunk/Source/WebCore/ChangeLog	2021-03-12 00:56:28 UTC (rev 274313)
@@ -1,3 +1,21 @@
+2021-03-11  Mark Lam  <mark....@apple.com>
+
+        [BigSur wk1 arm64] platform/mac/fast/objc/longlongTest.html is a consistent failure.
+        https://bugs.webkit.org/show_bug.cgi?id=223051
+
+        Reviewed by Chris Dumez and Yusuke Suzuki.
+
+        The issue is that the test is expecting convertValueToObjcValue()'s conversion of
+        double to long long to follow x86_64 semantics.  I don't think there's a
+        specification for this behavior (falls under undefined behavior).  I'll just
+        change the code such that it emulates x86_64 behavior to placate the test.
+
+        Test covered by platform/mac/fast/objc/longlongTest.html.
+
+        * bridge/objc/objc_utility.mm:
+        (JSC::Bindings::convertDoubleToLongLong):
+        (JSC::Bindings::convertValueToObjcValue):
+
 2021-03-11  Alexey Shvayka  <shvaikal...@gmail.com>
 
         Align JSGlobalObject::defineOwnProperty() with the spec and other runtimes

Modified: trunk/Source/WebCore/bridge/objc/objc_utility.mm (274312 => 274313)


--- trunk/Source/WebCore/bridge/objc/objc_utility.mm	2021-03-12 00:47:20 UTC (rev 274312)
+++ trunk/Source/WebCore/bridge/objc/objc_utility.mm	2021-03-12 00:56:28 UTC (rev 274313)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2004-2019 Apple Inc.  All rights reserved.
+ * Copyright (C) 2004-2021 Apple Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -76,6 +76,16 @@
     [], other       exception
 
 */
+
+static long long convertDoubleToLongLong(double d)
+{
+    // Ensure that non-x86_64 ports will match x86_64 semantics which allows for overflow.
+    long long potentiallyOverflowed = (unsigned long long)d;
+    if (potentiallyOverflowed < (long long)d)
+        return potentiallyOverflowed;
+    return (long long)d;
+}
+
 ObjcValue convertValueToObjcValue(JSGlobalObject* lexicalGlobalObject, JSValue value, ObjcValueType type)
 {
     ObjcValue result;
@@ -129,7 +139,7 @@
             break;
         case ObjcLongLongType:
         case ObjcUnsignedLongLongType:
-            result.longLongValue = (long long)d;
+            result.longLongValue = convertDoubleToLongLong(d);
             break;
         case ObjcFloatType:
             result.floatValue = (float)d;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to