Title: [257955] trunk/Source/WebCore
- Revision
- 257955
- Author
- n...@apple.com
- Date
- 2020-03-05 16:02:48 -0800 (Thu, 05 Mar 2020)
Log Message
Add signposts for top-level execution of script elements
https://bugs.webkit.org/show_bug.cgi?id=208548
Reviewed by Alex Christensen.
This adds signposts for initial global scope code evaluation of script elements. This makes
it easier to understand what code is executing and blocking initial HTML parsing from
completing.
In the long run, it would be nice to extend this to all top-level entry points back into JS
(e.g. we should emit an interval if we re-enter a script via setTimeout). However, such
probes have been removed in the past for being too noisy or slow (like in
https://bugs.webkit.org/show_bug.cgi?id=187196), so let's just start with this for now.
Note that we do emit the script URL in the signpost, but the signpost is gated behind both
an environment variable and an Apple-internal check to prevent accidentally leaking
sensitive info.
* dom/ScriptElement.cpp:
(WebCore::ScriptElement::executeClassicScript):
(WebCore::ScriptElement::executeModuleScript):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (257954 => 257955)
--- trunk/Source/WebCore/ChangeLog 2020-03-05 23:58:10 UTC (rev 257954)
+++ trunk/Source/WebCore/ChangeLog 2020-03-06 00:02:48 UTC (rev 257955)
@@ -1,3 +1,27 @@
+2020-03-05 Ben Nham <n...@apple.com>
+
+ Add signposts for top-level execution of script elements
+ https://bugs.webkit.org/show_bug.cgi?id=208548
+
+ Reviewed by Alex Christensen.
+
+ This adds signposts for initial global scope code evaluation of script elements. This makes
+ it easier to understand what code is executing and blocking initial HTML parsing from
+ completing.
+
+ In the long run, it would be nice to extend this to all top-level entry points back into JS
+ (e.g. we should emit an interval if we re-enter a script via setTimeout). However, such
+ probes have been removed in the past for being too noisy or slow (like in
+ https://bugs.webkit.org/show_bug.cgi?id=187196), so let's just start with this for now.
+
+ Note that we do emit the script URL in the signpost, but the signpost is gated behind both
+ an environment variable and an Apple-internal check to prevent accidentally leaking
+ sensitive info.
+
+ * dom/ScriptElement.cpp:
+ (WebCore::ScriptElement::executeClassicScript):
+ (WebCore::ScriptElement::executeModuleScript):
+
2020-03-05 Zalan Bujtas <za...@apple.com>
[First paint] Fixed sized SVG content should taken into account when computing VNE status
Modified: trunk/Source/WebCore/dom/ScriptElement.cpp (257954 => 257955)
--- trunk/Source/WebCore/dom/ScriptElement.cpp 2020-03-05 23:58:10 UTC (rev 257954)
+++ trunk/Source/WebCore/dom/ScriptElement.cpp 2020-03-06 00:02:48 UTC (rev 257955)
@@ -52,6 +52,7 @@
#include "Settings.h"
#include "TextNodeTraversal.h"
#include <wtf/StdLibExtras.h>
+#include <wtf/SystemTracing.h>
#include <wtf/text/StringBuilder.h>
#include <wtf/text/StringHash.h>
@@ -392,7 +393,9 @@
IgnoreDestructiveWriteCountIncrementer ignoreDesctructiveWriteCountIncrementer(m_isExternalScript ? &document : nullptr);
CurrentScriptIncrementer currentScriptIncrementer(document, m_element);
+ WTFBeginSignpost(this, "Execute Script Element", "executing classic script from URL: %{public}s async: %d defer: %d", m_isExternalScript ? sourceCode.url().string().utf8().data() : "inline", hasAsyncAttribute(), hasDeferAttribute());
frame->script().evaluateIgnoringException(sourceCode);
+ WTFEndSignpost(this, "Execute Script Element");
}
void ScriptElement::executeModuleScript(LoadableModuleScript& loadableModuleScript)
@@ -409,7 +412,9 @@
IgnoreDestructiveWriteCountIncrementer ignoreDesctructiveWriteCountIncrementer(&document);
CurrentScriptIncrementer currentScriptIncrementer(document, m_element);
+ WTFBeginSignpost(this, "Execute Script Element", "executing module script");
frame->script().linkAndEvaluateModuleScript(loadableModuleScript);
+ WTFEndSignpost(this, "Execute Script Element", "executing module script");
}
void ScriptElement::dispatchLoadEventRespectingUserGestureIndicator()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes