2016-07-14 16:16:42 +00:00
|
|
|
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
2016-03-08 04:49:35 +00:00
|
|
|
# vim: set filetype=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/.
|
2016-03-09 06:27:42 +00:00
|
|
|
|
2016-03-09 06:59:39 +00:00
|
|
|
# /!\ Use js_option() instead of option() in this file. /!\
|
|
|
|
# =========================================================
|
|
|
|
|
2018-12-11 19:34:28 +00:00
|
|
|
@depends(build_project)
|
|
|
|
def building_js(build_project):
|
2016-03-09 06:59:39 +00:00
|
|
|
return build_project == 'js'
|
|
|
|
|
2016-03-18 10:03:09 +00:00
|
|
|
# Exception to the rule above: JS_STANDALONE is a special option that doesn't
|
|
|
|
# want the js_option treatment. When we're done merging js/src/configure and
|
|
|
|
# top-level configure, it can go away, although the JS_STANDALONE config
|
|
|
|
# will still need to be set depending on building_js above.
|
|
|
|
option(env='JS_STANDALONE', default=building_js,
|
|
|
|
help='Reserved for internal use')
|
|
|
|
|
2020-02-28 14:17:33 +00:00
|
|
|
# SmooshMonkey (new frontend)
|
|
|
|
# ==================================================
|
|
|
|
|
|
|
|
# Define here in order to use the option from bindgen.configure.
|
|
|
|
js_option('--enable-smoosh', default=False,
|
|
|
|
help='Enable SmooshMonkey (new JS engine frontend)')
|
|
|
|
|
|
|
|
@depends('--enable-smoosh')
|
|
|
|
def enable_smoosh(value):
|
|
|
|
if value:
|
|
|
|
return True
|
|
|
|
|
|
|
|
set_config('JS_ENABLE_SMOOSH', enable_smoosh)
|
|
|
|
set_define('JS_ENABLE_SMOOSH', enable_smoosh)
|
|
|
|
|
2018-08-02 16:00:21 +00:00
|
|
|
include('../build/moz.configure/rust.configure',
|
|
|
|
when='--enable-compile-environment')
|
2019-02-15 15:23:08 +00:00
|
|
|
include('../build/moz.configure/bindgen.configure',
|
|
|
|
when='--enable-compile-environment')
|
2018-08-02 16:00:21 +00:00
|
|
|
|
2016-03-18 10:03:09 +00:00
|
|
|
@depends('JS_STANDALONE')
|
|
|
|
def js_standalone(value):
|
|
|
|
if value:
|
2016-03-22 05:21:32 +00:00
|
|
|
return True
|
|
|
|
set_config('JS_STANDALONE', js_standalone)
|
2017-08-31 22:59:13 +00:00
|
|
|
set_define('JS_STANDALONE', js_standalone)
|
2016-03-23 07:34:59 +00:00
|
|
|
add_old_configure_assignment('JS_STANDALONE', js_standalone)
|
2016-03-18 10:03:09 +00:00
|
|
|
js_option('--disable-js-shell', default=building_js,
|
2018-10-16 11:28:12 +00:00
|
|
|
help='{Build|Do not build} the JS shell')
|
2016-03-09 06:27:42 +00:00
|
|
|
|
|
|
|
@depends('--disable-js-shell')
|
2016-03-22 05:21:32 +00:00
|
|
|
def js_disable_shell(value):
|
2016-03-09 06:27:42 +00:00
|
|
|
if not value:
|
2016-03-22 05:21:32 +00:00
|
|
|
return True
|
|
|
|
|
|
|
|
set_config('JS_DISABLE_SHELL', js_disable_shell)
|
2016-03-09 08:41:40 +00:00
|
|
|
|
2018-02-22 08:40:00 +00:00
|
|
|
set_define('JS_64BIT', depends(target)(lambda t: t.bitness == 64 or None))
|
2016-03-09 08:41:40 +00:00
|
|
|
|
2017-12-02 02:29:28 +00:00
|
|
|
set_define('JS_PUNBOX64', depends(target)(lambda t: t.bitness == 64 or None))
|
|
|
|
set_define('JS_NUNBOX32', depends(target)(lambda t: t.bitness == 32 or None))
|
|
|
|
|
|
|
|
|
2016-03-09 08:41:40 +00:00
|
|
|
# SpiderMonkey as a shared library, and how its symbols are exported
|
|
|
|
# ==================================================================
|
2019-05-28 18:45:03 +00:00
|
|
|
js_option('--disable-shared-js', when=js_standalone,
|
2018-10-16 11:28:12 +00:00
|
|
|
help='{Create|Do not create} a shared library')
|
2016-03-09 08:41:40 +00:00
|
|
|
|
2019-05-28 18:45:03 +00:00
|
|
|
js_option('--disable-export-js', when=js_standalone,
|
2018-10-16 11:28:12 +00:00
|
|
|
help='{Mark|Do not mark} JS symbols as DLL exported/visible')
|
2016-03-09 08:41:40 +00:00
|
|
|
|
2019-05-28 18:45:03 +00:00
|
|
|
@depends('--disable-shared-js', '--disable-export-js', when=js_standalone)
|
2016-03-23 01:22:08 +00:00
|
|
|
def shared_js(shared_js, export_js):
|
2016-03-09 08:41:40 +00:00
|
|
|
if shared_js:
|
|
|
|
if not export_js:
|
2016-03-25 06:48:21 +00:00
|
|
|
die('Must export JS symbols when building a shared library.')
|
2016-03-23 01:22:08 +00:00
|
|
|
return True
|
|
|
|
|
|
|
|
set_config('JS_SHARED_LIBRARY', shared_js)
|
2016-03-23 07:34:59 +00:00
|
|
|
add_old_configure_assignment('JS_SHARED_LIBRARY', shared_js)
|
2016-03-23 01:22:08 +00:00
|
|
|
|
2019-05-28 18:45:03 +00:00
|
|
|
@depends(shared_js, '--disable-export-js', when=js_standalone)
|
2016-03-23 01:22:08 +00:00
|
|
|
def exportable_js_api(shared_js, export_js):
|
|
|
|
if not shared_js and export_js:
|
|
|
|
return True
|
|
|
|
|
|
|
|
set_define('STATIC_EXPORTABLE_JS_API', exportable_js_api)
|
|
|
|
|
2019-05-28 18:45:03 +00:00
|
|
|
@depends(shared_js, exportable_js_api)
|
2016-03-23 01:22:08 +00:00
|
|
|
def static_js_api(shared_js, export_js):
|
|
|
|
if not shared_js and not export_js:
|
|
|
|
return True
|
|
|
|
|
|
|
|
set_define('STATIC_JS_API', static_js_api)
|
2016-03-09 08:41:40 +00:00
|
|
|
|
2019-05-28 18:45:03 +00:00
|
|
|
@depends(shared_js)
|
2016-03-23 01:22:08 +00:00
|
|
|
def static_js(value):
|
|
|
|
if not value:
|
2016-03-22 05:21:32 +00:00
|
|
|
return True
|
|
|
|
|
2016-03-23 01:22:08 +00:00
|
|
|
set_define('MOZ_STATIC_JS', static_js)
|
2016-03-09 08:41:40 +00:00
|
|
|
|
2016-03-17 07:12:44 +00:00
|
|
|
|
2019-11-15 13:14:42 +00:00
|
|
|
js_option(env='NO_RUST_PANIC_HOOK', when=js_standalone,
|
|
|
|
help='Disable rust panic hook')
|
|
|
|
|
|
|
|
set_define('NO_RUST_PANIC_HOOK', True, when='NO_RUST_PANIC_HOOK')
|
|
|
|
|
|
|
|
|
2017-12-02 02:29:27 +00:00
|
|
|
# JIT support
|
|
|
|
# =======================================================
|
2019-02-06 13:41:56 +00:00
|
|
|
@depends(target)
|
2020-04-07 14:52:33 +00:00
|
|
|
def jit_default(target):
|
2017-12-02 02:29:27 +00:00
|
|
|
if target.cpu in ('x86', 'x86_64', 'arm', 'aarch64', 'mips32', 'mips64'):
|
|
|
|
return True
|
Bug 1366287 - Part 1.0: Define a new BigInt primitive type, with a GDB prettyprinter, Rust binding support, and a new out-of-line TraceKind. (Disabled by default, implemented only incompletely, currently passing --enable-bigint will disable JITs, will be flipped on Eventually once every sub-aspect is in place, Don't Have A Cow, Man.) r=jwalden, r=Ms2ger, r=sfink
--HG--
extra : rebase_source : aa13bd94bc6157ff8134894e3ba2e7a2b53e28d9
2018-05-24 18:26:09 +00:00
|
|
|
return False
|
2017-12-02 02:29:27 +00:00
|
|
|
|
2020-04-07 14:52:33 +00:00
|
|
|
js_option('--enable-jit',
|
|
|
|
default=jit_default,
|
|
|
|
help='{Enable|Disable} use of the JITs')
|
|
|
|
|
|
|
|
@deprecated_option('--enable-ion')
|
|
|
|
def report_deprecated(value):
|
|
|
|
if value:
|
|
|
|
die('--enable-ion is deprecated, use --enable-jit instead')
|
|
|
|
else:
|
|
|
|
die('--disable-ion is deprecated, use --disable-jit instead')
|
2017-12-02 02:29:27 +00:00
|
|
|
|
|
|
|
# JIT code simulator for cross compiles
|
|
|
|
# =======================================================
|
|
|
|
js_option('--enable-simulator', choices=('arm', 'arm64', 'mips32', 'mips64'),
|
|
|
|
nargs=1,
|
|
|
|
help='Enable a JIT code simulator for the specified architecture')
|
|
|
|
|
2020-04-07 14:52:33 +00:00
|
|
|
@depends('--enable-jit', '--enable-simulator', target)
|
|
|
|
def simulator(jit_enabled, simulator_enabled, target):
|
|
|
|
if not jit_enabled or not simulator_enabled:
|
2017-12-02 02:29:27 +00:00
|
|
|
return
|
|
|
|
|
|
|
|
sim_cpu = simulator_enabled[0]
|
|
|
|
|
|
|
|
if sim_cpu in ('arm', 'mips32'):
|
|
|
|
if target.cpu != 'x86':
|
|
|
|
die('The %s simulator only works on x86.' % sim_cpu)
|
|
|
|
|
|
|
|
if sim_cpu in ('arm64', 'mips64'):
|
|
|
|
if target.cpu != 'x86_64':
|
|
|
|
die('The %s simulator only works on x86-64.' % sim_cpu)
|
|
|
|
|
|
|
|
return namespace(**{sim_cpu: True})
|
|
|
|
|
|
|
|
set_config('JS_SIMULATOR', depends_if(simulator)(lambda x: True))
|
|
|
|
set_config('JS_SIMULATOR_ARM', simulator.arm)
|
|
|
|
set_config('JS_SIMULATOR_ARM64', simulator.arm64)
|
|
|
|
set_config('JS_SIMULATOR_MIPS32', simulator.mips32)
|
|
|
|
set_config('JS_SIMULATOR_MIPS64', simulator.mips64)
|
|
|
|
set_define('JS_SIMULATOR', depends_if(simulator)(lambda x: True))
|
|
|
|
set_define('JS_SIMULATOR_ARM', simulator.arm)
|
|
|
|
set_define('JS_SIMULATOR_ARM64', simulator.arm64)
|
|
|
|
set_define('JS_SIMULATOR_MIPS32', simulator.mips32)
|
|
|
|
set_define('JS_SIMULATOR_MIPS64', simulator.mips64)
|
|
|
|
|
2020-04-07 14:52:33 +00:00
|
|
|
@depends('--enable-jit', simulator, target)
|
|
|
|
def jit_codegen(jit_enabled, simulator, target):
|
|
|
|
if not jit_enabled:
|
2017-12-02 02:29:27 +00:00
|
|
|
return namespace(none=True)
|
|
|
|
|
|
|
|
if simulator:
|
|
|
|
return simulator
|
|
|
|
|
|
|
|
if target.cpu == 'aarch64':
|
|
|
|
return namespace(arm64=True)
|
|
|
|
elif target.cpu == 'x86_64':
|
|
|
|
return namespace(x64=True)
|
|
|
|
|
|
|
|
return namespace(**{str(target.cpu): True})
|
|
|
|
|
|
|
|
set_config('JS_CODEGEN_NONE', jit_codegen.none)
|
|
|
|
set_config('JS_CODEGEN_ARM', jit_codegen.arm)
|
|
|
|
set_config('JS_CODEGEN_ARM64', jit_codegen.arm64)
|
|
|
|
set_config('JS_CODEGEN_MIPS32', jit_codegen.mips32)
|
|
|
|
set_config('JS_CODEGEN_MIPS64', jit_codegen.mips64)
|
|
|
|
set_config('JS_CODEGEN_X86', jit_codegen.x86)
|
|
|
|
set_config('JS_CODEGEN_X64', jit_codegen.x64)
|
|
|
|
set_define('JS_CODEGEN_NONE', jit_codegen.none)
|
|
|
|
set_define('JS_CODEGEN_ARM', jit_codegen.arm)
|
|
|
|
set_define('JS_CODEGEN_ARM64', jit_codegen.arm64)
|
|
|
|
set_define('JS_CODEGEN_MIPS32', jit_codegen.mips32)
|
|
|
|
set_define('JS_CODEGEN_MIPS64', jit_codegen.mips64)
|
|
|
|
set_define('JS_CODEGEN_X86', jit_codegen.x86)
|
|
|
|
set_define('JS_CODEGEN_X64', jit_codegen.x64)
|
|
|
|
|
2016-03-17 07:12:44 +00:00
|
|
|
# Profiling
|
|
|
|
# =======================================================
|
|
|
|
js_option('--enable-instruments', env='MOZ_INSTRUMENTS',
|
|
|
|
help='Enable instruments remote profiling')
|
|
|
|
|
|
|
|
@depends('--enable-instruments', target)
|
|
|
|
def instruments(value, target):
|
|
|
|
if value and target.os != 'OSX':
|
2016-03-25 06:48:21 +00:00
|
|
|
die('--enable-instruments cannot be used when targeting %s',
|
|
|
|
target.os)
|
2016-03-17 07:12:44 +00:00
|
|
|
if value:
|
2016-03-22 05:21:32 +00:00
|
|
|
return True
|
2016-03-17 07:17:36 +00:00
|
|
|
|
2016-03-22 05:21:32 +00:00
|
|
|
set_config('MOZ_INSTRUMENTS', instruments)
|
2016-03-23 01:22:08 +00:00
|
|
|
set_define('MOZ_INSTRUMENTS', instruments)
|
2016-03-23 07:34:59 +00:00
|
|
|
add_old_configure_assignment('MOZ_INSTRUMENTS', instruments)
|
2016-03-23 05:18:57 +00:00
|
|
|
imply_option('--enable-profiling', instruments, reason='--enable-instruments')
|
2016-03-17 07:17:36 +00:00
|
|
|
|
|
|
|
js_option('--enable-callgrind', env='MOZ_CALLGRIND',
|
|
|
|
help='Enable callgrind profiling')
|
|
|
|
|
|
|
|
@depends('--enable-callgrind')
|
|
|
|
def callgrind(value):
|
|
|
|
if value:
|
2016-03-23 01:22:08 +00:00
|
|
|
return True
|
2016-03-17 07:24:30 +00:00
|
|
|
|
2016-03-23 01:22:08 +00:00
|
|
|
set_define('MOZ_CALLGRIND', callgrind)
|
2016-03-23 05:18:57 +00:00
|
|
|
imply_option('--enable-profiling', callgrind)
|
2016-03-17 07:24:30 +00:00
|
|
|
|
2018-12-11 19:34:28 +00:00
|
|
|
@depends(milestone)
|
|
|
|
def enable_profiling(milestone):
|
2016-11-29 21:47:38 +00:00
|
|
|
return milestone.is_nightly
|
|
|
|
|
|
|
|
js_option('--enable-profiling', env='MOZ_PROFILING', default=enable_profiling,
|
2018-10-16 11:28:12 +00:00
|
|
|
help='{Set|Do not set} compile flags necessary for using sampling '
|
|
|
|
'profilers (e.g. shark, perf)')
|
2016-03-17 07:24:30 +00:00
|
|
|
|
2016-03-23 05:18:57 +00:00
|
|
|
@depends('--enable-profiling')
|
|
|
|
def profiling(value):
|
2016-03-17 07:24:30 +00:00
|
|
|
if value:
|
2016-03-23 05:18:57 +00:00
|
|
|
return True
|
2016-03-17 07:24:30 +00:00
|
|
|
|
2016-03-23 07:34:59 +00:00
|
|
|
add_old_configure_assignment('MOZ_PROFILING', profiling)
|
|
|
|
|
2019-06-12 22:30:46 +00:00
|
|
|
with only_when('--enable-compile-environment'):
|
|
|
|
imply_option('--enable-frame-pointers', True, when=profiling)
|
|
|
|
|
|
|
|
|
2016-03-23 05:18:57 +00:00
|
|
|
@depends(profiling, target)
|
|
|
|
def imply_vtune(value, target):
|
2017-01-17 22:35:42 +00:00
|
|
|
ok_cpu = target.cpu in ['x86', 'x86_64']
|
|
|
|
ok_kernel = target.kernel == 'WINNT' or \
|
|
|
|
(target.kernel == 'Linux' and target.os == 'GNU')
|
|
|
|
|
|
|
|
if value and ok_cpu and ok_kernel:
|
2016-03-22 05:21:32 +00:00
|
|
|
return True
|
|
|
|
|
|
|
|
set_config('MOZ_PROFILING', profiling)
|
2016-03-23 01:22:08 +00:00
|
|
|
set_define('MOZ_PROFILING', profiling)
|
2016-03-23 05:18:57 +00:00
|
|
|
imply_option('--enable-vtune', imply_vtune, reason='--enable-profiling')
|
2016-03-17 07:24:30 +00:00
|
|
|
|
|
|
|
|
2017-01-17 22:35:42 +00:00
|
|
|
js_option('--enable-vtune', env='MOZ_VTUNE', help='Enable VTune profiling')
|
2016-03-17 07:24:30 +00:00
|
|
|
|
|
|
|
@depends('--enable-vtune')
|
|
|
|
def vtune(value):
|
|
|
|
if value:
|
2016-03-22 05:21:32 +00:00
|
|
|
return True
|
|
|
|
|
|
|
|
set_config('MOZ_VTUNE', vtune)
|
2016-03-23 01:22:08 +00:00
|
|
|
set_define('MOZ_VTUNE', vtune)
|
2016-08-10 11:06:40 +00:00
|
|
|
|
|
|
|
|
2020-05-05 16:35:14 +00:00
|
|
|
js_option('--enable-gc-probes', env='JS_GC_PROBES',
|
|
|
|
help='Turn on probes for allocation and finalization')
|
2016-08-10 11:06:40 +00:00
|
|
|
|
2020-05-05 16:35:14 +00:00
|
|
|
@depends('--enable-gc-probes')
|
|
|
|
def gc_probes(value):
|
2016-08-10 11:06:40 +00:00
|
|
|
if value:
|
|
|
|
return True
|
|
|
|
|
2020-05-05 16:35:14 +00:00
|
|
|
set_define('JS_GC_PROBES', gc_probes)
|
2016-08-10 11:06:49 +00:00
|
|
|
|
|
|
|
|
2017-12-03 18:40:03 +00:00
|
|
|
js_option('--enable-gczeal',
|
|
|
|
default=depends(when=moz_debug)(lambda: True),
|
2018-10-16 11:28:12 +00:00
|
|
|
help='{Enable|Disable} zealous GCing')
|
2017-12-03 18:40:03 +00:00
|
|
|
|
|
|
|
set_define('JS_GC_ZEAL',
|
|
|
|
depends_if('--enable-gczeal')(lambda _: True))
|
|
|
|
|
|
|
|
|
2017-12-03 18:44:55 +00:00
|
|
|
# Use a smaller chunk size for GC chunks
|
|
|
|
# ========================================================
|
|
|
|
# Use large (1MB) chunks by default. This option can be used to give
|
|
|
|
# smaller (currently 256K) chunks.
|
|
|
|
js_option('--enable-small-chunk-size',
|
|
|
|
help='Allocate memory for JS GC things in smaller chunks')
|
|
|
|
|
|
|
|
set_define('JS_GC_SMALL_CHUNK_SIZE',
|
|
|
|
depends(when='--enable-small-chunk-size')(lambda: True))
|
|
|
|
|
|
|
|
|
2017-12-02 18:43:41 +00:00
|
|
|
# Trace logging.
|
|
|
|
# =======================================================
|
2019-04-11 23:52:41 +00:00
|
|
|
@depends(milestone)
|
|
|
|
def default_trace_logging(milestone):
|
|
|
|
return milestone.is_nightly
|
|
|
|
|
|
|
|
|
2017-12-02 18:43:41 +00:00
|
|
|
js_option('--enable-trace-logging',
|
2019-04-11 23:52:41 +00:00
|
|
|
default=default_trace_logging,
|
2018-10-16 11:28:12 +00:00
|
|
|
help='{Enable|Disable} trace logging')
|
2017-12-02 18:43:41 +00:00
|
|
|
|
|
|
|
set_config('ENABLE_TRACE_LOGGING',
|
|
|
|
depends_if('--enable-trace-logging')(lambda x: True))
|
|
|
|
set_define('JS_TRACE_LOGGING',
|
|
|
|
depends_if('--enable-trace-logging')(lambda x: True))
|
|
|
|
|
|
|
|
|
2018-01-31 19:35:57 +00:00
|
|
|
# Enable breakpoint for artificial OOMs
|
|
|
|
# =======================================================
|
|
|
|
js_option('--enable-oom-breakpoint',
|
|
|
|
help='Enable a breakpoint function for artificial OOMs')
|
|
|
|
|
|
|
|
set_define('JS_OOM_BREAKPOINT',
|
|
|
|
depends_if('--enable-oom-breakpoint')(lambda _: True))
|
|
|
|
|
|
|
|
|
2016-08-10 11:06:49 +00:00
|
|
|
js_option('--enable-perf', env='JS_ION_PERF',
|
|
|
|
help='Enable Linux perf integration')
|
|
|
|
|
|
|
|
@depends('--enable-perf')
|
|
|
|
def ion_perf(value):
|
|
|
|
if value:
|
|
|
|
return True
|
|
|
|
|
|
|
|
set_define('JS_ION_PERF', ion_perf)
|
2016-08-10 11:06:55 +00:00
|
|
|
|
|
|
|
|
2017-12-02 18:43:40 +00:00
|
|
|
js_option('--enable-jitspew',
|
|
|
|
default=depends(when=moz_debug)(lambda: True),
|
2018-10-16 11:28:12 +00:00
|
|
|
help='{Enable|Disable} the Jit spew and IONFLAGS environment '
|
|
|
|
'variable')
|
2017-12-02 18:43:40 +00:00
|
|
|
|
|
|
|
set_define('JS_JITSPEW',
|
|
|
|
depends_if('--enable-jitspew')(lambda _: True))
|
|
|
|
set_config('JS_JITSPEW',
|
|
|
|
depends_if('--enable-jitspew')(lambda _: True))
|
|
|
|
|
2018-11-29 14:37:01 +00:00
|
|
|
# Also enable the structured spewer
|
|
|
|
set_define('JS_STRUCTURED_SPEW',
|
|
|
|
depends_if('--enable-jitspew')(lambda _: True))
|
|
|
|
set_config('JS_STRUCTURED_SPEW',
|
|
|
|
depends_if('--enable-jitspew')(lambda _: True))
|
2019-04-03 16:47:49 +00:00
|
|
|
|
2020-04-07 14:52:33 +00:00
|
|
|
@depends('--enable-jit', '--enable-jitspew', simulator, target, moz_debug)
|
|
|
|
def jit_disasm_arm(jit_enabled, spew, simulator, target, debug):
|
|
|
|
if not jit_enabled:
|
2019-04-03 16:47:49 +00:00
|
|
|
return
|
|
|
|
|
|
|
|
if simulator and (debug or spew):
|
|
|
|
if getattr(simulator, 'arm', None):
|
|
|
|
return True
|
|
|
|
|
|
|
|
if target.cpu == 'arm' and (debug or spew):
|
|
|
|
return True
|
|
|
|
|
|
|
|
set_config('JS_DISASM_ARM', jit_disasm_arm)
|
|
|
|
set_define('JS_DISASM_ARM', jit_disasm_arm)
|
|
|
|
|
2020-04-07 14:52:33 +00:00
|
|
|
@depends('--enable-jit', '--enable-jitspew', simulator, target, moz_debug)
|
|
|
|
def jit_disasm_arm64(jit_enabled, spew, simulator, target, debug):
|
|
|
|
if not jit_enabled:
|
2019-04-03 16:47:49 +00:00
|
|
|
return
|
|
|
|
|
|
|
|
if simulator and (debug or spew):
|
|
|
|
if getattr(simulator, 'arm64', None):
|
|
|
|
return True
|
|
|
|
|
|
|
|
if target.cpu == 'aarch64' and (debug or spew):
|
|
|
|
return True
|
|
|
|
|
|
|
|
set_config('JS_DISASM_ARM64', jit_disasm_arm64)
|
|
|
|
set_define('JS_DISASM_ARM64', jit_disasm_arm64)
|
|
|
|
|
2018-10-24 13:07:53 +00:00
|
|
|
# When enabled, masm will generate assumeUnreachable calls that act as
|
|
|
|
# assertions in the generated code. This option is worth disabling when you
|
|
|
|
# have to track mutated values through the generated code, to avoid constantly
|
|
|
|
# dumping registers on and off the stack.
|
|
|
|
js_option('--enable-masm-verbose',
|
|
|
|
default=depends(when=moz_debug)(lambda: True),
|
2018-10-16 11:28:12 +00:00
|
|
|
help='{Enable|Disable} MacroAssembler verbosity of generated code.')
|
2018-10-24 13:07:53 +00:00
|
|
|
set_define('JS_MASM_VERBOSE',
|
|
|
|
depends_if('--enable-masm-verbose')(lambda _: True))
|
|
|
|
set_config('JS_MASM_VERBOSE',
|
|
|
|
depends_if('--enable-masm-verbose')(lambda _: True))
|
|
|
|
|
2017-12-02 18:43:40 +00:00
|
|
|
|
2016-08-10 11:06:55 +00:00
|
|
|
js_option('--enable-more-deterministic', env='JS_MORE_DETERMINISTIC',
|
|
|
|
help='Enable changes that make the shell more deterministic')
|
|
|
|
|
|
|
|
@depends('--enable-more-deterministic')
|
|
|
|
def more_deterministic(value):
|
|
|
|
if value:
|
|
|
|
return True
|
|
|
|
|
|
|
|
set_define('JS_MORE_DETERMINISTIC', more_deterministic)
|
2016-10-04 05:57:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
# CTypes
|
|
|
|
# =======================================================
|
2018-12-11 19:34:28 +00:00
|
|
|
@depends(building_js)
|
|
|
|
def ctypes_default(building_js):
|
2016-10-04 05:57:00 +00:00
|
|
|
return not building_js
|
|
|
|
|
2018-10-16 11:28:12 +00:00
|
|
|
js_option('--enable-ctypes',
|
|
|
|
default=ctypes_default,
|
|
|
|
help='{Enable|Disable} js-ctypes')
|
2016-10-04 05:57:00 +00:00
|
|
|
|
|
|
|
build_ctypes = depends_if('--enable-ctypes')(lambda _: True)
|
|
|
|
|
|
|
|
set_config('BUILD_CTYPES', build_ctypes)
|
|
|
|
set_define('BUILD_CTYPES', build_ctypes)
|
|
|
|
|
|
|
|
@depends(build_ctypes, building_js)
|
|
|
|
def js_has_ctypes(ctypes, js):
|
|
|
|
if ctypes and js:
|
|
|
|
return True
|
|
|
|
|
|
|
|
set_config('JS_HAS_CTYPES', js_has_ctypes)
|
|
|
|
set_define('JS_HAS_CTYPES', js_has_ctypes)
|
|
|
|
|
2018-12-11 19:34:28 +00:00
|
|
|
@depends('--enable-ctypes', '--enable-compile-environment')
|
|
|
|
def ctypes_and_compile_environment(ctypes, compile_environment):
|
2016-10-04 05:57:00 +00:00
|
|
|
return ctypes and compile_environment
|
|
|
|
|
2016-10-13 08:15:24 +00:00
|
|
|
include('ffi.configure', when=ctypes_and_compile_environment)
|
2017-01-23 23:40:38 +00:00
|
|
|
|
|
|
|
|
2017-10-17 04:10:00 +00:00
|
|
|
# Enable pipeline operator
|
|
|
|
# ===================================================
|
|
|
|
js_option('--enable-pipeline-operator', default=False, help='Enable pipeline operator')
|
|
|
|
|
|
|
|
@depends('--enable-pipeline-operator')
|
|
|
|
def enable_pipeline_operator(value):
|
|
|
|
if value:
|
|
|
|
return True
|
|
|
|
|
|
|
|
set_config('ENABLE_PIPELINE_OPERATOR', enable_pipeline_operator)
|
|
|
|
set_define('ENABLE_PIPELINE_OPERATOR', enable_pipeline_operator)
|
2017-12-15 15:54:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Experimental support for BinAST
|
|
|
|
# ==============================================================
|
|
|
|
|
2019-02-14 10:52:57 +00:00
|
|
|
@depends(milestone.is_nightly)
|
|
|
|
def default_binast(is_nightly):
|
|
|
|
return is_nightly
|
|
|
|
|
|
|
|
js_option('--enable-binast',
|
|
|
|
default=default_binast,
|
|
|
|
help="{Enable|Disable} BinAST support")
|
2017-12-15 15:54:55 +00:00
|
|
|
|
2019-02-14 10:52:57 +00:00
|
|
|
set_config('JS_BUILD_BINAST', depends_if('--enable-binast')(lambda x: True))
|
|
|
|
set_define('JS_BUILD_BINAST', depends_if('--enable-binast')(lambda x: True))
|
2018-07-24 18:31:45 +00:00
|
|
|
|
|
|
|
|
2019-09-24 00:26:55 +00:00
|
|
|
# SIMD acceleration for encoding_rs
|
|
|
|
# ==============================================================
|
|
|
|
|
|
|
|
js_option('--enable-rust-simd', env='MOZ_RUST_SIMD',
|
|
|
|
help='Enable explicit SIMD in Rust code.')
|
|
|
|
|
|
|
|
@depends('--enable-rust-simd', target)
|
|
|
|
def rust_simd(value, target):
|
|
|
|
# As of 2019-09-17, the simd-accel feature of encoding_rs has not
|
|
|
|
# been properly set up outside aarch64, armv7, x86 and x86_64.
|
|
|
|
if target.cpu in ('aarch64', 'arm', 'x86', 'x86_64') and value:
|
|
|
|
return True
|
|
|
|
|
|
|
|
set_config('MOZ_RUST_SIMD', rust_simd)
|
|
|
|
set_define('MOZ_RUST_SIMD', rust_simd)
|
|
|
|
|
|
|
|
|
2018-07-24 18:31:45 +00:00
|
|
|
# Experimental support for wasm code generation with Cranelift
|
Bug 1566427 - Improved compiler availability computation. r=bbouvier
This patch cleans up wasm compiler selection and a few related things
with as few semantic changes as possible. The intent is to centralize
compiler availability computation so that all parts of the system stay
in sync and it is easy to change compiler selection policy.
First, we introduce new predicates <Compiler>Available(cx) to test for
the actual availability of a compiler. These predicates take into
account whether a compiler is compiled into the executable, whether it
supports the hardware, whether it is (currently) selected by
options/switches, and whether it can be used as a result of the
runtime environment (for example, Ion and Cranelift are not available
if the debugger is observing the page or if the GC feature is enabled;
Cranelift is not available if shared memory and atomics are enabled).
We switch to using these predicates almost everywhere that used
<Compiler>CanCompile() or cx->options().wasm<Compiler>(), since those
don't tell the full story.
Second, we implement a priority order of the optimizing compilers and
make it easy to change this order (see comments in code). At the
moment, Cranelift is prioritized over Ion since Ion is enabled by
default and Cranelift is not; thus the desire of somebody flipping the
pref for Cranelift is to deselect Ion. The priority order may change
in the future or may become platform-dependent. The default compiler
selection in both browser and shell remains Baseline+Ion.
Third, we rename HasCompilerSupport() as HasPlatformSupport(), since
the predicate does not test whether compilers are available, only
whether they are present in the executable and support the hardware.
And to make that more sensible, <Compiler>CanCompile() is renamed
as <Compiler>PlatformSupport().
Fourth, we remove some redundant testing predicates (we don't need
both wasmDebugSupport and wasmDebuggingIsSupported, nor do we need
wasmUsesCranelift because wasmCompileMode is more reliable).
Fifth, we introduce a few new test cases that try to ensure that
compiler selection works as it should. These are white-box and may
need to change if the compiler priority order changes.
Sixth, we rename the internal wasm::Has<Feature>Support() predicates
as wasm::<Feature>Available(), since they all actually test for
compiler availability.
Differential Revision: https://phabricator.services.mozilla.com/D64946
--HG--
extra : moz-landing-system : lando
2020-03-11 15:03:45 +00:00
|
|
|
#
|
|
|
|
# Note, you may have to disable features not supported by Cranelift
|
|
|
|
# (multi-value, threads) to make Cranelift actually available
|
2018-07-24 18:31:45 +00:00
|
|
|
# ==============================================================
|
2018-09-25 17:05:08 +00:00
|
|
|
|
2018-07-24 18:31:45 +00:00
|
|
|
js_option('--enable-cranelift',
|
2019-08-27 16:08:40 +00:00
|
|
|
default=milestone.is_nightly,
|
2018-10-16 11:28:12 +00:00
|
|
|
help='{Enable|Disable} Cranelift code generator for wasm')
|
2018-07-24 18:31:45 +00:00
|
|
|
|
2018-09-25 17:05:08 +00:00
|
|
|
set_config('ENABLE_WASM_CRANELIFT', depends_if('--enable-cranelift')(lambda x: True))
|
|
|
|
set_define('ENABLE_WASM_CRANELIFT', depends_if('--enable-cranelift')(lambda x: True))
|
2019-01-31 17:29:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Support for debugging code generated by wasm backends
|
|
|
|
# =====================================================
|
|
|
|
|
|
|
|
js_option('--enable-wasm-codegen-debug',
|
|
|
|
default=depends(when=moz_debug)(lambda: True),
|
|
|
|
help='{Enable|Disable} debugging for wasm codegen')
|
|
|
|
|
|
|
|
set_config('WASM_CODEGEN_DEBUG', depends_if('--enable-wasm-codegen-debug')(lambda x: True))
|
|
|
|
set_define('WASM_CODEGEN_DEBUG', depends_if('--enable-wasm-codegen-debug')(lambda x: True))
|
2019-02-14 11:44:25 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Support for typed objects.
|
|
|
|
# =====================================================
|
|
|
|
|
|
|
|
@depends(milestone.is_nightly)
|
|
|
|
def default_typed_objects(is_nightly):
|
|
|
|
return is_nightly
|
|
|
|
|
|
|
|
js_option('--enable-typed-objects',
|
|
|
|
default=default_typed_objects,
|
|
|
|
help='{Enable|Disable} typed objects')
|
|
|
|
|
2019-11-26 07:25:35 +00:00
|
|
|
set_config('JS_HAS_TYPED_OBJECTS', depends_if('--enable-typed-objects')(lambda x: True))
|
|
|
|
set_define('JS_HAS_TYPED_OBJECTS', depends_if('--enable-typed-objects')(lambda x: True))
|
2019-02-14 11:54:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Support for WebAssembly bulk memory operations.
|
|
|
|
# =====================================================
|
|
|
|
|
|
|
|
@depends(milestone.is_nightly)
|
|
|
|
def default_wasm_bulk_memory(is_nightly):
|
|
|
|
return is_nightly
|
|
|
|
|
|
|
|
js_option('--enable-wasm-bulk-memory',
|
|
|
|
default=default_wasm_bulk_memory,
|
|
|
|
help='{Enable|Disable} WebAssembly bulk memory operators')
|
|
|
|
|
|
|
|
set_config('ENABLE_WASM_BULKMEM_OPS', depends_if('--enable-wasm-bulk-memory')(lambda x: True))
|
|
|
|
set_define('ENABLE_WASM_BULKMEM_OPS', depends_if('--enable-wasm-bulk-memory')(lambda x: True))
|
2019-02-14 11:59:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Support for WebAssembly reference types.
|
|
|
|
# =====================================================
|
|
|
|
|
|
|
|
@depends(milestone.is_nightly)
|
|
|
|
def default_wasm_reftypes(is_nightly):
|
|
|
|
return is_nightly
|
|
|
|
|
|
|
|
js_option('--enable-wasm-reftypes',
|
|
|
|
default=default_wasm_reftypes,
|
|
|
|
help='{Enable|Disable} WebAssembly reference types')
|
|
|
|
|
|
|
|
set_config('ENABLE_WASM_REFTYPES', depends_if('--enable-wasm-reftypes')(lambda x: True))
|
|
|
|
set_define('ENABLE_WASM_REFTYPES', depends_if('--enable-wasm-reftypes')(lambda x: True))
|
|
|
|
|
|
|
|
|
|
|
|
# Support for WebAssembly GC.
|
|
|
|
# ===========================
|
|
|
|
|
|
|
|
@depends(milestone.is_nightly, '--enable-wasm-reftypes')
|
|
|
|
def default_wasm_gc(is_nightly, reftypes):
|
|
|
|
if reftypes and is_nightly:
|
|
|
|
return True
|
|
|
|
|
|
|
|
js_option('--enable-wasm-gc',
|
|
|
|
default=default_wasm_gc,
|
|
|
|
help='{Enable|Disable} WebAssembly GC')
|
|
|
|
|
|
|
|
set_config('ENABLE_WASM_GC', depends_if('--enable-wasm-gc')(lambda x: True))
|
|
|
|
set_define('ENABLE_WASM_GC', depends_if('--enable-wasm-gc')(lambda x: True))
|
|
|
|
|
|
|
|
|
|
|
|
# Support for WebAssembly private ref types.
|
|
|
|
# Prevent (ref T) types from being exposed to JS content so that wasm need do
|
|
|
|
# no typechecking at the JS/wasm boundary
|
|
|
|
# ===========================================================================
|
|
|
|
|
|
|
|
@depends(milestone.is_nightly, '--enable-wasm-gc')
|
|
|
|
def default_wasm_private_reftypes(is_nightly, gc):
|
|
|
|
if gc and is_nightly:
|
|
|
|
return True
|
|
|
|
|
|
|
|
js_option('--enable-wasm-private-reftypes',
|
|
|
|
default=default_wasm_private_reftypes,
|
|
|
|
help='{Enable|Disable} WebAssembly private reference types')
|
|
|
|
|
|
|
|
set_config('WASM_PRIVATE_REFTYPES', depends_if('--enable-wasm-private-reftypes')(lambda x: True))
|
|
|
|
set_define('WASM_PRIVATE_REFTYPES', depends_if('--enable-wasm-private-reftypes')(lambda x: True))
|
2019-10-01 14:30:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Support for the WebAssembly multi-value proposal.
|
Bug 1566427 - Improved compiler availability computation. r=bbouvier
This patch cleans up wasm compiler selection and a few related things
with as few semantic changes as possible. The intent is to centralize
compiler availability computation so that all parts of the system stay
in sync and it is easy to change compiler selection policy.
First, we introduce new predicates <Compiler>Available(cx) to test for
the actual availability of a compiler. These predicates take into
account whether a compiler is compiled into the executable, whether it
supports the hardware, whether it is (currently) selected by
options/switches, and whether it can be used as a result of the
runtime environment (for example, Ion and Cranelift are not available
if the debugger is observing the page or if the GC feature is enabled;
Cranelift is not available if shared memory and atomics are enabled).
We switch to using these predicates almost everywhere that used
<Compiler>CanCompile() or cx->options().wasm<Compiler>(), since those
don't tell the full story.
Second, we implement a priority order of the optimizing compilers and
make it easy to change this order (see comments in code). At the
moment, Cranelift is prioritized over Ion since Ion is enabled by
default and Cranelift is not; thus the desire of somebody flipping the
pref for Cranelift is to deselect Ion. The priority order may change
in the future or may become platform-dependent. The default compiler
selection in both browser and shell remains Baseline+Ion.
Third, we rename HasCompilerSupport() as HasPlatformSupport(), since
the predicate does not test whether compilers are available, only
whether they are present in the executable and support the hardware.
And to make that more sensible, <Compiler>CanCompile() is renamed
as <Compiler>PlatformSupport().
Fourth, we remove some redundant testing predicates (we don't need
both wasmDebugSupport and wasmDebuggingIsSupported, nor do we need
wasmUsesCranelift because wasmCompileMode is more reliable).
Fifth, we introduce a few new test cases that try to ensure that
compiler selection works as it should. These are white-box and may
need to change if the compiler priority order changes.
Sixth, we rename the internal wasm::Has<Feature>Support() predicates
as wasm::<Feature>Available(), since they all actually test for
compiler availability.
Differential Revision: https://phabricator.services.mozilla.com/D64946
--HG--
extra : moz-landing-system : lando
2020-03-11 15:03:45 +00:00
|
|
|
# Do not remove until Cranelift supports multi-value.
|
2019-10-01 14:30:35 +00:00
|
|
|
# =====================================================
|
|
|
|
|
2020-04-27 11:12:06 +00:00
|
|
|
js_option('--disable-wasm-multi-value',
|
|
|
|
help='Disable WebAssembly multi-value blocks and function calls')
|
2019-10-01 14:30:35 +00:00
|
|
|
|
2020-04-27 11:12:06 +00:00
|
|
|
@depends('--disable-wasm-multi-value')
|
|
|
|
def enable_wasm_multi_value(value):
|
|
|
|
if value:
|
|
|
|
return True
|
2019-10-01 14:30:35 +00:00
|
|
|
|
2020-04-27 11:12:06 +00:00
|
|
|
set_config('ENABLE_WASM_MULTI_VALUE', enable_wasm_multi_value)
|
|
|
|
set_define('ENABLE_WASM_MULTI_VALUE', enable_wasm_multi_value)
|
2019-12-02 16:13:05 +00:00
|
|
|
|
Bug 1566427 - Improved compiler availability computation. r=bbouvier
This patch cleans up wasm compiler selection and a few related things
with as few semantic changes as possible. The intent is to centralize
compiler availability computation so that all parts of the system stay
in sync and it is easy to change compiler selection policy.
First, we introduce new predicates <Compiler>Available(cx) to test for
the actual availability of a compiler. These predicates take into
account whether a compiler is compiled into the executable, whether it
supports the hardware, whether it is (currently) selected by
options/switches, and whether it can be used as a result of the
runtime environment (for example, Ion and Cranelift are not available
if the debugger is observing the page or if the GC feature is enabled;
Cranelift is not available if shared memory and atomics are enabled).
We switch to using these predicates almost everywhere that used
<Compiler>CanCompile() or cx->options().wasm<Compiler>(), since those
don't tell the full story.
Second, we implement a priority order of the optimizing compilers and
make it easy to change this order (see comments in code). At the
moment, Cranelift is prioritized over Ion since Ion is enabled by
default and Cranelift is not; thus the desire of somebody flipping the
pref for Cranelift is to deselect Ion. The priority order may change
in the future or may become platform-dependent. The default compiler
selection in both browser and shell remains Baseline+Ion.
Third, we rename HasCompilerSupport() as HasPlatformSupport(), since
the predicate does not test whether compilers are available, only
whether they are present in the executable and support the hardware.
And to make that more sensible, <Compiler>CanCompile() is renamed
as <Compiler>PlatformSupport().
Fourth, we remove some redundant testing predicates (we don't need
both wasmDebugSupport and wasmDebuggingIsSupported, nor do we need
wasmUsesCranelift because wasmCompileMode is more reliable).
Fifth, we introduce a few new test cases that try to ensure that
compiler selection works as it should. These are white-box and may
need to change if the compiler priority order changes.
Sixth, we rename the internal wasm::Has<Feature>Support() predicates
as wasm::<Feature>Available(), since they all actually test for
compiler availability.
Differential Revision: https://phabricator.services.mozilla.com/D64946
--HG--
extra : moz-landing-system : lando
2020-03-11 15:03:45 +00:00
|
|
|
|
|
|
|
# Support for WebAssembly shared memory and atomics.
|
|
|
|
#
|
|
|
|
# This affects the JS shell only and here to allow the use of
|
|
|
|
# Cranelift in the shell. Once Cranelift supports shared memory
|
|
|
|
# and atomics it can go away.
|
|
|
|
# =====================================================
|
|
|
|
|
2020-03-27 16:56:25 +00:00
|
|
|
js_option('--disable-shared-memory', help='Disable JS/WebAssembly shared memory and atomics')
|
Bug 1566427 - Improved compiler availability computation. r=bbouvier
This patch cleans up wasm compiler selection and a few related things
with as few semantic changes as possible. The intent is to centralize
compiler availability computation so that all parts of the system stay
in sync and it is easy to change compiler selection policy.
First, we introduce new predicates <Compiler>Available(cx) to test for
the actual availability of a compiler. These predicates take into
account whether a compiler is compiled into the executable, whether it
supports the hardware, whether it is (currently) selected by
options/switches, and whether it can be used as a result of the
runtime environment (for example, Ion and Cranelift are not available
if the debugger is observing the page or if the GC feature is enabled;
Cranelift is not available if shared memory and atomics are enabled).
We switch to using these predicates almost everywhere that used
<Compiler>CanCompile() or cx->options().wasm<Compiler>(), since those
don't tell the full story.
Second, we implement a priority order of the optimizing compilers and
make it easy to change this order (see comments in code). At the
moment, Cranelift is prioritized over Ion since Ion is enabled by
default and Cranelift is not; thus the desire of somebody flipping the
pref for Cranelift is to deselect Ion. The priority order may change
in the future or may become platform-dependent. The default compiler
selection in both browser and shell remains Baseline+Ion.
Third, we rename HasCompilerSupport() as HasPlatformSupport(), since
the predicate does not test whether compilers are available, only
whether they are present in the executable and support the hardware.
And to make that more sensible, <Compiler>CanCompile() is renamed
as <Compiler>PlatformSupport().
Fourth, we remove some redundant testing predicates (we don't need
both wasmDebugSupport and wasmDebuggingIsSupported, nor do we need
wasmUsesCranelift because wasmCompileMode is more reliable).
Fifth, we introduce a few new test cases that try to ensure that
compiler selection works as it should. These are white-box and may
need to change if the compiler priority order changes.
Sixth, we rename the internal wasm::Has<Feature>Support() predicates
as wasm::<Feature>Available(), since they all actually test for
compiler availability.
Differential Revision: https://phabricator.services.mozilla.com/D64946
--HG--
extra : moz-landing-system : lando
2020-03-11 15:03:45 +00:00
|
|
|
|
2020-03-27 16:56:25 +00:00
|
|
|
@depends('--disable-shared-memory')
|
|
|
|
def enable_shared_memory(value):
|
|
|
|
if value:
|
|
|
|
return True
|
Bug 1566427 - Improved compiler availability computation. r=bbouvier
This patch cleans up wasm compiler selection and a few related things
with as few semantic changes as possible. The intent is to centralize
compiler availability computation so that all parts of the system stay
in sync and it is easy to change compiler selection policy.
First, we introduce new predicates <Compiler>Available(cx) to test for
the actual availability of a compiler. These predicates take into
account whether a compiler is compiled into the executable, whether it
supports the hardware, whether it is (currently) selected by
options/switches, and whether it can be used as a result of the
runtime environment (for example, Ion and Cranelift are not available
if the debugger is observing the page or if the GC feature is enabled;
Cranelift is not available if shared memory and atomics are enabled).
We switch to using these predicates almost everywhere that used
<Compiler>CanCompile() or cx->options().wasm<Compiler>(), since those
don't tell the full story.
Second, we implement a priority order of the optimizing compilers and
make it easy to change this order (see comments in code). At the
moment, Cranelift is prioritized over Ion since Ion is enabled by
default and Cranelift is not; thus the desire of somebody flipping the
pref for Cranelift is to deselect Ion. The priority order may change
in the future or may become platform-dependent. The default compiler
selection in both browser and shell remains Baseline+Ion.
Third, we rename HasCompilerSupport() as HasPlatformSupport(), since
the predicate does not test whether compilers are available, only
whether they are present in the executable and support the hardware.
And to make that more sensible, <Compiler>CanCompile() is renamed
as <Compiler>PlatformSupport().
Fourth, we remove some redundant testing predicates (we don't need
both wasmDebugSupport and wasmDebuggingIsSupported, nor do we need
wasmUsesCranelift because wasmCompileMode is more reliable).
Fifth, we introduce a few new test cases that try to ensure that
compiler selection works as it should. These are white-box and may
need to change if the compiler priority order changes.
Sixth, we rename the internal wasm::Has<Feature>Support() predicates
as wasm::<Feature>Available(), since they all actually test for
compiler availability.
Differential Revision: https://phabricator.services.mozilla.com/D64946
--HG--
extra : moz-landing-system : lando
2020-03-11 15:03:45 +00:00
|
|
|
|
2020-03-27 16:56:25 +00:00
|
|
|
set_config('ENABLE_SHARED_MEMORY', enable_shared_memory)
|
|
|
|
set_define('ENABLE_SHARED_MEMORY', enable_shared_memory)
|
Bug 1566427 - Improved compiler availability computation. r=bbouvier
This patch cleans up wasm compiler selection and a few related things
with as few semantic changes as possible. The intent is to centralize
compiler availability computation so that all parts of the system stay
in sync and it is easy to change compiler selection policy.
First, we introduce new predicates <Compiler>Available(cx) to test for
the actual availability of a compiler. These predicates take into
account whether a compiler is compiled into the executable, whether it
supports the hardware, whether it is (currently) selected by
options/switches, and whether it can be used as a result of the
runtime environment (for example, Ion and Cranelift are not available
if the debugger is observing the page or if the GC feature is enabled;
Cranelift is not available if shared memory and atomics are enabled).
We switch to using these predicates almost everywhere that used
<Compiler>CanCompile() or cx->options().wasm<Compiler>(), since those
don't tell the full story.
Second, we implement a priority order of the optimizing compilers and
make it easy to change this order (see comments in code). At the
moment, Cranelift is prioritized over Ion since Ion is enabled by
default and Cranelift is not; thus the desire of somebody flipping the
pref for Cranelift is to deselect Ion. The priority order may change
in the future or may become platform-dependent. The default compiler
selection in both browser and shell remains Baseline+Ion.
Third, we rename HasCompilerSupport() as HasPlatformSupport(), since
the predicate does not test whether compilers are available, only
whether they are present in the executable and support the hardware.
And to make that more sensible, <Compiler>CanCompile() is renamed
as <Compiler>PlatformSupport().
Fourth, we remove some redundant testing predicates (we don't need
both wasmDebugSupport and wasmDebuggingIsSupported, nor do we need
wasmUsesCranelift because wasmCompileMode is more reliable).
Fifth, we introduce a few new test cases that try to ensure that
compiler selection works as it should. These are white-box and may
need to change if the compiler priority order changes.
Sixth, we rename the internal wasm::Has<Feature>Support() predicates
as wasm::<Feature>Available(), since they all actually test for
compiler availability.
Differential Revision: https://phabricator.services.mozilla.com/D64946
--HG--
extra : moz-landing-system : lando
2020-03-11 15:03:45 +00:00
|
|
|
|
|
|
|
|
2019-12-02 16:13:05 +00:00
|
|
|
# Initial support for new regexp engine
|
|
|
|
# ==================================================
|
|
|
|
|
2020-05-13 16:24:04 +00:00
|
|
|
js_option('--disable-new-regexp', help='{Enable|Disable} new regexp engine')
|
2019-12-02 16:13:05 +00:00
|
|
|
|
2020-05-13 16:24:04 +00:00
|
|
|
@depends('--disable-new-regexp')
|
2019-12-02 16:13:05 +00:00
|
|
|
def enable_new_regexp(value):
|
|
|
|
if value:
|
|
|
|
return True
|
|
|
|
|
|
|
|
set_config('ENABLE_NEW_REGEXP', enable_new_regexp)
|
|
|
|
set_define('ENABLE_NEW_REGEXP', enable_new_regexp)
|
2020-05-05 08:17:47 +00:00
|
|
|
|
|
|
|
# Support for WebAssembly SIMD
|
|
|
|
# =====================================================
|
|
|
|
|
|
|
|
@depends('--enable-jit', '--enable-simulator', target, milestone)
|
|
|
|
def default_wasm_simd(jit_enabled, simulator, target, milestone):
|
|
|
|
if not jit_enabled or simulator:
|
|
|
|
return
|
|
|
|
|
|
|
|
# Note, not `target.cpu in ('x86_64')`, as the parens are stripped
|
|
|
|
# from the 1-element tuple and the operation does string matching.
|
|
|
|
# Good grief.
|
|
|
|
if milestone.is_nightly and target.cpu == 'x86_64':
|
|
|
|
return True
|
|
|
|
|
|
|
|
js_option('--enable-wasm-simd',
|
|
|
|
default=default_wasm_simd,
|
|
|
|
help='{Enable|Disable} WebAssembly SIMD')
|
|
|
|
|
2020-05-20 07:01:38 +00:00
|
|
|
@depends('--enable-wasm-simd', '--enable-jit', '--enable-simulator', target)
|
|
|
|
def wasm_simd(value, jit_enabled, simulator, target):
|
|
|
|
if not value:
|
|
|
|
return
|
|
|
|
|
|
|
|
if jit_enabled and not simulator:
|
|
|
|
if target.cpu == 'x86_64':
|
|
|
|
return True
|
|
|
|
|
|
|
|
die('--enable-wasm-simd only possible when targeting the x86_64 jit')
|
|
|
|
|
|
|
|
set_config('ENABLE_WASM_SIMD', wasm_simd)
|
|
|
|
set_define('ENABLE_WASM_SIMD', wasm_simd)
|
2020-05-21 22:38:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Options for generating the shell as a script
|
|
|
|
# ============================================
|
|
|
|
js_option('--with-qemu-exe', nargs=1, help='Use path as an arm emulator on host platforms')
|
|
|
|
set_config('QEMU_EXE', depends_if('--with-qemu-exe')(lambda x: x))
|
|
|
|
|
|
|
|
js_option('--with-cross-lib', nargs=1, default=depends(target.alias)(lambda x: '/usr/%s' % x),
|
|
|
|
help='Use dir as the location for arm libraries')
|
|
|
|
set_config('CROSS_LIB', depends_if('--with-cross-lib')(lambda x: x))
|
2020-05-21 22:38:46 +00:00
|
|
|
|
|
|
|
# Enable static checking using sixgill
|
|
|
|
# ====================================
|
|
|
|
|
|
|
|
js_option('--with-sixgill', nargs=1, help='Enable static checking of code using sixgill')
|
|
|
|
|
|
|
|
@depends_if('--with-sixgill')
|
|
|
|
@imports('os')
|
|
|
|
def sixgill(value):
|
|
|
|
for f in ('bin/xdbfind', 'gcc/xgill.so', 'scripts/wrap_gcc/g++'):
|
|
|
|
if not os.path.exists(os.path.join(value[0], f)):
|
|
|
|
die('The sixgill plugin and binaries are not at the specified path')
|
|
|
|
return value[0]
|
|
|
|
|
|
|
|
set_config('SIXGILL_PATH', sixgill)
|