Commit 76d33a17 authored by Andreas Haas's avatar Andreas Haas Committed by Commit Bot

[cleanup] Add PrepareFunctionForOptimization to regression tests(2)

R=mythria@chromium.org

Bug: v8:9183
Change-Id: Ia534816b460eaf005a0017afeb2d55ccb3402a37
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1660473Reviewed-by: 's avatarMythri Alle <mythria@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62169}
parent 054af847
...@@ -47,8 +47,10 @@ function mkNumberDictionary() { ...@@ -47,8 +47,10 @@ function mkNumberDictionary() {
} }
function write(a, i) { a[i] = "bazinga!"; } function write(a, i) { a[i] = "bazinga!"; }
%PrepareFunctionForOptimization(write);
function test(factories, w) { function test(factories, w) {
%PrepareFunctionForOptimization(w);
factories.forEach(function(f) { w(f(), 0); }); factories.forEach(function(f) { w(f(), 0); });
factories.forEach(function(f) { w(f(), 0); }); factories.forEach(function(f) { w(f(), 0); });
%OptimizeFunctionOnNextCall(w); %OptimizeFunctionOnNextCall(w);
......
...@@ -39,6 +39,7 @@ function f(restIsArray, rest) { ...@@ -39,6 +39,7 @@ function f(restIsArray, rest) {
var arrIsArguments = (arr[1] !== rest); var arrIsArguments = (arr[1] !== rest);
assertEquals(restIsArray, arrIsArguments); assertEquals(restIsArray, arrIsArguments);
} }
%PrepareFunctionForOptimization(f);
f(false, 'b', 'c'); f(false, 'b', 'c');
f(false, 'b', 'c'); f(false, 'b', 'c');
......
...@@ -40,7 +40,9 @@ function MakeClosure() { ...@@ -40,7 +40,9 @@ function MakeClosure() {
// Create two closures that share the same literal boilerplates. // Create two closures that share the same literal boilerplates.
var closure1 = MakeClosure(); var closure1 = MakeClosure();
%PrepareFunctionForOptimization(closure1);
var closure2 = MakeClosure(); var closure2 = MakeClosure();
%PrepareFunctionForOptimization(closure2);
var expected = [1,2,3,3,4,5,6,7,8,9,bozo]; var expected = [1,2,3,3,4,5,6,7,8,9,bozo];
// Make sure we generate optimized code for the first closure after // Make sure we generate optimized code for the first closure after
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
var foo = (function() { var foo = (function() {
return eval("(function bar() { return 1; })"); return eval("(function bar() { return 1; })");
})(); })();
%PrepareFunctionForOptimization(foo);
foo(); foo();
foo(); foo();
......
...@@ -68,6 +68,7 @@ for (var i = 750; i < 3000; i++) { ...@@ -68,6 +68,7 @@ for (var i = 750; i < 3000; i++) {
source += "x=1; return _0;" source += "x=1; return _0;"
var f = new Function(source); var f = new Function(source);
%PrepareFunctionForOptimization(f);
f(); f();
%OptimizeFunctionOnNextCall(f); %OptimizeFunctionOnNextCall(f);
......
...@@ -36,6 +36,7 @@ function foo(x) { ...@@ -36,6 +36,7 @@ function foo(x) {
} }
return result; return result;
} }
%PrepareFunctionForOptimization(foo);
foo(0); foo(0);
foo(0); foo(0);
......
...@@ -36,6 +36,7 @@ function f() { ...@@ -36,6 +36,7 @@ function f() {
a[i]++; a[i]++;
assertTrue(isNaN(a[i])); assertTrue(isNaN(a[i]));
} }
%PrepareFunctionForOptimization(f);
f(); f();
f(); f();
......
...@@ -36,6 +36,7 @@ function f() { ...@@ -36,6 +36,7 @@ function f() {
a[i] = 1/y; a[i] = 1/y;
assertFalse(isNaN(a[i])); assertFalse(isNaN(a[i]));
} }
%PrepareFunctionForOptimization(f);
f(); f();
f(); f();
......
...@@ -37,6 +37,7 @@ function foo(x, fun) { ...@@ -37,6 +37,7 @@ function foo(x, fun) {
fun(); fun();
return a; return a;
} }
%PrepareFunctionForOptimization(foo);
assertThrows("foo(1, bailout)"); assertThrows("foo(1, bailout)");
assertThrows("foo(1, bailout)"); assertThrows("foo(1, bailout)");
......
...@@ -16,6 +16,7 @@ function foo(a) { ...@@ -16,6 +16,7 @@ function foo(a) {
} }
return sum; return sum;
} }
%PrepareFunctionForOptimization(foo);
var a = new Int32Array(10); var a = new Int32Array(10);
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
function foo() { return bar(arguments[0], arguments[1], arguments[2]); } function foo() { return bar(arguments[0], arguments[1], arguments[2]); }
function baz(f, deopt) { return foo("x", deopt, f); } function baz(f, deopt) { return foo("x", deopt, f); }
%PrepareFunctionForOptimization(baz);
baz(f1, 0); baz(f1, 0);
baz(f2, 0); baz(f2, 0);
...@@ -65,6 +66,7 @@ ...@@ -65,6 +66,7 @@
function foo() { return bar(arguments[0], arguments[1]); } function foo() { return bar(arguments[0], arguments[1]); }
function baz(deopt) { return foo("x", deopt); } function baz(deopt) { return foo("x", deopt); }
%PrepareFunctionForOptimization(baz);
baz(0); baz(0);
baz(0); baz(0);
...@@ -88,6 +90,7 @@ ...@@ -88,6 +90,7 @@
function foo() { return bar(arguments[0], arguments[1]); } function foo() { return bar(arguments[0], arguments[1]); }
function baz(deopt) { return foo(0, deopt); } function baz(deopt) { return foo(0, deopt); }
%PrepareFunctionForOptimization(baz);
baz(0); baz(0);
baz(0); baz(0);
......
...@@ -30,11 +30,13 @@ ...@@ -30,11 +30,13 @@
function bar() { return new Array(); } function bar() { return new Array(); }
%PrepareFunctionForOptimization(bar);
bar(); bar();
bar(); bar();
%OptimizeFunctionOnNextCall(bar); %OptimizeFunctionOnNextCall(bar);
a = bar(); a = bar();
function foo(len) { return new Array(len); } function foo(len) { return new Array(len); }
%PrepareFunctionForOptimization(foo);
foo(0); foo(0);
foo(0); foo(0);
%OptimizeFunctionOnNextCall(bar); %OptimizeFunctionOnNextCall(bar);
......
...@@ -37,6 +37,7 @@ function withCommaExpressionInConditional(x) { ...@@ -37,6 +37,7 @@ function withCommaExpressionInConditional(x) {
} }
return (y = x + 1, y > 1) ? 'medium' : 'small'; return (y = x + 1, y > 1) ? 'medium' : 'small';
} }
%PrepareFunctionForOptimization(withCommaExpressionInConditional);
for (var i = 0; i < 5; i++) { for (var i = 0; i < 5; i++) {
withCommaExpressionInConditional(i); withCommaExpressionInConditional(i);
......
...@@ -38,6 +38,7 @@ function __f_0(__v_1,__v_0,i) { ...@@ -38,6 +38,7 @@ function __f_0(__v_1,__v_0,i) {
__v_1.a = __v_0[i]; __v_1.a = __v_0[i];
gc(); gc();
} }
%PrepareFunctionForOptimization(__f_0);
try { try {
__f_0(__v_1,__v_0,0); __f_0(__v_1,__v_0,0);
__f_0(__v_1,__v_0,0); __f_0(__v_1,__v_0,0);
......
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