Commit 173a2bd8 authored by Vitaly Buka's avatar Vitaly Buka Committed by Commit Bot

Disable -ftrivial-auto-var-init=pattern on variable

This variable significantly slows down indexed-getter.html of blink_perf.bindings on linux-perf
https://pinpoint-dot-chromeperf.appspot.com/job/136cce54620000

V8_STACK_UNINITIALIZED macro is the same as http://crrev.com/c/1974951

Bug: chromium:977230

Change-Id: I3e7e91804e13b856d6b2ba0a5d67f0354636c510
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2046872
Commit-Queue: Vitaly Buka <vitalybuka@chromium.org>
Auto-Submit: Vitaly Buka <vitalybuka@chromium.org>
Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66278}
parent dfe37934
......@@ -105,4 +105,45 @@
#define V8_NOEXCEPT
#endif
#if defined(__clang__)
#if __has_attribute(uninitialized)
// Attribute "uninitialized" disables -ftrivial-auto-var-init=pattern for
// the specified variable.
// Library-wide alternative is
// 'configs -= [ "//build/config/compiler:default_init_stack_vars" ]' in .gn
// file.
//
// See "init_stack_vars" in build/config/compiler/BUILD.gn and
// http://crbug.com/977230
// "init_stack_vars" is enabled for non-official builds and we hope to enable it
// in official build in 2020 as well. The flag writes fixed pattern into
// uninitialized parts of all local variables. In rare cases such initialization
// is undesirable and attribute can be used:
// 1. Degraded performance
// In most cases compiler is able to remove additional stores. E.g. if memory is
// never accessed or properly initialized later. Preserved stores mostly will
// not affect program performance. However if compiler failed on some
// performance critical code we can get a visible regression in a benchmark.
// 2. memset, memcpy calls
// Compiler may replace some memory writes with memset or memcpy calls. This is
// not -ftrivial-auto-var-init specific, but it can happen more likely with the
// flag. It can be a problem if code is not linked with C run-time library.
//
// Note: The flag is security risk mitigation feature. So in future the
// attribute uses should be avoided when possible. However to enable this
// mitigation on the most of the code we need to be less strict now and minimize
// number of exceptions later. So if in doubt feel free to use attribute, but
// please document the problem for someone who is going to cleanup it later.
// E.g. platform, bot, benchmark or test name in patch description or next to
// the attribute.
#define V8_STACK_UNINITIALIZED __attribute__((uninitialized))
#else // No attribute uninitialized
#define V8_STACK_UNINITIALIZED
#endif // attribute uninitialized
#else // Not clang
#define V8_STACK_UNINITIALIZED
#endif // clang
#endif // V8_BASE_COMPILER_SPECIFIC_H_
......@@ -2794,8 +2794,10 @@ RUNTIME_FUNCTION(Runtime_LoadElementWithInterceptor) {
Handle<InterceptorInfo> interceptor(receiver->GetIndexedInterceptor(),
isolate);
PropertyCallbackArguments arguments(isolate, interceptor->data(), *receiver,
*receiver, Just(kDontThrow));
// Initialization significantly slows down indexed-getter.html of
// blink_perf.bindings on linux-perf. https://crbug.com/977230
V8_STACK_UNINITIALIZED PropertyCallbackArguments arguments(
isolate, interceptor->data(), *receiver, *receiver, Just(kDontThrow));
Handle<Object> result = arguments.CallIndexedGetter(interceptor, index);
RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate);
......
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