Commit 2a01ff8e authored by Sigurd Schneider's avatar Sigurd Schneider Committed by Commit Bot

[mjsunit] Split slow test out of array-sort and skip it on certain builds

The slow test tests SmiLexicographicCompare on a large number of Smi comparisons;
we can disable this test for some debug/noopt builds without losing much coverage.

Bug: v8:7783
Change-Id: Iab40e596604bb957b4d3312073ad85dbac08c6a0
Reviewed-on: https://chromium-review.googlesource.com/1068190
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: 's avatarMichael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53333}
parent 040ff0da
// Copyright 2010 the V8 project authors. All rights reserved. // Copyright 2010 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without // Use of this source code is governed by a BSD-style license that can be
// modification, are permitted provided that the following conditions are // found in the LICENSE file.
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --allow-natives-syntax // Flags: --allow-natives-syntax
...@@ -75,56 +52,6 @@ function TestNumberSort() { ...@@ -75,56 +52,6 @@ function TestNumberSort() {
TestNumberSort(); TestNumberSort();
function TestSmiLexicographicCompare() {
assertFalse(%_IsSmi(2147483648), 'Update test for >32 bit Smi');
// Collect a list of interesting Smis.
var seen = {};
var smis = [];
function add(x) {
if (x | 0 == x) {
x = x | 0; // Canonicalizes to Smi if 32-bit signed and fits in Smi.
}
if (%_IsSmi(x) && !seen[x]) {
seen[x] = 1;
smis.push(x);
}
}
function addSigned(x) {
add(x);
add(-x);
}
var BIGGER_THAN_ANY_SMI = 10 * 1000 * 1000 * 1000;
for (var xb = 1; xb <= BIGGER_THAN_ANY_SMI; xb *= 10) {
for (var xf = 0; xf <= 9; xf++) {
for (var xo = -1; xo <= 1; xo++) {
addSigned(xb * xf + xo);
}
}
}
for (var yb = 1; yb <= BIGGER_THAN_ANY_SMI; yb *= 2) {
for (var yo = -2; yo <= 2; yo++) {
addSigned(yb + yo);
}
}
for (var i = 0; i < smis.length; i++) {
for (var j = 0; j < smis.length; j++) {
var x = smis[i];
var y = smis[j];
var lex = %SmiLexicographicCompare(x, y);
var expected = (x == y) ? 0 : ((x + "") < (y + "") ? -1 : 1);
assertEquals(lex, expected, x + " < " + y);
}
}
}
TestSmiLexicographicCompare();
// Test lexicographical string sorting. // Test lexicographical string sorting.
function TestStringSort() { function TestStringSort() {
var a = [ "cc", "c", "aa", "a", "bb", "b", "ab", "ac" ]; var a = [ "cc", "c", "aa", "a", "bb", "b", "ab", "ac" ];
......
// 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.
// Flags: --allow-natives-syntax
(function () {
assertFalse(%IsSmi(2147483648), 'Update test for >32 bit Smi');
// Collect a list of interesting Smis.
const seen = {};
const smis = [];
function add(x) {
if (x | 0 == x) {
x = x | 0; // Canonicalizes to Smi if 32-bit signed and fits in Smi.
}
if (%_IsSmi(x) && !seen[x]) {
seen[x] = 1;
smis.push(x);
}
}
function addSigned(x) {
add(x);
add(-x);
}
var BIGGER_THAN_ANY_SMI = 10 * 1000 * 1000 * 1000;
for (var xb = 1; xb <= BIGGER_THAN_ANY_SMI; xb *= 10) {
for (var xf = 0; xf <= 9; xf++) {
for (var xo = -1; xo <= 1; xo++) {
addSigned(xb * xf + xo);
}
}
}
console.log("A")
for (var yb = 1; yb <= BIGGER_THAN_ANY_SMI; yb *= 2) {
for (var yo = -2; yo <= 2; yo++) {
addSigned(yb + yo);
}
}
function test(x,y) {
const lex = %SmiLexicographicCompare(x, y);
const expected = (x == y) ? 0 : (("" + x) < ("" + y) ? -1 : 1);
return lex == expected;
}
console.log(smis.length);
for (var i = 0; i < smis.length; i++) {
for (var j = 0; j < smis.length; j++) {
const x = smis[i];
const y = smis[j];
assertTrue(test(x, y), x + " < " + y);;
}
}
console.log("C")
})();
...@@ -265,6 +265,7 @@ ...@@ -265,6 +265,7 @@
# TODO(mstarzinger): Takes too long with TF. # TODO(mstarzinger): Takes too long with TF.
'array-sort': [PASS, NO_VARIANTS], 'array-sort': [PASS, NO_VARIANTS],
'lexicographic-compare': [PASS, NO_VARIANTS],
'regress/regress-91008': [PASS, NO_VARIANTS], 'regress/regress-91008': [PASS, NO_VARIANTS],
'regress/regress-transcendental': [PASS, ['arch == arm64', NO_VARIANTS]], 'regress/regress-transcendental': [PASS, ['arch == arm64', NO_VARIANTS]],
'compiler/osr-regress-max-locals': [PASS, NO_VARIANTS], 'compiler/osr-regress-max-locals': [PASS, NO_VARIANTS],
...@@ -357,6 +358,7 @@ ...@@ -357,6 +358,7 @@
'compiler/osr-with-args': [PASS, SLOW], 'compiler/osr-with-args': [PASS, SLOW],
'generated-transition-stub': [PASS, SLOW], 'generated-transition-stub': [PASS, SLOW],
'json2': [PASS, SLOW], 'json2': [PASS, SLOW],
'lexicographic-compare': [PASS, SLOW],
'math-floor-of-div-nosudiv': [PASS, SLOW], 'math-floor-of-div-nosudiv': [PASS, SLOW],
'math-floor-of-div': [PASS, SLOW], 'math-floor-of-div': [PASS, SLOW],
'messages': [PASS, SLOW], 'messages': [PASS, SLOW],
...@@ -384,6 +386,7 @@ ...@@ -384,6 +386,7 @@
# Pass but take too long with the simulator in debug mode. # Pass but take too long with the simulator in debug mode.
'array-sort': [PASS, SLOW], 'array-sort': [PASS, SLOW],
'lexicographic-compare': [PASS, SLOW],
'packed-elements': [SKIP], 'packed-elements': [SKIP],
'regexp-global': [SKIP], 'regexp-global': [SKIP],
'math-floor-of-div': [PASS, SLOW], 'math-floor-of-div': [PASS, SLOW],
...@@ -498,6 +501,7 @@ ...@@ -498,6 +501,7 @@
# Slow tests. # Slow tests.
'array-sort': [PASS, SLOW], 'array-sort': [PASS, SLOW],
'compiler/osr-with-args': [PASS, SLOW], 'compiler/osr-with-args': [PASS, SLOW],
'lexicographic-compare': [PASS, SLOW],
'packed-elements': [PASS, SLOW], 'packed-elements': [PASS, SLOW],
'regress/regress-2185-2': [PASS, SLOW], 'regress/regress-2185-2': [PASS, SLOW],
'regress/regress-2790': [PASS, SLOW], 'regress/regress-2790': [PASS, SLOW],
...@@ -786,11 +790,11 @@ ...@@ -786,11 +790,11 @@
############################################################################## ##############################################################################
['variant == nooptimization and (arch == arm or arch == arm64) and simulator_run', { ['variant == nooptimization and (arch == arm or arch == arm64) and simulator_run', {
# Slow tests: https://crbug.com/v8/7783 # Slow tests: https://crbug.com/v8/7783
'array-sort': [SKIP],
'compiler/alloc-number': [SKIP], 'compiler/alloc-number': [SKIP],
'compiler/osr-nested': [SKIP], 'compiler/osr-nested': [SKIP],
'compiler/osr-one': [SKIP], 'compiler/osr-one': [SKIP],
'compiler/osr-two': [SKIP], 'compiler/osr-two': [SKIP],
'lexicographic-compare': [SKIP],
'regress/regress-2185': [SKIP], 'regress/regress-2185': [SKIP],
'regress/regress-deep-proto': [SKIP], 'regress/regress-deep-proto': [SKIP],
'wasm/grow-memory': [SKIP], 'wasm/grow-memory': [SKIP],
......
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