Title: [291889] trunk
Revision
291889
Author
[email protected]
Date
2022-03-25 14:37:07 -0700 (Fri, 25 Mar 2022)

Log Message

Enable PGO when building for release and production
https://bugs.webkit.org/show_bug.cgi?id=238119
rdar://90182309

Reviewed by Alexey Proskuryakov and Geoff Garen.

Source/_javascript_Core:

See WebCore/ChangeLog for more information.

* Configurations/Base.xcconfig:
* Configurations/_javascript_Core.xcconfig:
* _javascript_Core.xcodeproj/project.pbxproj:

Source/WebCore:

Attempt to re-land support for compiling against profiling data, after it was reverted due to the profiling data
files being too large. We mitigate this by instead storing sparse profdata files as compressed files in
WebKitAdditions through `git lfs`, such that they don't cause the repo to grow significantly each time we update
profiling data.

At build time, we then introduce new build phase scripts to the _javascript_Core, WebCore and WebKit builds to
decompress their respective `.profdata.compressed` files into `.profdata` files in the build, using
`compression_tool`. We compile against these `profdata` files when building for release and production
configurations, via the `-fprofile-instr-use` flag.

In the case where the *.profdata.compressed files are non-existent or haven't been downloaded yet, we instead
fall back to using an empty profiling data file, but only on non-production builds; this allows us to continue
passing in the `-fprofile-instr-use` flag, without running into build failures.

Note that we intentionally require production builds to use the (real) profiling data, and explicitly fail the
build with a specific error message in the case where the profiles are missing.

Additionally, note that in order to check for and deal with the case where the *.profdata.compressed files are
only undownloaded `git-lfs` stubs, we not only check whether or not the `profdata.compressed` file exists, but
also whether or not the file size is at least an arbitrary cutoff of 4 KB (which should already be an order of
magnitude larger than the `git-lfs` stub). While mostly arbitrary, I chose this cutoff due to the fact that it's
very close to the size of the `Empty.profdata` placeholder file in Tools; in practice, we should expect the
profiles for WebKit, WebCore and _javascript_Core to be much, much larger than this empty file.

* Configurations/Base.xcconfig:
* Configurations/WebCore.xcconfig:
* WebCore.xcodeproj/project.pbxproj:

Source/WebKit:

See WebCore/ChangeLog for more information.

* Configurations/Base.xcconfig:
* Configurations/BaseTarget.xcconfig:
* WebKit.xcodeproj/project.pbxproj:

Tools:

Add an empty profiling data file that can be used as a fallback only for release (non-production) builds, when
the _javascript_Core, WebCore or WebKit profiling data hasn't been locally downloaded.

* Profiling/Empty.profdata: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (291888 => 291889)


--- trunk/Source/_javascript_Core/ChangeLog	2022-03-25 21:19:35 UTC (rev 291888)
+++ trunk/Source/_javascript_Core/ChangeLog	2022-03-25 21:37:07 UTC (rev 291889)
@@ -1,3 +1,17 @@
+2022-03-25  Wenson Hsieh  <[email protected]>
+
+        Enable PGO when building for release and production
+        https://bugs.webkit.org/show_bug.cgi?id=238119
+        rdar://90182309
+
+        Reviewed by Alexey Proskuryakov and Geoff Garen.
+
+        See WebCore/ChangeLog for more information.
+
+        * Configurations/Base.xcconfig:
+        * Configurations/_javascript_Core.xcconfig:
+        * _javascript_Core.xcodeproj/project.pbxproj:
+
 2022-03-24  Yusuke Suzuki  <[email protected]>
 
         [JSC] Use Data CallIC in unlinked DFG

Modified: trunk/Source/_javascript_Core/Configurations/Base.xcconfig (291888 => 291889)


--- trunk/Source/_javascript_Core/Configurations/Base.xcconfig	2022-03-25 21:19:35 UTC (rev 291888)
+++ trunk/Source/_javascript_Core/Configurations/Base.xcconfig	2022-03-25 21:37:07 UTC (rev 291889)
@@ -106,7 +106,7 @@
 GCC_WARN_UNUSED_VARIABLE = YES;
 CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
 PREBINDING = NO;
-WARNING_CFLAGS = -Wall -Wextra -Wcast-qual -Wchar-subscripts -Wconditional-uninitialized -Wextra-tokens -Wformat=2 -Winit-self -Wmissing-format-attribute -Wmissing-noreturn -Wpacked -Wpointer-arith -Wredundant-decls -Wundef -Wwrite-strings -Wexit-time-destructors -Wglobal-constructors -Wtautological-compare -Wimplicit-fallthrough -Wvla -Wliteral-conversion -Wthread-safety;
+WARNING_CFLAGS = -Wall -Wextra -Wcast-qual -Wchar-subscripts -Wconditional-uninitialized -Wextra-tokens -Wformat=2 -Winit-self -Wmissing-format-attribute -Wmissing-noreturn -Wpacked -Wpointer-arith -Wredundant-decls -Wundef -Wwrite-strings -Wexit-time-destructors -Wglobal-constructors -Wtautological-compare -Wimplicit-fallthrough -Wvla -Wliteral-conversion -Wthread-safety -Wno-profile-instr-out-of-date -Wno-profile-instr-unprofiled;
 
 HEADER_SEARCH_PATHS = . "${BUILT_PRODUCTS_DIR}/usr/local/include" $(HEADER_SEARCH_PATHS);
 

Modified: trunk/Source/_javascript_Core/Configurations/_javascript_Core.xcconfig (291888 => 291889)


--- trunk/Source/_javascript_Core/Configurations/_javascript_Core.xcconfig	2022-03-25 21:19:35 UTC (rev 291888)
+++ trunk/Source/_javascript_Core/Configurations/_javascript_Core.xcconfig	2022-03-25 21:37:07 UTC (rev 291889)
@@ -40,10 +40,19 @@
 SECTORDER_FLAGS_Production[sdk=iphoneos*] = -Wl,-order_file,$(SDKROOT)/AppleInternal/OrderFiles/_javascript_Core.order;
 SECTORDER_FLAGS_Production[sdk=macosx*] = -Wl,-order_file,_javascript_Core.order;
 
+PROFILE_DATA_FLAGS = $(PROFILE_DATA_FLAGS_$(CONFIGURATION)_$(WK_PLATFORM_NAME));
+PROFILE_DATA_FLAGS_Release_macosx = $(PROFILE_DATA_FLAGS_Release_macosx$(WK_MACOS_1200));
+PROFILE_DATA_FLAGS_Release_macosx_MACOS_SINCE_1200 = $(PROFILE_DATA_FLAGS_ENABLED);
+PROFILE_DATA_FLAGS_Release_iphoneos = $(PROFILE_DATA_FLAGS_ENABLED);
+PROFILE_DATA_FLAGS_Production_macosx = $(PROFILE_DATA_FLAGS_Production_macosx$(WK_MACOS_1200));
+PROFILE_DATA_FLAGS_Production_macosx_MACOS_SINCE_1200 = $(PROFILE_DATA_FLAGS_ENABLED);
+PROFILE_DATA_FLAGS_Production_iphoneos = $(PROFILE_DATA_FLAGS_ENABLED);
+PROFILE_DATA_FLAGS_ENABLED = -fprofile-instr-use=$(BUILT_PRODUCTS_DIR)/DerivedSources/_javascript_Core/_javascript_Core.profdata;
+
 GCC_PREFIX_HEADER = _javascript_CorePrefix.h;
 GCC_SYMBOLS_PRIVATE_EXTERN = YES;
-OTHER_CFLAGS = $(inherited) -fno-slp-vectorize --system-header-prefix=unicode/ -D__STDC_WANT_LIB_EXT1__=1;
-OTHER_CPLUSPLUSFLAGS = $(inherited) -fno-slp-vectorize --system-header-prefix=unicode/;
+OTHER_CFLAGS = $(inherited) -fno-slp-vectorize --system-header-prefix=unicode/ -D__STDC_WANT_LIB_EXT1__=1 $(PROFILE_DATA_FLAGS);
+OTHER_CPLUSPLUSFLAGS = $(inherited) -fno-slp-vectorize --system-header-prefix=unicode/ $(PROFILE_DATA_FLAGS);
 HEADER_SEARCH_PATHS = "${BUILT_PRODUCTS_DIR}/DerivedSources/_javascript_Core" $(HEADER_SEARCH_PATHS);
 INFOPLIST_FILE = Info.plist;
 INSTALL_PATH = $(INSTALL_PATH_PREFIX)$(_javascript_CORE_FRAMEWORKS_DIR);

Modified: trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj (291888 => 291889)


--- trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj	2022-03-25 21:19:35 UTC (rev 291888)
+++ trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj	2022-03-25 21:37:07 UTC (rev 291889)
@@ -11600,6 +11600,7 @@
 			buildPhases = (
 				5D2F7CF90C6875BB00B5B72B /* Update Info.plist with version information */,
 				A53F1ABF18C90F8B0072EB6D /* Resources */,
+				F4CDF3C927E9147500191928 /* Copy Profiling Data */,
 				932F5B3F0822A1C700736975 /* Headers */,
 				3732811A17FCD235004AD519 /* Postprocess Headers */,
 				932F5B910822A1C700736975 /* Sources */,
@@ -12119,6 +12120,28 @@
 			shellPath = /bin/sh;
 			shellScript = "Scripts/process-entitlements.sh\n";
 		};
+		F4CDF3C927E9147500191928 /* Copy Profiling Data */ = {
+			isa = PBXShellScriptBuildPhase;
+			buildActionMask = 12;
+			files = (
+			);
+			inputFileListPaths = (
+			);
+			inputPaths = (
+				"$(BUILT_PRODUCTS_DIR)/usr/local/include/WebKitAdditions/Profiling/_javascript_Core.profdata.compressed",
+				"$(SRCROOT)/../../Tools/Profiling/Empty.profdata",
+				"$(SDK_DIR)/usr/local/include/WebKitAdditions/Profiling/_javascript_Core.profdata.compressed",
+			);
+			name = "Copy Profiling Data";
+			outputFileListPaths = (
+			);
+			outputPaths = (
+				"$(BUILT_PRODUCTS_DIR)/DerivedSources/_javascript_Core/_javascript_Core.profdata",
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+			shellPath = /bin/sh;
+			shellScript = "if [ \"${ACTION}\" = \"installhdrs\" -o \"${ACTION}\" = \"installapi\" ]; then\n    exit 0;\nfi\n\nif [ -z \"${PROFILE_DATA_FLAGS}\" ]; then\n    exit 0;\nfi\n\nRELATIVE_PROFILE_DATA_PATH=\"usr/local/include/WebKitAdditions/Profiling/_javascript_Core.profdata.compressed\";\nABSOLUTE_PROFILE_DATA_PATH=\"${BUILT_PRODUCTS_DIR}/${RELATIVE_PROFILE_DATA_PATH}\";\n\nif [ ! -f \"${ABSOLUTE_PROFILE_DATA_PATH}\" ]; then\n    ABSOLUTE_PROFILE_DATA_PATH=\"${SDK_DIR}/${RELATIVE_PROFILE_DATA_PATH}\";\nfi\n\nif [ ! -f \"${ABSOLUTE_PROFILE_DATA_PATH}\" ] || [ $(wc -c <${ABSOLUTE_PROFILE_DATA_PATH}) -lt 4096 ]; then\n    if [ \"${CONFIGURATION}\" = \"Production\" ]; then\n        echo \"Error: production build missing profiling data at both ${ABSOLUTE_PROFILE_DATA_PATH} and ${BUILT_PRODUCTS_DIR}/${RELATIVE_PROFILE_DATA_PATH}\";\n        exit 1;\n  
   fi\n    echo \"Missing or invalid profiling data at both ${ABSOLUTE_PROFILE_DATA_PATH} and ${BUILT_PRODUCTS_DIR}/${RELATIVE_PROFILE_DATA_PATH} - falling back to empty file\";\n    cp ${SRCROOT}/../../Tools/Profiling/Empty.profdata ${BUILT_PRODUCTS_DIR}/DerivedSources/_javascript_Core/_javascript_Core.profdata;\nelse\n    echo \"Copying profiling data at ${ABSOLUTE_PROFILE_DATA_PATH}\";\n    compression_tool -decode -i ${ABSOLUTE_PROFILE_DATA_PATH} -o ${BUILT_PRODUCTS_DIR}/DerivedSources/_javascript_Core/_javascript_Core.profdata -a lzfse;\nfi\n";
+		};
 /* End PBXShellScriptBuildPhase section */
 
 /* Begin PBXSourcesBuildPhase section */

Modified: trunk/Source/WebCore/ChangeLog (291888 => 291889)


--- trunk/Source/WebCore/ChangeLog	2022-03-25 21:19:35 UTC (rev 291888)
+++ trunk/Source/WebCore/ChangeLog	2022-03-25 21:37:07 UTC (rev 291889)
@@ -1,3 +1,39 @@
+2022-03-25  Wenson Hsieh  <[email protected]>
+
+        Enable PGO when building for release and production
+        https://bugs.webkit.org/show_bug.cgi?id=238119
+        rdar://90182309
+
+        Reviewed by Alexey Proskuryakov and Geoff Garen.
+
+        Attempt to re-land support for compiling against profiling data, after it was reverted due to the profiling data
+        files being too large. We mitigate this by instead storing sparse profdata files as compressed files in
+        WebKitAdditions through `git lfs`, such that they don't cause the repo to grow significantly each time we update
+        profiling data.
+
+        At build time, we then introduce new build phase scripts to the _javascript_Core, WebCore and WebKit builds to
+        decompress their respective `.profdata.compressed` files into `.profdata` files in the build, using
+        `compression_tool`. We compile against these `profdata` files when building for release and production
+        configurations, via the `-fprofile-instr-use` flag.
+
+        In the case where the *.profdata.compressed files are non-existent or haven't been downloaded yet, we instead
+        fall back to using an empty profiling data file, but only on non-production builds; this allows us to continue
+        passing in the `-fprofile-instr-use` flag, without running into build failures.
+
+        Note that we intentionally require production builds to use the (real) profiling data, and explicitly fail the
+        build with a specific error message in the case where the profiles are missing.
+
+        Additionally, note that in order to check for and deal with the case where the *.profdata.compressed files are
+        only undownloaded `git-lfs` stubs, we not only check whether or not the `profdata.compressed` file exists, but
+        also whether or not the file size is at least an arbitrary cutoff of 4 KB (which should already be an order of
+        magnitude larger than the `git-lfs` stub). While mostly arbitrary, I chose this cutoff due to the fact that it's
+        very close to the size of the `Empty.profdata` placeholder file in Tools; in practice, we should expect the
+        profiles for WebKit, WebCore and _javascript_Core to be much, much larger than this empty file.
+
+        * Configurations/Base.xcconfig:
+        * Configurations/WebCore.xcconfig:
+        * WebCore.xcodeproj/project.pbxproj:
+
 2022-03-25  Youenn Fablet  <[email protected]>
 
         Add support for focused and visible ServiceWorkerWindowClient states

Modified: trunk/Source/WebCore/Configurations/Base.xcconfig (291888 => 291889)


--- trunk/Source/WebCore/Configurations/Base.xcconfig	2022-03-25 21:19:35 UTC (rev 291888)
+++ trunk/Source/WebCore/Configurations/Base.xcconfig	2022-03-25 21:37:07 UTC (rev 291889)
@@ -90,7 +90,7 @@
 GCC_WARN_UNINITIALIZED_AUTOS = YES;
 GCC_WARN_UNUSED_FUNCTION = YES;
 GCC_WARN_UNUSED_VARIABLE = YES;
-WARNING_CFLAGS = -Wall -Wextra -Wcast-qual -Wchar-subscripts -Wconditional-uninitialized -Wextra-tokens -Wformat=2 -Winit-self -Wmissing-format-attribute -Wmissing-noreturn -Wpacked -Wpointer-arith -Wredundant-decls -Wundef -Wwrite-strings -Wexit-time-destructors -Wglobal-constructors -Wtautological-compare -Wimplicit-fallthrough -Wvla -Wno-unknown-warning-option -Wliteral-conversion -Wthread-safety;
+WARNING_CFLAGS = -Wall -Wextra -Wcast-qual -Wchar-subscripts -Wconditional-uninitialized -Wextra-tokens -Wformat=2 -Winit-self -Wmissing-format-attribute -Wmissing-noreturn -Wpacked -Wpointer-arith -Wredundant-decls -Wundef -Wwrite-strings -Wexit-time-destructors -Wglobal-constructors -Wtautological-compare -Wimplicit-fallthrough -Wvla -Wno-unknown-warning-option -Wliteral-conversion -Wthread-safety -Wno-profile-instr-out-of-date -Wno-profile-instr-unprofiled;
 
 TARGET_MACOS_LEGACY_VERSION_IDENTIFIER = $(TARGET_MACOS_LEGACY_VERSION_IDENTIFIER_$(MACOSX_DEPLOYMENT_TARGET:base))
 TARGET_MACOS_LEGACY_VERSION_IDENTIFIER_10 = 10$(MACOSX_DEPLOYMENT_TARGET:suffix:identifier)

Modified: trunk/Source/WebCore/Configurations/WebCore.xcconfig (291888 => 291889)


--- trunk/Source/WebCore/Configurations/WebCore.xcconfig	2022-03-25 21:19:35 UTC (rev 291888)
+++ trunk/Source/WebCore/Configurations/WebCore.xcconfig	2022-03-25 21:37:07 UTC (rev 291889)
@@ -29,6 +29,17 @@
 GCC_PREFIX_HEADER = WebCorePrefix.h;
 GCC_PREPROCESSOR_DEFINITIONS = $(DEBUG_DEFINES) BUILDING_WEBKIT GL_SILENCE_DEPRECATION=1 GLES_SILENCE_DEPRECATION=1 $(inherited);
 
+PROFILE_DATA_FLAGS = $(PROFILE_DATA_FLAGS_$(CONFIGURATION)_$(WK_PLATFORM_NAME));
+PROFILE_DATA_FLAGS_Release_macosx = $(PROFILE_DATA_FLAGS_Release_macosx$(WK_MACOS_1200));
+PROFILE_DATA_FLAGS_Release_macosx_MACOS_SINCE_1200 = $(PROFILE_DATA_FLAGS_ENABLED);
+PROFILE_DATA_FLAGS_Release_iphoneos = $(PROFILE_DATA_FLAGS_ENABLED);
+PROFILE_DATA_FLAGS_Production_macosx = $(PROFILE_DATA_FLAGS_Production_macosx$(WK_MACOS_1200));
+PROFILE_DATA_FLAGS_Production_macosx_MACOS_SINCE_1200 = $(PROFILE_DATA_FLAGS_ENABLED);
+PROFILE_DATA_FLAGS_Production_iphoneos = $(PROFILE_DATA_FLAGS_ENABLED);
+PROFILE_DATA_FLAGS_ENABLED = -fprofile-instr-use=$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/WebCore.profdata;
+
+OTHER_CFLAGS = $(inherited) $(PROFILE_DATA_FLAGS);
+
 WK_PRIVATE_FRAMEWORKS_DIR = $(WK_PRIVATE_FRAMEWORKS_DIR_$(USE_INTERNAL_SDK));
 WK_PRIVATE_FRAMEWORKS_DIR_[sdk=macos*] = $(PROJECT_DIR)/../../WebKitLibraries/WebKitPrivateFrameworkStubs/Mac/$(TARGET_MAC_OS_X_VERSION_MAJOR);
 WK_PRIVATE_FRAMEWORKS_DIR_[sdk=iphone*] = $(PROJECT_DIR)/../../WebKitLibraries/WebKitPrivateFrameworkStubs/iOS/$(WK_TARGET_IOS_VERSION_MAJOR);

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (291888 => 291889)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2022-03-25 21:19:35 UTC (rev 291888)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2022-03-25 21:37:07 UTC (rev 291889)
@@ -38433,6 +38433,7 @@
 				446EE4E7255DF00D00454463 /* Concatenate and Copy Localizable.strings */,
 				93F199FD08245E59001E9ABC /* Resources */,
 				CD0DBF001422765700280263 /* Copy Audio Resources */,
+				F4CDF3CA27E9187200191928 /* Copy Profiling Data */,
 				93F19A0C08245E59001E9ABC /* Sources */,
 				93F19B1208245E59001E9ABC /* Frameworks */,
 				5D0D540D0E9862F60029E223 /* Check For Weak VTables and Externals */,
@@ -38798,6 +38799,28 @@
 			shellPath = /bin/sh;
 			shellScript = "Scripts/generate-derived-sources.sh\n";
 		};
+		F4CDF3CA27E9187200191928 /* Copy Profiling Data */ = {
+			isa = PBXShellScriptBuildPhase;
+			buildActionMask = 12;
+			files = (
+			);
+			inputFileListPaths = (
+			);
+			inputPaths = (
+				"$(BUILT_PRODUCTS_DIR)/usr/local/include/WebKitAdditions/Profiling/WebCore.profdata.compressed",
+				"$(SRCROOT)/../../Tools/Profiling/Empty.profdata",
+				"$(SDK_DIR)/usr/local/include/WebKitAdditions/Profiling/WebCore.profdata.compressed",
+			);
+			name = "Copy Profiling Data";
+			outputFileListPaths = (
+			);
+			outputPaths = (
+				"$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/WebCore.profdata",
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+			shellPath = /bin/sh;
+			shellScript = "if [ \"${ACTION}\" = \"installhdrs\" -o \"${ACTION}\" = \"installapi\" ]; then\n    exit 0;\nfi\n\nif [ -z \"${PROFILE_DATA_FLAGS}\" ]; then\n    exit 0;\nfi\n\nRELATIVE_PROFILE_DATA_PATH=\"usr/local/include/WebKitAdditions/Profiling/WebCore.profdata.compressed\";\nABSOLUTE_PROFILE_DATA_PATH=\"${BUILT_PRODUCTS_DIR}/${RELATIVE_PROFILE_DATA_PATH}\";\n\nif [ ! -f \"${ABSOLUTE_PROFILE_DATA_PATH}\" ]; then\n    ABSOLUTE_PROFILE_DATA_PATH=\"${SDK_DIR}/${RELATIVE_PROFILE_DATA_PATH}\";\nfi\n\nif [ ! -f \"${ABSOLUTE_PROFILE_DATA_PATH}\" ] || [ $(wc -c <${ABSOLUTE_PROFILE_DATA_PATH}) -lt 4096 ]; then\n    if [ \"${CONFIGURATION}\" = \"Production\" ]; then\n        echo \"Error: production build missing profiling data at both ${ABSOLUTE_PROFILE_DATA_PATH} and ${BUILT_PRODUCTS_DIR}/${RELATIVE_PROFILE_DATA_PATH}\";\n        exit 1;\n    fi\n 
    echo \"Missing or invalid profiling data at both ${ABSOLUTE_PROFILE_DATA_PATH} and ${BUILT_PRODUCTS_DIR}/${RELATIVE_PROFILE_DATA_PATH} - falling back to empty file\";\n    cp ${SRCROOT}/../../Tools/Profiling/Empty.profdata ${BUILT_PRODUCTS_DIR}/DerivedSources/WebCore/WebCore.profdata;\nelse\n    echo \"Copying profiling data at ${ABSOLUTE_PROFILE_DATA_PATH}\";\n    compression_tool -decode -i ${ABSOLUTE_PROFILE_DATA_PATH} -o ${BUILT_PRODUCTS_DIR}/DerivedSources/WebCore/WebCore.profdata -a lzfse;\nfi\n";
+		};
 /* End PBXShellScriptBuildPhase section */
 
 /* Begin PBXSourcesBuildPhase section */

Modified: trunk/Source/WebKit/ChangeLog (291888 => 291889)


--- trunk/Source/WebKit/ChangeLog	2022-03-25 21:19:35 UTC (rev 291888)
+++ trunk/Source/WebKit/ChangeLog	2022-03-25 21:37:07 UTC (rev 291889)
@@ -1,3 +1,17 @@
+2022-03-25  Wenson Hsieh  <[email protected]>
+
+        Enable PGO when building for release and production
+        https://bugs.webkit.org/show_bug.cgi?id=238119
+        rdar://90182309
+
+        Reviewed by Alexey Proskuryakov and Geoff Garen.
+
+        See WebCore/ChangeLog for more information.
+
+        * Configurations/Base.xcconfig:
+        * Configurations/BaseTarget.xcconfig:
+        * WebKit.xcodeproj/project.pbxproj:
+
 2022-03-25  Simon Fraser  <[email protected]>
 
         Add some generated sources to the WebKit project

Modified: trunk/Source/WebKit/Configurations/Base.xcconfig (291888 => 291889)


--- trunk/Source/WebKit/Configurations/Base.xcconfig	2022-03-25 21:19:35 UTC (rev 291888)
+++ trunk/Source/WebKit/Configurations/Base.xcconfig	2022-03-25 21:37:07 UTC (rev 291889)
@@ -94,7 +94,7 @@
 GCC_WARN_UNUSED_VARIABLE = YES;
 OTHER_MIGFLAGS = -F$(BUILT_PRODUCTS_DIR);
 PREBINDING = NO;
-WARNING_CFLAGS = -Wall -Wextra -Wcast-qual -Wchar-subscripts -Wconditional-uninitialized -Wextra-tokens -Wformat=2 -Winit-self -Wmissing-format-attribute -Wmissing-noreturn -Wno-unused-parameter -Wpacked -Wpointer-arith -Wredundant-decls -Wundef -Wwrite-strings -Wexit-time-destructors -Wglobal-constructors -Wtautological-compare -Wimplicit-fallthrough -Wvla -Wliteral-conversion -Wthread-safety;
+WARNING_CFLAGS = -Wall -Wextra -Wcast-qual -Wchar-subscripts -Wconditional-uninitialized -Wextra-tokens -Wformat=2 -Winit-self -Wmissing-format-attribute -Wmissing-noreturn -Wno-unused-parameter -Wpacked -Wpointer-arith -Wredundant-decls -Wundef -Wwrite-strings -Wexit-time-destructors -Wglobal-constructors -Wtautological-compare -Wimplicit-fallthrough -Wvla -Wliteral-conversion -Wthread-safety -Wno-profile-instr-out-of-date -Wno-profile-instr-unprofiled;
 
 SWIFT_VERSION = 5.0;
 

Modified: trunk/Source/WebKit/Configurations/BaseTarget.xcconfig (291888 => 291889)


--- trunk/Source/WebKit/Configurations/BaseTarget.xcconfig	2022-03-25 21:19:35 UTC (rev 291888)
+++ trunk/Source/WebKit/Configurations/BaseTarget.xcconfig	2022-03-25 21:37:07 UTC (rev 291889)
@@ -53,9 +53,17 @@
 
 HEADER_SEARCH_PATHS = $(ALTERNATE_HEADER_SEARCH_PATHS) $(BUILT_PRODUCTS_DIR)/usr/local/include "$(WEBCORE_PRIVATE_HEADERS_DIR)/ForwardingHeaders" $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit $(WEBGPU_HEADER_SEARCH_PATHS) $(WEBKITADDITIONS_HEADER_SEARCH_PATHS) $(LIBWEBRTC_HEADER_SEARCH_PATHS) $(SRCROOT) $(HEADER_SEARCH_PATHS);
 
-OTHER_CFLAGS = $(inherited) -iframework $(SDKROOT)$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks -D__STDC_WANT_LIB_EXT1__=1;
-OTHER_CPLUSPLUSFLAGS = $(OTHER_CFLAGS) -isystem $(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders;
+PROFILE_DATA_FLAGS = $(PROFILE_DATA_FLAGS_$(CONFIGURATION)_$(WK_PLATFORM_NAME));
+PROFILE_DATA_FLAGS_Release_macosx = $(PROFILE_DATA_FLAGS_Release_macosx$(WK_MACOS_1200));
+PROFILE_DATA_FLAGS_Release_macosx_MACOS_SINCE_1200 = $(PROFILE_DATA_FLAGS_ENABLED);
+PROFILE_DATA_FLAGS_Release_iphoneos = $(PROFILE_DATA_FLAGS_ENABLED);
+PROFILE_DATA_FLAGS_Production_macosx = $(PROFILE_DATA_FLAGS_Production_macosx$(WK_MACOS_1200));
+PROFILE_DATA_FLAGS_Production_macosx_MACOS_SINCE_1200 = $(PROFILE_DATA_FLAGS_ENABLED);
+PROFILE_DATA_FLAGS_Production_iphoneos = $(PROFILE_DATA_FLAGS_ENABLED);
+PROFILE_DATA_FLAGS_ENABLED = -fprofile-instr-use=$(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit/WebKit.profdata;
 
+OTHER_CFLAGS = $(inherited) -iframework $(SDKROOT)$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks -D__STDC_WANT_LIB_EXT1__=1 $(PROFILE_DATA_FLAGS);
+
 NORMAL_WEBCORE_FRAMEWORKS_DIR = $(NORMAL_WEBCORE_FRAMEWORKS_DIR_COCOA_TOUCH_$(WK_IS_COCOA_TOUCH));
 NORMAL_WEBCORE_FRAMEWORKS_DIR_COCOA_TOUCH_YES = $(PRODUCTION_FRAMEWORKS_DIR);
 NORMAL_WEBCORE_FRAMEWORKS_DIR_COCOA_TOUCH_NO = $(SYSTEM_LIBRARY_DIR)/Frameworks/WebKit.framework/Versions/A/Frameworks;

Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (291888 => 291889)


--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2022-03-25 21:19:35 UTC (rev 291888)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2022-03-25 21:37:07 UTC (rev 291889)
@@ -15697,6 +15697,7 @@
 				99CA3862207286DB00BAD578 /* Copy WebDriver Atoms to Framework Private Headers */,
 				37E531011B2391090074F0DF /* Copy iOS Sandbox Profiles for Manual Sandboxing */,
 				1A07D2F71919B36500ECDA16 /* Copy Message Generation Scripts */,
+				F4CDF3CC27E918D900191928 /* Copy Profiling Data */,
 				8DC2EF540486A6940098B216 /* Sources */,
 				8DC2EF560486A6940098B216 /* Frameworks */,
 				5DF408C5131DD46700130071 /* Check For Weak VTables and Externals */,
@@ -16834,6 +16835,28 @@
 			shellPath = /bin/sh;
 			shellScript = "echo \"Preprocessing sandbox\"\nScripts/generate-derived-sources.sh sandbox-profiles-ios\nmkdir -p ${DSTROOT}/${INSTALL_PATH}\ncp ${BUILT_PRODUCTS_DIR}/DerivedSources/WebKit/com.apple.WebKit.adattributiond.sb ${DSTROOT}/${INSTALL_PATH}\ncp ${BUILT_PRODUCTS_DIR}/DerivedSources/WebKit/com.apple.WebKit.GPU.sb ${DSTROOT}/${INSTALL_PATH}\ncp ${BUILT_PRODUCTS_DIR}/DerivedSources/WebKit/com.apple.WebKit.Networking.sb ${DSTROOT}/${INSTALL_PATH}\ncp ${BUILT_PRODUCTS_DIR}/DerivedSources/WebKit/com.apple.WebKit.WebAuth.sb ${DSTROOT}/${INSTALL_PATH}\ncp ${BUILT_PRODUCTS_DIR}/DerivedSources/WebKit/com.apple.WebKit.WebContent.sb ${DSTROOT}/${INSTALL_PATH}\n";
 		};
+		F4CDF3CC27E918D900191928 /* Copy Profiling Data */ = {
+			isa = PBXShellScriptBuildPhase;
+			buildActionMask = 12;
+			files = (
+			);
+			inputFileListPaths = (
+			);
+			inputPaths = (
+				"$(BUILT_PRODUCTS_DIR)/usr/local/include/WebKitAdditions/Profiling/WebKit.profdata.compressed",
+				"$(SRCROOT)/../../Tools/Profiling/Empty.profdata",
+				"$(SDK_DIR)/usr/local/include/WebKitAdditions/Profiling/WebKit.profdata.compressed",
+			);
+			name = "Copy Profiling Data";
+			outputFileListPaths = (
+			);
+			outputPaths = (
+				"$(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit/WebKit.profdata",
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+			shellPath = /bin/sh;
+			shellScript = "if [ \"${ACTION}\" = \"installhdrs\" -o \"${ACTION}\" = \"installapi\" ]; then\n    exit 0;\nfi\n\nif [ -z \"${PROFILE_DATA_FLAGS}\" ]; then\n    exit 0;\nfi\n\nRELATIVE_PROFILE_DATA_PATH=\"usr/local/include/WebKitAdditions/Profiling/WebKit.profdata.compressed\";\nABSOLUTE_PROFILE_DATA_PATH=\"${BUILT_PRODUCTS_DIR}/${RELATIVE_PROFILE_DATA_PATH}\";\n\nif [ ! -f \"${ABSOLUTE_PROFILE_DATA_PATH}\" ]; then\n    ABSOLUTE_PROFILE_DATA_PATH=\"${SDK_DIR}/${RELATIVE_PROFILE_DATA_PATH}\";\nfi\n\nif [ ! -f \"${ABSOLUTE_PROFILE_DATA_PATH}\" ] || [ $(wc -c <${ABSOLUTE_PROFILE_DATA_PATH}) -lt 4096 ]; then\n    if [ \"${CONFIGURATION}\" = \"Production\" ]; then\n        echo \"Error: production build missing profiling data at both ${ABSOLUTE_PROFILE_DATA_PATH} and ${BUILT_PRODUCTS_DIR}/${RELATIVE_PROFILE_DATA_PATH}\";\n        exit 1;\n    fi\n  
   echo \"Missing or invalid profiling data at both ${ABSOLUTE_PROFILE_DATA_PATH} and ${BUILT_PRODUCTS_DIR}/${RELATIVE_PROFILE_DATA_PATH} - falling back to empty file\";\n    cp ${SRCROOT}/../../Tools/Profiling/Empty.profdata ${BUILT_PRODUCTS_DIR}/DerivedSources/WebKit/WebKit.profdata;\nelse\n    echo \"Copying profiling data at ${ABSOLUTE_PROFILE_DATA_PATH}\";\n    compression_tool -decode -i ${ABSOLUTE_PROFILE_DATA_PATH} -o ${BUILT_PRODUCTS_DIR}/DerivedSources/WebKit/WebKit.profdata -a lzfse;\nfi\n";
+		};
 /* End PBXShellScriptBuildPhase section */
 
 /* Begin PBXSourcesBuildPhase section */

Modified: trunk/Tools/ChangeLog (291888 => 291889)


--- trunk/Tools/ChangeLog	2022-03-25 21:19:35 UTC (rev 291888)
+++ trunk/Tools/ChangeLog	2022-03-25 21:37:07 UTC (rev 291889)
@@ -1,3 +1,16 @@
+2022-03-25  Wenson Hsieh  <[email protected]>
+
+        Enable PGO when building for release and production
+        https://bugs.webkit.org/show_bug.cgi?id=238119
+        rdar://90182309
+
+        Reviewed by Alexey Proskuryakov and Geoff Garen.
+
+        Add an empty profiling data file that can be used as a fallback only for release (non-production) builds, when
+        the _javascript_Core, WebCore or WebKit profiling data hasn't been locally downloaded.
+
+        * Profiling/Empty.profdata: Added.
+
 2022-03-25  Devin Rousso  <[email protected]>
 
         `PointerEvent.movementX` always 0 (breaks https://noisecraft.app/)

Added: trunk/Tools/Profiling/Empty.profdata (0 => 291889)


--- trunk/Tools/Profiling/Empty.profdata	                        (rev 0)
+++ trunk/Tools/Profiling/Empty.profdata	2022-03-25 21:37:07 UTC (rev 291889)
@@ -0,0 +1,8 @@
+\xFFlprofi\x81����������������������������������������������\xA8+��������������������������������������������������������������������������������������������������������������0��������������'��������������������������������������������\xA0\x86��������������������������������������@+��������������������������������������\xE0\x93��������������������������������������\x80�������������������������������������� \xA1��������������������������������������\xC0'	��������������������������������������`\xAE
+����������������������������������������5��������������������������������������\xA0\xBB+��������������������������������������\xF0~��������������������������������������0��������������������������������������X>��������������������������������������\xDCA��������������������������������������6B��������������������������������������?B����������������������������������������AfR\x82Ց}?I�������������� ��������������_ZNSt3__14moveIRPN3WTF10StringImplEEEONS_16remove_referenceIT_E4typeEOS6_����������������������������������������������������������b\xB9\xA4\xBFa(<5�������������� ��������������_ZNSt3__18exchangeIPN3WTF10StringImplERDnEET_RS5_OT0_����������������������������������������������������������\xE4\xED\xE8\xC9R�������������� ��������������_ZN3WTF10AtomStringC2EPKc������������������������������������������������������������e\xF2\xF7:\x95\x98�������������� ��������������_ZN3WTF6StringD2Ev������������������������������������������
 ����������������\x85\xA9\xBF\xBCW(\xEEqE��������������(��������������_ZN3WTF21DefaultRefDerefTraitsINS_10StringImplEE14derefIfNotNullEPS1_\x91j\x9A����������������������������������������������������������������FB\xF5\x93RD�������������� ��������������_ZN3WTF12RawPtrTraitsINS_14AtomStringImplEE8exchangeIDnEEPS1_RS4_OT_����������������������������������������������������������.\xA9\x94\xCA\xF3|\xFFI��������������(��������������_
 ZN3WTF21DefaultRefDerefTraitsINS_14AtomStringImplEE14derefIfNotNullEPS1_\x91j\x9A������������������������������������������������������������������\xEF\xFBc?`\xED\xEC\x89e�������������� ��������������_ZN3WTF6RefPtrINS_14AtomStringImplENS_12RawPtrTraitsIS1_EENS_21DefaultRefDerefTraitsIS1_EEE7leakRefEv����������������������������������������������������������0id\xFA\xC3\xF3م�������������� ��������������_ZN3WTF14AtomStringImpl3addEPKc����������������������������������������������������������\xF12\x89Y\xFF\x82\x86;�������������� ��������������_ZNSt3__17forwardIRDnEEOT_RNS_16remove_referenceIS2_E4typeE����������������������������������������������������������3"\xC8yq\x9D\xCF\xD1��������������(��������������_ZN3WTF10StringImpl5derefEv&i
+������������������������������������������������������������������\xF5T\xD0\xE6\x9C\xD5rٔ�������������� ��������������_ZN3WTF6RefPtrINS_10StringImplENS_12RawPtrTraitsIS1_EENS_21DefaultRefDerefTraitsIS1_EEEC2INS_14AtomStringImplENS2_IS8_EENS4_IS8_EEEEONS0_IT_T0_T1_EE������������������������������������������������������������\xD6\\xA2x\xB7s|\xC29�������������� ��������������_ZNSt3__18exchangeIPN3WTF14AtomStringImplERDnEET_RS5_OT0_����������������������������������������������������������9JÊ\xB1K\xE8Yj�������������� ��������������_ZN3WTF6StringC2EONS_6RefPtrINS_14AtomStringImplENS_12RawPtrTraitsIS2_EENS_21DefaultRefDerefTraitsIS2_EEEE������������������������������������������������������������\xBA\xF1\xDDQ\x88౓�������������� ��������������_ZNSt3__14moveIRN3WTF6RefPtrINS1_14AtomStringImplENS1_12RawPtrTraitsIS3_EENS1_21DefaultRefDerefTraitsIS3_EEEEEEONS_16remove_referenceIT_E4typeEOSB_��������������������������������������������������������\xFAՍ\xE76d\x95\xDB
 �������������� ��������������main��������������������������������������������������������z|]\xFD}\xF2:_�������������� ��������������_ZN3WTF6RefPtrINS_14AtomStringImplENS_12RawPtrTraitsIS1_EENS_21DefaultRefDerefTraitsIS1_EEED2Ev����������������������������������������������������
 ������\xDA\xCArsJ\x81>\x96�������������� ��������������_ZNSt3__17forwardIRN3WTF6RefPtrINS1_14AtomStringImplENS1_12RawPtrTraitsIS3_EENS1_21DefaultRefDerefTraitsIS3_EEEEEEOT_RNS_16remove_referenceISA_E4typeE����������������������������������������������������������\xBBq\xE9d!\xD1[�������������� ��������������_ZN3WTF6RefPtrINS_10StringImplENS_12RawPtrTraitsIS1_EENS_21DefaultRefDerefTraitsIS1_EEED2Ev����������������������������������������������������������{n4T\xAC+\xC5+\xB1�������������� ��������������_ZSt4moveILN3WTF21CheckMoveParameterTagE0ERNS0_6RefPtrINS0_14AtomStringImplENS0_12RawPtrTraitsIS3_EENS0_21DefaultRefDerefTraitsIS3_EEEEEONSt3__116remove_referenceIT0_E4typeEOSC_\x98������������������������������������������������������\x9B\xAF\\xA8\x83x@�������������� ��������������_ZN3WTF12RawPtrTraitsINS_10StringImplEE8exchangeIDnEEPS1_RS4_OT_����������������������������������������������������������!\x80\xAE\x97\xBA\xADrM�������������� ��������������_ZNSt3__14
 moveIRPN3WTF14AtomStringImplEEEONS_16remove_referenceIT_E4typeEOS6_���������������������������������������������������������������������� ��������������������������������������������\xE8������������k����������������������������\xDA������������-������������\xFE����������
 ������������������������������������������������������������������������������������������������������������������|������������������������\xA6������������\xFF����������������������������t����������������������������\xD1������������\x9F��������������������������������������������������������\xB6������������$������������+������������������������������������������������������������
\ No newline at end of file
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to