Reviewers: Michael Starzinger,

Description:
Reduce the number of iterations in some OSR tests by using an explicit
%OptimizeOsr().

[email protected]
BUG=

Please review this at https://codereview.chromium.org/913463002/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+33, -58 lines):
  M test/mjsunit/compiler/osr-alignment.js
  M test/mjsunit/compiler/osr-nested2.js
  M test/mjsunit/compiler/osr-nested3.js
  M test/mjsunit/compiler/osr-simple.js
  M test/mjsunit/osr-elements-kind.js
  M test/mjsunit/regress/regress-1145.js
  M test/mjsunit/regress/regress-3032.js
  D test/mjsunit/regress/regress-634.js


Index: test/mjsunit/regress/regress-634.js
diff --git a/test/mjsunit/regress/regress-634.js b/test/mjsunit/regress/regress-634.js
deleted file mode 100644
index b68e84374075851e11d9d3d18edab44412670e60..0000000000000000000000000000000000000000
--- a/test/mjsunit/regress/regress-634.js
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright 2010 the V8 project authors. All rights reserved.
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-//       notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-//       copyright notice, this list of conditions and the following
-//       disclaimer in the documentation and/or other materials provided
-//       with the distribution.
-//     * Neither the name of Google Inc. nor the names of its
-//       contributors may be used to endorse or promote products derived
-//       from this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-for (var i = 0; i < 1000000; i++) {
-  a = new Array(0);
-  assertEquals(0, a.length);
-  assertEquals(0, a.length);
-}
Index: test/mjsunit/compiler/osr-alignment.js
diff --git a/test/mjsunit/compiler/osr-alignment.js b/test/mjsunit/compiler/osr-alignment.js index b1fd702aa3a7dd038413cb4967437cb15d823c46..085d6c4d689b5d93b442c7ff5feba9eccf77d92f 100644
--- a/test/mjsunit/compiler/osr-alignment.js
+++ b/test/mjsunit/compiler/osr-alignment.js
@@ -25,37 +25,40 @@
 // (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: --use-osr --turbo-osr
+// Flags: --allow-natives-syntax --use-osr --turbo-osr

 function f1() {
   var sum = 0;
-  for (var i = 0; i < 1000000; i++) {
+  for (var i = 0; i < 1000; i++) {
     var x = i + 2;
     var y = x + 5;
     var z = y + 3;
     sum += z;
+    if (i == 18) %OptimizeOsr();
   }
   return sum;
 }

 function f2() {
   var sum = 0;
-  for (var i = 0; i < 1000000; i++) {
+  for (var i = 0; i < 1000; i++) {
     var x = i + 2;
     var y = x + 5;
     var z = y + 3;
     sum += z;
+    if (i == 19) %OptimizeOsr();
   }
   return sum;
 }

 function f3() {
   var sum = 0;
-  for (var i = 0; i < 1000000; i++) {
+  for (var i = 0; i < 1000; i++) {
     var x = i + 2;
     var y = x + 5;
     var z = y + 3;
     sum += z;
+    if (i == 20) %OptimizeOsr();
   }
   return sum;
 }
@@ -63,21 +66,21 @@ function f3() {
 function test1() {
   var j = 11;
   for (var i = 0; i < 2; i++) {
-    assertEquals(500009500000, f1());
+    assertEquals(509500, f1());
   }
 }

 function test2() {
   for (var i = 0; i < 2; i++) {
     var j = 11, k = 12;
-    assertEquals(500009500000, f2());
+    assertEquals(509500, f2());
   }
 }

 function test3() {
   for (var i = 0; i < 2; i++) {
     var j = 11, k = 13, m = 14;
-    assertEquals(500009500000, f3());
+    assertEquals(509500, f3());
   }
 }

Index: test/mjsunit/compiler/osr-nested2.js
diff --git a/test/mjsunit/compiler/osr-nested2.js b/test/mjsunit/compiler/osr-nested2.js index af8112fe125c9b7d1abbdd21adc25da684500fd7..9c45c510ef953a95d013730796a9e2662a400fb9 100644
--- a/test/mjsunit/compiler/osr-nested2.js
+++ b/test/mjsunit/compiler/osr-nested2.js
@@ -2,16 +2,17 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.

-// Flags: --use-osr --turbo-osr
+// Flags: --allow-natives-syntax --use-osr --turbo-osr

 function f() {
   var sum = 0;
   for (var i = 5; i < 6; i++) {
-    for (var j = 0; j < 1000000; j++) {
+    for (var j = 0; j < 1000; j++) {
       var x = i + 2;
       var y = x + 5;
       var z = y + 3;
       sum += z;
+      if (i == 21) %OptimizeOsr();
     }
     if (true) break;
   }
@@ -19,6 +20,6 @@ function f() {
 }


-assertEquals(15000000, f());
-assertEquals(15000000, f());
-assertEquals(15000000, f());
+assertEquals(15000, f());
+assertEquals(15000, f());
+assertEquals(15000, f());
Index: test/mjsunit/compiler/osr-nested3.js
diff --git a/test/mjsunit/compiler/osr-nested3.js b/test/mjsunit/compiler/osr-nested3.js index b8f7e79a77f1d86cde42c5077fe87e2f8547325f..e4a4cdb6b6dd0dbb2e98b69aa8bc6bc82c8bdf94 100644
--- a/test/mjsunit/compiler/osr-nested3.js
+++ b/test/mjsunit/compiler/osr-nested3.js
@@ -2,17 +2,18 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.

-// Flags: --use-osr --turbo-osr
+// Flags: --allow-natives-syntax --use-osr --turbo-osr

 function f() {
   var sum = 0;
   for (var m = 99; m < 100; m++) {
     for (var i = 5; i < 6; i++) {
-      for (var j = 0; j < 1000000; j++) {
+      for (var j = 0; j < 1000; j++) {
         var x = i + 2;
         var y = x + 5;
         var z = y + 3;
         sum += z;
+        if (i == 19) %OptimizeOsr();
       }
       if (true) break;
     }
@@ -22,6 +23,6 @@ function f() {
 }


-assertEquals(15000000, f());
-assertEquals(15000000, f());
-assertEquals(15000000, f());
+assertEquals(15000, f());
+assertEquals(15000, f());
+assertEquals(15000, f());
Index: test/mjsunit/compiler/osr-simple.js
diff --git a/test/mjsunit/compiler/osr-simple.js b/test/mjsunit/compiler/osr-simple.js index 24a3c8f1b15e399a2c8a59c38ecb21ab10761449..ddbc5f8867fdc5731330e88a0c790ae9f44c1acf 100644
--- a/test/mjsunit/compiler/osr-simple.js
+++ b/test/mjsunit/compiler/osr-simple.js
@@ -2,20 +2,21 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.

-// Flags: --use-osr
+// Flags: --allow-natives-syntax --use-osr

 function f() {
   var sum = 0;
-  for (var i = 0; i < 1000000; i++) {
+  for (var i = 0; i < 1000; i++) {
     var x = i + 2;
     var y = x + 5;
     var z = y + 3;
     sum += z;
+    if (i == 11) %OptimizeOsr();
   }
   return sum;
 }


 for (var i = 0; i < 2; i++) {
-  assertEquals(500009500000, f());
+  assertEquals(509500, f());
 }
Index: test/mjsunit/osr-elements-kind.js
diff --git a/test/mjsunit/osr-elements-kind.js b/test/mjsunit/osr-elements-kind.js index 518b9847430f93f7bf85daeeecee9797e3f75c9a..389b6dac6f7f5cb90980f2895e20464befe392bd 100644
--- a/test/mjsunit/osr-elements-kind.js
+++ b/test/mjsunit/osr-elements-kind.js
@@ -88,11 +88,10 @@ function assertKind(expected, obj, name_opt) {
   assertEquals(expected, getKind(obj), name_opt);
 }

-// long-running loop forces OSR.
 %NeverOptimizeFunction(construct_smis);
 %NeverOptimizeFunction(construct_doubles);
 %NeverOptimizeFunction(convert_mixed);
-for (var i = 0; i < 1000000; i++) { }
+for (var i = 0; i < 10; i++) { if (i == 5) %OptimizeOsr(); }

 // This code exists to eliminate the learning influence of AllocationSites
 // on the following tests.
Index: test/mjsunit/regress/regress-1145.js
diff --git a/test/mjsunit/regress/regress-1145.js b/test/mjsunit/regress/regress-1145.js index 16d5527bbb38086d404248f8e33997bc0d73348f..eb4fd5b8ddfafd5c77af8378b3ebb8c5a5778e05 100644
--- a/test/mjsunit/regress/regress-1145.js
+++ b/test/mjsunit/regress/regress-1145.js
@@ -25,7 +25,7 @@
 // (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: --opt-eagerly --debug-code --lazy
+// Flags: --allow-natives-syntax --opt-eagerly --debug-code --lazy

 // See: http://code.google.com/p/v8/issues/detail?id=1145
 // Should not throw a syntax error exception (change this if we make lazily
@@ -44,9 +44,9 @@ function fail() { continue; }

 function opt_me() {
   var x = 1;
-  // Do lots of function calls and hope to be optimized.
-  for (var i = 0; i < 1000000; i++) {
+  for (var i = 0; i < 10; i++) {
     x = f();
+    if (i == 5) %OptimizeOsr();
   }
   if (x == 0) fail();  // Hope to be inlined during optimization.
 }
Index: test/mjsunit/regress/regress-3032.js
diff --git a/test/mjsunit/regress/regress-3032.js b/test/mjsunit/regress/regress-3032.js index ae545437586a68dd78866177f489975ecff11031..9b18e146ce612a3a668ee54f64e1eadb9b918a3b 100644
--- a/test/mjsunit/regress/regress-3032.js
+++ b/test/mjsunit/regress/regress-3032.js
@@ -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.

-for (var i = 0; i < 1000000; i++) { }
+// Flags: --allow-natives-syntax
+
+for (var i = 0; i < 10; i++) { if (i == 5) %OptimizeOsr(); }
 var xl = 4096;
 var z = i % xl;


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to