Commit e51107e7 authored by maxlg's avatar maxlg Committed by Commit Bot

Add a probe for V8.Complie in order to measure the time of compiling script for V8.

BUG=738495

Review-Url: https://codereview.chromium.org/2962353002
Cr-Commit-Position: refs/heads/master@{#488471}
parent e1b82558
...@@ -465,6 +465,12 @@ v8::MaybeLocal<v8::Script> V8ScriptRunner::CompileScript( ...@@ -465,6 +465,12 @@ v8::MaybeLocal<v8::Script> V8ScriptRunner::CompileScript(
"v8,devtools.timeline", "v8.compile", "fileName", file_name.Utf8(), "v8,devtools.timeline", "v8.compile", "fileName", file_name.Utf8(),
"data", "data",
InspectorCompileScriptEvent::Data(file_name, script_start_position)); InspectorCompileScriptEvent::Data(file_name, script_start_position));
// TODO(maxlg): probe will use a execution context once
// DocumentWriteEvaluator::EnsureEvaluationContext provide script state, see
// https://crbug.com/746961.
probe::V8Compile probe(nullptr, file_name,
script_start_position.line_.ZeroBasedInt(),
script_start_position.column_.ZeroBasedInt());
DCHECK(!streamer || resource); DCHECK(!streamer || resource);
DCHECK(!resource || resource->CacheHandler() == cache_handler); DCHECK(!resource || resource->CacheHandler() == cache_handler);
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
// found in the LICENSE file. // found in the LICENSE file.
#include "core/frame/PerformanceMonitor.h" #include "core/frame/PerformanceMonitor.h"
#include "bindings/core/v8/ScheduledAction.h" #include "bindings/core/v8/ScheduledAction.h"
#include "bindings/core/v8/ScriptEventListener.h" #include "bindings/core/v8/ScriptEventListener.h"
#include "bindings/core/v8/SourceLocation.h" #include "bindings/core/v8/SourceLocation.h"
...@@ -15,7 +14,9 @@ ...@@ -15,7 +14,9 @@
#include "core/frame/LocalFrame.h" #include "core/frame/LocalFrame.h"
#include "core/html/parser/HTMLDocumentParser.h" #include "core/html/parser/HTMLDocumentParser.h"
#include "core/probe/CoreProbes.h" #include "core/probe/CoreProbes.h"
#include "platform/Histogram.h"
#include "platform/wtf/CurrentTime.h" #include "platform/wtf/CurrentTime.h"
#include "platform/wtf/Time.h"
#include "public/platform/Platform.h" #include "public/platform/Platform.h"
namespace blink { namespace blink {
...@@ -202,6 +203,16 @@ void PerformanceMonitor::Did(const probe::CallFunction& probe) { ...@@ -202,6 +203,16 @@ void PerformanceMonitor::Did(const probe::CallFunction& probe) {
SourceLocation::FromFunction(probe.function)); SourceLocation::FromFunction(probe.function));
} }
void PerformanceMonitor::Will(const probe::V8Compile& probe) {
// Todo(maxlg): https://crbug.com/738495 Intentionally leave out as we need to
// verify monotonical time is reasonable in overhead.
}
void PerformanceMonitor::Did(const probe::V8Compile& probe) {
// Todo(maxlg): https://crbug.com/738495 Intentionally leave out as we need to
// verify monotonical time is reasonable in overhead.
}
void PerformanceMonitor::Will(const probe::UserCallback& probe) { void PerformanceMonitor::Will(const probe::UserCallback& probe) {
++user_callback_depth_; ++user_callback_depth_;
......
...@@ -20,6 +20,7 @@ class ExecuteScript; ...@@ -20,6 +20,7 @@ class ExecuteScript;
class RecalculateStyle; class RecalculateStyle;
class UpdateLayout; class UpdateLayout;
class UserCallback; class UserCallback;
class V8Compile;
} }
class DOMWindow; class DOMWindow;
...@@ -88,6 +89,9 @@ class CORE_EXPORT PerformanceMonitor final ...@@ -88,6 +89,9 @@ class CORE_EXPORT PerformanceMonitor final
void Will(const probe::UserCallback&); void Will(const probe::UserCallback&);
void Did(const probe::UserCallback&); void Did(const probe::UserCallback&);
void Will(const probe::V8Compile&);
void Did(const probe::V8Compile&);
void DocumentWriteFetchScript(Document*); void DocumentWriteFetchScript(Document*);
// Direct API for core. // Direct API for core.
......
...@@ -153,6 +153,7 @@ ...@@ -153,6 +153,7 @@
"RecalculateStyle", "RecalculateStyle",
"UpdateLayout", "UpdateLayout",
"UserCallback", "UserCallback",
"V8Compile",
] ]
}, },
TraceEvents: { TraceEvents: {
......
...@@ -152,6 +152,7 @@ interface CoreProbes { ...@@ -152,6 +152,7 @@ interface CoreProbes {
ExecuteScript([Keep] ExecutionContext* context); ExecuteScript([Keep] ExecutionContext* context);
CallFunction([Keep] ExecutionContext* context, v8::Local<v8::Function> function, int depth = 0); CallFunction([Keep] ExecutionContext* context, v8::Local<v8::Function> function, int depth = 0);
UserCallback([Keep] ExecutionContext* context, const char* name, const AtomicString& atomicName, bool recurring, EventTarget* eventTarget = nullptr); UserCallback([Keep] ExecutionContext* context, const char* name, const AtomicString& atomicName, bool recurring, EventTarget* eventTarget = nullptr);
V8Compile([Keep] ExecutionContext* context, const String& file_name, int line, int column);
ParseHTML(Document* document, HTMLDocumentParser* parser); ParseHTML(Document* document, HTMLDocumentParser* parser);
void forcePseudoState([Keep] Element* element, CSSSelector::PseudoType pseudoState, bool* result); void forcePseudoState([Keep] Element* element, CSSSelector::PseudoType pseudoState, bool* result);
void shouldWaitForDebuggerOnWorkerStart(ExecutionContext* context, bool* result); void shouldWaitForDebuggerOnWorkerStart(ExecutionContext* context, bool* result);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment