v8/test/js-perf-test/Array/some.js
Michael Stanton 6da8e1f993 Revert "[Builtins] Array.prototype.forEach perf regression on dictionaries."
This reverts commit 34625fdb5a.

Reason for revert: Test caused timeout, investigating.

Original change's description:
> [Builtins] Array.prototype.forEach perf regression on dictionaries.
> 
> An unnecessary call to ToString() on the array index caused trips to
> the runtime. The fix also includes performance micro-benchmarks so
> we'll have a harder time regressing this case in future.
> 
> Bug: v8:8112
> Change-Id: Iada5bd2e3c6d2246fb1225e7094f3d9c66ddafbd
> Reviewed-on: https://chromium-review.googlesource.com/1206355
> Commit-Queue: Michael Stanton <mvstanton@chromium.org>
> Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#55653}

TBR=mvstanton@chromium.org,tebbi@chromium.org

Change-Id: I21de9b9b33edf03f2173f579c4ba0fc3dfd8ff88
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:8112
Reviewed-on: https://chromium-review.googlesource.com/1209288
Reviewed-by: Michael Stanton <mvstanton@chromium.org>
Commit-Queue: Michael Stanton <mvstanton@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55681}
2018-09-06 11:00:15 +00:00

38 lines
1.3 KiB
JavaScript

// Copyright 2017 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
(() => {
// Make sure we inline the callback, pick up all possible TurboFan
// optimizations.
function RunOptFastSome(multiple) {
// Use of variable multiple in the callback function forces
// context creation without escape analysis.
//
// Also, the arrow function requires inlining based on
// SharedFunctionInfo.
result = array.some((v, i, a) => multiple !== 3);
}
// Don't optimize because I want to optimize RunOptFastMap with a parameter
// to be used in the callback.
%NeverOptimizeFunction(OptFastSome);
function OptFastSome() { RunOptFastSome(3); }
function side_effect(a) { return a; }
%NeverOptimizeFunction(side_effect);
function OptUnreliableSome() {
result = array.some(func, side_effect(array));
}
DefineHigherOrderTests([
// name, test function, setup function, user callback
['DoubleSome', newClosure('some'), DoubleSetup, v => v < 0.0],
['SmiSome', newClosure('some'), SmiSetup, v => v === 34343],
['FastSome', newClosure('some'), FastSetup, v => v === 'hi'],
['OptFastSome', OptFastSome, FastSetup, undefined],
['OptUnreliableSome', OptUnreliableSome, FastSetup, v => v === 'hi']
]);
})();