mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 17:10:23 +00:00
LibJS: Avoid unnecessary SourceRange construction in parse_program()
This takes `test-js` runtime from 4.3 sec to 4.1 sec on my machine.
This commit is contained in:
parent
f0482b61bf
commit
d16fab5815
Notes:
sideshowbarker
2024-07-17 04:09:49 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/d16fab5815 Pull-request: https://github.com/SerenityOS/serenity/pull/16170 Reviewed-by: https://github.com/linusg ✅ Reviewed-by: https://github.com/trflynn89 ✅
2 changed files with 4 additions and 2 deletions
|
@ -53,7 +53,9 @@ public:
|
|||
virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const;
|
||||
virtual void dump(int indent) const;
|
||||
|
||||
SourceRange source_range() const;
|
||||
[[nodiscard]] SourceRange source_range() const;
|
||||
|
||||
void set_end_offset(Badge<Parser>, u32 end_offset) { m_end_offset = end_offset; }
|
||||
|
||||
String class_name() const;
|
||||
|
||||
|
|
|
@ -497,7 +497,7 @@ NonnullRefPtr<Program> Parser::parse_program(bool starts_in_strict_mode)
|
|||
else
|
||||
parse_module(program);
|
||||
|
||||
program->source_range().end = position();
|
||||
program->set_end_offset({}, position().offset);
|
||||
return program;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue