Title: [287784] trunk/Source
Revision
287784
Author
[email protected]
Date
2022-01-07 14:45:01 -0800 (Fri, 07 Jan 2022)

Log Message

Adopt linkedOnOrAfter() in more places
https://bugs.webkit.org/show_bug.cgi?id=234951

Reviewed by Wenson Hsieh.

Source/_javascript_Core:

* API/JSWrapperMap.mm:
(supportsInitMethodConstructors):
* API/tests/testapi.cpp:
(TestAPI::promiseDrainDoesNotEatExceptions):
* API/tests/testapi.mm:
(testMicrotaskWithFunction):
* runtime/JSLock.cpp:
(JSC::JSLock::willReleaseLock):
* runtime/ObjectPrototype.cpp:
(JSC::isPokerBros):
Adopt linkedOnOrAfter.

Source/WTF:

* wtf/cocoa/LanguageCocoa.mm:
(WTF::canMinimizeLanguages):
Adopt linkedOnOrAfter and simplify.

* wtf/cocoa/RuntimeApplicationChecksCocoa.h:
The weird mismatch between the iOS and macOS values for FirstVersionThatSupportsInitConstructors
is correct; the iOS version was bumped in r202670.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/API/JSWrapperMap.mm (287783 => 287784)


--- trunk/Source/_javascript_Core/API/JSWrapperMap.mm	2022-01-07 22:22:38 UTC (rev 287783)
+++ trunk/Source/_javascript_Core/API/JSWrapperMap.mm	2022-01-07 22:45:01 UTC (rev 287784)
@@ -50,12 +50,7 @@
 #if PLATFORM(APPLETV)
 #else
 static constexpr int32_t firstJavaScriptCoreVersionWithInitConstructorSupport = 0x21A0400; // 538.4.0
-#if PLATFORM(IOS_FAMILY)
-static constexpr uint32_t firstSDKVersionWithInitConstructorSupport = DYLD_IOS_VERSION_10_0;
-#elif PLATFORM(MAC)
-static constexpr uint32_t firstSDKVersionWithInitConstructorSupport = 0xA0A00; // OSX 10.10.0
 #endif
-#endif
 
 @class JSObjCClassInfo;
 
@@ -702,21 +697,17 @@
     // There are no old clients on Apple TV, so there's no need for backwards compatibility.
     return true;
 #else
-    // First check to see the version of _javascript_Core we directly linked against.
-    static int32_t versionOfLinkTimeJavaScriptCore = 0;
-    if (!versionOfLinkTimeJavaScriptCore)
-        versionOfLinkTimeJavaScriptCore = NSVersionOfLinkTimeLibrary("_javascript_Core");
-    // Only do the link time version comparison if we linked directly with _javascript_Core
-    if (versionOfLinkTimeJavaScriptCore != -1)
-        return versionOfLinkTimeJavaScriptCore >= firstJavaScriptCoreVersionWithInitConstructorSupport;
+    static const bool supportsInitMethodConstructors = []() -> bool {
+        // First check to see the version of _javascript_Core we directly linked against.
+        int32_t versionOfLinkTimeJavaScriptCore = NSVersionOfLinkTimeLibrary("_javascript_Core");
 
-    // If we didn't link directly with _javascript_Core,
-    // base our check on what SDK was used to build the application.
-    static uint32_t programSDKVersion = 0;
-    if (!programSDKVersion)
-        programSDKVersion = applicationSDKVersion();
+        // Only do the link time version comparison if we linked directly with _javascript_Core
+        if (versionOfLinkTimeJavaScriptCore != -1)
+            return versionOfLinkTimeJavaScriptCore >= firstJavaScriptCoreVersionWithInitConstructorSupport;
 
-    return programSDKVersion >= firstSDKVersionWithInitConstructorSupport;
+        return linkedOnOrAfter(SDKVersion::FirstVersionThatSupportsInitConstructors);
+    }();
+    return supportsInitMethodConstructors;
 #endif
 }
 

Modified: trunk/Source/_javascript_Core/API/tests/testapi.cpp (287783 => 287784)


--- trunk/Source/_javascript_Core/API/tests/testapi.cpp	2022-01-07 22:22:38 UTC (rev 287783)
+++ trunk/Source/_javascript_Core/API/tests/testapi.cpp	2022-01-07 22:45:01 UTC (rev 287784)
@@ -617,16 +617,7 @@
 void TestAPI::promiseDrainDoesNotEatExceptions()
 {
 #if PLATFORM(COCOA)
-    bool useLegacyDrain = false;
-#if PLATFORM(MAC)
-    useLegacyDrain = applicationSDKVersion() < DYLD_MACOSX_VERSION_12_00;
-#elif PLATFORM(WATCH)
-        // Don't check, JSC isn't API on watch anyway.
-#elif PLATFORM(IOS_FAMILY)
-    useLegacyDrain = applicationSDKVersion() < DYLD_IOS_VERSION_15_0;
-#else
-#error "Unsupported Cocoa Platform"
-#endif
+    bool useLegacyDrain = !linkedOnOrAfter(SDKVersion::FirstThatDoesNotDrainTheMicrotaskQueueWhenCallingObjC);
     if (useLegacyDrain)
         return;
 #endif

Modified: trunk/Source/_javascript_Core/API/tests/testapi.mm (287783 => 287784)


--- trunk/Source/_javascript_Core/API/tests/testapi.mm	2022-01-07 22:22:38 UTC (rev 287783)
+++ trunk/Source/_javascript_Core/API/tests/testapi.mm	2022-01-07 22:45:01 UTC (rev 287784)
@@ -2738,16 +2738,7 @@
 {
     @autoreleasepool {
 #if PLATFORM(COCOA)
-        bool useLegacyDrain = false;
-#if PLATFORM(MAC)
-        useLegacyDrain = applicationSDKVersion() < DYLD_MACOSX_VERSION_12_00;
-#elif PLATFORM(WATCH)
-            // Don't check, JSC isn't API on watch anyway.
-#elif PLATFORM(IOS_FAMILY)
-        useLegacyDrain = applicationSDKVersion() < DYLD_IOS_VERSION_15_0;
-#else
-#error "Unsupported Cocoa Platform"
-#endif
+        bool useLegacyDrain = !linkedOnOrAfter(SDKVersion::FirstThatDoesNotDrainTheMicrotaskQueueWhenCallingObjC);
         if (useLegacyDrain)
             return;
 #endif

Modified: trunk/Source/_javascript_Core/ChangeLog (287783 => 287784)


--- trunk/Source/_javascript_Core/ChangeLog	2022-01-07 22:22:38 UTC (rev 287783)
+++ trunk/Source/_javascript_Core/ChangeLog	2022-01-07 22:45:01 UTC (rev 287784)
@@ -1,3 +1,22 @@
+2022-01-07  Tim Horton  <[email protected]>
+
+        Adopt linkedOnOrAfter() in more places
+        https://bugs.webkit.org/show_bug.cgi?id=234951
+
+        Reviewed by Wenson Hsieh.
+
+        * API/JSWrapperMap.mm:
+        (supportsInitMethodConstructors):
+        * API/tests/testapi.cpp:
+        (TestAPI::promiseDrainDoesNotEatExceptions):
+        * API/tests/testapi.mm:
+        (testMicrotaskWithFunction):
+        * runtime/JSLock.cpp:
+        (JSC::JSLock::willReleaseLock):
+        * runtime/ObjectPrototype.cpp:
+        (JSC::isPokerBros):
+        Adopt linkedOnOrAfter.
+
 2022-01-07  Alex Christensen  <[email protected]>
 
         Unreviewed, reverting r287698.

Modified: trunk/Source/_javascript_Core/runtime/JSLock.cpp (287783 => 287784)


--- trunk/Source/_javascript_Core/runtime/JSLock.cpp	2022-01-07 22:22:38 UTC (rev 287783)
+++ trunk/Source/_javascript_Core/runtime/JSLock.cpp	2022-01-07 22:45:01 UTC (rev 287784)
@@ -205,15 +205,7 @@
 #if PLATFORM(COCOA)
         static std::once_flag once;
         std::call_once(once, [] {
-#if PLATFORM(MAC)
-            useLegacyDrain = applicationSDKVersion() < DYLD_MACOSX_VERSION_12_00;
-#elif PLATFORM(WATCH)
-            // Don't check, JSC isn't API on watch anyway.
-#elif PLATFORM(IOS_FAMILY)
-            useLegacyDrain = applicationSDKVersion() < DYLD_IOS_VERSION_15_0;
-#else
-#error "Unsupported Cocoa Platform"
-#endif
+            useLegacyDrain = !linkedOnOrAfter(SDKVersion::FirstThatDoesNotDrainTheMicrotaskQueueWhenCallingObjC);
         });
 #endif
 

Modified: trunk/Source/_javascript_Core/runtime/ObjectPrototype.cpp (287783 => 287784)


--- trunk/Source/_javascript_Core/runtime/ObjectPrototype.cpp	2022-01-07 22:22:38 UTC (rev 287783)
+++ trunk/Source/_javascript_Core/runtime/ObjectPrototype.cpp	2022-01-07 22:45:01 UTC (rev 287784)
@@ -317,7 +317,7 @@
     auto bundleID = CFBundleGetIdentifier(CFBundleGetMainBundle());
     return bundleID
         && CFEqual(bundleID, CFSTR("com.kpgame.PokerBros"))
-        && applicationSDKVersion() < DYLD_IOS_VERSION_14_0;
+        && !linkedOnOrAfter(SDKVersion::FirstWithoutPokerBrosBuiltInTagQuirk);
 }
 #endif
 

Modified: trunk/Source/WTF/ChangeLog (287783 => 287784)


--- trunk/Source/WTF/ChangeLog	2022-01-07 22:22:38 UTC (rev 287783)
+++ trunk/Source/WTF/ChangeLog	2022-01-07 22:45:01 UTC (rev 287784)
@@ -1,3 +1,18 @@
+2022-01-07  Tim Horton  <[email protected]>
+
+        Adopt linkedOnOrAfter() in more places
+        https://bugs.webkit.org/show_bug.cgi?id=234951
+
+        Reviewed by Wenson Hsieh.
+
+        * wtf/cocoa/LanguageCocoa.mm:
+        (WTF::canMinimizeLanguages):
+        Adopt linkedOnOrAfter and simplify.
+
+        * wtf/cocoa/RuntimeApplicationChecksCocoa.h:
+        The weird mismatch between the iOS and macOS values for FirstVersionThatSupportsInitConstructors
+        is correct; the iOS version was bumped in r202670.
+
 2022-01-07  Alex Christensen  <[email protected]>
 
         Unreviewed, reverting r287698.

Modified: trunk/Source/WTF/wtf/cocoa/LanguageCocoa.mm (287783 => 287784)


--- trunk/Source/WTF/wtf/cocoa/LanguageCocoa.mm	2022-01-07 22:22:38 UTC (rev 287783)
+++ trunk/Source/WTF/wtf/cocoa/LanguageCocoa.mm	2022-01-07 22:45:01 UTC (rev 287784)
@@ -56,15 +56,7 @@
 bool canMinimizeLanguages()
 {
     static const bool result = []() -> bool {
-#if PLATFORM(MAC)
-        if (applicationSDKVersion() < DYLD_MACOSX_VERSION_10_15_4)
-            return false;
-#endif
-#if PLATFORM(IOS)
-        if (applicationSDKVersion() < DYLD_IOS_VERSION_13_4)
-            return false;
-#endif
-        return [NSLocale respondsToSelector:@selector(minimizedLanguagesFromLanguages:)];
+        return linkedOnOrAfter(SDKVersion::FirstThatMinimizesLanguages) && [NSLocale respondsToSelector:@selector(minimizedLanguagesFromLanguages:)];
     }();
     return result;
 }

Modified: trunk/Source/WTF/wtf/cocoa/RuntimeApplicationChecksCocoa.h (287783 => 287784)


--- trunk/Source/WTF/wtf/cocoa/RuntimeApplicationChecksCocoa.h	2022-01-07 22:22:38 UTC (rev 287783)
+++ trunk/Source/WTF/wtf/cocoa/RuntimeApplicationChecksCocoa.h	2022-01-07 22:45:01 UTC (rev 287784)
@@ -41,6 +41,7 @@
     FirstThatConvertsInvalidURLsToBlank = DYLD_IOS_VERSION_10_0,
     FirstWithoutTheSecretSocietyHiddenMysteryWindowOpenQuirk = DYLD_IOS_VERSION_10_0,
     FirstWithUnprefixedPlaysInlineAttribute = DYLD_IOS_VERSION_10_0,
+    FirstVersionThatSupportsInitConstructors = DYLD_IOS_VERSION_10_0,
     FirstWithExceptionsForDuplicateCompletionHandlerCalls = DYLD_IOS_VERSION_11_0,
     FirstWithExpiredOnlyReloadBehavior = DYLD_IOS_VERSION_11_0,
     FirstThatDisallowsSettingAnyXHRHeaderFromFileURLs = DYLD_IOS_VERSION_11_3,
@@ -65,11 +66,13 @@
     FirstWhereSiteSpecificQuirksAreEnabledByDefault = DYLD_IOS_VERSION_13_2,
     FirstThatRestrictsBaseURLSchemes = DYLD_IOS_VERSION_13_4,
     FirstThatSendsNativeMouseEvents = DYLD_IOS_VERSION_13_4,
+    FirstThatMinimizesLanguages = DYLD_IOS_VERSION_13_4,
     FirstWithSessionCleanupByDefault = DYLD_IOS_VERSION_14_0,
     FirstWithInitializeWebKit2MainThreadAssertion = DYLD_IOS_VERSION_14_0,
     FirstWithWKWebsiteDataStoreInitReturningNil = DYLD_IOS_VERSION_14_0,
     FirstWithWebSQLDisabledByDefaultInLegacyWebKit = DYLD_IOS_VERSION_14_0,
     FirstWithoutLaBanquePostaleQuirks = DYLD_IOS_VERSION_14_0,
+    FirstWithoutPokerBrosBuiltInTagQuirk = DYLD_IOS_VERSION_14_0,
     FirstVersionWithiOSAppsOnMacOS = DYLD_IOS_VERSION_14_2,
     FirstWithDataURLFragmentRemoval = DYLD_IOS_VERSION_14_5,
     FirstWithHTMLDocumentSupportedPropertyNames = DYLD_IOS_VERSION_14_5,
@@ -81,9 +84,11 @@
     FirstWithDOMWindowReuseRestriction  = DYLD_IOS_VERSION_15_0,
     FirstWithApplicationCacheDisabledByDefault = DYLD_IOS_VERSION_15_0,
     FirstWithoutExpandoIndexedPropertiesOnWindow = DYLD_IOS_VERSION_15_0,
+    FirstThatDoesNotDrainTheMicrotaskQueueWhenCallingObjC = DYLD_IOS_VERSION_15_0,
     FirstWithAuthorizationHeaderOnSameOriginRedirects = DYLD_IOS_VERSION_15_4,
     FirstForbiddingDotPrefixedFonts = DYLD_IOS_VERSION_16_0,
 #elif PLATFORM(MAC)
+    FirstVersionThatSupportsInitConstructors = 0xA0A00, // OS X 10.10
     FirstThatConvertsInvalidURLsToBlank = DYLD_MACOSX_VERSION_10_12,
     FirstWithExceptionsForDuplicateCompletionHandlerCalls = DYLD_MACOSX_VERSION_10_13,
     FirstWithDropToNavigateDisallowedByDefault = DYLD_MACOSX_VERSION_10_13,
@@ -97,17 +102,19 @@
     FirstWithDownloadDelegatesCalledOnTheMainThread = DYLD_MACOSX_VERSION_10_15,
     FirstWhereSiteSpecificQuirksAreEnabledByDefault = DYLD_MACOSX_VERSION_10_15_1,
     FirstThatRestrictsBaseURLSchemes = DYLD_MACOSX_VERSION_10_15_4,
+    FirstThatMinimizesLanguages = DYLD_MACOSX_VERSION_10_15_4,
     FirstWithSessionCleanupByDefault = DYLD_MACOSX_VERSION_10_16,
     FirstWithInitializeWebKit2MainThreadAssertion = DYLD_MACOSX_VERSION_10_16,
     FirstWithWKWebsiteDataStoreInitReturningNil = DYLD_MACOSX_VERSION_10_16,
     FirstWithDataURLFragmentRemoval = DYLD_MACOSX_VERSION_11_3,
     FirstWithHTMLDocumentSupportedPropertyNames = DYLD_MACOSX_VERSION_11_3,
-    FirstWithNullOriginForNonSpecialSchemedURLs = DYLD_MACOSX_VERSION_12_00,
-    FirstWithDOMWindowReuseRestriction = DYLD_MACOSX_VERSION_12_00,
     FirstWithBlankViewOnJSPrompt = DYLD_MACOSX_VERSION_11_3,
     FirstWithoutClientCertificateLookup = DYLD_MACOSX_VERSION_11_3,
     FirstThatDefaultsToPassiveWheelListenersOnDocument = DYLD_MACOSX_VERSION_11_3,
     FirstThatAllowsWheelEventGesturesToBecomeNonBlocking = DYLD_MACOSX_VERSION_11_3,
+    FirstWithNullOriginForNonSpecialSchemedURLs = DYLD_MACOSX_VERSION_12_00,
+    FirstWithDOMWindowReuseRestriction = DYLD_MACOSX_VERSION_12_00,
+    FirstThatDoesNotDrainTheMicrotaskQueueWhenCallingObjC = DYLD_MACOSX_VERSION_12_00,
     FirstWithApplicationCacheDisabledByDefault = DYLD_MACOSX_VERSION_12_00,
     FirstWithoutExpandoIndexedPropertiesOnWindow = DYLD_MACOSX_VERSION_12_00,
     FirstWithAuthorizationHeaderOnSameOriginRedirects = DYLD_MACOSX_VERSION_12_3,
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to