mirror of
https://github.com/roytam1/UXP.git
synced 2026-05-26 05:38:39 +00:00
Issue #2221 - Enable link-time optimization for Spidermonkey by default if building it shared.
Currently only Windows can take advantage of this. The reason why the arrays of deunified sources are named like that in Spidermonkey's moz.build is to avoid UnsortedErrors in python. There's probably a better way to handle that, but I just want something that works for now. And yes, the deunified sources will be reunified if LTO is disabled.
This commit is contained in:
@@ -194,6 +194,7 @@ def old_configure_options(*options):
|
||||
'--enable-ion',
|
||||
'--enable-ios-target',
|
||||
'--enable-jitspew',
|
||||
'--enable-js-lto',
|
||||
'--enable-libjpeg-turbo',
|
||||
'--enable-libproxy',
|
||||
'--enable-llvm-hacks',
|
||||
|
||||
Vendored
+6
@@ -128,3 +128,9 @@ else:
|
||||
'/js/src/ctypes/libffi/src/%s/%s' % (CONFIG['FFI_TARGET_DIR'], s)
|
||||
for s in sorted(ffi_srcs)
|
||||
]
|
||||
|
||||
# Explicitly enable WPO and LTCG in MSVC if we're doing LTO.
|
||||
if CONFIG['JS_LTO']:
|
||||
if CONFIG['_MSC_VER'] and not CONFIG['CLANG_CL']:
|
||||
CFLAGS += [ '-GL' ]
|
||||
CXXFLAGS += [ '-GL' ]
|
||||
|
||||
+44
-21
@@ -7,8 +7,6 @@ include('js-config.mozbuild')
|
||||
include('js-cxxflags.mozbuild')
|
||||
include('js-testing.mozbuild')
|
||||
|
||||
FILES_PER_UNIFIED_FILE = 6
|
||||
|
||||
if CONFIG['JS_BUNDLED_EDITLINE']:
|
||||
DIRS += ['editline']
|
||||
|
||||
@@ -111,7 +109,7 @@ EXPORTS.js += [
|
||||
'../public/WeakMapPtr.h',
|
||||
]
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
main_deunified_sources = [
|
||||
'builtin/AtomicsObject.cpp',
|
||||
'builtin/Eval.cpp',
|
||||
'builtin/intl/Collator.cpp',
|
||||
@@ -388,7 +386,7 @@ SOURCES += [
|
||||
]
|
||||
|
||||
if CONFIG['JS_POSIX_NSPR']:
|
||||
UNIFIED_SOURCES += [
|
||||
posix_nspr_deunified_sources = [
|
||||
'vm/PosixNSPR.cpp',
|
||||
]
|
||||
|
||||
@@ -405,26 +403,24 @@ if CONFIG['ENABLE_TRACE_LOGGING']:
|
||||
]
|
||||
|
||||
if not CONFIG['ENABLE_ION']:
|
||||
UNIFIED_SOURCES += [
|
||||
jit_ioncheck1_deunified_sources = [
|
||||
'jit/none/Trampoline-none.cpp'
|
||||
]
|
||||
elif CONFIG['JS_CODEGEN_X86'] or CONFIG['JS_CODEGEN_X64']:
|
||||
UNIFIED_SOURCES += [
|
||||
jit_ioncheck1_deunified_sources = [
|
||||
'jit/x86-shared/Architecture-x86-shared.cpp',
|
||||
'jit/x86-shared/Assembler-x86-shared.cpp',
|
||||
'jit/x86-shared/AssemblerBuffer-x86-shared.cpp',
|
||||
'jit/x86-shared/BaselineCompiler-x86-shared.cpp',
|
||||
'jit/x86-shared/BaselineIC-x86-shared.cpp',
|
||||
'jit/x86-shared/CodeGenerator-x86-shared.cpp',
|
||||
'jit/x86-shared/Disassembler-x86-shared.cpp', # using namespace js::jit::X86Encoding;
|
||||
'jit/x86-shared/Lowering-x86-shared.cpp',
|
||||
'jit/x86-shared/MacroAssembler-x86-shared.cpp',
|
||||
'jit/x86-shared/MoveEmitter-x86-shared.cpp',
|
||||
]
|
||||
UNIFIED_SOURCES += [
|
||||
'jit/x86-shared/Disassembler-x86-shared.cpp', # using namespace js::jit::X86Encoding;
|
||||
]
|
||||
if CONFIG['JS_CODEGEN_X64']:
|
||||
UNIFIED_SOURCES += [
|
||||
jit_ioncheck2_deunified_sources = [
|
||||
'jit/x64/Assembler-x64.cpp',
|
||||
'jit/x64/Bailouts-x64.cpp',
|
||||
'jit/x64/BaselineCompiler-x64.cpp',
|
||||
@@ -436,7 +432,7 @@ elif CONFIG['JS_CODEGEN_X86'] or CONFIG['JS_CODEGEN_X64']:
|
||||
'jit/x64/Trampoline-x64.cpp',
|
||||
]
|
||||
else:
|
||||
UNIFIED_SOURCES += [
|
||||
jit_ioncheck2_deunified_sources = [
|
||||
'jit/x86/Assembler-x86.cpp',
|
||||
'jit/x86/Bailouts-x86.cpp',
|
||||
'jit/x86/BaselineCompiler-x86.cpp',
|
||||
@@ -448,7 +444,7 @@ elif CONFIG['JS_CODEGEN_X86'] or CONFIG['JS_CODEGEN_X64']:
|
||||
'jit/x86/Trampoline-x86.cpp',
|
||||
]
|
||||
elif CONFIG['JS_CODEGEN_ARM']:
|
||||
UNIFIED_SOURCES += [
|
||||
jit_ioncheck1_deunified_sources = [
|
||||
'jit/arm/Architecture-arm.cpp',
|
||||
'jit/arm/Assembler-arm.cpp',
|
||||
'jit/arm/Bailouts-arm.cpp',
|
||||
@@ -464,16 +460,16 @@ elif CONFIG['JS_CODEGEN_ARM']:
|
||||
'jit/arm/Trampoline-arm.cpp',
|
||||
]
|
||||
if CONFIG['JS_SIMULATOR_ARM']:
|
||||
UNIFIED_SOURCES += [
|
||||
jit_ioncheck2_deunified_sources = [
|
||||
'jit/arm/Simulator-arm.cpp'
|
||||
]
|
||||
elif CONFIG['OS_ARCH'] == 'Darwin':
|
||||
UNIFIED_SOURCES += [
|
||||
jit_ioncheck2_deunified_sources = [
|
||||
'jit/arm/llvm-compiler-rt/arm/aeabi_idivmod.S',
|
||||
'jit/arm/llvm-compiler-rt/arm/aeabi_uidivmod.S',
|
||||
]
|
||||
elif CONFIG['JS_CODEGEN_ARM64']:
|
||||
UNIFIED_SOURCES += [
|
||||
jit_ioncheck1_deunified_sources = [
|
||||
'jit/arm64/Architecture-arm64.cpp',
|
||||
'jit/arm64/Assembler-arm64.cpp',
|
||||
'jit/arm64/Bailouts-arm64.cpp',
|
||||
@@ -496,14 +492,14 @@ elif CONFIG['JS_CODEGEN_ARM64']:
|
||||
'jit/arm64/vixl/Utils-vixl.cpp'
|
||||
]
|
||||
if CONFIG['JS_SIMULATOR_ARM64']:
|
||||
UNIFIED_SOURCES += [
|
||||
jit_ioncheck2_deunified_sources = [
|
||||
'jit/arm64/vixl/Debugger-vixl.cpp',
|
||||
'jit/arm64/vixl/Logic-vixl.cpp',
|
||||
'jit/arm64/vixl/MozSimulator-vixl.cpp',
|
||||
'jit/arm64/vixl/Simulator-vixl.cpp'
|
||||
]
|
||||
elif CONFIG['JS_CODEGEN_MIPS32'] or CONFIG['JS_CODEGEN_MIPS64']:
|
||||
UNIFIED_SOURCES += [
|
||||
jit_ioncheck1_deunified_sources = [
|
||||
'jit/mips-shared/Architecture-mips-shared.cpp',
|
||||
'jit/mips-shared/Assembler-mips-shared.cpp',
|
||||
'jit/mips-shared/Bailouts-mips-shared.cpp',
|
||||
@@ -515,7 +511,7 @@ elif CONFIG['JS_CODEGEN_MIPS32'] or CONFIG['JS_CODEGEN_MIPS64']:
|
||||
'jit/mips-shared/MoveEmitter-mips-shared.cpp',
|
||||
]
|
||||
if CONFIG['JS_CODEGEN_MIPS32']:
|
||||
UNIFIED_SOURCES += [
|
||||
jit_ioncheck2_deunified_sources = [
|
||||
'jit/mips32/Architecture-mips32.cpp',
|
||||
'jit/mips32/Assembler-mips32.cpp',
|
||||
'jit/mips32/Bailouts-mips32.cpp',
|
||||
@@ -529,11 +525,11 @@ elif CONFIG['JS_CODEGEN_MIPS32'] or CONFIG['JS_CODEGEN_MIPS64']:
|
||||
'jit/mips32/Trampoline-mips32.cpp',
|
||||
]
|
||||
if CONFIG['JS_SIMULATOR_MIPS32']:
|
||||
UNIFIED_SOURCES += [
|
||||
jit_ioncheck3_deunified_sources = [
|
||||
'jit/mips32/Simulator-mips32.cpp'
|
||||
]
|
||||
elif CONFIG['JS_CODEGEN_MIPS64']:
|
||||
UNIFIED_SOURCES += [
|
||||
jit_ioncheck2_deunified_sources = [
|
||||
'jit/mips64/Architecture-mips64.cpp',
|
||||
'jit/mips64/Assembler-mips64.cpp',
|
||||
'jit/mips64/Bailouts-mips64.cpp',
|
||||
@@ -547,7 +543,7 @@ elif CONFIG['JS_CODEGEN_MIPS32'] or CONFIG['JS_CODEGEN_MIPS64']:
|
||||
'jit/mips64/Trampoline-mips64.cpp',
|
||||
]
|
||||
if CONFIG['JS_SIMULATOR_MIPS64']:
|
||||
UNIFIED_SOURCES += [
|
||||
jit_ioncheck3_deunified_sources = [
|
||||
'jit/mips64/Simulator-mips64.cpp'
|
||||
]
|
||||
|
||||
@@ -627,6 +623,33 @@ else:
|
||||
'icuuc',
|
||||
]
|
||||
|
||||
# Explicitly enable WPO and LTCG in MSVC, and deunify sources if
|
||||
# we're doing LTO
|
||||
if CONFIG['JS_LTO']:
|
||||
if CONFIG['_MSC_VER'] and not CONFIG['CLANG_CL']:
|
||||
CFLAGS += [ '-GL' ]
|
||||
CXXFLAGS += [ '-GL' ]
|
||||
if CONFIG['JS_SHARED_LIBRARY']:
|
||||
LDFLAGS += [ '/LTCG' ]
|
||||
SOURCES += main_deunified_sources
|
||||
if CONFIG['JS_POSIX_NSPR']:
|
||||
SOURCES += posix_nspr_deunified_sources
|
||||
SOURCES += jit_ioncheck1_deunified_sources
|
||||
if CONFIG['ENABLE_ION']:
|
||||
SOURCES += jit_ioncheck2_deunified_sources
|
||||
if CONFIG['JS_CODEGEN_MIPS32'] or CONFIG['JS_CODEGEN_MIPS64']:
|
||||
SOURCES += jit_ioncheck3_deunified_sources
|
||||
else:
|
||||
FILES_PER_UNIFIED_FILE = 6
|
||||
UNIFIED_SOURCES += main_deunified_sources
|
||||
if CONFIG['JS_POSIX_NSPR']:
|
||||
UNIFIED_SOURCES += posix_nspr_deunified_sources
|
||||
UNIFIED_SOURCES += jit_ioncheck1_deunified_sources
|
||||
if CONFIG['ENABLE_ION']:
|
||||
UNIFIED_SOURCES += jit_ioncheck2_deunified_sources
|
||||
if CONFIG['JS_CODEGEN_MIPS32'] or CONFIG['JS_CODEGEN_MIPS64']:
|
||||
UNIFIED_SOURCES += jit_ioncheck3_deunified_sources
|
||||
|
||||
USE_LIBS += [
|
||||
'nspr',
|
||||
'zlib',
|
||||
|
||||
@@ -584,6 +584,26 @@ esac
|
||||
|
||||
MOZ_DOING_LTO(lto_is_enabled)
|
||||
|
||||
dnl ========================================================
|
||||
dnl Spidermonkey link-time optimization support
|
||||
dnl ========================================================
|
||||
|
||||
# We want LTO enabled by default in Spidermonkey if we're building it shared.
|
||||
if test -n "$JS_SHARED_LIBRARY"; then
|
||||
JS_LTO=1
|
||||
fi
|
||||
|
||||
MOZ_ARG_DISABLE_BOOL(js-lto,
|
||||
[ --disable-js-lto Disable link-time optimization for the Spidermonkey library],
|
||||
JS_LTO=,
|
||||
JS_LTO=1)
|
||||
|
||||
if test -n "$JS_LTO"; then
|
||||
AC_DEFINE(JS_LTO)
|
||||
fi
|
||||
|
||||
AC_SUBST(JS_LTO)
|
||||
|
||||
dnl ========================================================
|
||||
dnl System overrides of the defaults for target
|
||||
dnl ========================================================
|
||||
|
||||
@@ -38,6 +38,12 @@ if CONFIG['CC_TYPE'] == 'clang-cl':
|
||||
'-Wno-sign-compare', # signed/unsigned mismatch
|
||||
]
|
||||
|
||||
# Explicitly enable WPO and LTCG in MSVC if we're doing LTO.
|
||||
if CONFIG['JS_LTO']:
|
||||
if CONFIG['_MSC_VER'] and not CONFIG['CLANG_CL']:
|
||||
CFLAGS += [ '-GL' ]
|
||||
CXXFLAGS += [ '-GL' ]
|
||||
|
||||
SOURCES += [
|
||||
'e_acos.cpp',
|
||||
'e_acosh.cpp',
|
||||
|
||||
@@ -768,6 +768,26 @@ AC_SUBST(MOZILLA_UAVERSION_U)
|
||||
|
||||
MOZ_DOING_LTO(lto_is_enabled)
|
||||
|
||||
dnl ========================================================
|
||||
dnl Spidermonkey link-time optimization support
|
||||
dnl ========================================================
|
||||
|
||||
# We want LTO enabled by default in Spidermonkey if we're building it shared.
|
||||
if test -n "$JS_SHARED_LIBRARY"; then
|
||||
JS_LTO=1
|
||||
fi
|
||||
|
||||
MOZ_ARG_DISABLE_BOOL(js-lto,
|
||||
[ --disable-js-lto Disable link-time optimization for the Spidermonkey library],
|
||||
JS_LTO=,
|
||||
JS_LTO=1)
|
||||
|
||||
if test -n "$JS_LTO"; then
|
||||
AC_DEFINE(JS_LTO)
|
||||
fi
|
||||
|
||||
AC_SUBST(JS_LTO)
|
||||
|
||||
dnl ========================================================
|
||||
dnl System overrides of the defaults for target
|
||||
dnl ========================================================
|
||||
|
||||
Reference in New Issue
Block a user