Commit c4766f68 authored by Sigurd Schneider's avatar Sigurd Schneider Committed by Commit Bot

[turbofan] Improve performance of mjsunit test

R=neis@chromium.org

Bug: v8:7599
Change-Id: I8a1e4864800dbf76530ebbe2a9ce09dac55a1f65
Reviewed-on: https://chromium-review.googlesource.com/980055
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52217}
parent 95531a86
......@@ -105,7 +105,7 @@ test(function div() {
assertSame(-Infinity, Infinity / (-3));
assertSame(NaN, NaN / 3);
assertSame(-Infinity, 1 / (-0.0));
assertSame(Infinity, Infinity/0.0);
assertSame(Infinity, Infinity / 0.0);
});
test(function mathMin() {
......@@ -187,8 +187,8 @@ test(function mathRound() {
test(function mathFround() {
assertTrue(isNaN(Math.fround(NaN)));
assertSame(Infinity, 1/Math.fround(0));
assertSame(-Infinity, 1/Math.fround(-0));
assertSame(Infinity, 1 / Math.fround(0));
assertSame(-Infinity, 1 / Math.fround(-0));
assertSame(Infinity, Math.fround(Infinity));
assertSame(-Infinity, Math.fround(-Infinity));
assertSame(Infinity, Math.fround(1E200));
......@@ -275,6 +275,20 @@ test(function stringCodePointAt() {
assertSame(undefined, "äϠ�".codePointAt(1 + 4294967295));
}, 10);
test(function stringFromCodePoint() {
assertEquals(String.fromCodePoint(""), "\0");
assertEquals(String.fromCodePoint(), "");
assertEquals(String.fromCodePoint(-0), "\0");
assertEquals(String.fromCodePoint(0), "\0");
assertEquals(String.fromCodePoint(0x1D306), "\uD834\uDF06");
assertEquals(
String.fromCodePoint(0x1D306, 0x61, 0x1D307),
"\uD834\uDF06a\uD834\uDF07");
assertEquals(String.fromCodePoint(0x61, 0x62, 0x1D307), "ab\uD834\uDF07");
assertEquals(String.fromCodePoint(false), "\0");
assertEquals(String.fromCodePoint(null), "\0");
}, 5);
test(function stringFromCharCode() {
assertEquals("!", String.fromCharCode(0x10FF01));
}, 2);
......
......@@ -7,70 +7,60 @@
// Flags: --allow-natives-syntax
function test() {
assertEquals(String.fromCodePoint.length, 1);
assertEquals(String.propertyIsEnumerable("fromCodePoint"), false);
assertEquals(String.fromCodePoint.length, 1);
assertEquals(String.propertyIsEnumerable("fromCodePoint"), false);
assertEquals(String.fromCodePoint(""), "\0");
assertEquals(String.fromCodePoint(), "");
assertEquals(String.fromCodePoint(-0), "\0");
assertEquals(String.fromCodePoint(0), "\0");
assertEquals(String.fromCodePoint(0x1D306), "\uD834\uDF06");
assertEquals(
String.fromCodePoint(0x1D306, 0x61, 0x1D307),
"\uD834\uDF06a\uD834\uDF07");
assertEquals(String.fromCodePoint(0x61, 0x62, 0x1D307), "ab\uD834\uDF07");
assertEquals(String.fromCodePoint(false), "\0");
assertEquals(String.fromCodePoint(null), "\0");
assertEquals(String.fromCodePoint(""), "\0");
assertEquals(String.fromCodePoint(), "");
assertEquals(String.fromCodePoint(-0), "\0");
assertEquals(String.fromCodePoint(0), "\0");
assertEquals(String.fromCodePoint(0x1D306), "\uD834\uDF06");
assertEquals(
String.fromCodePoint(0x1D306, 0x61, 0x1D307),
"\uD834\uDF06a\uD834\uDF07");
assertEquals(String.fromCodePoint(0x61, 0x62, 0x1D307), "ab\uD834\uDF07");
assertEquals(String.fromCodePoint(false), "\0");
assertEquals(String.fromCodePoint(null), "\0");
assertThrows(function () { String.fromCodePoint("_"); }, RangeError);
assertThrows(function () { String.fromCodePoint("+Infinity"); }, RangeError);
assertThrows(function () { String.fromCodePoint("-Infinity"); }, RangeError);
assertThrows(function () { String.fromCodePoint(-1); }, RangeError);
assertThrows(function () { String.fromCodePoint(0x10FFFF + 1); }, RangeError);
assertThrows(function () { String.fromCodePoint(3.14); }, RangeError);
assertThrows(function () { String.fromCodePoint(3e-2); }, RangeError);
assertThrows(function () { String.fromCodePoint(-Infinity); }, RangeError);
assertThrows(function () { String.fromCodePoint(+Infinity); }, RangeError);
assertThrows(function () { String.fromCodePoint(NaN); }, RangeError);
assertThrows(function () { String.fromCodePoint(undefined); }, RangeError);
assertThrows(function () { String.fromCodePoint({}); }, RangeError);
assertThrows(function () { String.fromCodePoint(/./); }, RangeError);
assertThrows(function () {
String.fromCodePoint({
valueOf: function () { throw Error(); }
});
}, Error);
assertThrows(function () {
String.fromCodePoint({
valueOf: function () { throw Error(); }
});
}, Error);
var tmp = 0x60;
assertEquals(String.fromCodePoint({
valueOf: function () { ++tmp; return tmp; }
}), "a");
assertEquals(tmp, 0x61);
assertThrows(function () { String.fromCodePoint("_"); }, RangeError);
assertThrows(function () { String.fromCodePoint("+Infinity"); }, RangeError);
assertThrows(function () { String.fromCodePoint("-Infinity"); }, RangeError);
assertThrows(function () { String.fromCodePoint(-1); }, RangeError);
assertThrows(function () { String.fromCodePoint(0x10FFFF + 1); }, RangeError);
assertThrows(function () { String.fromCodePoint(3.14); }, RangeError);
assertThrows(function () { String.fromCodePoint(3e-2); }, RangeError);
assertThrows(function () { String.fromCodePoint(-Infinity); }, RangeError);
assertThrows(function () { String.fromCodePoint(+Infinity); }, RangeError);
assertThrows(function () { String.fromCodePoint(NaN); }, RangeError);
assertThrows(function () { String.fromCodePoint(undefined); }, RangeError);
assertThrows(function () { String.fromCodePoint({}); }, RangeError);
assertThrows(function () { String.fromCodePoint(/./); }, RangeError);
assertThrows(function () {
String.fromCodePoint({
valueOf: function () { throw Error(); }
});
}, Error);
assertThrows(function () {
String.fromCodePoint({
valueOf: function () { throw Error(); }
});
}, Error);
var tmp = 0x60;
assertEquals(String.fromCodePoint({
valueOf: function () { ++tmp; return tmp; }
}), "a");
assertEquals(tmp, 0x61);
var counter = Math.pow(2, 15) * 3 / 2;
var result = [];
while (--counter >= 0) {
result.push(0); // one code unit per symbol
}
String.fromCodePoint.apply(null, result); // must not throw
var counter = Math.pow(2, 15) * 3 / 2;
var result = [];
while (--counter >= 0) {
result.push(0xFFFF + 1); // two code units per symbol
}
String.fromCodePoint.apply(null, result); // must not throw
var counter = Math.pow(2, 15) * 3 / 2;
var result = [];
while (--counter >= 0) {
result.push(0); // one code unit per symbol
}
String.fromCodePoint.apply(null, result); // must not throw
test();
test();
for (var i = 0; i < 100; ++i) {
%OptimizeFunctionOnNextCall(test);
test();
var counter = Math.pow(2, 15) * 3 / 2;
var result = [];
while (--counter >= 0) {
result.push(0xFFFF + 1); // two code units per symbol
}
String.fromCodePoint.apply(null, result); // must not throw
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