Title: [247281] trunk/Source/WebKit
- Revision
- 247281
- Author
- [email protected]
- Date
- 2019-07-09 14:49:21 -0700 (Tue, 09 Jul 2019)
Log Message
WKObject's minimum object alignment needs to be larger
https://bugs.webkit.org/show_bug.cgi?id=199523
Patch by Saagar Jha <[email protected]> on 2019-07-09
Reviewed by Alex Christensen.
WKObject's wrapped objects are currently constructed at addresses aligned to 8-byte boundaries, but some
classes have more stringent requirements. By querying std::aligned_storage for the alignment of an object
larger than anything we can construct, we should be able to satisfy alignment for any of WebKit's types.
* Shared/Cocoa/APIObject.mm: Use std::aligned_storage in conjunction with alignof to determine
minimumObjectAlignment, instead of hardcoding 8.
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (247280 => 247281)
--- trunk/Source/WebKit/ChangeLog 2019-07-09 21:45:05 UTC (rev 247280)
+++ trunk/Source/WebKit/ChangeLog 2019-07-09 21:49:21 UTC (rev 247281)
@@ -1,3 +1,17 @@
+2019-07-09 Saagar Jha <[email protected]>
+
+ WKObject's minimum object alignment needs to be larger
+ https://bugs.webkit.org/show_bug.cgi?id=199523
+
+ Reviewed by Alex Christensen.
+
+ WKObject's wrapped objects are currently constructed at addresses aligned to 8-byte boundaries, but some
+ classes have more stringent requirements. By querying std::aligned_storage for the alignment of an object
+ larger than anything we can construct, we should be able to satisfy alignment for any of WebKit's types.
+
+ * Shared/Cocoa/APIObject.mm: Use std::aligned_storage in conjunction with alignof to determine
+ minimumObjectAlignment, instead of hardcoding 8.
+
2019-07-09 Megan Gardner <[email protected]>
Don't strip out spaces for personalized Autocorrections
Modified: trunk/Source/WebKit/Shared/Cocoa/APIObject.mm (247280 => 247281)
--- trunk/Source/WebKit/Shared/Cocoa/APIObject.mm 2019-07-09 21:45:05 UTC (rev 247280)
+++ trunk/Source/WebKit/Shared/Cocoa/APIObject.mm 2019-07-09 21:49:21 UTC (rev 247281)
@@ -90,7 +90,7 @@
#import "_WKApplicationManifestInternal.h"
#endif
-static const size_t minimumObjectAlignment = 8;
+static const size_t minimumObjectAlignment = alignof(std::aligned_storage<std::numeric_limits<size_t>::max()>::type);
static_assert(minimumObjectAlignment >= alignof(void*), "Objects should always be at least pointer-aligned.");
static const size_t maximumExtraSpaceForAlignment = minimumObjectAlignment - alignof(void*);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes