Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1594)

Unified Diff: test/mjsunit/compiler/load-elimination-osr.js

Issue 27148004: Implement global load elimination based on flow engine. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add a nested loop to the global load elimination test case. Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/mjsunit/compiler/load-elimination-global.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/compiler/load-elimination-osr.js
diff --git a/test/mjsunit/regress/regress-crbug-260345.js b/test/mjsunit/compiler/load-elimination-osr.js
similarity index 66%
copy from test/mjsunit/regress/regress-crbug-260345.js
copy to test/mjsunit/compiler/load-elimination-osr.js
index 75832ab4beb9e004dda914ffc2e23647f57ef979..a57fe173ee7be04313ca7ea2c18229e23fa16375 100644
--- a/test/mjsunit/regress/regress-crbug-260345.js
+++ b/test/mjsunit/compiler/load-elimination-osr.js
@@ -25,35 +25,41 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-var steps = 100000;
-var undefined_values = [undefined, "go on"];
-var null_values = [null, "go on"];
+// Flags: --allow-natives-syntax --load-elimination
-function get_undefined_object(i) {
- return undefined_values[(i / steps) | 0];
-}
+// Test global load elimination in the presence of OSR compilation.
+
+function It(x, y) { }
-function test_undefined() {
- var objects = 0;
- for (var i = 0; i < 2 * steps; i++) {
- undefined == get_undefined_object(i) && objects++;
+function foo_osr(x, limit) {
+ var o = new It();
+ o.x = x;
+ o.y = x;
+ for (var i = 0; i < limit; i++) {
+ o.y += o.x; // Load of x cannot be hoisted due to OSR.
}
- return objects;
-}
-assertEquals(steps, test_undefined());
+ return o.y;
+}
+assertEquals(22, foo_osr(11, 1));
+assertEquals(24, foo_osr(12, 1));
+assertEquals(1300013, foo_osr(13, 100000));
-function get_null_object(i) {
- return null_values[(i / steps) | 0];
-}
-function test_null() {
- var objects = 0;
- for (var i = 0; i < 2 * steps; i++) {
- null == get_null_object(i) && objects++;
+function foo_hot(x, limit) {
+ var o = new It();
+ o.x = x;
+ o.y = x;
+ for (var i = 0; i < limit; i++) {
+ o.y += o.x; // Load of x can be hoisted without OSR.
}
- return objects;
+
+ return o.y;
}
-assertEquals(steps, test_null());
+assertEquals(22, foo_hot(11, 1));
+assertEquals(24, foo_hot(12, 1));
+%OptimizeFunctionOnNextCall(foo_hot);
+assertEquals(32, foo_hot(16, 1));
+assertEquals(1300013, foo_hot(13, 100000));
« no previous file with comments | « test/mjsunit/compiler/load-elimination-global.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698