mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
LibJS: Log scripts parsed by JS::Script::parse() and how long it took
This commit is contained in:
parent
7f71f54fc3
commit
3ca2e701e6
Notes:
sideshowbarker
2024-07-18 04:00:09 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/3ca2e701e69
1 changed files with 6 additions and 0 deletions
|
@ -4,6 +4,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibCore/ElapsedTimer.h>
|
||||
#include <LibJS/AST.h>
|
||||
#include <LibJS/Lexer.h>
|
||||
#include <LibJS/Parser.h>
|
||||
|
@ -14,6 +15,11 @@ namespace JS {
|
|||
// 16.1.5 ParseScript ( sourceText, realm, hostDefined ), https://tc39.es/ecma262/#sec-parse-script
|
||||
NonnullRefPtr<Script> Script::parse(StringView source_text, Realm& realm, StringView filename)
|
||||
{
|
||||
auto timer = Core::ElapsedTimer::start_new();
|
||||
ScopeGuard timer_guard([&] {
|
||||
dbgln("JS::Script: Parsed {} in {}ms", filename, timer.elapsed());
|
||||
});
|
||||
|
||||
// 1. Let body be ParseText(sourceText, Script).
|
||||
auto body = Parser(Lexer(source_text, filename)).parse_program();
|
||||
|
||||
|
|
Loading…
Reference in a new issue