Diff
Modified: trunk/JSTests/ChangeLog (227416 => 227417)
--- trunk/JSTests/ChangeLog 2018-01-23 17:10:47 UTC (rev 227416)
+++ trunk/JSTests/ChangeLog 2018-01-23 17:11:40 UTC (rev 227417)
@@ -1,3 +1,44 @@
+2018-01-23 Filip Pizlo <[email protected]>
+
+ Unreviewed, retire some microbenchmarks that are proportionately very slow. Benchmark running time should be proportional to their value. Microbenchmarks have little value, so they should be very fast.
+
+ * microbenchmarks/array-push-3.js: Removed.
+ * microbenchmarks/bigswitch-indirect-symbol-or-undefined.js: Removed.
+ * microbenchmarks/double-to-int32.js: Removed.
+ * microbenchmarks/fake-iterators-that-throw-when-finished.js: Removed.
+ * microbenchmarks/ftl-polymorphic-bitand.js: Removed.
+ * microbenchmarks/ftl-polymorphic-bitor.js: Removed.
+ * microbenchmarks/ftl-polymorphic-bitxor.js: Removed.
+ * microbenchmarks/ftl-polymorphic-lshift.js: Removed.
+ * microbenchmarks/ftl-polymorphic-rshift.js: Removed.
+ * microbenchmarks/ftl-polymorphic-sub.js: Removed.
+ * microbenchmarks/ftl-polymorphic-urshift.js: Removed.
+ * microbenchmarks/map-constant-key.js: Removed.
+ * microbenchmarks/nested-function-parsing.js: Removed.
+ * microbenchmarks/rest-parameter-allocation-elimination.js: Removed.
+ * microbenchmarks/spread-large-array.js: Removed.
+ * microbenchmarks/string-add-constant-folding.js: Removed.
+ * microbenchmarks/to-lower-case.js: Removed.
+ * microbenchmarks/undefined-property-access.js: Removed.
+ * slowMicrobenchmarks/array-push-3.js: Copied from JSTests/microbenchmarks/array-push-3.js.
+ * slowMicrobenchmarks/bigswitch-indirect-symbol-or-undefined.js: Copied from JSTests/microbenchmarks/bigswitch-indirect-symbol-or-undefined.js.
+ * slowMicrobenchmarks/double-to-int32.js: Copied from JSTests/microbenchmarks/double-to-int32.js.
+ * slowMicrobenchmarks/fake-iterators-that-throw-when-finished.js: Copied from JSTests/microbenchmarks/fake-iterators-that-throw-when-finished.js.
+ * slowMicrobenchmarks/ftl-polymorphic-bitand.js: Copied from JSTests/microbenchmarks/ftl-polymorphic-bitand.js.
+ * slowMicrobenchmarks/ftl-polymorphic-bitor.js: Copied from JSTests/microbenchmarks/ftl-polymorphic-bitor.js.
+ * slowMicrobenchmarks/ftl-polymorphic-bitxor.js: Copied from JSTests/microbenchmarks/ftl-polymorphic-bitxor.js.
+ * slowMicrobenchmarks/ftl-polymorphic-lshift.js: Copied from JSTests/microbenchmarks/ftl-polymorphic-lshift.js.
+ * slowMicrobenchmarks/ftl-polymorphic-rshift.js: Copied from JSTests/microbenchmarks/ftl-polymorphic-rshift.js.
+ * slowMicrobenchmarks/ftl-polymorphic-sub.js: Copied from JSTests/microbenchmarks/ftl-polymorphic-sub.js.
+ * slowMicrobenchmarks/ftl-polymorphic-urshift.js: Copied from JSTests/microbenchmarks/ftl-polymorphic-urshift.js.
+ * slowMicrobenchmarks/map-constant-key.js: Copied from JSTests/microbenchmarks/map-constant-key.js.
+ * slowMicrobenchmarks/nested-function-parsing.js: Copied from JSTests/microbenchmarks/nested-function-parsing.js.
+ * slowMicrobenchmarks/rest-parameter-allocation-elimination.js: Copied from JSTests/microbenchmarks/rest-parameter-allocation-elimination.js.
+ * slowMicrobenchmarks/spread-large-array.js: Copied from JSTests/microbenchmarks/spread-large-array.js.
+ * slowMicrobenchmarks/string-add-constant-folding.js: Copied from JSTests/microbenchmarks/string-add-constant-folding.js.
+ * slowMicrobenchmarks/to-lower-case.js: Copied from JSTests/microbenchmarks/to-lower-case.js.
+ * slowMicrobenchmarks/undefined-property-access.js: Copied from JSTests/microbenchmarks/undefined-property-access.js.
+
2018-01-23 Robin Morisset <[email protected]>
Update the argument count in DFGByteCodeParser::handleRecursiveCall
Deleted: trunk/JSTests/microbenchmarks/array-push-3.js (227416 => 227417)
--- trunk/JSTests/microbenchmarks/array-push-3.js 2018-01-23 17:10:47 UTC (rev 227416)
+++ trunk/JSTests/microbenchmarks/array-push-3.js 2018-01-23 17:11:40 UTC (rev 227417)
@@ -1,9 +0,0 @@
-function arrayPush3() {
- var ret = [1];
- ret.push(1, 2, 3);
- return ret;
-}
-noInline(arrayPush3);
-
-for (var i = 0; i < 1e7; ++i)
- arrayPush3();
Deleted: trunk/JSTests/microbenchmarks/bigswitch-indirect-symbol-or-undefined.js (227416 => 227417)
--- trunk/JSTests/microbenchmarks/bigswitch-indirect-symbol-or-undefined.js 2018-01-23 17:10:47 UTC (rev 227416)
+++ trunk/JSTests/microbenchmarks/bigswitch-indirect-symbol-or-undefined.js 2018-01-23 17:11:40 UTC (rev 227417)
@@ -1,279 +0,0 @@
-var thing0 = Symbol();
-var thing1 = Symbol();
-var thing2 = Symbol();
-var thing3 = Symbol();
-var thing4 = Symbol();
-var thing5 = Symbol();
-var thing6 = Symbol();
-var thing7 = Symbol();
-var thing8 = Symbol();
-var thing9 = Symbol();
-var thing10 = Symbol();
-var thing11 = Symbol();
-var thing12 = Symbol();
-var thing13 = Symbol();
-var thing14 = Symbol();
-var thing15 = Symbol();
-var thing16 = Symbol();
-var thing17 = Symbol();
-var thing18 = Symbol();
-var thing19 = Symbol();
-var thing20 = Symbol();
-var thing21 = Symbol();
-var thing22 = Symbol();
-var thing23 = Symbol();
-var thing24 = Symbol();
-var thing25 = Symbol();
-var thing26 = Symbol();
-var thing27 = Symbol();
-var thing28 = Symbol();
-var thing29 = Symbol();
-var thing30 = Symbol();
-var thing31 = Symbol();
-var thing32 = Symbol();
-var thing33 = Symbol();
-var thing34 = Symbol();
-var thing35 = Symbol();
-var thing36 = Symbol();
-var thing37 = Symbol();
-var thing38 = Symbol();
-var thing39 = Symbol();
-var thing40 = Symbol();
-var thing41 = Symbol();
-var thing42 = Symbol();
-var thing43 = Symbol();
-var thing44 = Symbol();
-var thing45 = Symbol();
-var thing46 = Symbol();
-var thing47 = Symbol();
-var thing48 = Symbol();
-var thing49 = Symbol();
-var thing50 = Symbol();
-var thing51 = Symbol();
-var thing52 = Symbol();
-var thing53 = Symbol();
-var thing54 = Symbol();
-var thing55 = Symbol();
-var thing56 = Symbol();
-var thing57 = Symbol();
-var thing58 = Symbol();
-var thing59 = Symbol();
-var thing60 = Symbol();
-var thing61 = Symbol();
-var thing62 = Symbol();
-
-var things = [];
-for (var i = 0; i < 63; ++i)
- things.push(eval("thing" + i));
-
-function foo(o) {
- var result = 0;
- for (var i = 0; i < 1000; ++i) {
- var value = things[i & 63];
- switch (value) {
- case thing0:
- result += o.a;
- break;
- case thing1:
- result += o.b;
- break;
- case thing2:
- result += o.c;
- break;
- case thing3:
- result += o.d;
- break;
- case thing4:
- result += o.e;
- break;
- case thing5:
- result += o.f;
- break;
- case thing6:
- result += o.g;
- break;
- case thing7:
- result += o.h;
- break;
- case thing8:
- result += o.i;
- break;
- case thing9:
- result += o.j;
- break;
- case thing10:
- result += o.k;
- break;
- case thing11:
- result += o.a;
- break;
- case thing12:
- result += o.b;
- break;
- case thing13:
- result += o.c;
- break;
- case thing14:
- result += o.d;
- break;
- case thing15:
- result += o.e;
- break;
- case thing16:
- result += o.f;
- break;
- case thing17:
- result += o.g;
- break;
- case thing18:
- result += o.h;
- break;
- case thing19:
- result += o.i;
- break;
- case thing20:
- result += o.j;
- break;
- case thing21:
- result += o.k;
- break;
- case thing22:
- result += o.k;
- break;
- case thing23:
- result += o.a;
- break;
- case thing24:
- result += o.b;
- break;
- case thing25:
- result += o.c;
- break;
- case thing26:
- result += o.d;
- break;
- case thing27:
- result += o.e;
- break;
- case thing28:
- result += o.f;
- break;
- case thing29:
- result += o.g;
- break;
- case thing30:
- result += o.h;
- break;
- case thing31:
- result += o.i;
- break;
- case thing32:
- result += o.j;
- break;
- case thing33:
- result += o.k;
- break;
- case thing34:
- result += o.k;
- break;
- case thing35:
- result += o.k;
- break;
- case thing36:
- result += o.a;
- break;
- case thing37:
- result += o.b;
- break;
- case thing38:
- result += o.c;
- break;
- case thing39:
- result += o.d;
- break;
- case thing40:
- result += o.e;
- break;
- case thing41:
- result += o.f;
- break;
- case thing42:
- result += o.g;
- break;
- case thing43:
- result += o.h;
- break;
- case thing44:
- result += o.i;
- break;
- case thing45:
- result += o.j;
- break;
- case thing46:
- result += o.k;
- break;
- case thing47:
- result += o.i;
- break;
- case thing48:
- result += o.j;
- break;
- case thing49:
- result += o.k;
- break;
- case thing50:
- result += o.k;
- break;
- case thing51:
- result += o.k;
- break;
- case thing52:
- result += o.a;
- break;
- case thing53:
- result += o.b;
- break;
- case thing54:
- result += o.c;
- break;
- case thing55:
- result += o.d;
- break;
- case thing56:
- result += o.e;
- break;
- case thing57:
- result += o.f;
- break;
- case thing58:
- result += o.g;
- break;
- case thing59:
- result += o.h;
- break;
- case thing60:
- result += o.i;
- break;
- case thing61:
- result += o.j;
- break;
- case thing62:
- result += o.k;
- break;
- default:
- result += o.z;
- break;
- }
- }
- return result;
-}
-
-(function() {
- var o = {a:1, b:2, c:3, d:4, e:5, f:6, g:7, h:8, i:9, j:10, k:11, z:100};
- var result = 0;
- for (var i = 0; i < 1000; ++i)
- result += foo(o);
- if (result != 7966000)
- throw "Error: bad result: " + result;
-})();
-
Deleted: trunk/JSTests/microbenchmarks/double-to-int32.js (227416 => 227417)
--- trunk/JSTests/microbenchmarks/double-to-int32.js 2018-01-23 17:10:47 UTC (rev 227416)
+++ trunk/JSTests/microbenchmarks/double-to-int32.js 2018-01-23 17:11:40 UTC (rev 227417)
@@ -1,30 +0,0 @@
-// This microbenchmarks validates that the fix in https://webkit.org/b/170961
-// does not regress the performance gains from r211670: <http://trac.webkit.org/changeset/211670>.
-// r211670 reduces the size of operationToInt32SensibleSlow() for handling double numbers with
-// binary exponent 31. Hence, this microbenchmark stresses doubleToIn32 conversion on
-// numbers with binary exponents in the vicinity of 31.
-
-let doubleValues = [
- 2.147483648e8, // exp = 27
- 2.147483648e9, // exp = 31
- 2.147483648e10, // exp = 34
-];
-
-function test(q, r, s, t, u, v, w, x, y, z) {
- // Do a lot of double to int32 conversions to weigh more on the conversion.
- return q|0 + r|0 + s|0 + t|0 + u|0 + v|0 + w|0 + x|0 + y|0 + z|0;
-}
-noInline(test);
-
-var result = 0;
-let length = doubleValues.length;
-for (var i = 0; i < 1000000; ++i) {
- for (var j = 0; j < length; j++) {
- var value = doubleValues[j];
- result |= test(value, value, value, value, value, value, value, value, value, value);
- }
-}
-
-if (result != -1932735284) {
- throw "Bad result: " + result;
-}
Deleted: trunk/JSTests/microbenchmarks/fake-iterators-that-throw-when-finished.js (227416 => 227417)
--- trunk/JSTests/microbenchmarks/fake-iterators-that-throw-when-finished.js 2018-01-23 17:10:47 UTC (rev 227416)
+++ trunk/JSTests/microbenchmarks/fake-iterators-that-throw-when-finished.js 2018-01-23 17:11:40 UTC (rev 227417)
@@ -1,78 +0,0 @@
-function assert(b) {
- if (!b)
- throw new Error("Bad");
-}
-
-class Numbers {
- constructor(limit = 100) {
- this.limit = limit;
- this.item = 0;
- }
-
- next() {
- if (this.item >= this.limit)
- throw "done";
- return this.item++;
- }
-}
-
-function transpose(I, f) {
- return class Transpose {
- constructor(...args) {
- this.iterator = new I(...args);
- }
-
- next() {
- return f(this.iterator.next());
- }
- };
-}
-
-let EvenNumbers = transpose(Numbers, (x)=>x*2);
-function verifyEven(prev, cur) {
- assert(cur.value % 2 === 0);
- assert(!prev.value || prev.value+2 === cur.value);
-}
-
-let StringNumbers = transpose(Numbers, (x)=>`${x}`);
-function verifyString(_, cur) {
- assert(cur.value === `${cur.value}`);
-}
-
-let iterators = [
- [Numbers, function() {}],
- [Numbers, function() {}],
- [StringNumbers, verifyString],
- [EvenNumbers, verifyEven],
- [EvenNumbers, verifyEven],
-];
-
-function foo(i) {}
-noInline(foo);
-
-function runIterators() {
- for (let [iterator, verify] of iterators) {
- let i = new iterator;
- let prev = {};
- while (true) {
- let cur = {};
- try {
- cur.value = i.next();
- verify(prev, cur);
- } catch(e) {
- if (e !== "done")
- throw new Error("Bad: " + e);
- break;
- }
- prev = cur;
- }
- }
-}
-
-{
- let start = Date.now();
- for (let i = 0; i < 5000; ++i)
- runIterators();
- if (false)
- print(Date.now() - start);
-}
Deleted: trunk/JSTests/microbenchmarks/ftl-polymorphic-bitand.js (227416 => 227417)
--- trunk/JSTests/microbenchmarks/ftl-polymorphic-bitand.js 2018-01-23 17:10:47 UTC (rev 227416)
+++ trunk/JSTests/microbenchmarks/ftl-polymorphic-bitand.js 2018-01-23 17:11:40 UTC (rev 227417)
@@ -1,52 +0,0 @@
-//@ runFTLNoCJIT
-var o1 = {
- i: 0,
- valueOf: function() { return this.i; }
-};
-
-result = 0;
-function foo(a, b) {
- var result = 0;
- for (var j = 0; j < 10; j++) {
- var temp;
- if (a > b)
- temp = a & b;
- else
- temp = b & 1;
- result += temp;
- }
-
- // Busy work just to allow the DFG and FTL to optimize this out. If the above causes
- // us to speculation fail out to the baseline, this busy work will take a lot longer
- // to run.
- // This loop below also gets the DFG to compile this function sooner.
- var origResult = result;
- for (var i = 1; i < 1000; i++)
- result = result & i;
- result = origResult > result ? origResult : result;
- return result;
-}
-noInline(foo);
-
-var iterations;
-var expectedResult;
-if (this.window) {
- // The layout test doesn't like too many iterations and may time out.
- iterations = 10000;
- expectedResult = 499660;
-} else {
- iterations = 100000;
- expectedResult = 4999660;
-}
-
-
-for (var i = 0; i <= iterations; i++) {
- o1.i = i;
- if (i % 2)
- result += foo(o1, 10);
- else
- result += foo(i, 10);
-}
-
-if (result != expectedResult)
- throw "Bad result: " + result;
Deleted: trunk/JSTests/microbenchmarks/ftl-polymorphic-bitor.js (227416 => 227417)
--- trunk/JSTests/microbenchmarks/ftl-polymorphic-bitor.js 2018-01-23 17:10:47 UTC (rev 227416)
+++ trunk/JSTests/microbenchmarks/ftl-polymorphic-bitor.js 2018-01-23 17:11:40 UTC (rev 227417)
@@ -1,52 +0,0 @@
-//@ runFTLNoCJIT
-var o1 = {
- i: 0,
- valueOf: function() { return this.i; }
-};
-
-result = 0;
-function foo(a, b) {
- var result = 0;
- for (var j = 0; j < 10; j++) {
- var temp;
- if (a > b)
- temp = a | b;
- else
- temp = b | 1;
- result += temp;
- }
-
- // Busy work just to allow the DFG and FTL to optimize this out. If the above causes
- // us to speculation fail out to the baseline, this busy work will take a lot longer
- // to run.
- // This loop below also gets the DFG to compile this function sooner.
- var origResult = result;
- for (var i = 1; i < 1000; i++)
- result = result | i;
- result = origResult > result ? origResult : result;
- return result;
-}
-noInline(foo);
-
-var iterations;
-var expectedResult;
-if (this.window) {
- // The layout test doesn't like too many iterations and may time out.
- iterations = 10000;
- expectedResult = 505700591;
-} else {
- iterations = 100000;
- expectedResult = 50056912223;
-}
-
-
-for (var i = 0; i <= iterations; i++) {
- o1.i = i;
- if (i % 2)
- result += foo(o1, 10);
- else
- result += foo(i, 10);
-}
-
-if (result != expectedResult)
- throw "Bad result: " + result;
Deleted: trunk/JSTests/microbenchmarks/ftl-polymorphic-bitxor.js (227416 => 227417)
--- trunk/JSTests/microbenchmarks/ftl-polymorphic-bitxor.js 2018-01-23 17:10:47 UTC (rev 227416)
+++ trunk/JSTests/microbenchmarks/ftl-polymorphic-bitxor.js 2018-01-23 17:11:40 UTC (rev 227417)
@@ -1,52 +0,0 @@
-//@ runFTLNoCJIT
-var o1 = {
- i: 0,
- valueOf: function() { return this.i; }
-};
-
-result = 0;
-function foo(a, b) {
- var result = 0;
- for (var j = 0; j < 10; j++) {
- var temp;
- if (a > b)
- temp = a ^ b;
- else
- temp = b ^ 1;
- result += temp;
- }
-
- // Busy work just to allow the DFG and FTL to optimize this out. If the above causes
- // us to speculation fail out to the baseline, this busy work will take a lot longer
- // to run.
- // This loop below also gets the DFG to compile this function sooner.
- var origResult = result;
- for (var i = 1; i < 1000; i++)
- result = result ^ i;
- result = origResult > result ? origResult : result;
- return result;
-}
-noInline(foo);
-
-var iterations;
-var expectedResult;
-if (this.window) {
- // The layout test doesn't like too many iterations and may time out.
- iterations = 10000;
- expectedResult = 500050340;
-} else {
- iterations = 100000;
- expectedResult = 50000500340;
-}
-
-
-for (var i = 0; i <= iterations; i++) {
- o1.i = i;
- if (i % 2)
- result += foo(o1, 10);
- else
- result += foo(i, 10);
-}
-
-if (result != expectedResult)
- throw "Bad result: " + result;
Deleted: trunk/JSTests/microbenchmarks/ftl-polymorphic-lshift.js (227416 => 227417)
--- trunk/JSTests/microbenchmarks/ftl-polymorphic-lshift.js 2018-01-23 17:10:47 UTC (rev 227416)
+++ trunk/JSTests/microbenchmarks/ftl-polymorphic-lshift.js 2018-01-23 17:11:40 UTC (rev 227417)
@@ -1,52 +0,0 @@
-//@ runFTLNoCJIT
-var o1 = {
- i: 0,
- valueOf: function() { return this.i; }
-};
-
-result = 0;
-function foo(a, b) {
- var result = 0;
- for (var j = 0; j < 10; j++) {
- var temp;
- if (a > b)
- temp = a << b;
- else
- temp = b << 1;
- result += temp;
- }
-
- // Busy work just to allow the DFG and FTL to optimize this out. If the above causes
- // us to speculation fail out to the baseline, this busy work will take a lot longer
- // to run.
- // This loop below also gets the DFG to compile this function sooner.
- var origResult = result;
- for (var i = 1; i < 1000; i++)
- result = result << i;
- result = origResult > result ? origResult : result;
- return result;
-}
-noInline(foo);
-
-var iterations;
-var expectedResult;
-if (this.window) {
- // The layout test doesn't like too many iterations and may time out.
- iterations = 10000;
- expectedResult = 512050639000;
-} else {
- iterations = 100000;
- expectedResult = 51200511439000;
-}
-
-
-for (var i = 0; i <= iterations; i++) {
- o1.i = i;
- if (i % 2)
- result += foo(o1, 10);
- else
- result += foo(i, 10);
-}
-
-if (result != expectedResult)
- throw "Bad result: " + result;
Deleted: trunk/JSTests/microbenchmarks/ftl-polymorphic-rshift.js (227416 => 227417)
--- trunk/JSTests/microbenchmarks/ftl-polymorphic-rshift.js 2018-01-23 17:10:47 UTC (rev 227416)
+++ trunk/JSTests/microbenchmarks/ftl-polymorphic-rshift.js 2018-01-23 17:11:40 UTC (rev 227417)
@@ -1,52 +0,0 @@
-//@ runFTLNoCJIT
-var o1 = {
- i: 0,
- valueOf: function() { return this.i; }
-};
-
-result = 0;
-function foo(a, b) {
- var result = 0;
- for (var j = 0; j < 10; j++) {
- var temp;
- if (a > b)
- temp = a >> b;
- else
- temp = b >> 1;
- result += temp;
- }
-
- // Busy work just to allow the DFG and FTL to optimize this out. If the above causes
- // us to speculation fail out to the baseline, this busy work will take a lot longer
- // to run.
- // This loop below also gets the DFG to compile this function sooner.
- var origResult = result;
- for (var i = 1; i < 1000; i++)
- result = result >> i;
- result = origResult > result ? origResult : result;
- return result;
-}
-noInline(foo);
-
-var iterations;
-var expectedResult;
-if (this.window) {
- // The layout test doesn't like too many iterations and may time out.
- iterations = 10000;
- expectedResult = 439840;
-} else {
- iterations = 100000;
- expectedResult = 48330800;
-}
-
-
-for (var i = 0; i <= iterations; i++) {
- o1.i = i;
- if (i % 2)
- result += foo(o1, 10);
- else
- result += foo(i, 10);
-}
-
-if (result != expectedResult)
- throw "Bad result: " + result;
Deleted: trunk/JSTests/microbenchmarks/ftl-polymorphic-sub.js (227416 => 227417)
--- trunk/JSTests/microbenchmarks/ftl-polymorphic-sub.js 2018-01-23 17:10:47 UTC (rev 227416)
+++ trunk/JSTests/microbenchmarks/ftl-polymorphic-sub.js 2018-01-23 17:11:40 UTC (rev 227417)
@@ -1,54 +0,0 @@
-//@ runFTLNoCJIT
-var o1 = {
- i: 0,
- valueOf: function() { return this.i; }
-};
-var o2 = {
- i: 0,
- valueOf: function() { return this.i; }
-};
-
-result = 0;
-function foo(a, b) {
- var result = 0;
- for (var j = 0; j < 10; j++) {
- if (a > b)
- result += a - b;
- else
- result += b - 1;
- }
-
- // Busy work just to allow the DFG and FTL to optimize this out. If the above causes
- // us to speculation fail out to the baseline, this busy work will take a lot longer
- // to run.
- // This loop below also gets the DFG to compile this function sooner.
- var origResult = result;
- for (var i = 1; i < 1000; i++)
- result = result - i;
- result = origResult < result ? origResult : result;
- return result;
-}
-noInline(foo);
-
-var iterations;
-var expectedResult;
-if (this.window) {
- // The layout test doesn't like too many iterations and may time out.
- iterations = 10000;
- expectedResult = -4496448060;
-} else {
- iterations = 100000;
- expectedResult = 40001940;
-}
-
-
-for (var i = 0; i <= iterations; i++) {
- o1.i = i;
- if (i % 2)
- result += foo(o1, 10);
- else
- result += foo(i, 10);
-}
-
-if (result != expectedResult)
- throw "Bad result: " + result;
Deleted: trunk/JSTests/microbenchmarks/ftl-polymorphic-urshift.js (227416 => 227417)
--- trunk/JSTests/microbenchmarks/ftl-polymorphic-urshift.js 2018-01-23 17:10:47 UTC (rev 227416)
+++ trunk/JSTests/microbenchmarks/ftl-polymorphic-urshift.js 2018-01-23 17:11:40 UTC (rev 227417)
@@ -1,52 +0,0 @@
-//@ runFTLNoCJIT
-var o1 = {
- i: 0,
- valueOf: function() { return this.i; }
-};
-
-result = 0;
-function foo(a, b) {
- var result = 0;
- for (var j = 0; j < 10; j++) {
- var temp;
- if (a > b)
- temp = a >>> b;
- else
- temp = b >>> 1;
- result += temp;
- }
-
- // Busy work just to allow the DFG and FTL to optimize this out. If the above causes
- // us to speculation fail out to the baseline, this busy work will take a lot longer
- // to run.
- // This loop below also gets the DFG to compile this function sooner.
- var origResult = result;
- for (var i = 1; i < 1000; i++)
- result = result >>> i;
- result = origResult > result ? origResult : result;
- return result;
-}
-noInline(foo);
-
-var iterations;
-var expectedResult;
-if (this.window) {
- // The layout test doesn't like too many iterations and may time out.
- iterations = 10000;
- expectedResult = 439840;
-} else {
- iterations = 100000;
- expectedResult = 48330800;
-}
-
-
-for (var i = 0; i <= iterations; i++) {
- o1.i = i;
- if (i % 2)
- result += foo(o1, 10);
- else
- result += foo(i, 10);
-}
-
-if (result != expectedResult)
- throw "Bad result: " + result;
Deleted: trunk/JSTests/microbenchmarks/map-constant-key.js (227416 => 227417)
--- trunk/JSTests/microbenchmarks/map-constant-key.js 2018-01-23 17:10:47 UTC (rev 227416)
+++ trunk/JSTests/microbenchmarks/map-constant-key.js 2018-01-23 17:11:40 UTC (rev 227417)
@@ -1,49 +0,0 @@
-function assert(b) {
- if (!b)
- throw new Error("Bad assertion")
-}
-noInline(assert);
-function test(map, key, value) {
- let loadValue = eval(`${Math.random()}; let k = key; (function getValue() { return map.get(k); });`);
- noInline(loadValue);
- for (let i = 0; i < 1000000; i++) {
- assert(loadValue() === value);
- }
-}
-
-let reallyLongString = "";
-for (let i = 0; i < 60000; i++) {
- reallyLongString += "i";
-}
-reallyLongString.toString();
-
-let keys = [
- "foo",
- "fdashfdsahfdashfdsh",
- "rope" + "string",
- reallyLongString,
- 259243,
- 1238231.2138321,
- -92138.328,
- {foo: 25},
- Symbol("Hello world"),
- true,
- false,
- undefined,
- null,
- NaN,
- -0,
- function foo() {}
-];
-
-let start = Date.now();
-let map = new Map;
-let i = 0;
-for (let key of keys) {
- let value = {i: i++};
- map.set(key, value);
- test(map, key, value);
-}
-const verbose = false;
-if (verbose)
- print(Date.now() - start);
Deleted: trunk/JSTests/microbenchmarks/nested-function-parsing.js (227416 => 227417)
--- trunk/JSTests/microbenchmarks/nested-function-parsing.js 2018-01-23 17:10:47 UTC (rev 227416)
+++ trunk/JSTests/microbenchmarks/nested-function-parsing.js 2018-01-23 17:11:40 UTC (rev 227417)
@@ -1,21 +0,0 @@
-//@ skip
-
-(function() {
- var result = 0;
-
- for (var i = 0; i < 100; ++i) {
- var program = "(function f" + i + "() {\n";
- for (var j = 0; j < 1000; ++j) {
- program += "function f" + j + "() { return 0 && 1 && 2 && 3 && 4 && 5 && 6 && 7 && 8 && 9 && 10; }\n";
- }
- program += "})();\n";
- program += "return 0;\n";
-
- result += new Function(program)();
- }
-
- if (result != 0) {
- print("Bad result: " + result);
- throw "Error";
- }
-})();
Deleted: trunk/JSTests/microbenchmarks/rest-parameter-allocation-elimination.js (227416 => 227417)
--- trunk/JSTests/microbenchmarks/rest-parameter-allocation-elimination.js 2018-01-23 17:10:47 UTC (rev 227416)
+++ trunk/JSTests/microbenchmarks/rest-parameter-allocation-elimination.js 2018-01-23 17:11:40 UTC (rev 227417)
@@ -1,613 +0,0 @@
-function assert(b, m = "") {
- if (!b)
- throw new Error("Bad assertion: " + m);
-}
-noInline(assert);
-
-const iterations = 20000;
-
-function test1() {
- function bar(a, b, ...args) {
- return args.length;
- }
- noInline(bar);
- for (let i = 0; i < iterations; i++) {
- assert(bar() === 0, bar());
- assert(bar(i) === 0);
- assert(bar(i, i) === 0);
- assert(bar(i, i, i) === 1);
- assert(bar(i, i, i, i, i) === 3);
- }
-}
-
-function shallowEq(a, b) {
- if (a.length !== b.length)
- return false;
- for (let i = 0; i < a.length; i++) {
- if (a.length !== b.length)
- return false;
- }
- return true;
-}
-noInline(shallowEq);
-
-function test2() {
- function jaz(a, b, ...args) {
- let result = [];
- for (let i = 0; i < args.length; i++) {
- result.push(args[i]);
- }
- return result;
- }
- noInline(jaz);
-
- function jaz2(...args) {
- function kaz(a, b, ...args) {
- let result = [];
- for (let i = 0; i < args.length; i++) {
- result.push(args[i]);
- }
- return result;
- }
- return kaz.apply(null, args);
- }
- noInline(jaz2);
-
- for (let f of [jaz, jaz2]) {
- for (let i = 0; i < iterations; i++) {
- let r = f();
- assert(!r.length);
-
- r = f(i);
- assert(!r.length);
-
- r = f(i, i)
- assert(!r.length);
-
- r = f(i, i, i)
- assert(r.length === 1);
- assert(shallowEq(r, [i]));
-
- r = f(i, i, i)
- assert(r.length === 1);
- assert(shallowEq(r, [i]));
-
- r = f(i, i, i, i*2, i*4)
- assert(r.length === 3);
- assert(shallowEq(r, [i, i*2, i*4]));
- }
- }
-}
-
-function test3() {
- function foo(...args) {
- return args;
- }
- function baz(a, b, c, ...args) {
- return foo.apply(null, args);
- }
- function jaz(a, b, c, d, e, f) {
- return baz(a, b, c, d, e, f);
- }
- noInline(jaz);
-
- for (let i = 0; i < iterations; i++) {
- let r = jaz();
- assert(r.length === 3);
- assert(shallowEq(r, [undefined, undefined, undefined]));
-
- r = jaz(i, i);
- assert(r.length === 3);
- assert(shallowEq(r, [undefined, undefined, undefined]));
-
- r = jaz(i, i, i);
- assert(r.length === 3);
- assert(shallowEq(r, [undefined, undefined, undefined]));
-
- r = jaz(i, i, i, i);
- assert(r.length === 3);
- assert(shallowEq(r, [i, undefined, undefined]));
-
- r = jaz(i, i, i, i, i, i);
- assert(r.length === 3);
- assert(shallowEq(r, [i, i, i]));
- }
-}
-
-function test4() {
- function baz(...args) {
- return args;
- }
- function jaz(a, b, ...args) {
- return baz.apply(null, args);
- }
- noInline(jaz);
-
- for (let i = 0; i < iterations; i++) {
- let r = jaz();
- assert(r.length === 0);
-
- r = jaz(i);
- assert(r.length === 0);
-
- r = jaz(i, i);
- assert(r.length === 0);
-
- r = jaz(i, i, i);
- assert(r.length === 1);
- assert(shallowEq(r, [i]));
-
- r = jaz(i, i, i, i*10);
- assert(r.length === 2);
- assert(shallowEq(r, [i, i*10]));
-
- let o = {};
- r = jaz(i, i, i, i*10, o);
- assert(r.length === 3);
- assert(shallowEq(r, [i, i*10, o]));
- }
-}
-
-function test5() {
- function baz(...args) {
- return args;
- }
- noInline(baz);
- function jaz(a, b, ...args) {
- return baz.apply(null, args);
- }
- noInline(jaz);
-
- for (let i = 0; i < iterations; i++) {
- let r = jaz();
- assert(r.length === 0);
-
- r = jaz(i);
- assert(r.length === 0);
-
- r = jaz(i, i);
- assert(r.length === 0);
-
- r = jaz(i, i, i);
- assert(r.length === 1);
- assert(shallowEq(r, [i]));
-
- r = jaz(i, i, i, i*10);
- assert(r.length === 2);
- assert(shallowEq(r, [i, i*10]));
-
- let o = {};
- r = jaz(i, i, i, i*10, o);
- assert(r.length === 3);
- assert(shallowEq(r, [i, i*10, o]));
- }
-}
-
-function test6() {
- "use strict";
- function baz(...args) {
- return args;
- }
- noInline(baz);
- function jaz(a, b, ...args) {
- return baz.apply(null, args);
- }
- noInline(jaz);
-
- for (let i = 0; i < iterations; i++) {
- let r = jaz();
- assert(r.length === 0);
-
- r = jaz(i);
- assert(r.length === 0);
-
- r = jaz(i, i);
- assert(r.length === 0);
-
- r = jaz(i, i, i);
- assert(r.length === 1);
- assert(shallowEq(r, [i]));
-
- r = jaz(i, i, i, i*10);
- assert(r.length === 2);
- assert(shallowEq(r, [i, i*10]));
-
- let o = {};
- r = jaz(i, i, i, i*10, o);
- assert(r.length === 3);
- assert(shallowEq(r, [i, i*10, o]));
- }
-}
-
-function test7() {
- let shouldExit = false;
- function baz(...args) {
- if (shouldExit) {
- OSRExit();
- return [args.length, args[0], args[1], args[2]];
- }
- return [args.length, args[0], args[1], args[2]];
- }
- function jaz(a, b, ...args) {
- return baz.apply(null, args);
- }
- noInline(jaz);
-
- function check(i) {
- let [length, a, b, c] = jaz();
- assert(length === 0);
- assert(a === undefined);
- assert(b === undefined);
- assert(c === undefined);
-
- [length, a, b, c] = jaz(i);
- assert(length === 0);
- assert(a === undefined);
- assert(b === undefined);
- assert(c === undefined);
-
- [length, a, b, c] = jaz(i, i);
- assert(length === 0);
- assert(a === undefined);
- assert(b === undefined);
- assert(c === undefined);
-
- [length, a, b, c] = jaz(i, i, i);
- assert(length === 1);
- assert(a === i, JSON.stringify(a));
- assert(b === undefined);
- assert(c === undefined);
-
- [length, a, b, c] = jaz(i, i, i, i*10);
- assert(length === 2);
- assert(a === i);
- assert(b === i*10);
- assert(c === undefined);
-
- let o = {oooo:20};
- [length, a, b, c] = jaz(i, i, i, i*10, o);
- assert(length === 3);
- assert(a === i);
- assert(b === i*10);
- assert(c === o);
- }
-
- shouldExit = true;
- for (let i = 0; i < 400; i++) {
- check(i);
- }
-
- shouldExit = false;
- for (let i = 0; i < iterations; i++) {
- check(i);
- }
-
- shouldExit = false;
- check(10);
-}
-
-function test8() {
- let shouldExit = false;
- function baz(...args) {
- if (shouldExit) {
- OSRExit();
- return args;
- }
- return args;
- }
- function jaz(a, b, ...args) {
- return baz.apply(null, args);
- }
- noInline(jaz);
-
- function check(i) {
- let args = jaz();
- assert(args.length === 0);
-
- args = jaz(i);
- assert(args.length === 0);
-
- args = jaz(i, i);
- assert(args.length === 0);
-
- args = jaz(i, i, i);
- assert(args.length === 1);
- assert(args[0] === i);
-
- args = jaz(i, i, i, i*10);
- assert(args.length === 2);
- assert(args[0] === i);
- assert(args[1] === i*10);
-
- let o = {oooo:20};
- args = jaz(i, i, i, i*10, o);
- assert(args.length === 3);
- assert(args[0] === i);
- assert(args[1] === i*10);
- assert(args[2] === o);
- }
-
- shouldExit = true;
- for (let i = 0; i < 400; i++) {
- check(i);
- }
-
- shouldExit = false;
- for (let i = 0; i < iterations; i++) {
- check(i);
- }
-
- shouldExit = false;
- check(10);
-}
-
-function test9() {
- let shouldExit = false;
- function baz(a, ...args) {
- if (shouldExit) {
- OSRExit();
- return [args.length, args[0], args[1]];
- }
- return [args.length, args[0], args[1]];
- }
- function jaz(...args) {
- return baz.apply(null, args);
- }
- noInline(jaz);
-
- function check(i) {
- let [length, a, b] = jaz();
- assert(length === 0);
-
- [length, a, b] = jaz(i);
- assert(length === 0);
- assert(a === undefined);
- assert(b === undefined);
-
- [length, a, b] = jaz(i, i + 1);
- assert(length === 1);
- assert(a === i+1);
- assert(b === undefined);
-
- [length, a, b] = jaz(i, i+1, i+2);
- assert(length === 2);
- assert(a === i+1);
- assert(b === i+2);
-
- let o = {oooo:20};
- [length, a, b] = jaz(i, i+1, o);
- assert(length === 2);
- assert(a === i+1);
- assert(b === o);
- }
-
- shouldExit = true;
- for (let i = 0; i < 400; i++) {
- check(i);
- }
-
- shouldExit = false;
- for (let i = 0; i < iterations; i++) {
- check(i);
- }
-
- shouldExit = false;
- check(10);
-}
-
-function test10() {
- function baz(a, b, c, ...args) {
- return [args.length, args[0], args[1], args[2], args[3]];
- }
- function jaz(a, b, c, d, e, f) {
- return baz(a, b, c, d, e, f);
- }
- noInline(jaz);
-
- for (let i = 0; i < iterations; i++) {
- let [length, a, b, c, d] = jaz(1, 2, 3, 4, 5, 6);
- assert(length === 3);
- assert(a === 4);
- assert(b === 5);
- assert(c === 6);
- assert(d === undefined);
- }
-}
-
-function test11() {
- function bar(...args) {
- return args;
- }
- noInline(bar);
-
- function foo(a, b, c, d, ...args) {
- return bar.apply(null, args);
- }
- noInline(foo);
-
- function makeArguments(args) {
- return [1,2,3,4, ...args];
- }
- for (let i = 0; i < iterations; i++) {
- function test() { assert(shallowEq(a, foo.apply(null, makeArguments(a)))); }
- let a = [{}, 25, 50];
- test();
-
- a = [];
- test();
-
- a = [{foo: 20}];
- test();
-
- a = [10, 20, 30, 40, 50, 60, 70, 80];
- test();
- }
-}
-
-function test12() {
- "use strict";
- let thisValue = {};
- function getThisValue() { return thisValue; }
- noInline(getThisValue);
-
- function bar(...args) {
- assert(this === thisValue);
- return args;
- }
- noInline(bar);
-
- function foo(a, b, c, d, ...args) {
- return bar.apply(getThisValue(), args);
- }
- noInline(foo);
-
- function makeArguments(args) {
- return [1,2,3,4, ...args];
- }
- for (let i = 0; i < iterations; i++) {
- function test() { assert(shallowEq(a, foo.apply(null, makeArguments(a)))); }
- let a = [{}, 25, 50];
- test();
-
- a = [];
- test();
-
- a = [{foo: 20}];
- test();
-
- a = [10, 20, 30, 40, 50, 60, 70, 80];
- test();
- }
-}
-
-function test13() {
- "use strict";
- function bar(...args) {
- return args;
- }
- noInline(bar);
-
- function top(a, b, c, d, ...args) {
- return bar.apply(null, args);
- }
- function foo(...args) {
- let r = top.apply(null, args);
- return r;
- }
- noInline(foo);
-
- function makeArguments(args) {
- return [1,2,3,4, ...args];
- }
- for (let i = 0; i < iterations; i++) {
- function test() { assert(shallowEq(a, foo.apply(null, makeArguments(a)))); }
- let a = [{}, 25, 50];
- test();
-
- a = [];
- test();
-
- a = [10, 20, 30, 40, 50, 60, 70, 80];
- test();
- }
-}
-
-function test14() {
- "use strict";
- function bar(...args) {
- return args;
- }
- noInline(bar);
-
- function top(a, b, c, d, ...args) {
- return bar.apply(null, args);
- }
- function foo(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17) {
- return top(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17);
- }
- noInline(foo);
-
- function makeArguments(args) {
- let r = [1,2,3,4, ...args];
- while (r.length < foo.length)
- r.push(undefined);
- return r;
- }
- for (let i = 0; i < iterations; i++) {
- function test()
- {
- let args = makeArguments(a);
- assert(shallowEq(args.slice(4), foo.apply(null, args)));
- }
-
- let a = [{}, 25, 50];
- test();
-
- a = [];
- test();
-
- a = [10, 20, 30, 40, 50, 60, 70, 80];
- test();
- }
-}
-
-function test15() {
- "use strict";
- function bar(...args) {
- return args;
- }
- noInline(bar);
-
- function top(a, b, c, d, ...args) {
- return bar.apply(null, args);
- }
- function foo(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17) {
- let r = top(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17);
- return r;
- }
- noInline(foo);
-
- function makeArguments(args) {
- let r = [1,2,3,4, ...args];
- while (r.length < foo.length)
- r.push(undefined);
- return r;
- }
- for (let i = 0; i < iterations; i++) {
- function test()
- {
- let args = makeArguments(a);
- assert(shallowEq(args.slice(4), foo.apply(null, args)));
- }
-
- let a = [{}, 25, 50];
- test();
-
- a = [];
- test();
-
- a = [10, 20, 30, 40, 50, 60, 70, 80];
- test();
- }
-}
-
-let start = Date.now();
-test1();
-test2();
-test3();
-test4();
-test5();
-test6();
-test7();
-test8();
-test9();
-test10();
-test11();
-test12();
-test13();
-test14();
-test15();
-const verbose = false;
-if (verbose)
- print(Date.now() - start);
-
Deleted: trunk/JSTests/microbenchmarks/spread-large-array.js (227416 => 227417)
--- trunk/JSTests/microbenchmarks/spread-large-array.js 2018-01-23 17:10:47 UTC (rev 227416)
+++ trunk/JSTests/microbenchmarks/spread-large-array.js 2018-01-23 17:11:40 UTC (rev 227417)
@@ -1,39 +0,0 @@
-function foo(arg) {
- return [...arg];
-}
-noInline(foo);
-
-let arrays = [ ];
-const size = 500;
-{
- let arr = [];
- for (let i = 0; i < size; i++) {
- arr.push(i);
- }
- arrays.push(arr);
-}
-
-{
- let arr = [];
- for (let i = 0; i < size; i++) {
- arr.push(i + 0.5);
- }
- arrays.push(arr);
-}
-
-{
- let arr = [];
- for (let i = 0; i < size; i++) {
- arr.push({i: i});
- }
- arrays.push(arr);
-}
-
-let start = Date.now();
-for (let i = 0; i < 100000; i++) {
- let array = arrays[i % arrays.length];
- foo(array);
-}
-const verbose = false;
-if (verbose)
- print(Date.now() - start);
Deleted: trunk/JSTests/microbenchmarks/string-add-constant-folding.js (227416 => 227417)
--- trunk/JSTests/microbenchmarks/string-add-constant-folding.js 2018-01-23 17:10:47 UTC (rev 227416)
+++ trunk/JSTests/microbenchmarks/string-add-constant-folding.js 2018-01-23 17:11:40 UTC (rev 227417)
@@ -1,145 +0,0 @@
-function assert(b) {
- if (!b)
- throw new Error("Bad assertion.");
-}
-
-let tests = [];
-function test(f) {
- noInline(f);
- tests.push(f);
-}
-
-function runTests() {
- let start = Date.now();
- for (let f of tests) {
- for (let i = 0; i < 40000; i++)
- f();
- }
- const verbose = false;
- if (verbose)
- print(Date.now() - start);
-}
-
-function add(a,b) { return a + b; }
-noInline(add);
-
-test(function() {
- let a = "foo";
- let b = 20;
- assert(a + b === add(a, b));
- assert(b + a === add(b, a));
-});
-
-test(function() {
- let a = "foo";
- let b = null;
- assert(a + b === add(a, b));
- assert(b + a === add(b, a));
-});
-
-test(function() {
- let a = "foo";
- let b = undefined;
- assert(a + b === add(a, b));
- assert(b + a === add(b, a));
-});
-
-test(function() {
- let a = "foo";
- let b = 20.81239012821;
- assert(a + b === add(a, b));
- assert(b + a === add(b, a));
-});
-
-test(function() {
- let a = "foo";
- let b = true;
- assert(a + b === add(a, b));
- assert(b + a === add(b, a));
-});
-
-test(function() {
- let a = "foo";
- let b = false;
- assert(a + b === add(a, b));
- assert(b + a === add(b, a));
-});
-
-test(function() {
- let a = "foo";
- let b = NaN;
- assert(a + b === add(a, b));
- assert(b + a === add(b, a));
-});
-
-test(function() {
- let a = -0;
- let b = "foo";
- assert(a + b === add(a, b));
- assert(b + a === add(b, a));
-});
-
-test(function() {
- let a = "foo";
- let b = 0.0;
- assert(a + b === add(a, b));
- assert(b + a === add(b, a));
-});
-
-test(function() {
- let a = "foo";
- let b = Infinity;
- assert(a + b === add(a, b));
- assert(b + a === add(b, a));
-});
-
-test(function() {
- let a = -Infinity;
- let b = "foo";
- assert(a + b === add(a, b));
- assert(b + a === add(b, a));
-});
-
-test(function() {
- let a = "foo";
- let b = 1e10;
- assert(a + b === add(a, b));
- assert(b + a === add(b, a));
-});
-
-test(function() {
- let a = "foo";
- let b = 1e-10;
- assert(a + b === add(a, b));
- assert(b + a === add(b, a));
-});
-
-test(function() {
- let a = "foo";
- let b = 1e5;
- assert(a + b === add(a, b));
- assert(b + a === add(b, a));
-});
-
-test(function() {
- let a = "foo";
- let b = 1e-5;
- assert(a + b === add(a, b));
- assert(b + a === add(b, a));
-});
-
-test(function() {
- let a = "foo";
- let b = 1e-40;
- assert(a + b === add(a, b));
- assert(b + a === add(b, a));
-});
-
-test(function() {
- let a = "foo";
- let b = 1e40;
- assert(a + b === add(a, b));
- assert(b + a === add(b, a));
-});
-
-runTests();
Deleted: trunk/JSTests/microbenchmarks/to-lower-case.js (227416 => 227417)
--- trunk/JSTests/microbenchmarks/to-lower-case.js 2018-01-23 17:10:47 UTC (rev 227416)
+++ trunk/JSTests/microbenchmarks/to-lower-case.js 2018-01-23 17:11:40 UTC (rev 227417)
@@ -1,36 +0,0 @@
-function assert(b) {
- if (!b)
- throw new Error("Bad assertion");
-}
-noInline(assert);
-
-let tests = [
- ["foo", "foo"],
- ["foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo", "foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo"],
-];
-
-function foo(a) {
- return a.toLowerCase();
-}
-noInline(foo);
-
-function bar(a) {
- a.toLowerCase();
- assert(true); // side effects
- a.toLowerCase();
-}
-noInline(bar);
-
-let start = Date.now();
-for (let i = 0; i < 500000; i++) {
- for (let i = 0; i < tests.length; i++) {
- let test = tests[i][0];
- let result = tests[i][1];
- assert(foo(test) === result);
- bar(test);
- }
-}
-
-const verbose = false;
-if (verbose)
- print(Date.now() - start);
Deleted: trunk/JSTests/microbenchmarks/undefined-property-access.js (227416 => 227417)
--- trunk/JSTests/microbenchmarks/undefined-property-access.js 2018-01-23 17:10:47 UTC (rev 227416)
+++ trunk/JSTests/microbenchmarks/undefined-property-access.js 2018-01-23 17:11:40 UTC (rev 227417)
@@ -1,48 +0,0 @@
-var someGlobal;
-
-// This is a simple speed test. It should go fast.
-
-function foo() {
- var myObject = {};
- for (var i = 0; i < 10000000; ++i) {
- someGlobal = myObject.undefinedProperty;
- }
- return someGlobal;
-}
-result = foo();
-if (result != undefined)
- throw new Error("Bad result: " + result);
-
-// This test checks that a cached property lookup miss doesn't continue to fire when the property suddenly appears on the object.
-
-function bar() {
- var myObject = {};
- for (var i = 0; i < 100000000; ++i) {
- someGlobal = myObject.someProperty;
- if (i == 50000000)
- myObject.someProperty = 1;
- }
- return someGlobal;
-}
-var result = bar();
-if (result != 1)
- throw new Error("Bad result: " + result);
-someGlobal = undefined;
-
-// This test checks that a cached property lookup miss doesn't continue to fire when the property suddenly appears on the object's prototype.
-
-function baz() {
- var myPrototype = {}
- var myObject = {};
- myObject.__proto__ = myPrototype;
- for (var i = 0; i < 100000000; ++i) {
- someGlobal = myObject.someProperty;
- if (i == 50000000)
- myPrototype.someProperty = 2;
- }
- return someGlobal;
-}
-var result = baz();
-if (result != 2)
- throw new Error("Bad result: " + result);
-
Copied: trunk/JSTests/slowMicrobenchmarks/array-push-3.js (from rev 227416, trunk/JSTests/microbenchmarks/array-push-3.js) (0 => 227417)
--- trunk/JSTests/slowMicrobenchmarks/array-push-3.js (rev 0)
+++ trunk/JSTests/slowMicrobenchmarks/array-push-3.js 2018-01-23 17:11:40 UTC (rev 227417)
@@ -0,0 +1,9 @@
+function arrayPush3() {
+ var ret = [1];
+ ret.push(1, 2, 3);
+ return ret;
+}
+noInline(arrayPush3);
+
+for (var i = 0; i < 1e7; ++i)
+ arrayPush3();
Copied: trunk/JSTests/slowMicrobenchmarks/bigswitch-indirect-symbol-or-undefined.js (from rev 227416, trunk/JSTests/microbenchmarks/bigswitch-indirect-symbol-or-undefined.js) (0 => 227417)
--- trunk/JSTests/slowMicrobenchmarks/bigswitch-indirect-symbol-or-undefined.js (rev 0)
+++ trunk/JSTests/slowMicrobenchmarks/bigswitch-indirect-symbol-or-undefined.js 2018-01-23 17:11:40 UTC (rev 227417)
@@ -0,0 +1,279 @@
+var thing0 = Symbol();
+var thing1 = Symbol();
+var thing2 = Symbol();
+var thing3 = Symbol();
+var thing4 = Symbol();
+var thing5 = Symbol();
+var thing6 = Symbol();
+var thing7 = Symbol();
+var thing8 = Symbol();
+var thing9 = Symbol();
+var thing10 = Symbol();
+var thing11 = Symbol();
+var thing12 = Symbol();
+var thing13 = Symbol();
+var thing14 = Symbol();
+var thing15 = Symbol();
+var thing16 = Symbol();
+var thing17 = Symbol();
+var thing18 = Symbol();
+var thing19 = Symbol();
+var thing20 = Symbol();
+var thing21 = Symbol();
+var thing22 = Symbol();
+var thing23 = Symbol();
+var thing24 = Symbol();
+var thing25 = Symbol();
+var thing26 = Symbol();
+var thing27 = Symbol();
+var thing28 = Symbol();
+var thing29 = Symbol();
+var thing30 = Symbol();
+var thing31 = Symbol();
+var thing32 = Symbol();
+var thing33 = Symbol();
+var thing34 = Symbol();
+var thing35 = Symbol();
+var thing36 = Symbol();
+var thing37 = Symbol();
+var thing38 = Symbol();
+var thing39 = Symbol();
+var thing40 = Symbol();
+var thing41 = Symbol();
+var thing42 = Symbol();
+var thing43 = Symbol();
+var thing44 = Symbol();
+var thing45 = Symbol();
+var thing46 = Symbol();
+var thing47 = Symbol();
+var thing48 = Symbol();
+var thing49 = Symbol();
+var thing50 = Symbol();
+var thing51 = Symbol();
+var thing52 = Symbol();
+var thing53 = Symbol();
+var thing54 = Symbol();
+var thing55 = Symbol();
+var thing56 = Symbol();
+var thing57 = Symbol();
+var thing58 = Symbol();
+var thing59 = Symbol();
+var thing60 = Symbol();
+var thing61 = Symbol();
+var thing62 = Symbol();
+
+var things = [];
+for (var i = 0; i < 63; ++i)
+ things.push(eval("thing" + i));
+
+function foo(o) {
+ var result = 0;
+ for (var i = 0; i < 1000; ++i) {
+ var value = things[i & 63];
+ switch (value) {
+ case thing0:
+ result += o.a;
+ break;
+ case thing1:
+ result += o.b;
+ break;
+ case thing2:
+ result += o.c;
+ break;
+ case thing3:
+ result += o.d;
+ break;
+ case thing4:
+ result += o.e;
+ break;
+ case thing5:
+ result += o.f;
+ break;
+ case thing6:
+ result += o.g;
+ break;
+ case thing7:
+ result += o.h;
+ break;
+ case thing8:
+ result += o.i;
+ break;
+ case thing9:
+ result += o.j;
+ break;
+ case thing10:
+ result += o.k;
+ break;
+ case thing11:
+ result += o.a;
+ break;
+ case thing12:
+ result += o.b;
+ break;
+ case thing13:
+ result += o.c;
+ break;
+ case thing14:
+ result += o.d;
+ break;
+ case thing15:
+ result += o.e;
+ break;
+ case thing16:
+ result += o.f;
+ break;
+ case thing17:
+ result += o.g;
+ break;
+ case thing18:
+ result += o.h;
+ break;
+ case thing19:
+ result += o.i;
+ break;
+ case thing20:
+ result += o.j;
+ break;
+ case thing21:
+ result += o.k;
+ break;
+ case thing22:
+ result += o.k;
+ break;
+ case thing23:
+ result += o.a;
+ break;
+ case thing24:
+ result += o.b;
+ break;
+ case thing25:
+ result += o.c;
+ break;
+ case thing26:
+ result += o.d;
+ break;
+ case thing27:
+ result += o.e;
+ break;
+ case thing28:
+ result += o.f;
+ break;
+ case thing29:
+ result += o.g;
+ break;
+ case thing30:
+ result += o.h;
+ break;
+ case thing31:
+ result += o.i;
+ break;
+ case thing32:
+ result += o.j;
+ break;
+ case thing33:
+ result += o.k;
+ break;
+ case thing34:
+ result += o.k;
+ break;
+ case thing35:
+ result += o.k;
+ break;
+ case thing36:
+ result += o.a;
+ break;
+ case thing37:
+ result += o.b;
+ break;
+ case thing38:
+ result += o.c;
+ break;
+ case thing39:
+ result += o.d;
+ break;
+ case thing40:
+ result += o.e;
+ break;
+ case thing41:
+ result += o.f;
+ break;
+ case thing42:
+ result += o.g;
+ break;
+ case thing43:
+ result += o.h;
+ break;
+ case thing44:
+ result += o.i;
+ break;
+ case thing45:
+ result += o.j;
+ break;
+ case thing46:
+ result += o.k;
+ break;
+ case thing47:
+ result += o.i;
+ break;
+ case thing48:
+ result += o.j;
+ break;
+ case thing49:
+ result += o.k;
+ break;
+ case thing50:
+ result += o.k;
+ break;
+ case thing51:
+ result += o.k;
+ break;
+ case thing52:
+ result += o.a;
+ break;
+ case thing53:
+ result += o.b;
+ break;
+ case thing54:
+ result += o.c;
+ break;
+ case thing55:
+ result += o.d;
+ break;
+ case thing56:
+ result += o.e;
+ break;
+ case thing57:
+ result += o.f;
+ break;
+ case thing58:
+ result += o.g;
+ break;
+ case thing59:
+ result += o.h;
+ break;
+ case thing60:
+ result += o.i;
+ break;
+ case thing61:
+ result += o.j;
+ break;
+ case thing62:
+ result += o.k;
+ break;
+ default:
+ result += o.z;
+ break;
+ }
+ }
+ return result;
+}
+
+(function() {
+ var o = {a:1, b:2, c:3, d:4, e:5, f:6, g:7, h:8, i:9, j:10, k:11, z:100};
+ var result = 0;
+ for (var i = 0; i < 1000; ++i)
+ result += foo(o);
+ if (result != 7966000)
+ throw "Error: bad result: " + result;
+})();
+
Copied: trunk/JSTests/slowMicrobenchmarks/double-to-int32.js (from rev 227416, trunk/JSTests/microbenchmarks/double-to-int32.js) (0 => 227417)
--- trunk/JSTests/slowMicrobenchmarks/double-to-int32.js (rev 0)
+++ trunk/JSTests/slowMicrobenchmarks/double-to-int32.js 2018-01-23 17:11:40 UTC (rev 227417)
@@ -0,0 +1,30 @@
+// This microbenchmarks validates that the fix in https://webkit.org/b/170961
+// does not regress the performance gains from r211670: <http://trac.webkit.org/changeset/211670>.
+// r211670 reduces the size of operationToInt32SensibleSlow() for handling double numbers with
+// binary exponent 31. Hence, this microbenchmark stresses doubleToIn32 conversion on
+// numbers with binary exponents in the vicinity of 31.
+
+let doubleValues = [
+ 2.147483648e8, // exp = 27
+ 2.147483648e9, // exp = 31
+ 2.147483648e10, // exp = 34
+];
+
+function test(q, r, s, t, u, v, w, x, y, z) {
+ // Do a lot of double to int32 conversions to weigh more on the conversion.
+ return q|0 + r|0 + s|0 + t|0 + u|0 + v|0 + w|0 + x|0 + y|0 + z|0;
+}
+noInline(test);
+
+var result = 0;
+let length = doubleValues.length;
+for (var i = 0; i < 1000000; ++i) {
+ for (var j = 0; j < length; j++) {
+ var value = doubleValues[j];
+ result |= test(value, value, value, value, value, value, value, value, value, value);
+ }
+}
+
+if (result != -1932735284) {
+ throw "Bad result: " + result;
+}
Copied: trunk/JSTests/slowMicrobenchmarks/fake-iterators-that-throw-when-finished.js (from rev 227416, trunk/JSTests/microbenchmarks/fake-iterators-that-throw-when-finished.js) (0 => 227417)
--- trunk/JSTests/slowMicrobenchmarks/fake-iterators-that-throw-when-finished.js (rev 0)
+++ trunk/JSTests/slowMicrobenchmarks/fake-iterators-that-throw-when-finished.js 2018-01-23 17:11:40 UTC (rev 227417)
@@ -0,0 +1,78 @@
+function assert(b) {
+ if (!b)
+ throw new Error("Bad");
+}
+
+class Numbers {
+ constructor(limit = 100) {
+ this.limit = limit;
+ this.item = 0;
+ }
+
+ next() {
+ if (this.item >= this.limit)
+ throw "done";
+ return this.item++;
+ }
+}
+
+function transpose(I, f) {
+ return class Transpose {
+ constructor(...args) {
+ this.iterator = new I(...args);
+ }
+
+ next() {
+ return f(this.iterator.next());
+ }
+ };
+}
+
+let EvenNumbers = transpose(Numbers, (x)=>x*2);
+function verifyEven(prev, cur) {
+ assert(cur.value % 2 === 0);
+ assert(!prev.value || prev.value+2 === cur.value);
+}
+
+let StringNumbers = transpose(Numbers, (x)=>`${x}`);
+function verifyString(_, cur) {
+ assert(cur.value === `${cur.value}`);
+}
+
+let iterators = [
+ [Numbers, function() {}],
+ [Numbers, function() {}],
+ [StringNumbers, verifyString],
+ [EvenNumbers, verifyEven],
+ [EvenNumbers, verifyEven],
+];
+
+function foo(i) {}
+noInline(foo);
+
+function runIterators() {
+ for (let [iterator, verify] of iterators) {
+ let i = new iterator;
+ let prev = {};
+ while (true) {
+ let cur = {};
+ try {
+ cur.value = i.next();
+ verify(prev, cur);
+ } catch(e) {
+ if (e !== "done")
+ throw new Error("Bad: " + e);
+ break;
+ }
+ prev = cur;
+ }
+ }
+}
+
+{
+ let start = Date.now();
+ for (let i = 0; i < 5000; ++i)
+ runIterators();
+ if (false)
+ print(Date.now() - start);
+}
Copied: trunk/JSTests/slowMicrobenchmarks/ftl-polymorphic-bitand.js (from rev 227416, trunk/JSTests/microbenchmarks/ftl-polymorphic-bitand.js) (0 => 227417)
--- trunk/JSTests/slowMicrobenchmarks/ftl-polymorphic-bitand.js (rev 0)
+++ trunk/JSTests/slowMicrobenchmarks/ftl-polymorphic-bitand.js 2018-01-23 17:11:40 UTC (rev 227417)
@@ -0,0 +1,52 @@
+//@ runFTLNoCJIT
+var o1 = {
+ i: 0,
+ valueOf: function() { return this.i; }
+};
+
+result = 0;
+function foo(a, b) {
+ var result = 0;
+ for (var j = 0; j < 10; j++) {
+ var temp;
+ if (a > b)
+ temp = a & b;
+ else
+ temp = b & 1;
+ result += temp;
+ }
+
+ // Busy work just to allow the DFG and FTL to optimize this out. If the above causes
+ // us to speculation fail out to the baseline, this busy work will take a lot longer
+ // to run.
+ // This loop below also gets the DFG to compile this function sooner.
+ var origResult = result;
+ for (var i = 1; i < 1000; i++)
+ result = result & i;
+ result = origResult > result ? origResult : result;
+ return result;
+}
+noInline(foo);
+
+var iterations;
+var expectedResult;
+if (this.window) {
+ // The layout test doesn't like too many iterations and may time out.
+ iterations = 10000;
+ expectedResult = 499660;
+} else {
+ iterations = 100000;
+ expectedResult = 4999660;
+}
+
+
+for (var i = 0; i <= iterations; i++) {
+ o1.i = i;
+ if (i % 2)
+ result += foo(o1, 10);
+ else
+ result += foo(i, 10);
+}
+
+if (result != expectedResult)
+ throw "Bad result: " + result;
Copied: trunk/JSTests/slowMicrobenchmarks/ftl-polymorphic-bitor.js (from rev 227416, trunk/JSTests/microbenchmarks/ftl-polymorphic-bitor.js) (0 => 227417)
--- trunk/JSTests/slowMicrobenchmarks/ftl-polymorphic-bitor.js (rev 0)
+++ trunk/JSTests/slowMicrobenchmarks/ftl-polymorphic-bitor.js 2018-01-23 17:11:40 UTC (rev 227417)
@@ -0,0 +1,52 @@
+//@ runFTLNoCJIT
+var o1 = {
+ i: 0,
+ valueOf: function() { return this.i; }
+};
+
+result = 0;
+function foo(a, b) {
+ var result = 0;
+ for (var j = 0; j < 10; j++) {
+ var temp;
+ if (a > b)
+ temp = a | b;
+ else
+ temp = b | 1;
+ result += temp;
+ }
+
+ // Busy work just to allow the DFG and FTL to optimize this out. If the above causes
+ // us to speculation fail out to the baseline, this busy work will take a lot longer
+ // to run.
+ // This loop below also gets the DFG to compile this function sooner.
+ var origResult = result;
+ for (var i = 1; i < 1000; i++)
+ result = result | i;
+ result = origResult > result ? origResult : result;
+ return result;
+}
+noInline(foo);
+
+var iterations;
+var expectedResult;
+if (this.window) {
+ // The layout test doesn't like too many iterations and may time out.
+ iterations = 10000;
+ expectedResult = 505700591;
+} else {
+ iterations = 100000;
+ expectedResult = 50056912223;
+}
+
+
+for (var i = 0; i <= iterations; i++) {
+ o1.i = i;
+ if (i % 2)
+ result += foo(o1, 10);
+ else
+ result += foo(i, 10);
+}
+
+if (result != expectedResult)
+ throw "Bad result: " + result;
Copied: trunk/JSTests/slowMicrobenchmarks/ftl-polymorphic-bitxor.js (from rev 227416, trunk/JSTests/microbenchmarks/ftl-polymorphic-bitxor.js) (0 => 227417)
--- trunk/JSTests/slowMicrobenchmarks/ftl-polymorphic-bitxor.js (rev 0)
+++ trunk/JSTests/slowMicrobenchmarks/ftl-polymorphic-bitxor.js 2018-01-23 17:11:40 UTC (rev 227417)
@@ -0,0 +1,52 @@
+//@ runFTLNoCJIT
+var o1 = {
+ i: 0,
+ valueOf: function() { return this.i; }
+};
+
+result = 0;
+function foo(a, b) {
+ var result = 0;
+ for (var j = 0; j < 10; j++) {
+ var temp;
+ if (a > b)
+ temp = a ^ b;
+ else
+ temp = b ^ 1;
+ result += temp;
+ }
+
+ // Busy work just to allow the DFG and FTL to optimize this out. If the above causes
+ // us to speculation fail out to the baseline, this busy work will take a lot longer
+ // to run.
+ // This loop below also gets the DFG to compile this function sooner.
+ var origResult = result;
+ for (var i = 1; i < 1000; i++)
+ result = result ^ i;
+ result = origResult > result ? origResult : result;
+ return result;
+}
+noInline(foo);
+
+var iterations;
+var expectedResult;
+if (this.window) {
+ // The layout test doesn't like too many iterations and may time out.
+ iterations = 10000;
+ expectedResult = 500050340;
+} else {
+ iterations = 100000;
+ expectedResult = 50000500340;
+}
+
+
+for (var i = 0; i <= iterations; i++) {
+ o1.i = i;
+ if (i % 2)
+ result += foo(o1, 10);
+ else
+ result += foo(i, 10);
+}
+
+if (result != expectedResult)
+ throw "Bad result: " + result;
Copied: trunk/JSTests/slowMicrobenchmarks/ftl-polymorphic-lshift.js (from rev 227416, trunk/JSTests/microbenchmarks/ftl-polymorphic-lshift.js) (0 => 227417)
--- trunk/JSTests/slowMicrobenchmarks/ftl-polymorphic-lshift.js (rev 0)
+++ trunk/JSTests/slowMicrobenchmarks/ftl-polymorphic-lshift.js 2018-01-23 17:11:40 UTC (rev 227417)
@@ -0,0 +1,52 @@
+//@ runFTLNoCJIT
+var o1 = {
+ i: 0,
+ valueOf: function() { return this.i; }
+};
+
+result = 0;
+function foo(a, b) {
+ var result = 0;
+ for (var j = 0; j < 10; j++) {
+ var temp;
+ if (a > b)
+ temp = a << b;
+ else
+ temp = b << 1;
+ result += temp;
+ }
+
+ // Busy work just to allow the DFG and FTL to optimize this out. If the above causes
+ // us to speculation fail out to the baseline, this busy work will take a lot longer
+ // to run.
+ // This loop below also gets the DFG to compile this function sooner.
+ var origResult = result;
+ for (var i = 1; i < 1000; i++)
+ result = result << i;
+ result = origResult > result ? origResult : result;
+ return result;
+}
+noInline(foo);
+
+var iterations;
+var expectedResult;
+if (this.window) {
+ // The layout test doesn't like too many iterations and may time out.
+ iterations = 10000;
+ expectedResult = 512050639000;
+} else {
+ iterations = 100000;
+ expectedResult = 51200511439000;
+}
+
+
+for (var i = 0; i <= iterations; i++) {
+ o1.i = i;
+ if (i % 2)
+ result += foo(o1, 10);
+ else
+ result += foo(i, 10);
+}
+
+if (result != expectedResult)
+ throw "Bad result: " + result;
Copied: trunk/JSTests/slowMicrobenchmarks/ftl-polymorphic-rshift.js (from rev 227416, trunk/JSTests/microbenchmarks/ftl-polymorphic-rshift.js) (0 => 227417)
--- trunk/JSTests/slowMicrobenchmarks/ftl-polymorphic-rshift.js (rev 0)
+++ trunk/JSTests/slowMicrobenchmarks/ftl-polymorphic-rshift.js 2018-01-23 17:11:40 UTC (rev 227417)
@@ -0,0 +1,52 @@
+//@ runFTLNoCJIT
+var o1 = {
+ i: 0,
+ valueOf: function() { return this.i; }
+};
+
+result = 0;
+function foo(a, b) {
+ var result = 0;
+ for (var j = 0; j < 10; j++) {
+ var temp;
+ if (a > b)
+ temp = a >> b;
+ else
+ temp = b >> 1;
+ result += temp;
+ }
+
+ // Busy work just to allow the DFG and FTL to optimize this out. If the above causes
+ // us to speculation fail out to the baseline, this busy work will take a lot longer
+ // to run.
+ // This loop below also gets the DFG to compile this function sooner.
+ var origResult = result;
+ for (var i = 1; i < 1000; i++)
+ result = result >> i;
+ result = origResult > result ? origResult : result;
+ return result;
+}
+noInline(foo);
+
+var iterations;
+var expectedResult;
+if (this.window) {
+ // The layout test doesn't like too many iterations and may time out.
+ iterations = 10000;
+ expectedResult = 439840;
+} else {
+ iterations = 100000;
+ expectedResult = 48330800;
+}
+
+
+for (var i = 0; i <= iterations; i++) {
+ o1.i = i;
+ if (i % 2)
+ result += foo(o1, 10);
+ else
+ result += foo(i, 10);
+}
+
+if (result != expectedResult)
+ throw "Bad result: " + result;
Copied: trunk/JSTests/slowMicrobenchmarks/ftl-polymorphic-sub.js (from rev 227416, trunk/JSTests/microbenchmarks/ftl-polymorphic-sub.js) (0 => 227417)
--- trunk/JSTests/slowMicrobenchmarks/ftl-polymorphic-sub.js (rev 0)
+++ trunk/JSTests/slowMicrobenchmarks/ftl-polymorphic-sub.js 2018-01-23 17:11:40 UTC (rev 227417)
@@ -0,0 +1,54 @@
+//@ runFTLNoCJIT
+var o1 = {
+ i: 0,
+ valueOf: function() { return this.i; }
+};
+var o2 = {
+ i: 0,
+ valueOf: function() { return this.i; }
+};
+
+result = 0;
+function foo(a, b) {
+ var result = 0;
+ for (var j = 0; j < 10; j++) {
+ if (a > b)
+ result += a - b;
+ else
+ result += b - 1;
+ }
+
+ // Busy work just to allow the DFG and FTL to optimize this out. If the above causes
+ // us to speculation fail out to the baseline, this busy work will take a lot longer
+ // to run.
+ // This loop below also gets the DFG to compile this function sooner.
+ var origResult = result;
+ for (var i = 1; i < 1000; i++)
+ result = result - i;
+ result = origResult < result ? origResult : result;
+ return result;
+}
+noInline(foo);
+
+var iterations;
+var expectedResult;
+if (this.window) {
+ // The layout test doesn't like too many iterations and may time out.
+ iterations = 10000;
+ expectedResult = -4496448060;
+} else {
+ iterations = 100000;
+ expectedResult = 40001940;
+}
+
+
+for (var i = 0; i <= iterations; i++) {
+ o1.i = i;
+ if (i % 2)
+ result += foo(o1, 10);
+ else
+ result += foo(i, 10);
+}
+
+if (result != expectedResult)
+ throw "Bad result: " + result;
Copied: trunk/JSTests/slowMicrobenchmarks/ftl-polymorphic-urshift.js (from rev 227416, trunk/JSTests/microbenchmarks/ftl-polymorphic-urshift.js) (0 => 227417)
--- trunk/JSTests/slowMicrobenchmarks/ftl-polymorphic-urshift.js (rev 0)
+++ trunk/JSTests/slowMicrobenchmarks/ftl-polymorphic-urshift.js 2018-01-23 17:11:40 UTC (rev 227417)
@@ -0,0 +1,52 @@
+//@ runFTLNoCJIT
+var o1 = {
+ i: 0,
+ valueOf: function() { return this.i; }
+};
+
+result = 0;
+function foo(a, b) {
+ var result = 0;
+ for (var j = 0; j < 10; j++) {
+ var temp;
+ if (a > b)
+ temp = a >>> b;
+ else
+ temp = b >>> 1;
+ result += temp;
+ }
+
+ // Busy work just to allow the DFG and FTL to optimize this out. If the above causes
+ // us to speculation fail out to the baseline, this busy work will take a lot longer
+ // to run.
+ // This loop below also gets the DFG to compile this function sooner.
+ var origResult = result;
+ for (var i = 1; i < 1000; i++)
+ result = result >>> i;
+ result = origResult > result ? origResult : result;
+ return result;
+}
+noInline(foo);
+
+var iterations;
+var expectedResult;
+if (this.window) {
+ // The layout test doesn't like too many iterations and may time out.
+ iterations = 10000;
+ expectedResult = 439840;
+} else {
+ iterations = 100000;
+ expectedResult = 48330800;
+}
+
+
+for (var i = 0; i <= iterations; i++) {
+ o1.i = i;
+ if (i % 2)
+ result += foo(o1, 10);
+ else
+ result += foo(i, 10);
+}
+
+if (result != expectedResult)
+ throw "Bad result: " + result;
Copied: trunk/JSTests/slowMicrobenchmarks/map-constant-key.js (from rev 227416, trunk/JSTests/microbenchmarks/map-constant-key.js) (0 => 227417)
--- trunk/JSTests/slowMicrobenchmarks/map-constant-key.js (rev 0)
+++ trunk/JSTests/slowMicrobenchmarks/map-constant-key.js 2018-01-23 17:11:40 UTC (rev 227417)
@@ -0,0 +1,49 @@
+function assert(b) {
+ if (!b)
+ throw new Error("Bad assertion")
+}
+noInline(assert);
+function test(map, key, value) {
+ let loadValue = eval(`${Math.random()}; let k = key; (function getValue() { return map.get(k); });`);
+ noInline(loadValue);
+ for (let i = 0; i < 1000000; i++) {
+ assert(loadValue() === value);
+ }
+}
+
+let reallyLongString = "";
+for (let i = 0; i < 60000; i++) {
+ reallyLongString += "i";
+}
+reallyLongString.toString();
+
+let keys = [
+ "foo",
+ "fdashfdsahfdashfdsh",
+ "rope" + "string",
+ reallyLongString,
+ 259243,
+ 1238231.2138321,
+ -92138.328,
+ {foo: 25},
+ Symbol("Hello world"),
+ true,
+ false,
+ undefined,
+ null,
+ NaN,
+ -0,
+ function foo() {}
+];
+
+let start = Date.now();
+let map = new Map;
+let i = 0;
+for (let key of keys) {
+ let value = {i: i++};
+ map.set(key, value);
+ test(map, key, value);
+}
+const verbose = false;
+if (verbose)
+ print(Date.now() - start);
Copied: trunk/JSTests/slowMicrobenchmarks/nested-function-parsing.js (from rev 227416, trunk/JSTests/microbenchmarks/nested-function-parsing.js) (0 => 227417)
--- trunk/JSTests/slowMicrobenchmarks/nested-function-parsing.js (rev 0)
+++ trunk/JSTests/slowMicrobenchmarks/nested-function-parsing.js 2018-01-23 17:11:40 UTC (rev 227417)
@@ -0,0 +1,21 @@
+//@ skip
+
+(function() {
+ var result = 0;
+
+ for (var i = 0; i < 100; ++i) {
+ var program = "(function f" + i + "() {\n";
+ for (var j = 0; j < 1000; ++j) {
+ program += "function f" + j + "() { return 0 && 1 && 2 && 3 && 4 && 5 && 6 && 7 && 8 && 9 && 10; }\n";
+ }
+ program += "})();\n";
+ program += "return 0;\n";
+
+ result += new Function(program)();
+ }
+
+ if (result != 0) {
+ print("Bad result: " + result);
+ throw "Error";
+ }
+})();
Copied: trunk/JSTests/slowMicrobenchmarks/rest-parameter-allocation-elimination.js (from rev 227416, trunk/JSTests/microbenchmarks/rest-parameter-allocation-elimination.js) (0 => 227417)
--- trunk/JSTests/slowMicrobenchmarks/rest-parameter-allocation-elimination.js (rev 0)
+++ trunk/JSTests/slowMicrobenchmarks/rest-parameter-allocation-elimination.js 2018-01-23 17:11:40 UTC (rev 227417)
@@ -0,0 +1,613 @@
+function assert(b, m = "") {
+ if (!b)
+ throw new Error("Bad assertion: " + m);
+}
+noInline(assert);
+
+const iterations = 20000;
+
+function test1() {
+ function bar(a, b, ...args) {
+ return args.length;
+ }
+ noInline(bar);
+ for (let i = 0; i < iterations; i++) {
+ assert(bar() === 0, bar());
+ assert(bar(i) === 0);
+ assert(bar(i, i) === 0);
+ assert(bar(i, i, i) === 1);
+ assert(bar(i, i, i, i, i) === 3);
+ }
+}
+
+function shallowEq(a, b) {
+ if (a.length !== b.length)
+ return false;
+ for (let i = 0; i < a.length; i++) {
+ if (a.length !== b.length)
+ return false;
+ }
+ return true;
+}
+noInline(shallowEq);
+
+function test2() {
+ function jaz(a, b, ...args) {
+ let result = [];
+ for (let i = 0; i < args.length; i++) {
+ result.push(args[i]);
+ }
+ return result;
+ }
+ noInline(jaz);
+
+ function jaz2(...args) {
+ function kaz(a, b, ...args) {
+ let result = [];
+ for (let i = 0; i < args.length; i++) {
+ result.push(args[i]);
+ }
+ return result;
+ }
+ return kaz.apply(null, args);
+ }
+ noInline(jaz2);
+
+ for (let f of [jaz, jaz2]) {
+ for (let i = 0; i < iterations; i++) {
+ let r = f();
+ assert(!r.length);
+
+ r = f(i);
+ assert(!r.length);
+
+ r = f(i, i)
+ assert(!r.length);
+
+ r = f(i, i, i)
+ assert(r.length === 1);
+ assert(shallowEq(r, [i]));
+
+ r = f(i, i, i)
+ assert(r.length === 1);
+ assert(shallowEq(r, [i]));
+
+ r = f(i, i, i, i*2, i*4)
+ assert(r.length === 3);
+ assert(shallowEq(r, [i, i*2, i*4]));
+ }
+ }
+}
+
+function test3() {
+ function foo(...args) {
+ return args;
+ }
+ function baz(a, b, c, ...args) {
+ return foo.apply(null, args);
+ }
+ function jaz(a, b, c, d, e, f) {
+ return baz(a, b, c, d, e, f);
+ }
+ noInline(jaz);
+
+ for (let i = 0; i < iterations; i++) {
+ let r = jaz();
+ assert(r.length === 3);
+ assert(shallowEq(r, [undefined, undefined, undefined]));
+
+ r = jaz(i, i);
+ assert(r.length === 3);
+ assert(shallowEq(r, [undefined, undefined, undefined]));
+
+ r = jaz(i, i, i);
+ assert(r.length === 3);
+ assert(shallowEq(r, [undefined, undefined, undefined]));
+
+ r = jaz(i, i, i, i);
+ assert(r.length === 3);
+ assert(shallowEq(r, [i, undefined, undefined]));
+
+ r = jaz(i, i, i, i, i, i);
+ assert(r.length === 3);
+ assert(shallowEq(r, [i, i, i]));
+ }
+}
+
+function test4() {
+ function baz(...args) {
+ return args;
+ }
+ function jaz(a, b, ...args) {
+ return baz.apply(null, args);
+ }
+ noInline(jaz);
+
+ for (let i = 0; i < iterations; i++) {
+ let r = jaz();
+ assert(r.length === 0);
+
+ r = jaz(i);
+ assert(r.length === 0);
+
+ r = jaz(i, i);
+ assert(r.length === 0);
+
+ r = jaz(i, i, i);
+ assert(r.length === 1);
+ assert(shallowEq(r, [i]));
+
+ r = jaz(i, i, i, i*10);
+ assert(r.length === 2);
+ assert(shallowEq(r, [i, i*10]));
+
+ let o = {};
+ r = jaz(i, i, i, i*10, o);
+ assert(r.length === 3);
+ assert(shallowEq(r, [i, i*10, o]));
+ }
+}
+
+function test5() {
+ function baz(...args) {
+ return args;
+ }
+ noInline(baz);
+ function jaz(a, b, ...args) {
+ return baz.apply(null, args);
+ }
+ noInline(jaz);
+
+ for (let i = 0; i < iterations; i++) {
+ let r = jaz();
+ assert(r.length === 0);
+
+ r = jaz(i);
+ assert(r.length === 0);
+
+ r = jaz(i, i);
+ assert(r.length === 0);
+
+ r = jaz(i, i, i);
+ assert(r.length === 1);
+ assert(shallowEq(r, [i]));
+
+ r = jaz(i, i, i, i*10);
+ assert(r.length === 2);
+ assert(shallowEq(r, [i, i*10]));
+
+ let o = {};
+ r = jaz(i, i, i, i*10, o);
+ assert(r.length === 3);
+ assert(shallowEq(r, [i, i*10, o]));
+ }
+}
+
+function test6() {
+ "use strict";
+ function baz(...args) {
+ return args;
+ }
+ noInline(baz);
+ function jaz(a, b, ...args) {
+ return baz.apply(null, args);
+ }
+ noInline(jaz);
+
+ for (let i = 0; i < iterations; i++) {
+ let r = jaz();
+ assert(r.length === 0);
+
+ r = jaz(i);
+ assert(r.length === 0);
+
+ r = jaz(i, i);
+ assert(r.length === 0);
+
+ r = jaz(i, i, i);
+ assert(r.length === 1);
+ assert(shallowEq(r, [i]));
+
+ r = jaz(i, i, i, i*10);
+ assert(r.length === 2);
+ assert(shallowEq(r, [i, i*10]));
+
+ let o = {};
+ r = jaz(i, i, i, i*10, o);
+ assert(r.length === 3);
+ assert(shallowEq(r, [i, i*10, o]));
+ }
+}
+
+function test7() {
+ let shouldExit = false;
+ function baz(...args) {
+ if (shouldExit) {
+ OSRExit();
+ return [args.length, args[0], args[1], args[2]];
+ }
+ return [args.length, args[0], args[1], args[2]];
+ }
+ function jaz(a, b, ...args) {
+ return baz.apply(null, args);
+ }
+ noInline(jaz);
+
+ function check(i) {
+ let [length, a, b, c] = jaz();
+ assert(length === 0);
+ assert(a === undefined);
+ assert(b === undefined);
+ assert(c === undefined);
+
+ [length, a, b, c] = jaz(i);
+ assert(length === 0);
+ assert(a === undefined);
+ assert(b === undefined);
+ assert(c === undefined);
+
+ [length, a, b, c] = jaz(i, i);
+ assert(length === 0);
+ assert(a === undefined);
+ assert(b === undefined);
+ assert(c === undefined);
+
+ [length, a, b, c] = jaz(i, i, i);
+ assert(length === 1);
+ assert(a === i, JSON.stringify(a));
+ assert(b === undefined);
+ assert(c === undefined);
+
+ [length, a, b, c] = jaz(i, i, i, i*10);
+ assert(length === 2);
+ assert(a === i);
+ assert(b === i*10);
+ assert(c === undefined);
+
+ let o = {oooo:20};
+ [length, a, b, c] = jaz(i, i, i, i*10, o);
+ assert(length === 3);
+ assert(a === i);
+ assert(b === i*10);
+ assert(c === o);
+ }
+
+ shouldExit = true;
+ for (let i = 0; i < 400; i++) {
+ check(i);
+ }
+
+ shouldExit = false;
+ for (let i = 0; i < iterations; i++) {
+ check(i);
+ }
+
+ shouldExit = false;
+ check(10);
+}
+
+function test8() {
+ let shouldExit = false;
+ function baz(...args) {
+ if (shouldExit) {
+ OSRExit();
+ return args;
+ }
+ return args;
+ }
+ function jaz(a, b, ...args) {
+ return baz.apply(null, args);
+ }
+ noInline(jaz);
+
+ function check(i) {
+ let args = jaz();
+ assert(args.length === 0);
+
+ args = jaz(i);
+ assert(args.length === 0);
+
+ args = jaz(i, i);
+ assert(args.length === 0);
+
+ args = jaz(i, i, i);
+ assert(args.length === 1);
+ assert(args[0] === i);
+
+ args = jaz(i, i, i, i*10);
+ assert(args.length === 2);
+ assert(args[0] === i);
+ assert(args[1] === i*10);
+
+ let o = {oooo:20};
+ args = jaz(i, i, i, i*10, o);
+ assert(args.length === 3);
+ assert(args[0] === i);
+ assert(args[1] === i*10);
+ assert(args[2] === o);
+ }
+
+ shouldExit = true;
+ for (let i = 0; i < 400; i++) {
+ check(i);
+ }
+
+ shouldExit = false;
+ for (let i = 0; i < iterations; i++) {
+ check(i);
+ }
+
+ shouldExit = false;
+ check(10);
+}
+
+function test9() {
+ let shouldExit = false;
+ function baz(a, ...args) {
+ if (shouldExit) {
+ OSRExit();
+ return [args.length, args[0], args[1]];
+ }
+ return [args.length, args[0], args[1]];
+ }
+ function jaz(...args) {
+ return baz.apply(null, args);
+ }
+ noInline(jaz);
+
+ function check(i) {
+ let [length, a, b] = jaz();
+ assert(length === 0);
+
+ [length, a, b] = jaz(i);
+ assert(length === 0);
+ assert(a === undefined);
+ assert(b === undefined);
+
+ [length, a, b] = jaz(i, i + 1);
+ assert(length === 1);
+ assert(a === i+1);
+ assert(b === undefined);
+
+ [length, a, b] = jaz(i, i+1, i+2);
+ assert(length === 2);
+ assert(a === i+1);
+ assert(b === i+2);
+
+ let o = {oooo:20};
+ [length, a, b] = jaz(i, i+1, o);
+ assert(length === 2);
+ assert(a === i+1);
+ assert(b === o);
+ }
+
+ shouldExit = true;
+ for (let i = 0; i < 400; i++) {
+ check(i);
+ }
+
+ shouldExit = false;
+ for (let i = 0; i < iterations; i++) {
+ check(i);
+ }
+
+ shouldExit = false;
+ check(10);
+}
+
+function test10() {
+ function baz(a, b, c, ...args) {
+ return [args.length, args[0], args[1], args[2], args[3]];
+ }
+ function jaz(a, b, c, d, e, f) {
+ return baz(a, b, c, d, e, f);
+ }
+ noInline(jaz);
+
+ for (let i = 0; i < iterations; i++) {
+ let [length, a, b, c, d] = jaz(1, 2, 3, 4, 5, 6);
+ assert(length === 3);
+ assert(a === 4);
+ assert(b === 5);
+ assert(c === 6);
+ assert(d === undefined);
+ }
+}
+
+function test11() {
+ function bar(...args) {
+ return args;
+ }
+ noInline(bar);
+
+ function foo(a, b, c, d, ...args) {
+ return bar.apply(null, args);
+ }
+ noInline(foo);
+
+ function makeArguments(args) {
+ return [1,2,3,4, ...args];
+ }
+ for (let i = 0; i < iterations; i++) {
+ function test() { assert(shallowEq(a, foo.apply(null, makeArguments(a)))); }
+ let a = [{}, 25, 50];
+ test();
+
+ a = [];
+ test();
+
+ a = [{foo: 20}];
+ test();
+
+ a = [10, 20, 30, 40, 50, 60, 70, 80];
+ test();
+ }
+}
+
+function test12() {
+ "use strict";
+ let thisValue = {};
+ function getThisValue() { return thisValue; }
+ noInline(getThisValue);
+
+ function bar(...args) {
+ assert(this === thisValue);
+ return args;
+ }
+ noInline(bar);
+
+ function foo(a, b, c, d, ...args) {
+ return bar.apply(getThisValue(), args);
+ }
+ noInline(foo);
+
+ function makeArguments(args) {
+ return [1,2,3,4, ...args];
+ }
+ for (let i = 0; i < iterations; i++) {
+ function test() { assert(shallowEq(a, foo.apply(null, makeArguments(a)))); }
+ let a = [{}, 25, 50];
+ test();
+
+ a = [];
+ test();
+
+ a = [{foo: 20}];
+ test();
+
+ a = [10, 20, 30, 40, 50, 60, 70, 80];
+ test();
+ }
+}
+
+function test13() {
+ "use strict";
+ function bar(...args) {
+ return args;
+ }
+ noInline(bar);
+
+ function top(a, b, c, d, ...args) {
+ return bar.apply(null, args);
+ }
+ function foo(...args) {
+ let r = top.apply(null, args);
+ return r;
+ }
+ noInline(foo);
+
+ function makeArguments(args) {
+ return [1,2,3,4, ...args];
+ }
+ for (let i = 0; i < iterations; i++) {
+ function test() { assert(shallowEq(a, foo.apply(null, makeArguments(a)))); }
+ let a = [{}, 25, 50];
+ test();
+
+ a = [];
+ test();
+
+ a = [10, 20, 30, 40, 50, 60, 70, 80];
+ test();
+ }
+}
+
+function test14() {
+ "use strict";
+ function bar(...args) {
+ return args;
+ }
+ noInline(bar);
+
+ function top(a, b, c, d, ...args) {
+ return bar.apply(null, args);
+ }
+ function foo(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17) {
+ return top(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17);
+ }
+ noInline(foo);
+
+ function makeArguments(args) {
+ let r = [1,2,3,4, ...args];
+ while (r.length < foo.length)
+ r.push(undefined);
+ return r;
+ }
+ for (let i = 0; i < iterations; i++) {
+ function test()
+ {
+ let args = makeArguments(a);
+ assert(shallowEq(args.slice(4), foo.apply(null, args)));
+ }
+
+ let a = [{}, 25, 50];
+ test();
+
+ a = [];
+ test();
+
+ a = [10, 20, 30, 40, 50, 60, 70, 80];
+ test();
+ }
+}
+
+function test15() {
+ "use strict";
+ function bar(...args) {
+ return args;
+ }
+ noInline(bar);
+
+ function top(a, b, c, d, ...args) {
+ return bar.apply(null, args);
+ }
+ function foo(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17) {
+ let r = top(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17);
+ return r;
+ }
+ noInline(foo);
+
+ function makeArguments(args) {
+ let r = [1,2,3,4, ...args];
+ while (r.length < foo.length)
+ r.push(undefined);
+ return r;
+ }
+ for (let i = 0; i < iterations; i++) {
+ function test()
+ {
+ let args = makeArguments(a);
+ assert(shallowEq(args.slice(4), foo.apply(null, args)));
+ }
+
+ let a = [{}, 25, 50];
+ test();
+
+ a = [];
+ test();
+
+ a = [10, 20, 30, 40, 50, 60, 70, 80];
+ test();
+ }
+}
+
+let start = Date.now();
+test1();
+test2();
+test3();
+test4();
+test5();
+test6();
+test7();
+test8();
+test9();
+test10();
+test11();
+test12();
+test13();
+test14();
+test15();
+const verbose = false;
+if (verbose)
+ print(Date.now() - start);
+
Copied: trunk/JSTests/slowMicrobenchmarks/spread-large-array.js (from rev 227416, trunk/JSTests/microbenchmarks/spread-large-array.js) (0 => 227417)
--- trunk/JSTests/slowMicrobenchmarks/spread-large-array.js (rev 0)
+++ trunk/JSTests/slowMicrobenchmarks/spread-large-array.js 2018-01-23 17:11:40 UTC (rev 227417)
@@ -0,0 +1,39 @@
+function foo(arg) {
+ return [...arg];
+}
+noInline(foo);
+
+let arrays = [ ];
+const size = 500;
+{
+ let arr = [];
+ for (let i = 0; i < size; i++) {
+ arr.push(i);
+ }
+ arrays.push(arr);
+}
+
+{
+ let arr = [];
+ for (let i = 0; i < size; i++) {
+ arr.push(i + 0.5);
+ }
+ arrays.push(arr);
+}
+
+{
+ let arr = [];
+ for (let i = 0; i < size; i++) {
+ arr.push({i: i});
+ }
+ arrays.push(arr);
+}
+
+let start = Date.now();
+for (let i = 0; i < 100000; i++) {
+ let array = arrays[i % arrays.length];
+ foo(array);
+}
+const verbose = false;
+if (verbose)
+ print(Date.now() - start);
Copied: trunk/JSTests/slowMicrobenchmarks/string-add-constant-folding.js (from rev 227416, trunk/JSTests/microbenchmarks/string-add-constant-folding.js) (0 => 227417)
--- trunk/JSTests/slowMicrobenchmarks/string-add-constant-folding.js (rev 0)
+++ trunk/JSTests/slowMicrobenchmarks/string-add-constant-folding.js 2018-01-23 17:11:40 UTC (rev 227417)
@@ -0,0 +1,145 @@
+function assert(b) {
+ if (!b)
+ throw new Error("Bad assertion.");
+}
+
+let tests = [];
+function test(f) {
+ noInline(f);
+ tests.push(f);
+}
+
+function runTests() {
+ let start = Date.now();
+ for (let f of tests) {
+ for (let i = 0; i < 40000; i++)
+ f();
+ }
+ const verbose = false;
+ if (verbose)
+ print(Date.now() - start);
+}
+
+function add(a,b) { return a + b; }
+noInline(add);
+
+test(function() {
+ let a = "foo";
+ let b = 20;
+ assert(a + b === add(a, b));
+ assert(b + a === add(b, a));
+});
+
+test(function() {
+ let a = "foo";
+ let b = null;
+ assert(a + b === add(a, b));
+ assert(b + a === add(b, a));
+});
+
+test(function() {
+ let a = "foo";
+ let b = undefined;
+ assert(a + b === add(a, b));
+ assert(b + a === add(b, a));
+});
+
+test(function() {
+ let a = "foo";
+ let b = 20.81239012821;
+ assert(a + b === add(a, b));
+ assert(b + a === add(b, a));
+});
+
+test(function() {
+ let a = "foo";
+ let b = true;
+ assert(a + b === add(a, b));
+ assert(b + a === add(b, a));
+});
+
+test(function() {
+ let a = "foo";
+ let b = false;
+ assert(a + b === add(a, b));
+ assert(b + a === add(b, a));
+});
+
+test(function() {
+ let a = "foo";
+ let b = NaN;
+ assert(a + b === add(a, b));
+ assert(b + a === add(b, a));
+});
+
+test(function() {
+ let a = -0;
+ let b = "foo";
+ assert(a + b === add(a, b));
+ assert(b + a === add(b, a));
+});
+
+test(function() {
+ let a = "foo";
+ let b = 0.0;
+ assert(a + b === add(a, b));
+ assert(b + a === add(b, a));
+});
+
+test(function() {
+ let a = "foo";
+ let b = Infinity;
+ assert(a + b === add(a, b));
+ assert(b + a === add(b, a));
+});
+
+test(function() {
+ let a = -Infinity;
+ let b = "foo";
+ assert(a + b === add(a, b));
+ assert(b + a === add(b, a));
+});
+
+test(function() {
+ let a = "foo";
+ let b = 1e10;
+ assert(a + b === add(a, b));
+ assert(b + a === add(b, a));
+});
+
+test(function() {
+ let a = "foo";
+ let b = 1e-10;
+ assert(a + b === add(a, b));
+ assert(b + a === add(b, a));
+});
+
+test(function() {
+ let a = "foo";
+ let b = 1e5;
+ assert(a + b === add(a, b));
+ assert(b + a === add(b, a));
+});
+
+test(function() {
+ let a = "foo";
+ let b = 1e-5;
+ assert(a + b === add(a, b));
+ assert(b + a === add(b, a));
+});
+
+test(function() {
+ let a = "foo";
+ let b = 1e-40;
+ assert(a + b === add(a, b));
+ assert(b + a === add(b, a));
+});
+
+test(function() {
+ let a = "foo";
+ let b = 1e40;
+ assert(a + b === add(a, b));
+ assert(b + a === add(b, a));
+});
+
+runTests();
Copied: trunk/JSTests/slowMicrobenchmarks/to-lower-case.js (from rev 227416, trunk/JSTests/microbenchmarks/to-lower-case.js) (0 => 227417)
--- trunk/JSTests/slowMicrobenchmarks/to-lower-case.js (rev 0)
+++ trunk/JSTests/slowMicrobenchmarks/to-lower-case.js 2018-01-23 17:11:40 UTC (rev 227417)
@@ -0,0 +1,36 @@
+function assert(b) {
+ if (!b)
+ throw new Error("Bad assertion");
+}
+noInline(assert);
+
+let tests = [
+ ["foo", "foo"],
+ ["foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo", "foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo"],
+];
+
+function foo(a) {
+ return a.toLowerCase();
+}
+noInline(foo);
+
+function bar(a) {
+ a.toLowerCase();
+ assert(true); // side effects
+ a.toLowerCase();
+}
+noInline(bar);
+
+let start = Date.now();
+for (let i = 0; i < 500000; i++) {
+ for (let i = 0; i < tests.length; i++) {
+ let test = tests[i][0];
+ let result = tests[i][1];
+ assert(foo(test) === result);
+ bar(test);
+ }
+}
+
+const verbose = false;
+if (verbose)
+ print(Date.now() - start);
Copied: trunk/JSTests/slowMicrobenchmarks/undefined-property-access.js (from rev 227416, trunk/JSTests/microbenchmarks/undefined-property-access.js) (0 => 227417)
--- trunk/JSTests/slowMicrobenchmarks/undefined-property-access.js (rev 0)
+++ trunk/JSTests/slowMicrobenchmarks/undefined-property-access.js 2018-01-23 17:11:40 UTC (rev 227417)
@@ -0,0 +1,48 @@
+var someGlobal;
+
+// This is a simple speed test. It should go fast.
+
+function foo() {
+ var myObject = {};
+ for (var i = 0; i < 10000000; ++i) {
+ someGlobal = myObject.undefinedProperty;
+ }
+ return someGlobal;
+}
+result = foo();
+if (result != undefined)
+ throw new Error("Bad result: " + result);
+
+// This test checks that a cached property lookup miss doesn't continue to fire when the property suddenly appears on the object.
+
+function bar() {
+ var myObject = {};
+ for (var i = 0; i < 100000000; ++i) {
+ someGlobal = myObject.someProperty;
+ if (i == 50000000)
+ myObject.someProperty = 1;
+ }
+ return someGlobal;
+}
+var result = bar();
+if (result != 1)
+ throw new Error("Bad result: " + result);
+someGlobal = undefined;
+
+// This test checks that a cached property lookup miss doesn't continue to fire when the property suddenly appears on the object's prototype.
+
+function baz() {
+ var myPrototype = {}
+ var myObject = {};
+ myObject.__proto__ = myPrototype;
+ for (var i = 0; i < 100000000; ++i) {
+ someGlobal = myObject.someProperty;
+ if (i == 50000000)
+ myPrototype.someProperty = 2;
+ }
+ return someGlobal;
+}
+var result = baz();
+if (result != 2)
+ throw new Error("Bad result: " + result);
+