Skip to content

Add default feature for JIT #589

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion mozjs-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "mozjs_sys"
description = "System crate for the Mozilla SpiderMonkey JavaScript engine."
repository.workspace = true
version = "0.128.13-0"
version = "0.128.13-1"
authors = ["Mozilla"]
links = "mozjs"
license.workspace = true
Expand All @@ -24,6 +24,7 @@ doctest = false
[features]
debugmozjs = []
profilemozjs = []
jit = []
jitspew = []
crown = []
oom_with_hook = []
Expand Down
3 changes: 3 additions & 0 deletions mozjs-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,9 @@ fn should_build_from_source() -> bool {
} else if env::var_os("CARGO_FEATURE_DEBUGMOZJS").is_some() {
println!("debug-mozjs feature is enabled. Building from source directly.");
true
} else if !env::var_os("CARGO_FEATURE_JIT").is_some() {
println!("jit feature is NOT enabled. Building from source directly.");
true
} else {
false
}
Expand Down
6 changes: 5 additions & 1 deletion mozjs-sys/makefile.cargo
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ CONFIGURE_FLAGS := \
--disable-shared-js \
--build-backends=RecursiveMake

ifeq (,$(CARGO_FEATURE_JIT))
CONFIGURE_FLAGS += --disable-jit
endif

ifneq (,$(CARGO_FEATURE_JITSPEW))
CONFIGURE_FLAGS += --enable-jitspew
endif
Expand Down Expand Up @@ -63,7 +67,7 @@ ifneq ($(HOST),$(TARGET))
endif

ifeq (aarch64-unknown-linux-gnu,$(TARGET))
# Reset TARGET variable because aarch64 target name used by Rust is not
# Reset TARGET variable because aarch64 target name used by Rust is not
# the same as the target name needed for the CXX toolchain.
TARGET = aarch64-linux-gnu
endif
Expand Down
4 changes: 3 additions & 1 deletion mozjs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "mozjs"
description = "Rust bindings to the Mozilla SpiderMonkey JavaScript engine."
repository.workspace = true
version = "0.14.1"
version = "0.14.2"
authors = ["The Servo Project Developers"]
license.workspace = true
edition.workspace = true
Expand All @@ -12,6 +12,8 @@ doctest = false

[features]
debugmozjs = ['mozjs_sys/debugmozjs']
default = ["jit"]
jit = ['mozjs_sys/jit']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a default feature for the mozjs crate as well.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved the default feature to mozjs and removed it as default feature from mozjs_sys. Otherwise we couldn't disable it, unless mozjs would depend on monz_js_sys with default-features = false. Since I don't think there would be any other users of the sys crate, besides mozjs, I think it makes the most sense to expose the jit feature as default in mozjs and don't add any default features to mozjs_sys.
What do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, I agree!

jitspew = ['mozjs_sys/jitspew']
profilemozjs = ['mozjs_sys/profilemozjs']
crown = ['mozjs_sys/crown']
Expand Down
Loading