Commit 6974d333 authored by yukishiino's avatar yukishiino Committed by Commit bot

bindings: Improves the speed perf of EventTarget.dispatchEvent.

Introduces a hack to recover the speed performance of
EventTarget.dispatchEvent.  The code looks like close to the one before
http://crrev.com/1417023006 .

BUG=564407, 509936

Review URL: https://codereview.chromium.org/1494803003

Cr-Commit-Position: refs/heads/master@{#362937}
parent 9cb8e2ec
......@@ -28,12 +28,27 @@ static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const
{% endif %}
{# Security checks #}
{% if method.is_check_security_for_receiver %}
{% if interface_name == 'EventTarget' %}
// Performance hack for EventTarget. Checking whether it's a Window or not
// prior to the call to BindingSecurity::shouldAllowAccessTo increases 30%
// of speed performance on Android Nexus 7 as of Dec 2016. ALWAYS_INLINE
// didn't work in this case.
if (LocalDOMWindow* window = impl->toDOMWindow()) {
if (!BindingSecurity::shouldAllowAccessTo(info.GetIsolate(), callingDOMWindow(info.GetIsolate()), window, exceptionState)) {
{% if not method.returns_promise %}
exceptionState.throwIfNeeded();
{% endif %}
return;
}
}
{% else %}{# interface_name == 'EventTarget' #}
if (!BindingSecurity::shouldAllowAccessTo(info.GetIsolate(), callingDOMWindow(info.GetIsolate()), impl, exceptionState)) {
{% if not method.returns_promise %}
exceptionState.throwIfNeeded();
{% endif %}
return;
}
{% endif %}{# interface_name == 'EventTarget' #}
{% endif %}
{% if method.is_check_security_for_return_value %}
if (!BindingSecurity::shouldAllowAccessTo(info.GetIsolate(), callingDOMWindow(info.GetIsolate()), {{method.cpp_value}}, exceptionState)) {
......
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