diff --git a/Cargo.toml b/Cargo.toml index e8ae79719cc1..1a2a5bf36838 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -123,7 +123,7 @@ resolver = "2" thiserror = "1.0.30" tokio = { version = "1", default-features = false } toml = "0.8.2" - tracing = "0.1.41" + tracing = {version = "0.1.41", features= ["max_level_trace","release_max_level_trace"]} tracing-chrome = "0.7.2" tracing-subscriber = "0.3.20" triomphe = "0.1.13" diff --git a/bindings/binding_core_node/src/lib.rs b/bindings/binding_core_node/src/lib.rs index 6719f477de21..b5d4f16750c3 100644 --- a/bindings/binding_core_node/src/lib.rs +++ b/bindings/binding_core_node/src/lib.rs @@ -58,7 +58,6 @@ pub struct JsCompiler { impl JsCompiler { #[napi(constructor)] #[allow(clippy::new_without_default)] - #[tracing::instrument(level = "info", skip_all)] pub fn new() -> Self { Self { _compiler: COMPILER.clone(), diff --git a/crates/swc/src/lib.rs b/crates/swc/src/lib.rs index 1ce2868165e0..0885e85214e5 100644 --- a/crates/swc/src/lib.rs +++ b/crates/swc/src/lib.rs @@ -394,10 +394,7 @@ impl Compiler { }; match result { Ok(r) => r, - Err(err) => { - tracing::error!("failed to read input source map: {:?}", err); - None - } + Err(_) => None, } }; @@ -465,7 +462,6 @@ impl Compiler { } } - #[tracing::instrument(skip_all)] pub fn read_config(&self, opts: &Options, name: &FileName) -> Result, Error> { static CUR_DIR: Lazy = Lazy::new(|| { if cfg!(target_arch = "wasm32") { @@ -577,7 +573,6 @@ impl Compiler { /// This method handles merging of config. /// /// This method does **not** parse module. - #[tracing::instrument(skip_all)] pub fn parse_js_as_input<'a, P>( &'a self, fm: Lrc, @@ -642,7 +637,6 @@ impl Compiler { }) } - #[tracing::instrument(skip_all)] pub fn transform( &self, handler: &Handler, @@ -670,7 +664,6 @@ impl Compiler { /// /// This means, you can use `noop_visit_type`, `noop_fold_type` and /// `noop_visit_mut_type` in your visitor to reduce the binary size. - #[tracing::instrument(skip_all)] pub fn process_js_with_custom_pass( &self, fm: Arc, @@ -727,7 +720,6 @@ impl Compiler { }) } - #[tracing::instrument(skip(self, handler, opts))] pub fn process_js_file( &self, fm: Arc, @@ -745,7 +737,6 @@ impl Compiler { ) } - #[tracing::instrument(skip_all)] pub fn minify( &self, fm: Arc, @@ -938,7 +929,6 @@ impl Compiler { /// You can use custom pass with this method. /// /// Pass building logic has been inlined into the configuration system. - #[tracing::instrument(skip_all)] pub fn process_js( &self, handler: &Handler, @@ -959,7 +949,6 @@ impl Compiler { ) } - #[tracing::instrument(name = "swc::Compiler::apply_transforms", skip_all)] fn apply_transforms( &self, handler: &Handler, @@ -1124,7 +1113,6 @@ fn find_swcrc(path: &Path, root: &Path, root_mode: RootMode) -> Option None } -#[tracing::instrument(skip_all)] fn load_swcrc(path: &Path) -> Result { let content = read_to_string(path).context("failed to read config (.swcrc) file")?; diff --git a/crates/swc/src/plugin.rs b/crates/swc/src/plugin.rs index 154ca8f490d5..433e07473ff0 100644 --- a/crates/swc/src/plugin.rs +++ b/crates/swc/src/plugin.rs @@ -91,7 +91,6 @@ impl RustPlugins { .with_context(|| format!("failed to invoke plugin on '{filename:?}'")) } - #[tracing::instrument(level = "info", skip_all, name = "apply_plugins")] #[cfg(all(feature = "plugin", not(target_arch = "wasm32")))] fn apply_inner(&mut self, n: Program) -> Result { use anyhow::Context; @@ -167,7 +166,6 @@ impl RustPlugins { } #[cfg(all(feature = "plugin", target_arch = "wasm32"))] - #[tracing::instrument(level = "info", skip_all)] fn apply_inner(&mut self, n: Program) -> Result { // [TODO]: unimplemented n @@ -240,7 +238,6 @@ pub(crate) fn compile_wasm_plugins( }; inner_cache.store_bytes_from_path(plugin_runtime, &path, plugin_name)?; - tracing::debug!("Initialized WASM plugin {plugin_name}"); } } diff --git a/crates/swc_bundler/src/bundler/chunk/cjs.rs b/crates/swc_bundler/src/bundler/chunk/cjs.rs index 428812e6263f..0624505524a9 100644 --- a/crates/swc_bundler/src/bundler/chunk/cjs.rs +++ b/crates/swc_bundler/src/bundler/chunk/cjs.rs @@ -58,7 +58,6 @@ where return Ok(module); } - tracing::debug!("Merging as a common js module: {}", info.fm.name); let load_var = self.make_cjs_load_var(info, DUMMY_SP); @@ -86,7 +85,6 @@ where self.injected_ctxt, ); - tracing::debug!("Injected a variable named `load` for a common js module"); Ok(wrapped) } @@ -216,7 +214,6 @@ where self.replaced = true; *node = load; - tracing::trace!("Found, and replacing require"); } } } diff --git a/crates/swc_bundler/src/bundler/chunk/merge.rs b/crates/swc_bundler/src/bundler/chunk/merge.rs index cc5769b34bec..a06caf342e53 100644 --- a/crates/swc_bundler/src/bundler/chunk/merge.rs +++ b/crates/swc_bundler/src/bundler/chunk/merge.rs @@ -98,7 +98,6 @@ where let all_deps_of_entry = self.collect_all_deps(&ctx.graph, entry_id, &mut Default::default()); - tracing::debug!("Merging dependencies: {:?}", all_deps_of_entry); let deps = all_deps_of_entry.iter().map(|id| { let dep_info = self.scope.get_module(*id).unwrap(); @@ -438,14 +437,11 @@ where } fn finalize_merging_of_entry(&self, ctx: &Ctx, id: ModuleId, entry: &mut Modules) { - tracing::trace!("All modules are merged"); - tracing::debug!("Injecting reexports"); self.inject_reexports(ctx, id, entry); // entry.print(&self.cm, "before inline"); - tracing::debug!("Inlining injected variables"); inline(self.injected_ctxt, entry); @@ -495,7 +491,6 @@ where true }); - tracing::debug!("Renaming keywords"); entry.visit_mut_with(&mut KeywordRenamer::default()); @@ -511,10 +506,8 @@ where /// Remove exports with wrong syntax context fn remove_wrong_exports(&self, ctx: &Ctx, info: &TransformedModule, module: &mut Modules) { - tracing::debug!("Removing wrong exports"); let item_count = module.iter().count(); - tracing::trace!("Item count = {}", item_count); module.retain_mut(|_, item| { if let ModuleItem::ModuleDecl(ModuleDecl::ExportNamed(NamedExport { @@ -552,7 +545,6 @@ where true }); - tracing::debug!("Removed wrong exports"); } /// This method handles imports and exports. @@ -779,10 +771,6 @@ where } // Create `export { local_default as default }` - tracing::trace!( - "Exporting `default` with `export default decl` ({})", - local.sym - ); let exported = Ident::new(atom!("default"), DUMMY_SP, info.export_ctxt()); @@ -851,7 +839,6 @@ where exported: Some(ModuleExportName::Ident(exported)), is_type_only: false, }); - tracing::trace!("Exporting `default` with `export default expr`"); extra.push( NamedExport { span: export.span, @@ -904,11 +891,6 @@ where info.export_ctxt(), ); - tracing::trace!( - "Exporting `{}{:?}` with `export decl`", - id.sym, - id.ctxt - ); new.push( id.clone() @@ -952,10 +934,6 @@ where _ => panic!("unable to access unknown nodes"), }; - tracing::trace!( - "Exporting `default` with `export default decl` ({})", - local.sym - ); // Create `export { local_ident as exported_ident }` let exported = diff --git a/crates/swc_bundler/src/bundler/chunk/mod.rs b/crates/swc_bundler/src/bundler/chunk/mod.rs index f7764548706d..99ac5730052e 100644 --- a/crates/swc_bundler/src/bundler/chunk/mod.rs +++ b/crates/swc_bundler/src/bundler/chunk/mod.rs @@ -35,7 +35,6 @@ where #[cfg(not(target_arch = "wasm32"))] let dur = Instant::now() - start; #[cfg(not(target_arch = "wasm32"))] - tracing::debug!("Dependency analysis took {:?}", dur); if cfg!(debug_assertions) { for (i, id1) in plan.all.iter().enumerate() { @@ -77,7 +76,6 @@ where #[cfg(not(target_arch = "wasm32"))] let dur = Instant::now() - start; #[cfg(not(target_arch = "wasm32"))] - tracing::debug!("Module preparation took {:?}", dur); let entries = all .iter() @@ -95,7 +93,6 @@ where .map(|(id, mut entry)| { self.merge_into_entry(&ctx, id, &mut entry, &mut all); - tracing::debug!("Merged `{}` and it's dep into an entry", id); (id, entry) }) @@ -121,7 +118,6 @@ where let mut a = all.clone(); self.merge_into_entry(&ctx, id, &mut entry, &mut a); - tracing::debug!("Merged `{}` and it's dep into an entry", id); (id, entry) }) diff --git a/crates/swc_bundler/src/bundler/finalize.rs b/crates/swc_bundler/src/bundler/finalize.rs index fd6ce8e3cb78..3d6800a9e84c 100644 --- a/crates/swc_bundler/src/bundler/finalize.rs +++ b/crates/swc_bundler/src/bundler/finalize.rs @@ -123,7 +123,6 @@ where let path = match &*self.scope.get_module(bundle.id).unwrap().fm.name { FileName::Real(ref v) => v.clone(), _ => { - tracing::error!("Cannot rename: not a real file"); return bundle; } }; diff --git a/crates/swc_bundler/src/bundler/load.rs b/crates/swc_bundler/src/bundler/load.rs index 40290272381a..5ca347438d6a 100644 --- a/crates/swc_bundler/src/bundler/load.rs +++ b/crates/swc_bundler/src/bundler/load.rs @@ -74,11 +74,9 @@ where file_name: &FileName, ) -> Result, Error> { self.run(|| { - tracing::trace!("load_transformed: ({})", file_name); // In case of common module if let Some(cached) = self.scope.get_module_by_path(file_name) { - tracing::debug!("Cached: {}", file_name); return Ok(Some(cached)); } @@ -88,20 +86,12 @@ where .context("failed to analyze module")?; files.dedup_by_key(|v| v.1.clone()); - tracing::debug!( - "({:?}, {:?}, {:?}) Storing module: {}", - v.id, - v.local_ctxt(), - v.export_ctxt(), - file_name - ); self.scope.store_module(v.clone()); // Load dependencies and store them in the `Scope` let results = files .into_par_iter() .map(|(_src, path)| { - tracing::trace!("loading dependency: {}", path); self.load_transformed(&path) }) .collect::>(); @@ -135,7 +125,6 @@ where mut data: ModuleData, ) -> Result<(TransformedModule, Vec<(Source, Lrc)>), Error> { self.run(|| { - tracing::trace!("transform_module({})", data.fm.name); let (id, local_mark, export_mark) = self.scope.module_id_gen.gen(file_name); data.module.visit_mut_with(&mut ClearMark); @@ -225,7 +214,6 @@ where raw: RawExports, ) -> Result<(Exports, Vec<(Source, Lrc)>), Error> { self.run(|| { - tracing::trace!("resolve_exports({})", base); let mut files = Vec::new(); let mut exports = Exports::default(); @@ -282,7 +270,6 @@ where info: RawImports, ) -> Result<(Imports, Vec<(Source, Lrc)>), Error> { self.run(|| { - tracing::trace!("resolve_imports({})", base); let mut files = Vec::new(); let mut merged = Imports::default(); diff --git a/crates/swc_bundler/src/bundler/mod.rs b/crates/swc_bundler/src/bundler/mod.rs index 5e7b09c9d202..aa3ebbc1a80e 100644 --- a/crates/swc_bundler/src/bundler/mod.rs +++ b/crates/swc_bundler/src/bundler/mod.rs @@ -117,11 +117,8 @@ where ) -> Self { GLOBALS.set(globals, || { let helper_ctxt = SyntaxContext::empty().apply_mark(Mark::fresh(Mark::root())); - tracing::debug!("Helper ctxt: {:?}", helper_ctxt); let synthesized_ctxt = SyntaxContext::empty().apply_mark(Mark::fresh(Mark::root())); - tracing::debug!("Synthesized ctxt: {:?}", synthesized_ctxt); let injected_ctxt = SyntaxContext::empty().apply_mark(Mark::fresh(Mark::root())); - tracing::debug!("Injected ctxt: {:?}", injected_ctxt); Bundler { config, diff --git a/crates/swc_bundler/src/inline.rs b/crates/swc_bundler/src/inline.rs index 1d8c6496225e..462191e1d7d4 100644 --- a/crates/swc_bundler/src/inline.rs +++ b/crates/swc_bundler/src/inline.rs @@ -15,7 +15,6 @@ pub(crate) struct InlineData { /// Inline **injected** variables. pub(crate) fn inline(injected_ctxt: SyntaxContext, module: &mut Modules) { - tracing::debug!("Inlining injected variables"); let mut data = Default::default(); diff --git a/crates/swc_bundler/src/modules/sort/chunk.rs b/crates/swc_bundler/src/modules/sort/chunk.rs index d1ede6dd8ff8..67ac37da8889 100644 --- a/crates/swc_bundler/src/modules/sort/chunk.rs +++ b/crates/swc_bundler/src/modules/sort/chunk.rs @@ -68,10 +68,6 @@ fn toposort_real_modules<'a>( let mut chunks = Vec::new(); - tracing::debug!( - "Topologically sorting modules based on the dependency graph: ({} items)", - modules.len() - ); #[cfg(not(target_arch = "wasm32"))] let start = Instant::now(); @@ -79,7 +75,6 @@ fn toposort_real_modules<'a>( #[cfg(not(target_arch = "wasm32"))] let end = Instant::now(); #[cfg(not(target_arch = "wasm32"))] - tracing::debug!("Toposort of module ids took {:?}", end - start); for ids in sorted_ids { if ids.is_empty() { continue; @@ -226,7 +221,6 @@ fn toposort_real_module_ids<'a>( continue; } - tracing::info!("Using slow, fallback logic for topological sorting"); all_modules_in_circle.extend(deps_of_circle); } diff --git a/crates/swc_bundler/src/modules/sort/mod.rs b/crates/swc_bundler/src/modules/sort/mod.rs index 5efc9b9a0658..c2d965896869 100644 --- a/crates/swc_bundler/src/modules/sort/mod.rs +++ b/crates/swc_bundler/src/modules/sort/mod.rs @@ -26,7 +26,6 @@ impl Modules { cycles: &Vec>, cm: &Lrc, ) { - tracing::debug!("Sorting {:?}", entry_id); let injected_ctxt = self.injected_ctxt; @@ -36,7 +35,6 @@ impl Modules { #[cfg(not(target_arch = "wasm32"))] let dur = Instant::now() - start; #[cfg(not(target_arch = "wasm32"))] - tracing::debug!("Sorting took {:?}", dur); let buf = chunks .into_iter() @@ -52,6 +50,5 @@ impl Modules { // print_hygiene("after sort", cm, &module); *self = Modules::from(entry_id, module, injected_ctxt); - tracing::debug!("Sorted {:?}", entry_id); } } diff --git a/crates/swc_bundler/src/modules/sort/stmt.rs b/crates/swc_bundler/src/modules/sort/stmt.rs index f3b7366ab667..9f9eaf4b8f3b 100644 --- a/crates/swc_bundler/src/modules/sort/stmt.rs +++ b/crates/swc_bundler/src/modules/sort/stmt.rs @@ -55,7 +55,6 @@ pub(super) fn sort_stmts( let mut id_graph = calc_deps(&stmts); - tracing::debug!("Analyzed dependencies between statements"); let orders = iter( &mut id_graph, @@ -66,7 +65,6 @@ pub(super) fn sort_stmts( ) .collect::>(); - tracing::debug!("Sorted statements"); debug_assert_eq!(total_len, orders.len()); @@ -656,7 +654,6 @@ impl Visit for RequirementCalculator { } fn calc_deps(new: &[ModuleItem]) -> StmtDepGraph { - tracing::debug!("Analyzing dependencies between statements"); let mut graph = StmtDepGraph::default(); let mut declared_by = FxHashMap::>::default(); diff --git a/crates/swc_cli_impl/src/commands/compile.rs b/crates/swc_cli_impl/src/commands/compile.rs index 328ecefc0dea..34048bfcf32a 100644 --- a/crates/swc_cli_impl/src/commands/compile.rs +++ b/crates/swc_cli_impl/src/commands/compile.rs @@ -126,7 +126,6 @@ static DEFAULT_EXTENSIONS: &[&str] = &["js", "jsx", "es6", "es", "mjs", "ts", "t /// Infer list of files to be transformed from cli arguments. /// If given input is a directory, it'll traverse it and collect all supported /// files. -#[tracing::instrument(level = "info", skip_all)] fn get_files_list( raw_files_input: &[PathBuf], extensions: &[String], diff --git a/crates/swc_common/src/plugin/serialized.rs b/crates/swc_common/src/plugin/serialized.rs index f0d73b1c325b..0dd2b99e7c72 100644 --- a/crates/swc_common/src/plugin/serialized.rs +++ b/crates/swc_common/src/plugin/serialized.rs @@ -47,7 +47,6 @@ impl PluginSerializedBytes { * Constructs an instance from already serialized byte * slices. */ - #[tracing::instrument(level = "info", skip_all)] pub fn from_bytes(field: Vec) -> PluginSerializedBytes { PluginSerializedBytes { field } } @@ -59,7 +58,6 @@ impl PluginSerializedBytes { * to implement TryFrom trait */ /* - #[tracing::instrument(level = "info", skip_all)] pub fn try_serialize(t: &VersionedSerializable) -> Result where W: rkyv::Serialize>, @@ -78,7 +76,6 @@ impl PluginSerializedBytes { } */ - #[tracing::instrument(level = "info", skip_all)] pub fn try_serialize(t: &VersionedSerializable) -> Result where W: cbor4ii::core::enc::Encode, @@ -93,7 +90,6 @@ impl PluginSerializedBytes { /* * Internal fn to constructs an instance from raw bytes ptr. */ - #[tracing::instrument(level = "info", skip_all)] #[allow(clippy::not_unsafe_ptr_arg_deref)] pub fn from_raw_ptr( raw_allocated_ptr: *const u8, @@ -113,7 +109,6 @@ impl PluginSerializedBytes { (self.field.as_ptr(), self.field.len()) } - #[tracing::instrument(level = "info", skip_all)] pub fn deserialize(&self) -> Result, Error> where W: for<'de> cbor4ii::core::dec::Decode<'de>, @@ -127,7 +122,6 @@ impl PluginSerializedBytes { } /* - #[tracing::instrument(level = "info", skip_all)] pub fn deserialize(&self) -> Result, Error> where W: rkyv::Archive, diff --git a/crates/swc_core/tests/fixture/stub_napi/src/lib.rs b/crates/swc_core/tests/fixture/stub_napi/src/lib.rs index 2aeee1f3c3a7..3a7be58dd98a 100644 --- a/crates/swc_core/tests/fixture/stub_napi/src/lib.rs +++ b/crates/swc_core/tests/fixture/stub_napi/src/lib.rs @@ -41,7 +41,6 @@ pub struct JsCompiler { impl JsCompiler { #[napi(constructor)] #[allow(clippy::new_without_default)] - #[tracing::instrument(level = "info", skip_all)] pub fn new() -> Self { Self { _compiler: COMPILER.clone(), diff --git a/crates/swc_ecma_codegen/src/lib.rs b/crates/swc_ecma_codegen/src/lib.rs index aae7558fd7b8..e326f7acc526 100644 --- a/crates/swc_ecma_codegen/src/lib.rs +++ b/crates/swc_ecma_codegen/src/lib.rs @@ -1429,7 +1429,6 @@ impl MacroNode for Program { #[node_impl] impl MacroNode for Module { - #[tracing::instrument(level = "debug", skip_all)] fn emit(&mut self, emitter: &mut Macro) -> Result { emitter.emit_leading_comments_of_span(self.span(), false)?; @@ -1457,7 +1456,6 @@ impl MacroNode for Module { #[node_impl] impl MacroNode for Script { - #[tracing::instrument(level = "debug", skip_all)] fn emit(&mut self, emitter: &mut Macro) -> Result { emitter.emit_leading_comments_of_span(self.span(), false)?; diff --git a/crates/swc_ecma_compat_common/src/macros.rs b/crates/swc_ecma_compat_common/src/macros.rs index 749968c62e41..d4952a498213 100644 --- a/crates/swc_ecma_compat_common/src/macros.rs +++ b/crates/swc_ecma_compat_common/src/macros.rs @@ -137,7 +137,6 @@ macro_rules! impl_visit_mut_fn { return; } - tracing::trace!("visit_mut_constructor(parmas.len() = {})", f.params.len()); f.visit_mut_children_with(self); @@ -155,10 +154,6 @@ macro_rules! impl_visit_mut_fn { let (params, body) = self.visit_mut_fn_like(&mut params, &mut f.body.take().unwrap()); - tracing::trace!( - "visit_mut_constructor(parmas.len() = {}, after)", - params.len() - ); f.params = params.into_iter().map(ParamOrTsParamProp::Param).collect(); f.body = Some(body); diff --git a/crates/swc_ecma_compat_es2015/src/destructuring.rs b/crates/swc_ecma_compat_es2015/src/destructuring.rs index 0f2e7b26cfda..ab6cc60da45e 100644 --- a/crates/swc_ecma_compat_es2015/src/destructuring.rs +++ b/crates/swc_ecma_compat_es2015/src/destructuring.rs @@ -1148,7 +1148,6 @@ fn make_ref_ident(c: Config, decls: &mut Vec, init: Option, diff --git a/crates/swc_ecma_compat_es2015/src/for_of.rs b/crates/swc_ecma_compat_es2015/src/for_of.rs index 203569fbfb48..b2c2f0f64035 100644 --- a/crates/swc_ecma_compat_es2015/src/for_of.rs +++ b/crates/swc_ecma_compat_es2015/src/for_of.rs @@ -569,7 +569,6 @@ impl ForOf { /// } /// } /// ``` -#[tracing::instrument(level = "debug", skip_all)] fn make_finally_block( iterator_return: Box, normal_completion_ident: &Ident, diff --git a/crates/swc_ecma_compat_es2015/src/generator.rs b/crates/swc_ecma_compat_es2015/src/generator.rs index f64636044670..a9e358af05a4 100644 --- a/crates/swc_ecma_compat_es2015/src/generator.rs +++ b/crates/swc_ecma_compat_es2015/src/generator.rs @@ -978,7 +978,6 @@ impl VisitMut for Generator { } } - #[tracing::instrument(level = "debug", skip_all)] fn visit_mut_stmt(&mut self, node: &mut Stmt) { match node { Stmt::Break(b) => { @@ -3130,7 +3129,6 @@ impl Generator { }); } - #[tracing::instrument(level = "debug", skip(self))] fn try_enter_label(&mut self, op_index: usize) { if self.label_offsets.is_none() { return; @@ -3184,7 +3182,6 @@ impl Generator { } /// Tries to enter or leave a code block. - #[tracing::instrument(level = "debug", skip(self))] fn try_enter_or_leave_block(&mut self, op_index: usize) { if let Some(blocks) = &self.blocks { while self.block_index < self.block_actions.as_ref().unwrap().len() @@ -3251,7 +3248,6 @@ impl Generator { /// Writes an operation as a statement to the current label's statement /// list. - #[tracing::instrument(level = "debug", skip(self))] fn write_operation(&mut self, op_index: usize) { if cfg!(debug_assertions) { debug!("Writing operation {}", op_index); diff --git a/crates/swc_ecma_compat_es2015/src/spread.rs b/crates/swc_ecma_compat_es2015/src/spread.rs index c2d079a77de1..9a7aca8aa5ce 100644 --- a/crates/swc_ecma_compat_es2015/src/spread.rs +++ b/crates/swc_ecma_compat_es2015/src/spread.rs @@ -486,7 +486,6 @@ impl Spread { } } -#[tracing::instrument(level = "debug", skip_all)] fn expand_literal_args( args: impl ExactSizeIterator>, ) -> Vec> { diff --git a/crates/swc_ecma_compat_es2015/src/typeof_symbol.rs b/crates/swc_ecma_compat_es2015/src/typeof_symbol.rs index 2aad12b5e8e7..f9787eea40ec 100644 --- a/crates/swc_ecma_compat_es2015/src/typeof_symbol.rs +++ b/crates/swc_ecma_compat_es2015/src/typeof_symbol.rs @@ -150,7 +150,6 @@ impl VisitMut for TypeOfSymbol { } } -#[tracing::instrument(level = "debug", skip_all)] fn is_non_symbol_literal(e: &Expr) -> bool { match e { Expr::Lit(Lit::Str(Str { value, .. })) => matches!( diff --git a/crates/swc_ecma_compat_es2016/src/exponentiation.rs b/crates/swc_ecma_compat_es2016/src/exponentiation.rs index a7027ead414b..47950efbdbc4 100644 --- a/crates/swc_ecma_compat_es2016/src/exponentiation.rs +++ b/crates/swc_ecma_compat_es2016/src/exponentiation.rs @@ -136,7 +136,6 @@ impl VisitMut for Exponentiation { } } -#[tracing::instrument(level = "debug", skip_all)] fn mk_call(span: Span, left: Box, right: Box) -> Expr { // Math.pow() CallExpr { diff --git a/crates/swc_ecma_compat_es2017/src/async_to_generator.rs b/crates/swc_ecma_compat_es2017/src/async_to_generator.rs index 6cc0cfdbfd43..77161259f296 100644 --- a/crates/swc_ecma_compat_es2017/src/async_to_generator.rs +++ b/crates/swc_ecma_compat_es2017/src/async_to_generator.rs @@ -390,7 +390,6 @@ impl VisitMut for AsyncToGenerator { /// Creates /// /// `_async_to_generator(function*() {})()` from `async function() {}`; -#[tracing::instrument(level = "debug", skip_all)] fn make_fn_ref(fn_state: &FnState, params: Vec, body: BlockStmt) -> Expr { let helper = if fn_state.is_generator { helper_expr!(DUMMY_SP, wrap_async_generator) @@ -430,7 +429,6 @@ fn make_fn_ref(fn_state: &FnState, params: Vec, body: BlockStmt) -> Expr } } -#[tracing::instrument(level = "debug", skip_all)] fn could_potentially_throw(param: &[Param], unresolved_ctxt: SyntaxContext) -> bool { for param in param { debug_assert!(param.decorators.is_empty()); @@ -491,7 +489,6 @@ impl Check for ShouldWork { } } -#[tracing::instrument(level = "debug", skip_all)] fn handle_await_for(stmt: &mut Stmt, is_async_generator: bool) { let s = match stmt { Stmt::ForOf(s @ ForOfStmt { is_await: true, .. }) => s.take(), diff --git a/crates/swc_ecma_compat_es2018/src/object_rest.rs b/crates/swc_ecma_compat_es2018/src/object_rest.rs index f5623bef4d51..4176309d3ced 100644 --- a/crates/swc_ecma_compat_es2018/src/object_rest.rs +++ b/crates/swc_ecma_compat_es2018/src/object_rest.rs @@ -878,7 +878,6 @@ impl ObjectRest { } } -#[tracing::instrument(level = "debug", skip_all)] fn object_without_properties( obj: Box, excluded_props: Vec>, @@ -956,7 +955,6 @@ fn object_without_properties( .into() } -#[tracing::instrument(level = "debug", skip_all)] fn excluded_props(props: &[ObjectPatProp]) -> Vec> { props .iter() diff --git a/crates/swc_ecma_compiler/src/es2020/nullish_coalescing.rs b/crates/swc_ecma_compiler/src/es2020/nullish_coalescing.rs index bac9dc869e7d..1a87fdc74936 100644 --- a/crates/swc_ecma_compiler/src/es2020/nullish_coalescing.rs +++ b/crates/swc_ecma_compiler/src/es2020/nullish_coalescing.rs @@ -119,7 +119,6 @@ impl<'a> CompilerImpl<'a> { } /// Generate the conditional expression for nullish coalescing -#[tracing::instrument(level = "debug", skip_all)] fn make_cond( no_document_all: bool, span: Span, diff --git a/crates/swc_ecma_lexer/src/common/lexer/mod.rs b/crates/swc_ecma_lexer/src/common/lexer/mod.rs index 852877860f3f..12b728e217e3 100644 --- a/crates/swc_ecma_lexer/src/common/lexer/mod.rs +++ b/crates/swc_ecma_lexer/src/common/lexer/mod.rs @@ -226,7 +226,6 @@ pub trait Lexer<'a, TokenAndSpan>: Tokens + Sized { if self.ctx().contains(Context::IgnoreError) { return; } - tracing::warn!("Lexer error at {:?}", span); let err = crate::error::Error::new(span, kind); self.push_error(err); } @@ -567,7 +566,6 @@ pub trait Lexer<'a, TokenAndSpan>: Tokens + Sized { ); if cfg!(feature = "debug") { - tracing::trace!("read_digits(radix = {}), cur = {:?}", RADIX, self.cur()); } let start = self.cur_pos(); diff --git a/crates/swc_ecma_lexer/src/common/parser/expr.rs b/crates/swc_ecma_lexer/src/common/parser/expr.rs index e26512d5ce74..0ae7c274a4c0 100644 --- a/crates/swc_ecma_lexer/src/common/parser/expr.rs +++ b/crates/swc_ecma_lexer/src/common/parser/expr.rs @@ -1370,25 +1370,12 @@ fn parse_bin_op_recursively_inner<'a, P: Parser<'a>>( if op.precedence() <= min_prec { if cfg!(feature = "debug") { - tracing::trace!( - "returning {:?} without parsing {:?} because min_prec={}, prec={}", - left, - op, - min_prec, - op.precedence() - ); } return Ok((left, None)); } p.bump(); if cfg!(feature = "debug") { - tracing::trace!( - "parsing binary op {:?} min_prec={}, prec={}", - op, - min_prec, - op.precedence() - ); } match *left { // This is invalid syntax. diff --git a/crates/swc_ecma_lexer/src/common/parser/macros.rs b/crates/swc_ecma_lexer/src/common/parser/macros.rs index 02f41a9f072d..7575c5f6cedd 100644 --- a/crates/swc_ecma_lexer/src/common/parser/macros.rs +++ b/crates/swc_ecma_lexer/src/common/parser/macros.rs @@ -36,13 +36,6 @@ macro_rules! syntax_error { } } if cfg!(feature = "debug") { - tracing::error!( - "Syntax error called from {}:{}:{}\nCurrent token = {:?}", - file!(), - line!(), - column!(), - $p.input().cur() - ); } return Err(err.into()); }}; @@ -63,7 +56,6 @@ Current token is {:?}", macro_rules! trace_cur { ($p:expr, $name:ident) => {{ if cfg!(feature = "debug") { - tracing::debug!("{}: {:?}", stringify!($name), $p.input().cur()); } }}; } diff --git a/crates/swc_ecma_lexer/src/common/parser/mod.rs b/crates/swc_ecma_lexer/src/common/parser/mod.rs index e17910ad4e04..4b3f72ac1071 100644 --- a/crates/swc_ecma_lexer/src/common/parser/mod.rs +++ b/crates/swc_ecma_lexer/src/common/parser/mod.rs @@ -208,7 +208,6 @@ pub trait Parser<'a>: Sized + Clone { fn eat_general_semi(&mut self) -> bool { if cfg!(feature = "debug") { - tracing::trace!("eat(';'): cur={:?}", self.input().cur()); } let cur = self.input().cur(); if cur.is_semi() { diff --git a/crates/swc_ecma_lexer/src/lexer/state.rs b/crates/swc_ecma_lexer/src/lexer/state.rs index 8dc108697f8a..7b5cecf92ee3 100644 --- a/crates/swc_ecma_lexer/src/lexer/state.rs +++ b/crates/swc_ecma_lexer/src/lexer/state.rs @@ -56,11 +56,6 @@ pub struct State { impl State { pub(super) fn update(&mut self, start: BytePos, next: TokenKind) { if cfg!(feature = "debug") { - tracing::trace!( - "updating state: next={:?}, had_line_break={} ", - next, - self.had_line_break() - ); } let prev = self.token_type(); self.set_token_type(next.into()); diff --git a/crates/swc_ecma_lexer/src/parser/macros.rs b/crates/swc_ecma_lexer/src/parser/macros.rs index d5abbd61f94d..cce9bbf9747d 100644 --- a/crates/swc_ecma_lexer/src/parser/macros.rs +++ b/crates/swc_ecma_lexer/src/parser/macros.rs @@ -1,7 +1,6 @@ macro_rules! trace_cur { ($p:expr, $name:ident) => {{ if cfg!(feature = "debug") { - tracing::debug!("{}: {:?}", stringify!($name), $p.input.cur()); } }}; } diff --git a/crates/swc_ecma_minifier/src/compress/optimize/mod.rs b/crates/swc_ecma_minifier/src/compress/optimize/mod.rs index 87bd81052933..6db99e8526d4 100644 --- a/crates/swc_ecma_minifier/src/compress/optimize/mod.rs +++ b/crates/swc_ecma_minifier/src/compress/optimize/mod.rs @@ -1985,9 +1985,6 @@ impl VisitMut for Optimizer<'_> { } self.reduce_escaped_newline_for_str_lit(e); - - #[cfg(feature = "trace-ast")] - tracing::debug!("Output: {}", dump(e, true)); } #[cfg_attr(feature = "debug", tracing::instrument(level = "debug", skip_all))] diff --git a/crates/swc_ecma_minifier/src/compress/util/mod.rs b/crates/swc_ecma_minifier/src/compress/util/mod.rs index 21ae0c15efa4..0b5d62a7ce8f 100644 --- a/crates/swc_ecma_minifier/src/compress/util/mod.rs +++ b/crates/swc_ecma_minifier/src/compress/util/mod.rs @@ -222,7 +222,6 @@ pub(crate) fn is_ok_to_negate_rhs(expr_ctx: ExprCtx, rhs: &Expr) -> bool { #[cfg(feature = "debug")] { - tracing::warn!("unimplemented: is_ok_to_negate_rhs: `{}`", dump(rhs, false)); } false diff --git a/crates/swc_ecma_minifier/src/eval.rs b/crates/swc_ecma_minifier/src/eval.rs index fc2fb10d8900..4c62f8473eac 100644 --- a/crates/swc_ecma_minifier/src/eval.rs +++ b/crates/swc_ecma_minifier/src/eval.rs @@ -78,7 +78,6 @@ impl Mode for Eval { } impl Evaluator { - #[tracing::instrument(name = "Evaluator::run", level = "debug", skip_all)] fn run(&mut self) { if !self.done { self.done = true; diff --git a/crates/swc_ecma_minifier/src/lib.rs b/crates/swc_ecma_minifier/src/lib.rs index 0a4f59a358a1..f33a0d7f1223 100644 --- a/crates/swc_ecma_minifier/src/lib.rs +++ b/crates/swc_ecma_minifier/src/lib.rs @@ -260,11 +260,6 @@ fn perform_dce(m: &mut Program, options: &CompressOptions, extra: Marks) { #[cfg(feature = "debug")] if visitor.changed() { let src = crate::debug::dump(&*m, false); - tracing::debug!( - "===== Before DCE =====\n{}\n===== After DCE =====\n{}", - start, - src - ); } if !visitor.changed() { diff --git a/crates/swc_ecma_minifier/src/macros.rs b/crates/swc_ecma_minifier/src/macros.rs index 8ab7d0b5de8d..71907dd8b43c 100644 --- a/crates/swc_ecma_minifier/src/macros.rs +++ b/crates/swc_ecma_minifier/src/macros.rs @@ -1,46 +1,17 @@ /// Used when something is modified. macro_rules! report_change { - ($($tt:tt)+) => {{ - #[cfg(feature = "debug")] - tracing::debug!( - kind = "change", - $($tt)* - ); - }}; + ($($tt:tt)+) => {{}}; } /// Used when a function decided to give up. macro_rules! log_abort { - ($($tt:tt)+) => {{ - #[cfg(feature = "debug")] - { - tracing::trace!( - kind = "abort", - $($tt)* - ); - } - }}; + ($($tt:tt)+) => {{}}; } macro_rules! dump_change_detail { - ($($tt:tt)+) => {{ - #[cfg(feature = "debug")] - { - tracing::trace!( - kind = "detail", - $($tt)* - ); - } - }}; + ($($tt:tt)+) => {{}}; } macro_rules! trace_op { - ($($tt:tt)+) => {{ - #[cfg(feature = "debug")] - { - tracing::trace!( - $($tt)* - ); - } - }}; + ($($tt:tt)+) => {{}}; } diff --git a/crates/swc_ecma_minifier/src/program_data.rs b/crates/swc_ecma_minifier/src/program_data.rs index 4f26bb85710e..f94cd8002fe6 100644 --- a/crates/swc_ecma_minifier/src/program_data.rs +++ b/crates/swc_ecma_minifier/src/program_data.rs @@ -471,7 +471,6 @@ impl Storage for ProgramData { { #[cfg(feature = "debug")] { - tracing::trace!("declare_decl(`{}`): Already declared", i); } v.flags |= VarUsageInfoFlags::REASSIGNED; diff --git a/crates/swc_ecma_minifier/src/util/base54.rs b/crates/swc_ecma_minifier/src/util/base54.rs index 855ba4ff347d..2cf1db55762a 100644 --- a/crates/swc_ecma_minifier/src/util/base54.rs +++ b/crates/swc_ecma_minifier/src/util/base54.rs @@ -254,8 +254,6 @@ impl CharFreq { all.extend_from_slice(&alpha); all.extend_from_slice(&digits); - #[cfg(feature = "debug")] - tracing::info!("Chars: {}", String::from_utf8_lossy(&all)); Base54Chars { chars: all.try_into().unwrap(), diff --git a/crates/swc_ecma_minifier/tests/compress.rs b/crates/swc_ecma_minifier/tests/compress.rs index bf9a7b950496..011e172df372 100644 --- a/crates/swc_ecma_minifier/tests/compress.rs +++ b/crates/swc_ecma_minifier/tests/compress.rs @@ -248,11 +248,6 @@ fn run( }, ); let end = Instant::now(); - tracing::info!( - "optimize({}) took {:?}", - input.display(), - end - optimization_start - ); if !disable_hygiene { output.visit_mut_with(&mut hygiene()) @@ -261,11 +256,6 @@ fn run( let output = output.apply(&mut fixer(None)); let end = Instant::now(); - tracing::info!( - "process({}) took {:?}", - input.display(), - end - minification_start - ); Some(output) }) diff --git a/crates/swc_ecma_minifier/tests/terser_exec.rs b/crates/swc_ecma_minifier/tests/terser_exec.rs index 971a46e84e1b..db6d7673de58 100644 --- a/crates/swc_ecma_minifier/tests/terser_exec.rs +++ b/crates/swc_ecma_minifier/tests/terser_exec.rs @@ -238,22 +238,12 @@ fn run(cm: Lrc, handler: &Handler, input: &Path, config: &str) -> Opt }, ); let end = Instant::now(); - tracing::info!( - "optimize({}) took {:?}", - input.display(), - end - optimization_start - ); output.visit_mut_with(&mut hygiene()); let output = output.apply(&mut fixer(None)); let end = Instant::now(); - tracing::info!( - "process({}) took {:?}", - input.display(), - end - minification_start - ); Some(output) }) diff --git a/crates/swc_ecma_parser/src/lexer/mod.rs b/crates/swc_ecma_parser/src/lexer/mod.rs index fba8994ed75e..1fdf7801afdc 100644 --- a/crates/swc_ecma_parser/src/lexer/mod.rs +++ b/crates/swc_ecma_parser/src/lexer/mod.rs @@ -606,7 +606,6 @@ impl<'a> Lexer<'a> { if self.ctx().contains(Context::IgnoreError) { return; } - tracing::warn!("Lexer error at {:?}", span); let err = crate::error::Error::new(span, kind); self.push_error(err); } @@ -908,7 +907,6 @@ impl<'a> Lexer<'a> { ); if cfg!(feature = "debug") { - tracing::trace!("read_digits(radix = {}), cur = {:?}", RADIX, self.cur()); } let start = self.cur_pos(); diff --git a/crates/swc_ecma_parser/src/parser/expr.rs b/crates/swc_ecma_parser/src/parser/expr.rs index 9ad64f6ea1ba..081d7a7ffe9a 100644 --- a/crates/swc_ecma_parser/src/parser/expr.rs +++ b/crates/swc_ecma_parser/src/parser/expr.rs @@ -1800,25 +1800,12 @@ impl Parser { if op.precedence() <= min_prec { if cfg!(feature = "debug") { - tracing::trace!( - "returning {:?} without parsing {:?} because min_prec={}, prec={}", - left, - op, - min_prec, - op.precedence() - ); } return Ok((left, None)); } self.bump(); if cfg!(feature = "debug") { - tracing::trace!( - "parsing binary op {:?} min_prec={}, prec={}", - op, - min_prec, - op.precedence() - ); } match *left { // This is invalid syntax. diff --git a/crates/swc_ecma_parser/src/parser/macros.rs b/crates/swc_ecma_parser/src/parser/macros.rs index e027ea0bb4b7..b9da378c2fa0 100644 --- a/crates/swc_ecma_parser/src/parser/macros.rs +++ b/crates/swc_ecma_parser/src/parser/macros.rs @@ -1,7 +1,6 @@ macro_rules! trace_cur { ($p:expr, $name:ident) => {{ if cfg!(feature = "debug") { - tracing::debug!("{}: {:?}", stringify!($name), $p.input.cur()); } }}; } @@ -20,13 +19,6 @@ macro_rules! syntax_error { } } if cfg!(feature = "debug") { - tracing::error!( - "Syntax error called from {}:{}:{}\nCurrent token = {:?}", - file!(), - line!(), - column!(), - $p.input().cur() - ); } return Err(err.into()); }}; diff --git a/crates/swc_ecma_parser/src/parser/mod.rs b/crates/swc_ecma_parser/src/parser/mod.rs index bd2e347e5fdd..637cd18f6619 100644 --- a/crates/swc_ecma_parser/src/parser/mod.rs +++ b/crates/swc_ecma_parser/src/parser/mod.rs @@ -449,7 +449,6 @@ impl Parser { pub fn eat_general_semi(&mut self) -> bool { if cfg!(feature = "debug") { - tracing::trace!("eat(';'): cur={:?}", self.input().cur()); } let cur = self.input().cur(); if cur == Token::Semi { diff --git a/crates/swc_ecma_transforms_optimization/src/simplify/expr/mod.rs b/crates/swc_ecma_transforms_optimization/src/simplify/expr/mod.rs index 55a19fbd6fde..10f7849cbc45 100644 --- a/crates/swc_ecma_transforms_optimization/src/simplify/expr/mod.rs +++ b/crates/swc_ecma_transforms_optimization/src/simplify/expr/mod.rs @@ -138,7 +138,6 @@ impl VisitMut for SimplifyExpr { match seq.exprs.first().map(|v| &**v) { Some(Expr::Lit(..) | Expr::Ident(..)) => {} _ => { - tracing::debug!("Injecting `0` to preserve `this = undefined`"); seq.exprs.insert(0, 0.0.into()); } } @@ -482,7 +481,6 @@ impl VisitMut for SimplifyExpr { if exprs.is_empty() { exprs.push(0.0.into()); - tracing::trace!("expr_simplifier: Preserving first zero"); } } @@ -494,7 +492,6 @@ impl VisitMut for SimplifyExpr { exprs.push(0.0.into()); - tracing::debug!("expr_simplifier: Injected first zero"); } } diff --git a/crates/swc_ecma_transforms_optimization/src/simplify/inlining/mod.rs b/crates/swc_ecma_transforms_optimization/src/simplify/inlining/mod.rs index 917cc754ee3c..1dbdc8b1ef6e 100644 --- a/crates/swc_ecma_transforms_optimization/src/simplify/inlining/mod.rs +++ b/crates/swc_ecma_transforms_optimization/src/simplify/inlining/mod.rs @@ -110,7 +110,6 @@ impl VisitMut for Inlining<'_> { } fn visit_mut_assign_expr(&mut self, e: &mut AssignExpr) { - tracing::trace!("{:?}; Fold", self.phase); self.pat_mode = PatFoldingMode::Assign; match e.op { @@ -126,7 +125,6 @@ impl VisitMut for Inlining<'_> { AssignTarget::Simple(left) => { // if let SimpleAssignTarget::Member(ref left) = &*left { - tracing::trace!("Assign to member expression!"); let mut v = IdentListVisitor { scope: &mut self.scope, }; @@ -300,14 +298,11 @@ impl VisitMut for Inlining<'_> { self.scope.add_read(&id); } Phase::Inlining => { - tracing::trace!("Trying to inline: {:?}", id); let expr = if let Some(var) = self.scope.find_binding(&id) { - tracing::trace!("VarInfo: {:?}", var); if !var.is_inline_prevented() { let expr = var.value.borrow(); if let Some(expr) = &*expr { - tracing::debug!("Inlining: {:?}", id); if *node != *expr { self.changed = true; @@ -315,18 +310,15 @@ impl VisitMut for Inlining<'_> { Some(expr.clone()) } else { - tracing::debug!("Inlining: {:?} as undefined", id); if var.is_undefined.get() { *node = *Expr::undefined(i.span); return; } else { - tracing::trace!("Not a cheap expression"); None } } } else { - tracing::trace!("Inlining is prevented"); None } } else { @@ -478,7 +470,6 @@ impl VisitMut for Inlining<'_> { self.phase = Phase::Analysis; program.visit_mut_children_with(self); - tracing::trace!("Switching to Inlining phase"); // Inline self.phase = Phase::Inlining; @@ -649,18 +640,15 @@ impl VisitMut for Inlining<'_> { if self.var_decl_kind != VarDeclKind::Const { let id = name.to_id(); - tracing::trace!("Trying to optimize variable declaration: {:?}", id); if self.scope.is_inline_prevented(&Ident::from(name).into()) || !self.scope.has_same_this(&id, node.init.as_deref()) { - tracing::trace!("Inline is prevented for {:?}", id); return; } let mut init = node.init.take(); init.visit_mut_with(self); - tracing::trace!("\tInit: {:?}", init); if let Some(init) = &init { if let Expr::Ident(ri) = &**init { @@ -675,10 +663,6 @@ impl VisitMut for Inlining<'_> { if let Some(ref e) = init { if self.scope.is_inline_prevented(e) { - tracing::trace!( - "Inlining is not possible as inline of the initialization was \ - prevented" - ); node.init = init; self.scope.prevent_inline(&name.to_id()); return; @@ -709,8 +693,6 @@ impl VisitMut for Inlining<'_> { } }; - // tracing::trace!("({}): Inserting {:?}", self.scope.depth(), - // name.to_id()); self.declare(name.to_id(), e.map(|e| Cow::Owned(*e)), false, kind); diff --git a/crates/swc_ecma_transforms_optimization/src/simplify/inlining/scope.rs b/crates/swc_ecma_transforms_optimization/src/simplify/inlining/scope.rs index 3ea7678da79f..4e3eb1e77938 100644 --- a/crates/swc_ecma_transforms_optimization/src/simplify/inlining/scope.rs +++ b/crates/swc_ecma_transforms_optimization/src/simplify/inlining/scope.rs @@ -62,7 +62,6 @@ impl Inlining<'_> { (child.scope.unresolved_usages, child.scope.bindings) }; - tracing::trace!("propagating variables"); self.scope.unresolved_usages.extend(unresolved_usages); @@ -78,7 +77,6 @@ impl Inlining<'_> { }) { let v: VarInfo = v; - tracing::trace!("Hoisting a variable {:?}", id); if self.scope.unresolved_usages.contains(&id) { v.inline_prevented.set(true) @@ -102,12 +100,6 @@ impl Inlining<'_> { is_change: bool, kind: VarType, ) { - tracing::trace!( - "({}, {:?}) declare({})", - self.scope.depth(), - self.phase, - id.0 - ); let init = init.map(|cow| match cow { Cow::Owned(v) => Cow::Owned(v), @@ -143,10 +135,8 @@ impl Inlining<'_> { }; if is_inline_prevented { - tracing::trace!("\tdeclare: Inline prevented: {:?}", id) } if is_undefined { - tracing::trace!("\tdeclare: {:?} is undefined", id); } let idx = match self.scope.bindings.entry(id.clone()) { @@ -192,7 +182,6 @@ impl Inlining<'_> { } if scope.kind == ScopeKind::Loop { - tracing::trace!("preventing inline as it's declared in a loop"); self.scope.prevent_inline(&id); break; } @@ -210,7 +199,6 @@ impl Inlining<'_> { if barrier_works { if let Some((value_idx, vi)) = value_idx { - tracing::trace!("\tdeclare: {} -> {}", idx, value_idx); let barrier_exists = (|| { for &blocker in self.scope.inline_barriers.borrow().iter() { @@ -225,12 +213,10 @@ impl Inlining<'_> { })(); if value_idx > idx || barrier_exists { - tracing::trace!("Variable use before declaration: {:?}", id); self.scope.prevent_inline(&id); self.scope.prevent_inline(&vi) } } else { - tracing::trace!("\tdeclare: value idx is none"); } } } @@ -315,7 +301,6 @@ impl<'a> Scope<'a> { } fn read_prevents_inlining(&self, id: &Id) -> bool { - tracing::trace!("read_prevents_inlining({:?})", id); if let Some(v) = self.find_binding(id) { match v.kind { @@ -339,17 +324,11 @@ impl<'a> Scope<'a> { let found = scope.find_binding_from_current(id).is_some(); if found { - tracing::trace!("found"); break; } - tracing::trace!("({}): {}: kind = {:?}", scope.depth(), id.0, scope.kind); match scope.kind { ScopeKind::Fn { .. } => { - tracing::trace!( - "{}: variable access from a nested function detected", - id.0 - ); return true; } ScopeKind::Loop | ScopeKind::Cond => { @@ -366,7 +345,6 @@ impl<'a> Scope<'a> { pub fn add_read(&mut self, id: &Id) { if self.read_prevents_inlining(id) { - tracing::trace!("prevent inlining because of read: {}", id.0); self.prevent_inline(id) } @@ -381,7 +359,6 @@ impl<'a> Scope<'a> { var_info.inline_prevented.set(true); } } else { - tracing::trace!("({}): Unresolved usage.: {:?}", self.depth(), id); self.unresolved_usages.insert(id.clone()); } @@ -394,7 +371,6 @@ impl<'a> Scope<'a> { } fn write_prevents_inline(&self, id: &Id) -> bool { - tracing::trace!("write_prevents_inline({})", id.0); { let mut cur = Some(self); @@ -405,14 +381,9 @@ impl<'a> Scope<'a> { if found { break; } - tracing::trace!("({}): {}: kind = {:?}", scope.depth(), id.0, scope.kind); match scope.kind { ScopeKind::Fn { .. } => { - tracing::trace!( - "{}: variable access from a nested function detected", - id.0 - ); return true; } ScopeKind::Loop | ScopeKind::Cond => { @@ -437,7 +408,6 @@ impl<'a> Scope<'a> { .entered(); if self.write_prevents_inline(id) { - tracing::trace!("prevent inlining because of write: {}", id.0); self.prevent_inline(id) } @@ -457,12 +427,6 @@ impl<'a> Scope<'a> { } else if self.has_constant(id) { // noop } else { - tracing::trace!( - "({}): Unresolved. (scope = ({})): {:?}", - self.depth(), - scope.depth(), - id - ); self.bindings.insert( id.clone(), VarInfo { @@ -534,7 +498,6 @@ impl<'a> Scope<'a> { } pub fn store_inline_barrier(&self, phase: Phase) { - tracing::trace!("store_inline_barrier({:?})", phase); match phase { Phase::Analysis => { @@ -578,7 +541,6 @@ impl<'a> Scope<'a> { } pub fn prevent_inline(&self, id: &Id) { - tracing::trace!("({}) Prevent inlining: {:?}", self.depth(), id); if let Some(v) = self.find_binding_from_current(id) { v.inline_prevented.set(true); diff --git a/crates/swc_graph_analyzer/src/lib.rs b/crates/swc_graph_analyzer/src/lib.rs index 7640a306f243..60a8e2e1c5d6 100644 --- a/crates/swc_graph_analyzer/src/lib.rs +++ b/crates/swc_graph_analyzer/src/lib.rs @@ -66,7 +66,6 @@ where if let Some(rpos) = cycle_rpos { let cycle = path[rpos..].to_vec(); - tracing::debug!("Found cycle: {:?}", cycle); self.data.cycles.push(cycle); } @@ -87,7 +86,6 @@ where self.data.graph.add_node(module_id); for dep_module_id in self.dep_graph.deps_of(module_id) { - tracing::debug!("Dep: {:?} -> {:?}", module_id, dep_module_id); self.data.graph.add_edge(module_id, dep_module_id, ()); diff --git a/crates/swc_node_bundler/src/loaders/swc.rs b/crates/swc_node_bundler/src/loaders/swc.rs index e612ab959c21..c3690b755d4b 100644 --- a/crates/swc_node_bundler/src/loaders/swc.rs +++ b/crates/swc_node_bundler/src/loaders/swc.rs @@ -82,7 +82,6 @@ impl SwcLoader { } fn load_with_handler(&self, handler: &Handler, name: &FileName) -> Result { - tracing::debug!("JsLoader.load({})", name); let helpers = Helpers::new(false); if let FileName::Custom(id) = name { @@ -150,7 +149,6 @@ impl SwcLoader { } } - tracing::trace!("JsLoader.load: loaded"); let program = if fm.name.to_string().contains("node_modules") { let comments = self.compiler.comments().clone(); @@ -251,7 +249,6 @@ impl SwcLoader { |_| noop_pass(), )?; - tracing::trace!("JsLoader.load: loaded config"); // We run transform at this phase to strip out unused dependencies. // @@ -308,7 +305,6 @@ impl SwcLoader { .context("tried to parse as ecmascript as it's excluded by .swcrc")? }; - tracing::trace!("JsLoader.load: applied transforms"); program }; diff --git a/crates/swc_plugin_proxy/src/memory_interop/read_returned_result_from_host.rs b/crates/swc_plugin_proxy/src/memory_interop/read_returned_result_from_host.rs index 5835caaa8ca9..e0a0a4dafaa3 100644 --- a/crates/swc_plugin_proxy/src/memory_interop/read_returned_result_from_host.rs +++ b/crates/swc_plugin_proxy/src/memory_interop/read_returned_result_from_host.rs @@ -36,7 +36,6 @@ fn read_returned_result_from_host_inner(f: F) -> Option { feature = "__plugin_mode", target_arch = "wasm32" ))] -#[tracing::instrument(level = "info", skip_all)] fn read_returned_result_from_host_inner(f: F) -> Option where F: FnOnce(u32) -> u32, @@ -85,7 +84,6 @@ pub fn read_returned_result_from_host(f: F) -> Option { target_arch = "wasm32" ))] #[cfg_attr(not(target_arch = "wasm32"), allow(unused))] -#[tracing::instrument(level = "info", skip_all)] pub fn read_returned_result_from_host(f: F) -> Option where F: FnOnce(u32) -> u32, diff --git a/crates/swc_plugin_runner/src/cache.rs b/crates/swc_plugin_runner/src/cache.rs index 588d187e36af..1b488f42c7f0 100644 --- a/crates/swc_plugin_runner/src/cache.rs +++ b/crates/swc_plugin_runner/src/cache.rs @@ -116,7 +116,6 @@ impl PluginModuleCacheInner { let module = if let Some(cache) = unsafe { fs_cache_store.load(rt, &module_bytes_hash) } { - tracing::debug!("Build WASM from cache: {key}"); cache } else { let cache = rt @@ -222,7 +221,6 @@ struct FileSystemCache { #[cfg(all(not(target_arch = "wasm32"), feature = "filesystem_cache"))] impl FileSystemCache { - #[tracing::instrument(level = "info", skip_all)] fn create(root: Option<&str>) -> Option { let mut root_path = if let Some(root) = root { Some(PathBuf::from(root)) diff --git a/crates/swc_plugin_runner/src/imported_fn/comments.rs b/crates/swc_plugin_runner/src/imported_fn/comments.rs index 777e3210dba0..7ee6f40c1688 100644 --- a/crates/swc_plugin_runner/src/imported_fn/comments.rs +++ b/crates/swc_plugin_runner/src/imported_fn/comments.rs @@ -35,7 +35,6 @@ impl CommentHostEnvironment { /// Copy given serialized byte into host's comment buffer, subsequent proxy call /// in the host can read it. -#[tracing::instrument(level = "info", skip_all)] pub fn copy_comment_to_host_env( caller: &mut dyn runtime::Caller<'_>, env: &CommentHostEnvironment, @@ -48,7 +47,6 @@ pub fn copy_comment_to_host_env( /// Utility fn to unwrap necessary values for the comments fn operation when fn /// needs to return values. -#[tracing::instrument(level = "info", skip_all)] fn unwrap_comments_storage_or_default(f: F, default: R) -> R where F: FnOnce(&SingleThreadedComments) -> R, @@ -68,7 +66,6 @@ where /// Utility fn to unwrap necessary values for the comments fn operation when fn /// does not need to return values. -#[tracing::instrument(level = "info", skip_all)] fn unwrap_comments_storage(f: F) where F: FnOnce(&SingleThreadedComments), @@ -83,7 +80,6 @@ where } /// Common logics for add_*_comment/comments. -#[tracing::instrument(level = "info", skip_all)] fn add_comments_inner(env: &CommentHostEnvironment, byte_pos: u32, f: F) where F: FnOnce(&SingleThreadedComments, BytePos, PluginSerializedBytes), @@ -118,7 +114,6 @@ pub fn add_leading_comment_proxy( }); } -#[tracing::instrument(level = "info", skip_all)] pub fn add_leading_comments_proxy( _caller: &mut dyn runtime::Caller<'_>, env: &CommentHostEnvironment, @@ -135,19 +130,16 @@ pub fn add_leading_comments_proxy( }); } -#[tracing::instrument(level = "info", skip_all)] pub fn has_leading_comments_proxy(byte_pos: u32) -> i32 { unwrap_comments_storage_or_default(|comments| comments.has_leading(BytePos(byte_pos)) as i32, 0) } -#[tracing::instrument(level = "info", skip_all)] pub fn move_leading_comments_proxy(from_byte_pos: u32, to_byte_pos: u32) { unwrap_comments_storage(|comments| { comments.move_leading(BytePos(from_byte_pos), BytePos(to_byte_pos)) }); } -#[tracing::instrument(level = "info", skip_all)] pub fn take_leading_comments_proxy( caller: &mut dyn runtime::Caller<'_>, _env: &CommentHostEnvironment, @@ -182,7 +174,6 @@ pub fn take_leading_comments_proxy( /// /// Returns 1 if operation success with Some(Vec), 0 otherwise. /// Allocated results should be read through CommentsPtr. -#[tracing::instrument(level = "info", skip_all)] pub fn get_leading_comments_proxy( caller: &mut dyn runtime::Caller<'_>, _env: &CommentHostEnvironment, @@ -212,7 +203,6 @@ pub fn get_leading_comments_proxy( ) } -#[tracing::instrument(level = "info", skip_all)] pub fn add_trailing_comment_proxy( _caller: &mut dyn runtime::Caller<'_>, env: &CommentHostEnvironment, @@ -229,7 +219,6 @@ pub fn add_trailing_comment_proxy( }); } -#[tracing::instrument(level = "info", skip_all)] pub fn add_trailing_comments_proxy( _caller: &mut dyn runtime::Caller<'_>, env: &CommentHostEnvironment, @@ -246,7 +235,6 @@ pub fn add_trailing_comments_proxy( }); } -#[tracing::instrument(level = "info", skip_all)] pub fn has_trailing_comments_proxy(byte_pos: u32) -> i32 { unwrap_comments_storage_or_default( |comments| comments.has_trailing(BytePos(byte_pos)) as i32, @@ -254,14 +242,12 @@ pub fn has_trailing_comments_proxy(byte_pos: u32) -> i32 { ) } -#[tracing::instrument(level = "info", skip_all)] pub fn move_trailing_comments_proxy(from_byte_pos: u32, to_byte_pos: u32) { unwrap_comments_storage(|comments| { comments.move_trailing(BytePos(from_byte_pos), BytePos(to_byte_pos)) }); } -#[tracing::instrument(level = "info", skip_all)] pub fn take_trailing_comments_proxy( caller: &mut dyn runtime::Caller<'_>, _env: &CommentHostEnvironment, @@ -291,7 +277,6 @@ pub fn take_trailing_comments_proxy( ) } -#[tracing::instrument(level = "info", skip_all)] pub fn get_trailing_comments_proxy( caller: &mut dyn runtime::Caller<'_>, _env: &CommentHostEnvironment, @@ -321,7 +306,6 @@ pub fn get_trailing_comments_proxy( ) } -#[tracing::instrument(level = "info", skip_all)] pub fn add_pure_comment_proxy(byte_pos: u32) { unwrap_comments_storage(|comments| comments.add_pure_comment(BytePos(byte_pos))); } diff --git a/crates/swc_plugin_runner/src/imported_fn/diagnostics.rs b/crates/swc_plugin_runner/src/imported_fn/diagnostics.rs index 4d7b0e92113e..ae36a966c383 100644 --- a/crates/swc_plugin_runner/src/imported_fn/diagnostics.rs +++ b/crates/swc_plugin_runner/src/imported_fn/diagnostics.rs @@ -19,7 +19,6 @@ impl DiagnosticContextHostEnvironment { } } -#[tracing::instrument(level = "info", skip_all)] pub fn set_plugin_core_pkg_diagnostics( caller: &mut dyn runtime::Caller<'_>, env: &DiagnosticContextHostEnvironment, diff --git a/crates/swc_plugin_runner/src/imported_fn/handler.rs b/crates/swc_plugin_runner/src/imported_fn/handler.rs index f357d8fc2832..667d9618e0c4 100644 --- a/crates/swc_plugin_runner/src/imported_fn/handler.rs +++ b/crates/swc_plugin_runner/src/imported_fn/handler.rs @@ -6,7 +6,6 @@ use swc_transform_common::output::experimental_emit; use crate::{host_environment::BaseHostEnvironment, memory_interop::copy_bytes_into_host, runtime}; -#[tracing::instrument(level = "info", skip_all)] pub fn emit_diagnostics( caller: &mut dyn runtime::Caller<'_>, _env: &BaseHostEnvironment, diff --git a/crates/swc_plugin_runner/src/imported_fn/hygiene.rs b/crates/swc_plugin_runner/src/imported_fn/hygiene.rs index dffac4544cab..d0a7624287a8 100644 --- a/crates/swc_plugin_runner/src/imported_fn/hygiene.rs +++ b/crates/swc_plugin_runner/src/imported_fn/hygiene.rs @@ -24,7 +24,6 @@ pub fn mark_parent_proxy(self_mark: u32) -> u32 { /// via serialized MutableMarkContext. /// Inside of guest context, once this host function returns it'll assign params /// with return value accordingly. -#[tracing::instrument(level = "info", skip_all)] pub fn mark_is_descendant_of_proxy( caller: &mut dyn runtime::Caller<'_>, _env: &BaseHostEnvironment, @@ -48,7 +47,6 @@ pub fn mark_is_descendant_of_proxy( write_into_memory_view(caller, &serialized_bytes, |_, _| allocated_ptr); } -#[tracing::instrument(level = "info", skip_all)] pub fn mark_least_ancestor_proxy( caller: &mut dyn runtime::Caller<'_>, _env: &BaseHostEnvironment, @@ -69,14 +67,12 @@ pub fn mark_least_ancestor_proxy( write_into_memory_view(caller, &serialized_bytes, |_, _| allocated_ptr); } -#[tracing::instrument(level = "info", skip_all)] pub fn syntax_context_apply_mark_proxy(self_syntax_context: u32, mark: u32) -> u32 { SyntaxContext::from_u32(self_syntax_context) .apply_mark(Mark::from_u32(mark)) .as_u32() } -#[tracing::instrument(level = "info", skip_all)] pub fn syntax_context_remove_mark_proxy( caller: &mut dyn runtime::Caller<'_>, _env: &BaseHostEnvironment, @@ -98,7 +94,6 @@ pub fn syntax_context_remove_mark_proxy( write_into_memory_view(caller, &serialized_bytes, |_, _| allocated_ptr); } -#[tracing::instrument(level = "info", skip_all)] pub fn syntax_context_outer_proxy(self_mark: u32) -> u32 { SyntaxContext::from_u32(self_mark).outer().as_u32() } diff --git a/crates/swc_plugin_runner/src/imported_fn/metadata_context.rs b/crates/swc_plugin_runner/src/imported_fn/metadata_context.rs index 518ad0818987..a8a03507c2e6 100644 --- a/crates/swc_plugin_runner/src/imported_fn/metadata_context.rs +++ b/crates/swc_plugin_runner/src/imported_fn/metadata_context.rs @@ -35,7 +35,6 @@ impl MetadataContextHostEnvironment { /// Copy given serialized byte into host's comment buffer, subsequent proxy call /// in the host can read it. -#[tracing::instrument(level = "info", skip_all)] pub fn copy_context_key_to_host_env( caller: &mut dyn runtime::Caller<'_>, env: &MetadataContextHostEnvironment, @@ -46,7 +45,6 @@ pub fn copy_context_key_to_host_env( copy_bytes_into_host(caller, bytes_ptr, bytes_ptr_len, &mut buf); } -#[tracing::instrument(level = "info", skip_all)] pub fn get_transform_plugin_config( caller: &mut dyn runtime::Caller<'_>, env: &MetadataContextHostEnvironment, @@ -70,7 +68,6 @@ pub fn get_transform_plugin_config( 0 } -#[tracing::instrument(level = "info", skip_all)] pub fn get_transform_context( caller: &mut dyn runtime::Caller<'_>, env: &MetadataContextHostEnvironment, @@ -91,7 +88,6 @@ pub fn get_transform_context( 1 } -#[tracing::instrument(level = "info", skip_all)] pub fn get_experimental_transform_context( caller: &mut dyn runtime::Caller<'_>, env: &MetadataContextHostEnvironment, @@ -121,7 +117,6 @@ pub fn get_experimental_transform_context( 0 } -#[tracing::instrument(level = "info", skip_all)] pub fn get_raw_experiemtal_transform_context( caller: &mut dyn runtime::Caller<'_>, env: &MetadataContextHostEnvironment, diff --git a/crates/swc_plugin_runner/src/imported_fn/set_transform_result.rs b/crates/swc_plugin_runner/src/imported_fn/set_transform_result.rs index 2d78456812dc..6f29b54bb54e 100644 --- a/crates/swc_plugin_runner/src/imported_fn/set_transform_result.rs +++ b/crates/swc_plugin_runner/src/imported_fn/set_transform_result.rs @@ -26,7 +26,6 @@ impl TransformResultHostEnvironment { /// This is an `imported` fn - when we instantiate plugin module, we inject this /// fn into plugin's export space. Once transform completes, plugin will call /// this to set its result back to host. -#[tracing::instrument(level = "info", skip_all)] pub fn set_transform_result( caller: &mut dyn runtime::Caller<'_>, env: &TransformResultHostEnvironment, diff --git a/crates/swc_plugin_runner/src/imported_fn/source_map.rs b/crates/swc_plugin_runner/src/imported_fn/source_map.rs index b9f8f1d79202..ca9f88405dc8 100644 --- a/crates/swc_plugin_runner/src/imported_fn/source_map.rs +++ b/crates/swc_plugin_runner/src/imported_fn/source_map.rs @@ -38,7 +38,6 @@ impl SourceMapHostEnvironment { /// Returns `Loc` form given bytepos to the guest. /// Returned `Loc` is partial, which excludes `SourceFile` from original struct /// to avoid unnecessary data copying. -#[tracing::instrument(level = "info", skip_all)] pub fn lookup_char_pos_proxy( caller: &mut dyn runtime::Caller<'_>, env: &SourceMapHostEnvironment, @@ -65,7 +64,6 @@ pub fn lookup_char_pos_proxy( 1 } -#[tracing::instrument(level = "info", skip_all)] pub fn doctest_offset_line_proxy( _caller: &mut dyn runtime::Caller<'_>, env: &SourceMapHostEnvironment, @@ -75,7 +73,6 @@ pub fn doctest_offset_line_proxy( } #[allow(clippy::too_many_arguments)] -#[tracing::instrument(level = "info", skip_all)] pub fn merge_spans_proxy( caller: &mut dyn runtime::Caller<'_>, env: &SourceMapHostEnvironment, @@ -107,7 +104,6 @@ pub fn merge_spans_proxy( } } -#[tracing::instrument(level = "info", skip_all)] pub fn span_to_lines_proxy( caller: &mut dyn runtime::Caller<'_>, env: &SourceMapHostEnvironment, @@ -143,7 +139,6 @@ pub fn span_to_lines_proxy( 1 } -#[tracing::instrument(level = "info", skip_all)] pub fn lookup_byte_offset_proxy( caller: &mut dyn runtime::Caller<'_>, env: &SourceMapHostEnvironment, @@ -161,7 +156,6 @@ pub fn lookup_byte_offset_proxy( 1 } -#[tracing::instrument(level = "info", skip_all)] pub fn span_to_string_proxy( caller: &mut dyn runtime::Caller<'_>, env: &SourceMapHostEnvironment, @@ -182,7 +176,6 @@ pub fn span_to_string_proxy( 1 } -#[tracing::instrument(level = "info", skip_all)] pub fn span_to_filename_proxy( caller: &mut dyn runtime::Caller<'_>, env: &SourceMapHostEnvironment, @@ -203,7 +196,6 @@ pub fn span_to_filename_proxy( 1 } -#[tracing::instrument(level = "info", skip_all)] pub fn span_to_source_proxy( caller: &mut dyn runtime::Caller<'_>, env: &SourceMapHostEnvironment, diff --git a/crates/swc_plugin_runner/src/memory_interop.rs b/crates/swc_plugin_runner/src/memory_interop.rs index d9415cce2c12..137a9f383100 100644 --- a/crates/swc_plugin_runner/src/memory_interop.rs +++ b/crates/swc_plugin_runner/src/memory_interop.rs @@ -2,7 +2,6 @@ use swc_common::plugin::serialized::PluginSerializedBytes; use crate::runtime; -#[tracing::instrument(level = "info", skip_all)] pub fn copy_bytes_into_host( caller: &dyn runtime::Caller<'_>, bytes_ptr: i32, @@ -17,7 +16,6 @@ pub fn copy_bytes_into_host( } /// Locate a view from given memory, write serialized bytes into. -#[tracing::instrument(level = "info", skip_all)] pub fn write_into_memory_view( view: &mut dyn runtime::Caller<'_>, serialized_bytes: &PluginSerializedBytes, @@ -44,7 +42,6 @@ where /// non-deterministic size like `Vec`. Guest pre-allocates a struct to /// contain ptr to the value, host in here allocates guest memory for the actual /// value then returns its ptr with length to the preallocated struct. -#[tracing::instrument(level = "info", skip_all)] pub fn allocate_return_values_into_guest( caller: &mut dyn runtime::Caller<'_>, allocated_ret_ptr: u32, diff --git a/crates/swc_plugin_runner/src/transform_executor.rs b/crates/swc_plugin_runner/src/transform_executor.rs index 249ee571d924..1eff6685faad 100644 --- a/crates/swc_plugin_runner/src/transform_executor.rs +++ b/crates/swc_plugin_runner/src/transform_executor.rs @@ -156,10 +156,6 @@ pub struct TransformExecutor { #[cfg(feature = "encoding-impl")] impl TransformExecutor { - #[tracing::instrument( - level = "info", - skip(source_map, metadata_context, plugin_config, module_bytes, runtime) - )] pub fn new( module_bytes: Box, source_map: &Arc, @@ -247,7 +243,6 @@ impl TransformExecutor { }) } - #[tracing::instrument(level = "info", skip_all)] pub fn transform( &mut self, program: &PluginSerializedBytes, diff --git a/crates/swc_trace_macro/src/lib.rs b/crates/swc_trace_macro/src/lib.rs index c660bd91fa0b..d9cc916779f8 100644 --- a/crates/swc_trace_macro/src/lib.rs +++ b/crates/swc_trace_macro/src/lib.rs @@ -3,7 +3,6 @@ extern crate proc_macro; use quote::ToTokens; use syn::{parse_quote, AttrStyle, Attribute, ImplItem, ItemImpl}; -/// Utility proc macro to add `#[tracing::instrument(level = "info", /// skip_all)]` to all methods in an impl block. /// /// This attribute macro is typically applied on an `VisitMut` impl block. @@ -19,7 +18,6 @@ pub fn swc_trace( item.items.iter_mut().for_each(|item| { // We only handle methods if let ImplItem::Fn(m) = item { - // #[tracing::instrument(level = "info", skip_all)] let attr = Attribute { pound_token: Default::default(), style: AttrStyle::Outer,