-
Notifications
You must be signed in to change notification settings - Fork 107
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
refactor: pass along hash through eval context code cache callbacks #753
refactor: pass along hash through eval context code cache callbacks #753
Conversation
if let Some(cb) = state.eval_context_code_cache_ready_cb.as_ref() { | ||
let unbound_script = script.get_unbound_script(tc_scope); | ||
let code_cache = unbound_script.create_code_cache().ok_or_else(|| { | ||
type_error("Unable to get code cache from unbound module script") | ||
})?; | ||
cb(&specifier, &code_cache); | ||
cb(specifier, code_cache_hash, &code_cache); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please focus on this function to ensure this is correct.
core/modules/mod.rs
Outdated
pub type EvalContextGetCodeCacheCb = | ||
Box<dyn Fn(&str) -> Result<Option<Cow<'static, [u8]>>, AnyError>>; | ||
Box<dyn Fn(&Url, &v8::String) -> Result<ModuleSourceCodeCache, AnyError>>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since v8::String
is hashable, we can just pass this along.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…n now be used in eval context and it's not a cache, but information in the cache
* denoland/deno_core#752 * denoland/deno_core#753 Did benchmarking on this and it's slightly faster (couple ms) or equal to in performance as main. Closes #23904
Follow-up to #752