diff options
author | Andreas Kling <kling@serenityos.org> | 2023-05-28 08:28:43 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-05-28 10:03:11 +0200 |
commit | 87ac906ee679043421f27617cc3822ebc9524622 (patch) | |
tree | 90fdcf14c778f51cda9a4a1a81a9ad6d9eb89d48 /Userland/Libraries/LibJS/AST.h | |
parent | 6c81b90e5a06d6fb2164f6484c7e69b0492aa87f (diff) | |
download | serenity-87ac906ee679043421f27617cc3822ebc9524622.zip |
LibJS: Make Error stack traces lazier
Instead of eagerly populating the stack trace with a textual
representation of every call frame, just store the raw source code range
(code, start offset, end offset). From that, we can generate the full
rich backtrace when requested, and save ourselves the trouble otherwise.
This makes test-wasm take ~7 seconds on my machine instead of ~60. :^)
Diffstat (limited to 'Userland/Libraries/LibJS/AST.h')
-rw-r--r-- | Userland/Libraries/LibJS/AST.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/AST.h b/Userland/Libraries/LibJS/AST.h index 0dcd6329d1..3f36831327 100644 --- a/Userland/Libraries/LibJS/AST.h +++ b/Userland/Libraries/LibJS/AST.h @@ -58,6 +58,9 @@ public: [[nodiscard]] SourceRange source_range() const; u32 start_offset() const { return m_start_offset; } + u32 end_offset() const { return m_end_offset; } + + SourceCode const& source_code() const { return *m_source_code; } void set_end_offset(Badge<Parser>, u32 end_offset) { m_end_offset = end_offset; } |