Commit f47145f4 authored by Adithya Srinivasan's avatar Adithya Srinivasan Committed by Commit Bot

[RuntimeCallStats] Add more counters

The counters added here are for methods and attributes that take up
a non-trivial portion (4-10%) of time spent doing Blink C++ on some websites
from the v8_top25 benchmark.

Bug: 724543
Change-Id: Idbab1de4b7128a4a934ca22a7b739c2fa5b035bc
Reviewed-on: https://chromium-review.googlesource.com/565682
Commit-Queue: Adithya Srinivasan <adithyas@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarJeremy Roman <jbroman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#486143}
parent 1db339c4
...@@ -41,6 +41,8 @@ EventListener* V8EventListenerHelper::GetEventListener( ...@@ -41,6 +41,8 @@ EventListener* V8EventListenerHelper::GetEventListener(
v8::Local<v8::Value> value, v8::Local<v8::Value> value,
bool is_attribute, bool is_attribute,
ListenerLookupType lookup) { ListenerLookupType lookup) {
RUNTIME_CALL_TIMER_SCOPE(script_state->GetIsolate(),
RuntimeCallStats::CounterId::kGetEventListener);
if (lookup == kListenerFindOnly) { if (lookup == kListenerFindOnly) {
// Used by EventTarget::removeEventListener, specifically // Used by EventTarget::removeEventListener, specifically
// EventTargetV8Internal::removeEventListenerMethod // EventTargetV8Internal::removeEventListenerMethod
......
...@@ -95,7 +95,7 @@ typedef (HTMLScriptElement or SVGScriptElement) HTMLOrSVGScriptElement; ...@@ -95,7 +95,7 @@ typedef (HTMLScriptElement or SVGScriptElement) HTMLOrSVGScriptElement;
[PutForwards=href, Unforgeable] readonly attribute Location? location; [PutForwards=href, Unforgeable] readonly attribute Location? location;
[RaisesException=Setter] attribute DOMString domain; [RaisesException=Setter] attribute DOMString domain;
readonly attribute DOMString referrer; readonly attribute DOMString referrer;
[RaisesException] attribute DOMString cookie; [RaisesException, RuntimeCallStatsCounter=DocumentCookie] attribute DOMString cookie;
readonly attribute DOMString lastModified; readonly attribute DOMString lastModified;
readonly attribute DocumentReadyState readyState; readonly attribute DocumentReadyState readyState;
......
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
#include "core/dom/Document.h" #include "core/dom/Document.h"
#include "core/html/parser/HTMLDocumentParser.h" #include "core/html/parser/HTMLDocumentParser.h"
#include "core/xml/parser/XMLDocumentParser.h" #include "core/xml/parser/XMLDocumentParser.h"
#include "platform/bindings/RuntimeCallStats.h"
#include "platform/bindings/V8PerIsolateData.h"
namespace blink { namespace blink {
...@@ -67,6 +69,9 @@ Node* DocumentFragment::cloneNode(bool deep, ExceptionState&) { ...@@ -67,6 +69,9 @@ Node* DocumentFragment::cloneNode(bool deep, ExceptionState&) {
void DocumentFragment::ParseHTML(const String& source, void DocumentFragment::ParseHTML(const String& source,
Element* context_element, Element* context_element,
ParserContentPolicy parser_content_policy) { ParserContentPolicy parser_content_policy) {
RUNTIME_CALL_TIMER_SCOPE(
V8PerIsolateData::MainThreadIsolate(),
RuntimeCallStats::CounterId::kDocumentFragmentParseHTML);
HTMLDocumentParser::ParseDocumentFragment(source, this, context_element, HTMLDocumentParser::ParseDocumentFragment(source, this, context_element,
parser_content_policy); parser_content_policy);
} }
......
...@@ -91,7 +91,7 @@ interface Element : Node { ...@@ -91,7 +91,7 @@ interface Element : Node {
// CSSOM View Module // CSSOM View Module
// https://dev.w3.org/csswg/cssom-view/#extension-to-the-element-interface // https://dev.w3.org/csswg/cssom-view/#extension-to-the-element-interface
DOMRectList getClientRects(); DOMRectList getClientRects();
DOMRect getBoundingClientRect(); [RuntimeCallStatsCounter=ElementGetBoundingClientRect] DOMRect getBoundingClientRect();
// TODO(sunyunjia): Add default value for scrollIntoView() once // TODO(sunyunjia): Add default value for scrollIntoView() once
// crbug.com/734599 is fixed. // crbug.com/734599 is fixed.
......
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
boolean isDefaultNamespace(DOMString? namespaceURI); boolean isDefaultNamespace(DOMString? namespaceURI);
[CEReactions, CustomElementCallbacks, PerWorldBindings, RaisesException] Node insertBefore(Node node, Node? child); [CEReactions, CustomElementCallbacks, PerWorldBindings, RaisesException] Node insertBefore(Node node, Node? child);
[CEReactions, CustomElementCallbacks, PerWorldBindings, RaisesException] Node appendChild(Node node); [CEReactions, CustomElementCallbacks, PerWorldBindings, RaisesException, RuntimeCallStatsCounter=NodeAppendChild] Node appendChild(Node node);
[CEReactions, CustomElementCallbacks, PerWorldBindings, RaisesException] Node replaceChild(Node node, Node child); [CEReactions, CustomElementCallbacks, PerWorldBindings, RaisesException] Node replaceChild(Node node, Node child);
[CEReactions, CustomElementCallbacks, RaisesException] Node removeChild(Node child); [CEReactions, CustomElementCallbacks, RaisesException, RuntimeCallStatsCounter=NodeRemoveChild] Node removeChild(Node child);
}; };
...@@ -176,20 +176,28 @@ class PLATFORM_EXPORT RuntimeCallStats { ...@@ -176,20 +176,28 @@ class PLATFORM_EXPORT RuntimeCallStats {
V(AssociateObjectWithWrapper) \ V(AssociateObjectWithWrapper) \
V(CollectGarbage) \ V(CollectGarbage) \
V(CreateWrapper) \ V(CreateWrapper) \
V(GetEventListener) \
V(HasInstance) \
V(DocumentFragmentParseHTML) \
V(PaintContents) \ V(PaintContents) \
V(PerformIdleLazySweep) \ V(PerformIdleLazySweep) \
V(ProcessStyleSheet) \ V(ProcessStyleSheet) \
V(ToExecutionContext) \ V(ToExecutionContext) \
V(ToV8DOMWindow) \ V(ToV8DOMWindow) \
V(ToV8SequenceInternal) \
V(UpdateLayerPositionsAfterLayout) \ V(UpdateLayerPositionsAfterLayout) \
V(UpdateLayout) \ V(UpdateLayout) \
V(UpdateStyle) \ V(UpdateStyle) \
V(SetReturnValueFromStringSlow) \ V(SetReturnValueFromStringSlow) \
V(V8ExternalStringSlow) \ V(V8ExternalStringSlow) \
V(V8) \ V(V8) \
BINDINGS_METHOD(V, ElementGetBoundingClientRect) \
BINDINGS_METHOD(V, EventTargetDispatchEvent) \ BINDINGS_METHOD(V, EventTargetDispatchEvent) \
BINDINGS_METHOD(V, HTMLElementClick) \ BINDINGS_METHOD(V, HTMLElementClick) \
BINDINGS_METHOD(V, NodeAppendChild) \
BINDINGS_METHOD(V, NodeRemoveChild) \
BINDINGS_METHOD(V, WindowSetTimeout) \ BINDINGS_METHOD(V, WindowSetTimeout) \
BINDINGS_ATTRIBUTE(V, DocumentCookie) \
BINDINGS_ATTRIBUTE(V, ElementInnerHTML) \ BINDINGS_ATTRIBUTE(V, ElementInnerHTML) \
V(TestCounter1) \ V(TestCounter1) \
V(TestCounter2) \ V(TestCounter2) \
......
...@@ -233,6 +233,8 @@ inline v8::Local<v8::Value> ToV8SequenceInternal( ...@@ -233,6 +233,8 @@ inline v8::Local<v8::Value> ToV8SequenceInternal(
const Sequence& sequence, const Sequence& sequence,
v8::Local<v8::Object> creation_context, v8::Local<v8::Object> creation_context,
v8::Isolate* isolate) { v8::Isolate* isolate) {
RUNTIME_CALL_TIMER_SCOPE(isolate,
RuntimeCallStats::CounterId::kToV8SequenceInternal);
v8::Local<v8::Array> array; v8::Local<v8::Array> array;
{ {
v8::Context::Scope context_scope(creation_context->CreationContext()); v8::Context::Scope context_scope(creation_context->CreationContext());
......
...@@ -221,6 +221,8 @@ void V8PerIsolateData::ClearScriptRegexpContext() { ...@@ -221,6 +221,8 @@ void V8PerIsolateData::ClearScriptRegexpContext() {
bool V8PerIsolateData::HasInstance( bool V8PerIsolateData::HasInstance(
const WrapperTypeInfo* untrusted_wrapper_type_info, const WrapperTypeInfo* untrusted_wrapper_type_info,
v8::Local<v8::Value> value) { v8::Local<v8::Value> value) {
RUNTIME_CALL_TIMER_SCOPE(GetIsolate(),
RuntimeCallStats::CounterId::kHasInstance);
return HasInstance(untrusted_wrapper_type_info, value, return HasInstance(untrusted_wrapper_type_info, value,
interface_template_map_for_main_world_) || interface_template_map_for_main_world_) ||
HasInstance(untrusted_wrapper_type_info, value, HasInstance(untrusted_wrapper_type_info, value,
......
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