summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-09-14 21:00:41 +0200
committerAndreas Kling <kling@serenityos.org>2021-09-14 21:41:51 +0200
commit20fb9009377529942618d4474d1431b3fe35cb42 (patch)
tree0fdd280724f1043b22792f90a0ea73d3f86c8302 /Userland
parent0a09eaf3a117f217a5cc96964ebf042c6dba6bc6 (diff)
downloadserenity-20fb9009377529942618d4474d1431b3fe35cb42.zip
LibJS+LibWeb: Move script parse time logging from JS::Script to LibWeb
Let's only log HTML::ClassicScript parse times for now. Otherwise things will get excessively noisy in test-js and the test262 runner.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibJS/Script.cpp6
-rw-r--r--Userland/Libraries/LibWeb/HTML/Scripting/ClassicScript.cpp2
2 files changed, 2 insertions, 6 deletions
diff --git a/Userland/Libraries/LibJS/Script.cpp b/Userland/Libraries/LibJS/Script.cpp
index 2df2dc2a63..158bff42cd 100644
--- a/Userland/Libraries/LibJS/Script.cpp
+++ b/Userland/Libraries/LibJS/Script.cpp
@@ -4,7 +4,6 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
-#include <LibCore/ElapsedTimer.h>
#include <LibJS/AST.h>
#include <LibJS/Lexer.h>
#include <LibJS/Parser.h>
@@ -15,11 +14,6 @@ namespace JS {
// 16.1.5 ParseScript ( sourceText, realm, hostDefined ), https://tc39.es/ecma262/#sec-parse-script
Result<NonnullRefPtr<Script>, Vector<Parser::Error>> 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 parser = Parser(Lexer(source_text, filename));
auto body = parser.parse_program();
diff --git a/Userland/Libraries/LibWeb/HTML/Scripting/ClassicScript.cpp b/Userland/Libraries/LibWeb/HTML/Scripting/ClassicScript.cpp
index c5a14b98a6..d9385cca7d 100644
--- a/Userland/Libraries/LibWeb/HTML/Scripting/ClassicScript.cpp
+++ b/Userland/Libraries/LibWeb/HTML/Scripting/ClassicScript.cpp
@@ -36,7 +36,9 @@ NonnullRefPtr<ClassicScript> ClassicScript::create(String filename, StringView s
// FIXME: 9. Set script's parse error and error to rethrow to null.
// 10. Let result be ParseScript(source, settings's Realm, script).
+ auto parse_timer = Core::ElapsedTimer::start_new();
auto result = JS::Script::parse(source, realm, script->filename());
+ dbgln("ClassicScript: Parsed {} in {}ms", script->filename(), parse_timer.elapsed());
// 11. If result is a list of errors, then: