summaryrefslogtreecommitdiffstats
path: root/nsprpub/build/win32
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /nsprpub/build/win32
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'nsprpub/build/win32')
-rw-r--r--nsprpub/build/win32/pgomerge.py44
1 files changed, 44 insertions, 0 deletions
diff --git a/nsprpub/build/win32/pgomerge.py b/nsprpub/build/win32/pgomerge.py
new file mode 100644
index 000000000..313d66870
--- /dev/null
+++ b/nsprpub/build/win32/pgomerge.py
@@ -0,0 +1,44 @@
+#!/usr/bin/python
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+# Usage: pgomerge.py <binary basename> <dist/bin>
+# Gathers .pgc files from dist/bin and merges them into
+# $PWD/$basename.pgd using pgomgr, then deletes them.
+# No errors if any of these files don't exist.
+
+import sys, os, os.path, subprocess
+if not sys.platform == "win32":
+ raise Exception("This script was only meant for Windows.")
+
+def MergePGOFiles(basename, pgddir, pgcdir):
+ """Merge pgc files produced from an instrumented binary
+ into the pgd file for the second pass of profile-guided optimization
+ with MSVC. |basename| is the name of the DLL or EXE without the
+ extension. |pgddir| is the path that contains <basename>.pgd
+ (should be the objdir it was built in). |pgcdir| is the path
+ containing basename!N.pgc files, which is probably dist/bin.
+ Calls pgomgr to merge each pgc file into the pgd, then deletes
+ the pgc files."""
+ if not os.path.isdir(pgddir) or not os.path.isdir(pgcdir):
+ return
+ pgdfile = os.path.abspath(os.path.join(pgddir, basename + ".pgd"))
+ if not os.path.isfile(pgdfile):
+ return
+ for file in os.listdir(pgcdir):
+ if file.startswith(basename+"!") and file.endswith(".pgc"):
+ try:
+ pgcfile = os.path.normpath(os.path.join(pgcdir, file))
+ subprocess.call(['pgomgr', '-merge',
+ pgcfile,
+ pgdfile])
+ os.remove(pgcfile)
+ except OSError:
+ pass
+
+if __name__ == '__main__':
+ if len(sys.argv) != 3:
+ print >>sys.stderr, "Usage: pgomerge.py <binary basename> <dist/bin>"
+ sys.exit(1)
+ MergePGOFiles(sys.argv[1], os.getcwd(), sys.argv[2])