diff options
author | Nayeem Rahman <nayeemrmn99@gmail.com> | 2022-06-20 13:42:20 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-20 14:42:20 +0200 |
commit | 79b42808a474c0a049ae17a3b6b1f93ad83d217b (patch) | |
tree | 937c16d6f2c5928a784ed28e60dffe18c3517643 /core/ops_builtin_v8.rs | |
parent | 94d369ebc65a55bd9fbf378a765c8ed88a4efe2c (diff) |
perf(core): Cache source lookups (#14816)
Keep a cache for source maps and source lines.
We sort of already had a cache argument for source map lookup
functions but we just passed an empty map instead of storing it.
Extended it to cache source line lookups as well and plugged it
into runtime state.
Diffstat (limited to 'core/ops_builtin_v8.rs')
-rw-r--r-- | core/ops_builtin_v8.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/core/ops_builtin_v8.rs b/core/ops_builtin_v8.rs index 7b7cfcc45..7f0c58212 100644 --- a/core/ops_builtin_v8.rs +++ b/core/ops_builtin_v8.rs @@ -752,14 +752,14 @@ fn op_apply_source_map( location: Location, ) -> Result<Location, Error> { let state_rc = JsRuntime::state(scope); - let state = state_rc.borrow(); + let state = &mut *state_rc.borrow_mut(); if let Some(source_map_getter) = &state.source_map_getter { let mut location = location; - let (f, l, c, _) = apply_source_map_( + let (f, l, c) = apply_source_map_( location.file_name, location.line_number.into(), location.column_number.into(), - &mut Default::default(), + &mut state.source_map_cache, source_map_getter.as_ref(), ); location.file_name = f; |