Skip to content

Commit

Permalink
fix(es/parser): Don't use stacker for armv7 (#6916)
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 committed Feb 8, 2023
1 parent 4be6c33 commit 4c5d5a6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion crates/swc_ecma_parser/Cargo.toml
Expand Up @@ -37,7 +37,7 @@ swc_ecma_visit = { version = "0.82.3", path = "../swc_ecma_visit", optional = tr
tracing = "0.1.32"
typed-arena = "2.0.1"

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
[target.'cfg(not(any(target_arch = "wasm32", target_arch = "arm")))'.dependencies]
stacker = "0.1.15"

[dev-dependencies]
Expand Down
14 changes: 8 additions & 6 deletions crates/swc_ecma_parser/src/lib.rs
Expand Up @@ -448,11 +448,13 @@ expose!(parse_file_as_script, Script, |p| { p.parse_script() });
expose!(parse_file_as_program, Program, |p| { p.parse_program() });

#[inline(always)]
#[cfg_attr(target_arch = "wasm32", allow(unused))]
fn maybe_grow<R, F: FnOnce() -> R>(red_zone: usize, stack_size: usize, callback: F) -> R {
#[cfg(target_arch = "wasm32")]
return callback();
#[cfg(any(target_arch = "wasm32", target_arch = "arm"))]
fn maybe_grow<R, F: FnOnce() -> R>(_red_zone: usize, _stack_size: usize, callback: F) -> R {
callback()
}

#[cfg(not(target_arch = "wasm32"))]
return stacker::maybe_grow(red_zone, stack_size, callback);
#[inline(always)]
#[cfg(not(any(target_arch = "wasm32", target_arch = "arm")))]
fn maybe_grow<R, F: FnOnce() -> R>(red_zone: usize, stack_size: usize, callback: F) -> R {
stacker::maybe_grow(red_zone, stack_size, callback)
}

0 comments on commit 4c5d5a6

Please sign in to comment.