Commit ccee44e1 authored by Simon Zünd's avatar Simon Zünd Committed by Commit Bot

[array] Add megamorphic Array.p.sort benchmark

This CL adds a benchmark where the array to sort undergoes
multiple element kind transitions before it is sorted.

R=jgruber@chromium.org

Bug: v8:7382
Change-Id: I5196a33139a5f3b833719c2a111dc9a521bdb37c
Reviewed-on: https://chromium-review.googlesource.com/1066012
Commit-Queue: Simon Zünd <szuend@google.com>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53283}
parent 38da15ea
......@@ -124,3 +124,5 @@ function cmp_smaller(a, b) {
if (b < a) return 1;
return 0;
}
function cmp_greater(a, b) { return cmp_smaller(b, a); }
......@@ -4,8 +4,6 @@
load('sort-base.js');
function cmp_greater(a, b) { return cmp_smaller(b, a); }
// Each benchmark calls sort with multiple different comparison functions
// to create polyomorphic call sites. Most/all of the
// other sort benchmarks have monomorphic call sites.
......
// Copyright 2018 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.
load('sort-base.js');
function SetupMegamorphic() {
CreatePackedSmiArray();
Array.prototype.sort.call([1.1]);
Array.prototype.sort.call(['a']);
Array.prototype.sort.call([2,,3]);
Array.prototype.sort.call([0.2,,0.1]);
Array.prototype.sort.call(['b',,'a']);
Array.prototype.sort.call({});
}
benchy('Base', Sort, SetupMegamorphic);
benchy('MultipleCompareFns', CreateSortFn([cmp_smaller, cmp_greater]),
SetupMegamorphic);
......@@ -775,6 +775,21 @@
{"name": "PackedSmiPreSortedReversed"}
]
},
{
"name": "ArraySortMegamorphic",
"path": ["ArraySort"],
"main": "run.js",
"resources": ["sort-base.js", "sort-megamorphic.js"],
"test_flags": ["sort-megamorphic"],
"results_regexp": "^%s\\-ArraySort\\(Score\\): (.+)$",
"flags": [
"--allow-natives-syntax"
],
"tests": [
{"name": "Base"},
{"name": "MultipleCompareFns"}
]
},
{
"name": "ForLoops",
"path": ["ForLoops"],
......
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