⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 287784 in webkit


Ignore:
Timestamp:
Jan 7, 2022, 2:45:01 PM (5 years ago)
Author:
timothy_horton@apple.com
Message:

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

Reviewed by Wenson Hsieh.

Source/JavaScriptCore:

  • 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.

Location:
trunk/Source
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/API/JSWrapperMap.mm

    r273194 r287784  
    5151#else
    5252static constexpr int32_t firstJavaScriptCoreVersionWithInitConstructorSupport = 0x21A0400; // 538.4.0
    53 #if PLATFORM(IOS_FAMILY)
    54 static constexpr uint32_t firstSDKVersionWithInitConstructorSupport = DYLD_IOS_VERSION_10_0;
    55 #elif PLATFORM(MAC)
    56 static constexpr uint32_t firstSDKVersionWithInitConstructorSupport = 0xA0A00; // OSX 10.10.0
    57 #endif
    5853#endif
    5954
     
    703698    return true;
    704699#else
    705     // First check to see the version of JavaScriptCore we directly linked against.
    706     static int32_t versionOfLinkTimeJavaScriptCore = 0;
    707     if (!versionOfLinkTimeJavaScriptCore)
    708         versionOfLinkTimeJavaScriptCore = NSVersionOfLinkTimeLibrary("JavaScriptCore");
    709     // Only do the link time version comparison if we linked directly with JavaScriptCore
    710     if (versionOfLinkTimeJavaScriptCore != -1)
    711         return versionOfLinkTimeJavaScriptCore >= firstJavaScriptCoreVersionWithInitConstructorSupport;
    712 
    713     // If we didn't link directly with JavaScriptCore,
    714     // base our check on what SDK was used to build the application.
    715     static uint32_t programSDKVersion = 0;
    716     if (!programSDKVersion)
    717         programSDKVersion = applicationSDKVersion();
    718 
    719     return programSDKVersion >= firstSDKVersionWithInitConstructorSupport;
     700    static const bool supportsInitMethodConstructors = []() -> bool {
     701        // First check to see the version of JavaScriptCore we directly linked against.
     702        int32_t versionOfLinkTimeJavaScriptCore = NSVersionOfLinkTimeLibrary("JavaScriptCore");
     703
     704        // Only do the link time version comparison if we linked directly with JavaScriptCore
     705        if (versionOfLinkTimeJavaScriptCore != -1)
     706            return versionOfLinkTimeJavaScriptCore >= firstJavaScriptCoreVersionWithInitConstructorSupport;
     707
     708        return linkedOnOrAfter(SDKVersion::FirstVersionThatSupportsInitConstructors);
     709    }();
     710    return supportsInitMethodConstructors;
    720711#endif
    721712}
  • trunk/Source/JavaScriptCore/API/tests/testapi.cpp

    r278888 r287784  
    618618{
    619619#if PLATFORM(COCOA)
    620     bool useLegacyDrain = false;
    621 #if PLATFORM(MAC)
    622     useLegacyDrain = applicationSDKVersion() < DYLD_MACOSX_VERSION_12_00;
    623 #elif PLATFORM(WATCH)
    624         // Don't check, JSC isn't API on watch anyway.
    625 #elif PLATFORM(IOS_FAMILY)
    626     useLegacyDrain = applicationSDKVersion() < DYLD_IOS_VERSION_15_0;
    627 #else
    628 #error "Unsupported Cocoa Platform"
    629 #endif
     620    bool useLegacyDrain = !linkedOnOrAfter(SDKVersion::FirstThatDoesNotDrainTheMicrotaskQueueWhenCallingObjC);
    630621    if (useLegacyDrain)
    631622        return;
  • trunk/Source/JavaScriptCore/API/tests/testapi.mm

    r287368 r287784  
    27392739    @autoreleasepool {
    27402740#if PLATFORM(COCOA)
    2741         bool useLegacyDrain = false;
    2742 #if PLATFORM(MAC)
    2743         useLegacyDrain = applicationSDKVersion() < DYLD_MACOSX_VERSION_12_00;
    2744 #elif PLATFORM(WATCH)
    2745             // Don't check, JSC isn't API on watch anyway.
    2746 #elif PLATFORM(IOS_FAMILY)
    2747         useLegacyDrain = applicationSDKVersion() < DYLD_IOS_VERSION_15_0;
    2748 #else
    2749 #error "Unsupported Cocoa Platform"
    2750 #endif
     2741        bool useLegacyDrain = !linkedOnOrAfter(SDKVersion::FirstThatDoesNotDrainTheMicrotaskQueueWhenCallingObjC);
    27512742        if (useLegacyDrain)
    27522743            return;
  • trunk/Source/JavaScriptCore/ChangeLog

    r287770 r287784  
     12022-01-07  Tim Horton  <timothy_horton@apple.com>
     2
     3        Adopt linkedOnOrAfter() in more places
     4        https://bugs.webkit.org/show_bug.cgi?id=234951
     5
     6        Reviewed by Wenson Hsieh.
     7
     8        * API/JSWrapperMap.mm:
     9        (supportsInitMethodConstructors):
     10        * API/tests/testapi.cpp:
     11        (TestAPI::promiseDrainDoesNotEatExceptions):
     12        * API/tests/testapi.mm:
     13        (testMicrotaskWithFunction):
     14        * runtime/JSLock.cpp:
     15        (JSC::JSLock::willReleaseLock):
     16        * runtime/ObjectPrototype.cpp:
     17        (JSC::isPokerBros):
     18        Adopt linkedOnOrAfter.
     19
    1202022-01-07  Alex Christensen  <achristensen@webkit.org>
    221
  • trunk/Source/JavaScriptCore/runtime/JSLock.cpp

    r278888 r287784  
    206206        static std::once_flag once;
    207207        std::call_once(once, [] {
    208 #if PLATFORM(MAC)
    209             useLegacyDrain = applicationSDKVersion() < DYLD_MACOSX_VERSION_12_00;
    210 #elif PLATFORM(WATCH)
    211             // Don't check, JSC isn't API on watch anyway.
    212 #elif PLATFORM(IOS_FAMILY)
    213             useLegacyDrain = applicationSDKVersion() < DYLD_IOS_VERSION_15_0;
    214 #else
    215 #error "Unsupported Cocoa Platform"
    216 #endif
     208            useLegacyDrain = !linkedOnOrAfter(SDKVersion::FirstThatDoesNotDrainTheMicrotaskQueueWhenCallingObjC);
    217209        });
    218210#endif
  • trunk/Source/JavaScriptCore/runtime/ObjectPrototype.cpp

    r286994 r287784  
    318318    return bundleID
    319319        && CFEqual(bundleID, CFSTR("com.kpgame.PokerBros"))
    320         && applicationSDKVersion() < DYLD_IOS_VERSION_14_0;
     320        && !linkedOnOrAfter(SDKVersion::FirstWithoutPokerBrosBuiltInTagQuirk);
    321321}
    322322#endif
  • trunk/Source/WTF/ChangeLog

    r287770 r287784  
     12022-01-07  Tim Horton  <timothy_horton@apple.com>
     2
     3        Adopt linkedOnOrAfter() in more places
     4        https://bugs.webkit.org/show_bug.cgi?id=234951
     5
     6        Reviewed by Wenson Hsieh.
     7
     8        * wtf/cocoa/LanguageCocoa.mm:
     9        (WTF::canMinimizeLanguages):
     10        Adopt linkedOnOrAfter and simplify.
     11
     12        * wtf/cocoa/RuntimeApplicationChecksCocoa.h:
     13        The weird mismatch between the iOS and macOS values for FirstVersionThatSupportsInitConstructors
     14        is correct; the iOS version was bumped in r202670.
     15
    1162022-01-07  Alex Christensen  <achristensen@webkit.org>
    217
  • trunk/Source/WTF/wtf/cocoa/LanguageCocoa.mm

    r280811 r287784  
    5757{
    5858    static const bool result = []() -> bool {
    59 #if PLATFORM(MAC)
    60         if (applicationSDKVersion() < DYLD_MACOSX_VERSION_10_15_4)
    61             return false;
    62 #endif
    63 #if PLATFORM(IOS)
    64         if (applicationSDKVersion() < DYLD_IOS_VERSION_13_4)
    65             return false;
    66 #endif
    67         return [NSLocale respondsToSelector:@selector(minimizedLanguagesFromLanguages:)];
     59        return linkedOnOrAfter(SDKVersion::FirstThatMinimizesLanguages) && [NSLocale respondsToSelector:@selector(minimizedLanguagesFromLanguages:)];
    6860    }();
    6961    return result;
  • trunk/Source/WTF/wtf/cocoa/RuntimeApplicationChecksCocoa.h

    r287737 r287784  
    4242    FirstWithoutTheSecretSocietyHiddenMysteryWindowOpenQuirk = DYLD_IOS_VERSION_10_0,
    4343    FirstWithUnprefixedPlaysInlineAttribute = DYLD_IOS_VERSION_10_0,
     44    FirstVersionThatSupportsInitConstructors = DYLD_IOS_VERSION_10_0,
    4445    FirstWithExceptionsForDuplicateCompletionHandlerCalls = DYLD_IOS_VERSION_11_0,
    4546    FirstWithExpiredOnlyReloadBehavior = DYLD_IOS_VERSION_11_0,
     
    6667    FirstThatRestrictsBaseURLSchemes = DYLD_IOS_VERSION_13_4,
    6768    FirstThatSendsNativeMouseEvents = DYLD_IOS_VERSION_13_4,
     69    FirstThatMinimizesLanguages = DYLD_IOS_VERSION_13_4,
    6870    FirstWithSessionCleanupByDefault = DYLD_IOS_VERSION_14_0,
    6971    FirstWithInitializeWebKit2MainThreadAssertion = DYLD_IOS_VERSION_14_0,
     
    7173    FirstWithWebSQLDisabledByDefaultInLegacyWebKit = DYLD_IOS_VERSION_14_0,
    7274    FirstWithoutLaBanquePostaleQuirks = DYLD_IOS_VERSION_14_0,
     75    FirstWithoutPokerBrosBuiltInTagQuirk = DYLD_IOS_VERSION_14_0,
    7376    FirstVersionWithiOSAppsOnMacOS = DYLD_IOS_VERSION_14_2,
    7477    FirstWithDataURLFragmentRemoval = DYLD_IOS_VERSION_14_5,
     
    8285    FirstWithApplicationCacheDisabledByDefault = DYLD_IOS_VERSION_15_0,
    8386    FirstWithoutExpandoIndexedPropertiesOnWindow = DYLD_IOS_VERSION_15_0,
     87    FirstThatDoesNotDrainTheMicrotaskQueueWhenCallingObjC = DYLD_IOS_VERSION_15_0,
    8488    FirstWithAuthorizationHeaderOnSameOriginRedirects = DYLD_IOS_VERSION_15_4,
    8589    FirstForbiddingDotPrefixedFonts = DYLD_IOS_VERSION_16_0,
    8690#elif PLATFORM(MAC)
     91    FirstVersionThatSupportsInitConstructors = 0xA0A00, // OS X 10.10
    8792    FirstThatConvertsInvalidURLsToBlank = DYLD_MACOSX_VERSION_10_12,
    8893    FirstWithExceptionsForDuplicateCompletionHandlerCalls = DYLD_MACOSX_VERSION_10_13,
     
    98103    FirstWhereSiteSpecificQuirksAreEnabledByDefault = DYLD_MACOSX_VERSION_10_15_1,
    99104    FirstThatRestrictsBaseURLSchemes = DYLD_MACOSX_VERSION_10_15_4,
     105    FirstThatMinimizesLanguages = DYLD_MACOSX_VERSION_10_15_4,
    100106    FirstWithSessionCleanupByDefault = DYLD_MACOSX_VERSION_10_16,
    101107    FirstWithInitializeWebKit2MainThreadAssertion = DYLD_MACOSX_VERSION_10_16,
     
    103109    FirstWithDataURLFragmentRemoval = DYLD_MACOSX_VERSION_11_3,
    104110    FirstWithHTMLDocumentSupportedPropertyNames = DYLD_MACOSX_VERSION_11_3,
    105     FirstWithNullOriginForNonSpecialSchemedURLs = DYLD_MACOSX_VERSION_12_00,
    106     FirstWithDOMWindowReuseRestriction = DYLD_MACOSX_VERSION_12_00,
    107111    FirstWithBlankViewOnJSPrompt = DYLD_MACOSX_VERSION_11_3,
    108112    FirstWithoutClientCertificateLookup = DYLD_MACOSX_VERSION_11_3,
    109113    FirstThatDefaultsToPassiveWheelListenersOnDocument = DYLD_MACOSX_VERSION_11_3,
    110114    FirstThatAllowsWheelEventGesturesToBecomeNonBlocking = DYLD_MACOSX_VERSION_11_3,
     115    FirstWithNullOriginForNonSpecialSchemedURLs = DYLD_MACOSX_VERSION_12_00,
     116    FirstWithDOMWindowReuseRestriction = DYLD_MACOSX_VERSION_12_00,
     117    FirstThatDoesNotDrainTheMicrotaskQueueWhenCallingObjC = DYLD_MACOSX_VERSION_12_00,
    111118    FirstWithApplicationCacheDisabledByDefault = DYLD_MACOSX_VERSION_12_00,
    112119    FirstWithoutExpandoIndexedPropertiesOnWindow = DYLD_MACOSX_VERSION_12_00,
Note: See TracChangeset for help on using the changeset viewer.