Skip to content
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

Merged
merged 16 commits into from
May 24, 2024

Conversation

dsherret
Copy link
Member

@dsherret dsherret commented May 23, 2024

Follow-up to #752

dsherret added 11 commits May 22, 2024 21:43

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@dsherret dsherret requested review from igorzi and bartlomieju May 23, 2024 19:05
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);
}
}
Copy link
Member Author

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.

pub type EvalContextGetCodeCacheCb =
Box<dyn Fn(&str) -> Result<Option<Cow<'static, [u8]>>, AnyError>>;
Box<dyn Fn(&Url, &v8::String) -> Result<ModuleSourceCodeCache, AnyError>>;
Copy link
Member Author

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.

dsherret added 2 commits May 23, 2024 15:20
Copy link
Contributor

@igorzi igorzi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

dsherret added 2 commits May 23, 2024 16:48
…n now be used in eval context and it's not a cache, but information in the cache
@dsherret dsherret merged commit ae231f1 into denoland:main May 24, 2024
18 checks passed
@dsherret dsherret deleted the code_cache_hash_eval_context branch May 24, 2024 00:00
dsherret added a commit to denoland/deno that referenced this pull request May 24, 2024
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants