Skip to content

Commit 1d4f3f0

Browse files
committed
Add default feature for JIT
When building servo on Linux with the profile `production-stripped`, disabling JIT with this change shaves off 9MiB from the servo binary size, which is around 10%. Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
1 parent 128e1e2 commit 1d4f3f0

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

mozjs-sys/Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "mozjs_sys"
33
description = "System crate for the Mozilla SpiderMonkey JavaScript engine."
44
repository.workspace = true
5-
version = "0.128.13-0"
5+
version = "0.128.13-1"
66
authors = ["Mozilla"]
77
links = "mozjs"
88
license.workspace = true
@@ -22,8 +22,10 @@ name = "mozjs_sys"
2222
doctest = false
2323

2424
[features]
25+
default = ["jit"]
2526
debugmozjs = []
2627
profilemozjs = []
28+
jit = []
2729
jitspew = []
2830
crown = []
2931
oom_with_hook = []

mozjs-sys/build.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,9 @@ fn should_build_from_source() -> bool {
405405
} else if env::var_os("CARGO_FEATURE_DEBUGMOZJS").is_some() {
406406
println!("debug-mozjs feature is enabled. Building from source directly.");
407407
true
408+
} else if !env::var_os("CARGO_FEATURE_JIT").is_some() {
409+
println!("jit feature is NOT enabled. Building from source directly.");
410+
true
408411
} else {
409412
false
410413
}

mozjs-sys/makefile.cargo

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ CONFIGURE_FLAGS := \
1111
--disable-shared-js \
1212
--build-backends=RecursiveMake
1313

14+
ifeq (,$(CARGO_FEATURE_JIT))
15+
CONFIGURE_FLAGS += --disable-jit
16+
endif
17+
1418
ifneq (,$(CARGO_FEATURE_JITSPEW))
1519
CONFIGURE_FLAGS += --enable-jitspew
1620
endif
@@ -63,7 +67,7 @@ ifneq ($(HOST),$(TARGET))
6367
endif
6468

6569
ifeq (aarch64-unknown-linux-gnu,$(TARGET))
66-
# Reset TARGET variable because aarch64 target name used by Rust is not
70+
# Reset TARGET variable because aarch64 target name used by Rust is not
6771
# the same as the target name needed for the CXX toolchain.
6872
TARGET = aarch64-linux-gnu
6973
endif

0 commit comments

Comments
 (0)