Title: [238572] branches/safari-606-branch
Revision
238572
Author
[email protected]
Date
2018-11-27 13:29:29 -0800 (Tue, 27 Nov 2018)

Log Message

Apply patch. rdar://problem/46259202

Modified Paths


Added Paths

Diff

Modified: branches/safari-606-branch/Source/_javascript_Core/jit/ExecutableAllocator.cpp (238571 => 238572)


--- branches/safari-606-branch/Source/_javascript_Core/jit/ExecutableAllocator.cpp	2018-11-27 21:22:35 UTC (rev 238571)
+++ branches/safari-606-branch/Source/_javascript_Core/jit/ExecutableAllocator.cpp	2018-11-27 21:29:29 UTC (rev 238572)
@@ -114,15 +114,42 @@
 static uintptr_t startOfFixedWritableMemoryPool;
 #endif
 
-static bool allowJIT()
+class FixedVMPoolExecutableAllocator;
+static FixedVMPoolExecutableAllocator* allocator = nullptr;
+static ExecutableAllocator* executableAllocator = nullptr;
+
+static bool s_isJITEnabled = true;
+static bool isJITEnabled()
 {
 #if PLATFORM(IOS) && (CPU(ARM64) || CPU(ARM))
-    return processHasEntitlement("dynamic-codesigning");
+    return processHasEntitlement("dynamic-codesigning") && s_isJITEnabled;
 #else
-    return true;
+    return s_isJITEnabled;
 #endif
 }
+void ExecutableAllocator::setJITEnabled(bool enabled)
+{
+    ASSERT(!allocator);
+    if (s_isJITEnabled == enabled)
+        return;
 
+    s_isJITEnabled = enabled;
+
+#if PLATFORM(IOS_FAMILY) && (CPU(ARM64) || CPU(ARM))
+    if (!enabled) {
+        constexpr size_t size = 1;
+        constexpr int protection = PROT_READ | PROT_WRITE | PROT_EXEC;
+        constexpr int flags = MAP_PRIVATE | MAP_ANON | MAP_JIT;
+        constexpr int fd = OSAllocator::JSJITCodePages;
+        void* allocation = mmap(nullptr, size, protection, flags, fd, 0);
+        const void* executableMemoryAllocationFailure = reinterpret_cast<void*>(-1);
+        RELEASE_ASSERT_WITH_MESSAGE(allocation && allocation != executableMemoryAllocationFailure, "We should not have allocated executable memory before disabling the JIT.");
+        RELEASE_ASSERT_WITH_MESSAGE(!munmap(allocation, size), "Unmapping executable memory should succeed so we do not have any executable memory in the address space");
+        RELEASE_ASSERT_WITH_MESSAGE(mmap(nullptr, size, protection, flags, fd, 0) == executableMemoryAllocationFailure, "Allocating executable memory should fail after setJITEnabled(false) is called.");
+    }
+#endif
+}
+
 class FixedVMPoolExecutableAllocator : public MetaAllocator {
     WTF_MAKE_FAST_ALLOCATED;
 public:
@@ -129,7 +156,7 @@
     FixedVMPoolExecutableAllocator()
         : MetaAllocator(jitAllocationGranule) // round up all allocations to 32 bytes
     {
-        if (!allowJIT())
+        if (!isJITEnabled())
             return;
 
         size_t reservationSize;
@@ -350,9 +377,6 @@
     PageReservation m_reservation;
 };
 
-static FixedVMPoolExecutableAllocator* allocator;
-static ExecutableAllocator* executableAllocator;
-
 void ExecutableAllocator::initializeAllocator()
 {
     ASSERT(!allocator);

Modified: branches/safari-606-branch/Source/_javascript_Core/jit/ExecutableAllocator.h (238571 => 238572)


--- branches/safari-606-branch/Source/_javascript_Core/jit/ExecutableAllocator.h	2018-11-27 21:22:35 UTC (rev 238571)
+++ branches/safari-606-branch/Source/_javascript_Core/jit/ExecutableAllocator.h	2018-11-27 21:29:29 UTC (rev 238572)
@@ -130,6 +130,8 @@
     static void dumpProfile() { }
 #endif
 
+    JS_EXPORT_PRIVATE static void setJITEnabled(bool);
+
     RefPtr<ExecutableMemoryHandle> allocate(size_t sizeInBytes, void* ownerUID, JITCompilationEffort);
 
     bool isValidExecutableMemory(const AbstractLocker&, void* address);

Modified: branches/safari-606-branch/Source/WebKit/Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h (238571 => 238572)


--- branches/safari-606-branch/Source/WebKit/Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h	2018-11-27 21:22:35 UTC (rev 238571)
+++ branches/safari-606-branch/Source/WebKit/Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h	2018-11-27 21:29:29 UTC (rev 238572)
@@ -28,6 +28,7 @@
 
 #import "ChildProcess.h"
 #import "WebKit2Initialize.h"
+#import <_javascript_Core/ExecutableAllocator.h>
 #import <wtf/OSObjectPtr.h>
 #import <wtf/spi/darwin/XPCSPI.h>
 
@@ -70,6 +71,9 @@
 template<typename XPCServiceType, typename XPCServiceInitializerDelegateType>
 void XPCServiceInitializer(OSObjectPtr<xpc_connection_t> connection, xpc_object_t initializerMessage, xpc_object_t priorityBoostMessage)
 {
+    if (initializerMessage && xpc_dictionary_get_bool(initializerMessage, "disable-jit"))
+        JSC::ExecutableAllocator::setJITEnabled(false);
+
     XPCServiceInitializerDelegateType delegate(WTFMove(connection), initializerMessage);
 
     // We don't want XPC to be in charge of whether the process should be terminated or not,

Modified: branches/safari-606-branch/Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.cpp (238571 => 238572)


--- branches/safari-606-branch/Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.cpp	2018-11-27 21:22:35 UTC (rev 238571)
+++ branches/safari-606-branch/Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.cpp	2018-11-27 21:29:29 UTC (rev 238572)
@@ -123,6 +123,7 @@
     copy->m_alwaysRunsAtBackgroundPriority = this->m_alwaysRunsAtBackgroundPriority;
     copy->m_shouldTakeUIBackgroundAssertion = this->m_shouldTakeUIBackgroundAssertion;
     copy->m_shouldCaptureAudioInUIProcess = this->m_shouldCaptureAudioInUIProcess;
+    copy->m_isJITEnabled = this->m_isJITEnabled;
 #if PLATFORM(IOS)
     copy->m_ctDataConnectionServiceType = this->m_ctDataConnectionServiceType;
 #endif

Modified: branches/safari-606-branch/Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.h (238571 => 238572)


--- branches/safari-606-branch/Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.h	2018-11-27 21:22:35 UTC (rev 238571)
+++ branches/safari-606-branch/Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.h	2018-11-27 21:29:29 UTC (rev 238572)
@@ -154,6 +154,9 @@
     void setSuppressesConnectionTerminationOnSystemChange(bool suppressesConnectionTerminationOnSystemChange) { m_suppressesConnectionTerminationOnSystemChange = suppressesConnectionTerminationOnSystemChange; }
 #endif
 
+    bool isJITEnabled() const { return m_isJITEnabled; }
+    void setJITEnabled(bool enabled) { m_isJITEnabled = enabled; }
+
 private:
     bool m_shouldHaveLegacyDataStore { false };
 
@@ -188,6 +191,7 @@
     bool m_processSwapsOnNavigation { false };
     bool m_alwaysKeepAndReuseSwappedProcesses { false };
     bool m_processSwapsOnWindowOpenWithOpener { false };
+    bool m_isJITEnabled { true };
 
 #if PLATFORM(IOS)
     WTF::String m_ctDataConnectionServiceType;

Modified: branches/safari-606-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (238571 => 238572)


--- branches/safari-606-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2018-11-27 21:22:35 UTC (rev 238571)
+++ branches/safari-606-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2018-11-27 21:29:29 UTC (rev 238572)
@@ -4485,6 +4485,11 @@
 #endif
 }
 
+- (BOOL)_isJITEnabled
+{
+    return _page->isJITEnabled();
+}
+
 - (void)_evaluateJavaScriptWithoutUserGesture:(NSString *)_javascript_String completionHandler:(void (^)(id, NSError *))completionHandler
 {
     [self _evaluateJavaScript:_javascript_String forceUserGesture:NO completionHandler:completionHandler];

Modified: branches/safari-606-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h (238571 => 238572)


--- branches/safari-606-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h	2018-11-27 21:22:35 UTC (rev 238571)
+++ branches/safari-606-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h	2018-11-27 21:29:29 UTC (rev 238572)
@@ -168,6 +168,8 @@
 
 - (void)_updateWebsitePolicies:(_WKWebsitePolicies *)websitePolicies WK_API_AVAILABLE(macosx(10.13), ios(11.0));
 
+- (BOOL)_isJITEnabled WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
+
 - (void)_evaluateJavaScriptWithoutUserGesture:(NSString *)_javascript_String completionHandler:(void (^)(id, NSError *))completionHandler WK_API_AVAILABLE(macosx(10.13), ios(11.0));
 
 @property (nonatomic, setter=_setLayoutMode:) _WKLayoutMode _layoutMode;

Modified: branches/safari-606-branch/Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h (238571 => 238572)


--- branches/safari-606-branch/Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h	2018-11-27 21:22:35 UTC (rev 238571)
+++ branches/safari-606-branch/Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h	2018-11-27 21:29:29 UTC (rev 238572)
@@ -66,6 +66,7 @@
 @property (nonatomic) BOOL processSwapsOnWindowOpenWithOpener WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
 @property (nonatomic) BOOL pageCacheEnabled WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
 @property (nonatomic) BOOL suppressesConnectionTerminationOnSystemChange WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
+@property (nonatomic, getter=isJITEnabled) BOOL JITEnabled WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
 
 @end
 

Modified: branches/safari-606-branch/Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm (238571 => 238572)


--- branches/safari-606-branch/Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm	2018-11-27 21:22:35 UTC (rev 238571)
+++ branches/safari-606-branch/Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm	2018-11-27 21:29:29 UTC (rev 238572)
@@ -287,6 +287,16 @@
     return _processPoolConfiguration->suppressesConnectionTerminationOnSystemChange();
 }
 
+- (BOOL)isJITEnabled
+{
+    return _processPoolConfiguration->isJITEnabled();
+}
+
+- (void)setJITEnabled:(BOOL)enabled
+{
+    _processPoolConfiguration->setJITEnabled(enabled);
+}
+
 - (void)setSuppressesConnectionTerminationOnSystemChange:(BOOL)suppressesConnectionTerminationOnSystemChange
 {
     _processPoolConfiguration->setSuppressesConnectionTerminationOnSystemChange(suppressesConnectionTerminationOnSystemChange);

Modified: branches/safari-606-branch/Source/WebKit/UIProcess/Launcher/ProcessLauncher.h (238571 => 238572)


--- branches/safari-606-branch/Source/WebKit/UIProcess/Launcher/ProcessLauncher.h	2018-11-27 21:22:35 UTC (rev 238571)
+++ branches/safari-606-branch/Source/WebKit/UIProcess/Launcher/ProcessLauncher.h	2018-11-27 21:29:29 UTC (rev 238572)
@@ -48,6 +48,7 @@
         virtual ~Client() { }
         
         virtual void didFinishLaunching(ProcessLauncher*, IPC::Connection::Identifier) = 0;
+        virtual bool isJITEnabled() const { return true; }
     };
     
     enum class ProcessType {

Modified: branches/safari-606-branch/Source/WebKit/UIProcess/Launcher/mac/ProcessLauncherMac.mm (238571 => 238572)


--- branches/safari-606-branch/Source/WebKit/UIProcess/Launcher/mac/ProcessLauncherMac.mm	2018-11-27 21:22:35 UTC (rev 238571)
+++ branches/safari-606-branch/Source/WebKit/UIProcess/Launcher/mac/ProcessLauncherMac.mm	2018-11-27 21:29:29 UTC (rev 238572)
@@ -175,6 +175,10 @@
 
     // FIXME: Switch to xpc_connection_set_bootstrap once it's available everywhere we need.
     auto bootstrapMessage = adoptOSObject(xpc_dictionary_create(nullptr, nullptr, 0));
+
+    if (m_client && !m_client->isJITEnabled())
+        xpc_dictionary_set_bool(bootstrapMessage.get(), "disable-jit", true);
+
     xpc_dictionary_set_string(bootstrapMessage.get(), "message-name", "bootstrap");
 
     xpc_dictionary_set_mach_send(bootstrapMessage.get(), "server-port", listeningPort);

Modified: branches/safari-606-branch/Source/WebKit/UIProcess/WebPageProxy.cpp (238571 => 238572)


--- branches/safari-606-branch/Source/WebKit/UIProcess/WebPageProxy.cpp	2018-11-27 21:22:35 UTC (rev 238571)
+++ branches/safari-606-branch/Source/WebKit/UIProcess/WebPageProxy.cpp	2018-11-27 21:29:29 UTC (rev 238572)
@@ -6283,6 +6283,13 @@
     return parameters;
 }
 
+bool WebPageProxy::isJITEnabled()
+{
+    bool enabled = false;
+    m_process->connection()->sendSync(Messages::WebProcess::IsJITEnabled(), Messages::WebProcess::IsJITEnabled::Reply(enabled), 0);
+    return enabled;
+}
+
 void WebPageProxy::enterAcceleratedCompositingMode(const LayerTreeContext& layerTreeContext)
 {
     m_pageClient.enterAcceleratedCompositingMode(layerTreeContext);

Modified: branches/safari-606-branch/Source/WebKit/UIProcess/WebPageProxy.h (238571 => 238572)


--- branches/safari-606-branch/Source/WebKit/UIProcess/WebPageProxy.h	2018-11-27 21:22:35 UTC (rev 238571)
+++ branches/safari-606-branch/Source/WebKit/UIProcess/WebPageProxy.h	2018-11-27 21:29:29 UTC (rev 238572)
@@ -825,6 +825,7 @@
     void setPaginationLineGridEnabled(bool);
     bool paginationLineGridEnabled() const { return m_paginationLineGridEnabled; }
     unsigned pageCount() const { return m_pageCount; }
+    bool isJITEnabled();
         
 #if PLATFORM(MAC)
     void setUseSystemAppearance(bool);

Modified: branches/safari-606-branch/Source/WebKit/UIProcess/WebProcessProxy.cpp (238571 => 238572)


--- branches/safari-606-branch/Source/WebKit/UIProcess/WebProcessProxy.cpp	2018-11-27 21:22:35 UTC (rev 238571)
+++ branches/safari-606-branch/Source/WebKit/UIProcess/WebProcessProxy.cpp	2018-11-27 21:29:29 UTC (rev 238572)
@@ -1235,6 +1235,11 @@
     send(Messages::WebProcess::MainThreadPing(), 0);
 }
 
+bool WebProcessProxy::isJITEnabled() const
+{
+    return processPool().configuration().isJITEnabled();
+}
+
 void WebProcessProxy::didReceiveMainThreadPing()
 {
     responsivenessTimer().stop();

Modified: branches/safari-606-branch/Source/WebKit/UIProcess/WebProcessProxy.h (238571 => 238572)


--- branches/safari-606-branch/Source/WebKit/UIProcess/WebProcessProxy.h	2018-11-27 21:22:35 UTC (rev 238571)
+++ branches/safari-606-branch/Source/WebKit/UIProcess/WebProcessProxy.h	2018-11-27 21:29:29 UTC (rev 238572)
@@ -107,7 +107,7 @@
 
     WebConnection* webConnection() const { return m_webConnection.get(); }
 
-    WebProcessPool& processPool() { return m_processPool; }
+    WebProcessPool& processPool() const { return m_processPool; }
 
     // FIXME: WebsiteDataStores should be made per-WebPageProxy throughout WebKit2
     WebsiteDataStore& websiteDataStore() const { return m_websiteDataStore.get(); }
@@ -242,6 +242,8 @@
     void cacheMediaMIMETypesInternal(const Vector<String>&);
 #endif
 
+    bool isJITEnabled() const final;
+
 private:
     // Called when the web process has crashed or we know that it will terminate soon.
     // Will potentially cause the WebProcessProxy object to be freed.

Modified: branches/safari-606-branch/Source/WebKit/WebProcess/WebProcess.cpp (238571 => 238572)


--- branches/safari-606-branch/Source/WebKit/WebProcess/WebProcess.cpp	2018-11-27 21:22:35 UTC (rev 238571)
+++ branches/safari-606-branch/Source/WebKit/WebProcess/WebProcess.cpp	2018-11-27 21:29:29 UTC (rev 238572)
@@ -906,6 +906,11 @@
 #endif
 }
 
+void WebProcess::isJITEnabled(CompletionHandler<void(bool)>&& completionHandler)
+{
+    completionHandler(JSC::VM::canUseJIT());
+}
+
 void WebProcess::clearPluginClientPolicies()
 {
 #if ENABLE(NETSCAPE_PLUGIN_API) && PLATFORM(MAC)

Modified: branches/safari-606-branch/Source/WebKit/WebProcess/WebProcess.h (238571 => 238572)


--- branches/safari-606-branch/Source/WebKit/WebProcess/WebProcess.h	2018-11-27 21:22:35 UTC (rev 238571)
+++ branches/safari-606-branch/Source/WebKit/WebProcess/WebProcess.h	2018-11-27 21:29:29 UTC (rev 238572)
@@ -225,6 +225,8 @@
     bool hasRichContentServices() const { return m_hasRichContentServices; }
 #endif
 
+    void isJITEnabled(CompletionHandler<void(bool)>&&);
+
     WebCore::ApplicationCacheStorage& applicationCacheStorage() { return *m_applicationCacheStorage; }
 
     void prefetchDNS(const String&);

Modified: branches/safari-606-branch/Source/WebKit/WebProcess/WebProcess.messages.in (238571 => 238572)


--- branches/safari-606-branch/Source/WebKit/WebProcess/WebProcess.messages.in	2018-11-27 21:22:35 UTC (rev 238571)
+++ branches/safari-606-branch/Source/WebKit/WebProcess/WebProcess.messages.in	2018-11-27 21:29:29 UTC (rev 238572)
@@ -129,6 +129,8 @@
 
     UpdateActivePages()
 
+    IsJITEnabled() -> (bool enabled) Delayed
+
 #if PLATFORM(MAC)
     SetScreenProperties(struct WebCore::ScreenProperties screenProperties)
 #if ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING)

Modified: branches/safari-606-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (238571 => 238572)


--- branches/safari-606-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2018-11-27 21:22:35 UTC (rev 238571)
+++ branches/safari-606-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2018-11-27 21:29:29 UTC (rev 238572)
@@ -278,6 +278,7 @@
 		5C9E59431D3EB5AC00E3C62E /* ApplicationCache.db-wal in Copy Resources */ = {isa = PBXBuildFile; fileRef = 5C9E59401D3EB1DE00E3C62E /* ApplicationCache.db-wal */; };
 		5CA1DEC81F71F70100E71BD3 /* HTTPHeaderField.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5CA1DEC71F71F40700E71BD3 /* HTTPHeaderField.cpp */; };
 		5CA1DED91F74A91A00E71BD3 /* ContentRuleListNotification.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5CA1DED81F74A87100E71BD3 /* ContentRuleListNotification.mm */; };
+		5CA66B9521AD1A5600EBF412 /* JITEnabled.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5CA66B9421ACDB8500EBF412 /* JITEnabled.mm */; };
 		5CAE463820193B6A0051610F /* NetworkProcessCrashNonPersistentDataStore.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5CAE4637201937CD0051610F /* NetworkProcessCrashNonPersistentDataStore.mm */; };
 		5CB18BA81F5645E300EE23C4 /* ClickAutoFillButton.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5CB18BA71F5645B200EE23C4 /* ClickAutoFillButton.mm */; };
 		5CB3CE391FA1697F00C3A2D6 /* WKWebViewConfiguration.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5CB3CE381FA1691700C3A2D6 /* WKWebViewConfiguration.mm */; };
@@ -1538,6 +1539,7 @@
 		5C9E59401D3EB1DE00E3C62E /* ApplicationCache.db-wal */ = {isa = PBXFileReference; lastKnownFileType = file; path = "ApplicationCache.db-wal"; sourceTree = "<group>"; };
 		5CA1DEC71F71F40700E71BD3 /* HTTPHeaderField.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTTPHeaderField.cpp; sourceTree = "<group>"; };
 		5CA1DED81F74A87100E71BD3 /* ContentRuleListNotification.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ContentRuleListNotification.mm; sourceTree = "<group>"; };
+		5CA66B9421ACDB8500EBF412 /* JITEnabled.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = JITEnabled.mm; sourceTree = "<group>"; };
 		5CAE4637201937CD0051610F /* NetworkProcessCrashNonPersistentDataStore.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = NetworkProcessCrashNonPersistentDataStore.mm; sourceTree = "<group>"; };
 		5CB18BA71F5645B200EE23C4 /* ClickAutoFillButton.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ClickAutoFillButton.mm; sourceTree = "<group>"; };
 		5CB3CE381FA1691700C3A2D6 /* WKWebViewConfiguration.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebViewConfiguration.mm; sourceTree = "<group>"; };
@@ -2279,6 +2281,7 @@
 				5198A23F1EA7E595008910B7 /* InitialWarmedProcessUsed.mm */,
 				79C5D430209D768300F1E7CA /* InjectedBundleNodeHandleIsTextField.mm */,
 				2DB0232E1E4E871800707123 /* InteractionDeadlockAfterCrash.mm */,
+				5CA66B9421ACDB8500EBF412 /* JITEnabled.mm */,
 				5C69BDD41F82A7EB000F4F4B /* _javascript_DuringNavigation.mm */,
 				C25CCA051E51380B0026CB8A /* LineBreaking.mm */,
 				37D36ED61AF42ECD00BAF5D9 /* LoadAlternateHTMLString.mm */,
@@ -3601,6 +3604,7 @@
 				7C83E0411D0A63F200FEBCF3 /* CandidateTests.mm in Sources */,
 				7CCE7EE71A411AE600447C4C /* CanHandleRequest.cpp in Sources */,
 				07C046CA1E4262A8007201E7 /* CARingBuffer.cpp in Sources */,
+				5CA66B9521AD1A5600EBF412 /* JITEnabled.mm in Sources */,
 				57303BCB2008376500355965 /* CBORReaderTest.cpp in Sources */,
 				57303BC9200824D300355965 /* CBORValueTest.cpp in Sources */,
 				57303BCA20082C0100355965 /* CBORWriterTest.cpp in Sources */,

Added: branches/safari-606-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/JITEnabled.mm (0 => 238572)


--- branches/safari-606-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/JITEnabled.mm	                        (rev 0)
+++ branches/safari-606-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/JITEnabled.mm	2018-11-27 21:29:29 UTC (rev 238572)
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+
+#if WK_API_ENABLED
+
+#import "PlatformUtilities.h"
+#import <WebKit/WKProcessPoolPrivate.h>
+#import <WebKit/WKWebViewPrivate.h>
+#import <WebKit/_WKProcessPoolConfiguration.h>
+#import <wtf/RetainPtr.h>
+
+TEST(WebKit, JITEnabled)
+{
+    auto checkJITEnabled = [] (RetainPtr<WKWebView>&& webView, BOOL expectedValue) {
+        __block bool done = false;
+        [webView evaluateJavaScript:@"for(i=0;i<100000;++i);'abc'" completionHandler:^(id result, NSError *error) {
+            EXPECT_TRUE(error == nil);
+            EXPECT_STREQ([result UTF8String], "abc");
+            EXPECT_TRUE([webView _isJITEnabled] == expectedValue);
+            done = true;
+        }];
+        TestWebKitAPI::Util::run(&done);
+    };
+
+    auto processPoolConfiguration = adoptNS([_WKProcessPoolConfiguration new]);
+    [processPoolConfiguration setJITEnabled:NO];
+    auto configuration = adoptNS([WKWebViewConfiguration new]);
+    [configuration setProcessPool:[[[WKProcessPool alloc] _initWithConfiguration:processPoolConfiguration.get()] autorelease]];
+      auto webViewNoJIT = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
+    checkJITEnabled(webViewNoJIT, NO);
+    checkJITEnabled(adoptNS([WKWebView new]), YES);
+}
+
+#endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to