Skip to content

Commit e1f9c3a

Browse files
authored
Add default feature for JIT (#589)
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 <[email protected]>
1 parent 9c3843e commit e1f9c3a

File tree

4 files changed

+13
-4
lines changed

4 files changed

+13
-4
lines changed

mozjs-sys/Cargo.toml

Lines changed: 2 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.140.5-2"
5+
version = "0.140.5-3"
66
authors = ["Mozilla", "The Servo Project Developers"]
77
links = "mozjs"
88
license.workspace = true
@@ -18,6 +18,7 @@ doctest = false
1818
[features]
1919
debugmozjs = []
2020
profilemozjs = []
21+
jit = []
2122
jitspew = []
2223
libz-sys = ["dep:libz-sys"]
2324
libz-rs = ["dep:libz-rs-sys"]

mozjs-sys/build.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,9 @@ fn should_build_from_source() -> bool {
463463
} else if env::var_os("CARGO_FEATURE_INTL").is_none() {
464464
println!("intl feature is disabled. Building from source directly.");
465465
true
466+
} else if !env::var_os("CARGO_FEATURE_JIT").is_some() {
467+
println!("jit feature is NOT enabled. Building from source directly.");
468+
true
466469
} else {
467470
false
468471
}

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
@@ -77,7 +81,7 @@ ifneq ($(HOST),$(TARGET))
7781
endif
7882

7983
ifeq (aarch64-unknown-linux-gnu,$(TARGET))
80-
# Reset TARGET variable because aarch64 target name used by Rust is not
84+
# Reset TARGET variable because aarch64 target name used by Rust is not
8185
# the same as the target name needed for the CXX toolchain.
8286
TARGET = aarch64-linux-gnu
8387
endif

mozjs/Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "mozjs"
33
description = "Rust bindings to the Mozilla SpiderMonkey JavaScript engine."
44
repository.workspace = true
5-
version = "0.14.1"
5+
version = "0.14.2"
66
authors = ["The Servo Project Developers"]
77
license.workspace = true
88
edition.workspace = true
@@ -11,9 +11,10 @@ edition.workspace = true
1111
doctest = false
1212

1313
[features]
14-
default = ["libz-sys", "intl"]
14+
default = ["jit", "libz-sys", "intl"]
1515
debugmozjs = ["mozjs_sys/debugmozjs"]
1616
profilemozjs = ["mozjs_sys/profilemozjs"]
17+
jit = ['mozjs_sys/jit']
1718
jitspew = ["mozjs_sys/jitspew"]
1819
libz-sys = ["mozjs_sys/libz-sys"]
1920
libz-rs = ["mozjs_sys/libz-rs"]

0 commit comments

Comments
 (0)