fix(es/parser): Don't use stacker for armv7 (#6916)

This commit is contained in:
Donny/강동윤 2023-02-08 14:14:41 +09:00 committed by GitHub
parent 4be6c33687
commit 4c5d5a6fca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 8 deletions

View File

@ -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]

View File

@ -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(not(target_arch = "wasm32"))]
return stacker::maybe_grow(red_zone, stack_size, 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()
}
#[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)
}