mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-03 04:52:06 +02:00
LibJS+LibWeb: Parse classic scripts off the main thread
Create a SourceCode on the main thread (performing UTF-8 to UTF-16 conversion), then submit parse_program() to the ThreadPool for Rust parsing on a worker thread. This unblocks the WebContent event loop during external script loading. Add Script::create_from_parsed() and ClassicScript::create_from_pre_parsed() factory methods that take a pre-parsed RustParsedProgram and a SourceCode, performing only the GC-allocating compile step on the main thread. Falls back to synchronous parsing when the Rust pipeline is unavailable (LIBJS_CPP=1 or LIBJS_COMPARE_PIPELINES=1).
This commit is contained in:
committed by
Andreas Kling
parent
6983c6b1a5
commit
d8921646f5
Notes:
github-actions[bot]
2026-03-06 12:07:42 +00:00
Author: https://github.com/awesomekling Commit: https://github.com/LadybirdBrowser/ladybird/commit/d8921646f53 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8211 Reviewed-by: https://github.com/ADKaster Reviewed-by: https://github.com/Zaggy1024 Reviewed-by: https://github.com/alimpfard
@@ -26,6 +26,7 @@ public:
|
||||
Yes,
|
||||
};
|
||||
static GC::Ref<ClassicScript> create(ByteString filename, StringView source, JS::Realm&, URL::URL base_url, size_t source_line_number = 1, MutedErrors = MutedErrors::No);
|
||||
static GC::Ref<ClassicScript> create_from_pre_parsed(ByteString filename, NonnullRefPtr<JS::SourceCode const> source_code, JS::Realm&, URL::URL base_url, RustParsedProgram* parsed, MutedErrors = MutedErrors::No);
|
||||
|
||||
JS::Script* script_record() { return m_script_record; }
|
||||
JS::Script const* script_record() const { return m_script_record; }
|
||||
|
||||
Reference in New Issue
Block a user