Replace long running loops by OptimizeFunctionOnNextCall in some tests that are often timing out on ARM.

Review URL: http://codereview.chromium.org/6910022

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7765 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
karlklose@chromium.org 2011-05-03 13:53:08 +00:00
parent 4d890da191
commit 8b917d4d96
5 changed files with 31 additions and 9 deletions

View File

@ -25,10 +25,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --allow-natives-syntax
function runner(f, expected) {
for (var i = 0; i < 1000000; i++) {
assertEquals(expected, f.call(this));
}
assertEquals(expected, f.call(this));
}
function test(n) {
@ -36,6 +36,8 @@ function test(n) {
var result = n * 2 + arguments.length;
return result;
}
for (var i = 0; i < 5; ++i) MyFunction();
%OptimizeFunctionOnNextCall(MyFunction)
runner(MyFunction, n * 2);
}

View File

@ -25,12 +25,15 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --allow-natives-syntax
// Verifies that closures in presence of eval work fine.
function withEval(expr, filter) {
function walk(v) {
for (var i in v) {
for (var i in v) {}
}
%OptimizeFunctionOnNextCall(filter);
return filter(v);
}
@ -46,6 +49,8 @@ function makeTagInfoJSON(n) {
var expr = '([' + makeTagInfoJSON(128).join(', ') + '])'
for (var n = 0; n < 300; n++) {
for (var n = 0; n < 5; n++) {
withEval(expr, function(a) { return a; });
}
%OptimizeFunctionOnNextCall(withEval);
withEval(expr, function(a) { return a; });

View File

@ -25,6 +25,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --allow-natives-syntax
// Test overflow checks in optimized code.
function testMul(a, b) {
a *= 2;
@ -34,7 +36,8 @@ function testMul(a, b) {
}
}
for (var i=0; i<1000000; i++) testMul(0,0);
for (var i=0; i<5; i++) testMul(0,0);
%OptimizeFunctionOnNextCall(testMul);
assertEquals(4611686018427388000, testMul(-0x40000000, -0x40000000));
function testAdd(a, b) {
@ -45,7 +48,8 @@ function testAdd(a, b) {
}
}
for (var i=0; i<1000000; i++) testAdd(0,0);
for (var i=0; i<5; i++) testAdd(0,0);
%OptimizeFunctionOnNextCall(testAdd);
assertEquals(-4294967296, testAdd(-0x40000000, -0x40000000));
@ -58,5 +62,6 @@ function testSub(a, b) {
}
}
for (var i=0; i<1000000; i++) testSub(0,0);
for (var i=0; i<5; i++) testSub(0,0);
%OptimizeFunctionOnNextCall(testSub);
assertEquals(-2147483650, testSub(-0x40000000, 1));

View File

@ -25,6 +25,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --allow-natives-syntax
// Test that LApplyArguments lithium instruction restores context after the call.
function X() {
@ -41,6 +43,9 @@ function Y(x) {
var y = Y(X());
for (var i = 0; i < 1000000; i++) {
for (var i = 0; i < 5; i++) {
assertTrue(y("foo"));
}
%OptimizeFunctionOnNextCall(y);
assertTrue(y("foo"));

View File

@ -25,8 +25,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --allow-natives-syntax
var global = 0;
var MAX = 1000000;
var MAX = 5;
// Attempt to inline strcit in non-strict.
@ -43,6 +45,7 @@ function nonstrictCallStrict(n) {
(function testInlineStrictInNonStrict() {
for (var i = 0; i <= MAX; i ++) {
try {
if (i == MAX - 1) %OptimizeFunctionOnNextCall(nonstrictCallStrict);
nonstrictCallStrict(i);
} catch (e) {
assertInstanceof(e, ReferenceError);
@ -68,6 +71,7 @@ function strictCallNonStrict(n) {
(function testInlineNonStrictInStrict() {
for (var i = 0; i <= MAX; i ++) {
try {
if (i == MAX - 1) %OptimizeFunctionOnNextCall(nonstrictCallStrict);
strictCallNonStrict(i);
} catch (e) {
fail("no exception", "exception");
@ -87,6 +91,7 @@ function strictAssignToUndefined(n) {
(function testOptimizeStrictAssignToUndefined() {
for (var i = 0; i <= MAX; i ++) {
try {
if (i == MAX - 1) %OptimizeFunctionOnNextCall(nonstrictCallStrict);
strictAssignToUndefined(i);
} catch (e) {
assertInstanceof(e, ReferenceError);