Title: [237764] trunk/Source/_javascript_Core
Revision
237764
Author
keith_mil...@apple.com
Date
2018-11-02 18:52:35 -0700 (Fri, 02 Nov 2018)

Log Message

Assert JSValues can fit into a pointer when API casting
https://bugs.webkit.org/show_bug.cgi?id=191220

Reviewed by Michael Saboff.

* API/APICast.h:
(toJS):
(toJSForGC):
(toRef):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/API/APICast.h (237763 => 237764)


--- trunk/Source/_javascript_Core/API/APICast.h	2018-11-03 01:27:42 UTC (rev 237763)
+++ trunk/Source/_javascript_Core/API/APICast.h	2018-11-03 01:52:35 UTC (rev 237764)
@@ -79,6 +79,7 @@
     else
         result = jsCell;
 #else
+    static_assert(sizeof(OpaqueJSValue*) == sizeof(JSC::JSValue), "JSValue needs to fit into a boxed pointer");
     JSC::JSValue result = JSC::JSValue::decode(reinterpret_cast<JSC::EncodedJSValue>(const_cast<OpaqueJSValue*>(v)));
 #endif
     if (!result)
@@ -97,6 +98,7 @@
         return JSC::JSValue();
     JSC::JSValue result = jsCell;
 #else
+    static_assert(sizeof(OpaqueJSValue*) == sizeof(JSC::JSValue), "JSValue needs to fit into a boxed pointer");
     JSC::JSValue result = JSC::JSValue::decode(reinterpret_cast<JSC::EncodedJSValue>(const_cast<OpaqueJSValue*>(v)));
 #endif
     if (result && result.isCell())
@@ -138,6 +140,7 @@
         return reinterpret_cast<JSValueRef>(JSC::jsAPIValueWrapper(exec, v).asCell());
     return reinterpret_cast<JSValueRef>(v.asCell());
 #else
+    static_assert(sizeof(OpaqueJSValue*) == sizeof(JSC::JSValue), "JSValue needs to fit into a boxed pointer");
     UNUSED_PARAM(exec);
     return reinterpret_cast<JSValueRef>(JSC::JSValue::encode(v));
 #endif

Modified: trunk/Source/_javascript_Core/ChangeLog (237763 => 237764)


--- trunk/Source/_javascript_Core/ChangeLog	2018-11-03 01:27:42 UTC (rev 237763)
+++ trunk/Source/_javascript_Core/ChangeLog	2018-11-03 01:52:35 UTC (rev 237764)
@@ -1,3 +1,15 @@
+2018-11-02  Keith Miller  <keith_mil...@apple.com>
+
+        Assert JSValues can fit into a pointer when API casting
+        https://bugs.webkit.org/show_bug.cgi?id=191220
+
+        Reviewed by Michael Saboff.
+
+        * API/APICast.h:
+        (toJS):
+        (toJSForGC):
+        (toRef):
+
 2018-11-02  Michael Saboff  <msab...@apple.com>
 
         Rolling in r237753 with unreviewed build fix.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to