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

Unified Diff: test/mjsunit/compiler/osr-follow.js

Issue 892593002: [turbofan] Fix usage of ThisFunction parameter in OSR. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 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 | « src/compiler/x64/linkage-x64.cc ('k') | test/mjsunit/compiler/osr-forin.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/compiler/osr-follow.js
diff --git a/test/mjsunit/compiler/osr-follow.js b/test/mjsunit/compiler/osr-follow.js
new file mode 100644
index 0000000000000000000000000000000000000000..b6a2e8e4be7227981e4a832325ead821e873a615
--- /dev/null
+++ b/test/mjsunit/compiler/osr-follow.js
@@ -0,0 +1,61 @@
+// Copyright 2015 the V8 project authors. All rights reserved.
+// 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
+
+function foo(a) {
+ var sum = 0;
+ var inc = a ? 100 : 200;
+ for (var i = 0; i < 100000; i++) {
+ sum += inc;
+ }
+ return sum + inc;
+}
+
+function bar(a) {
+ var sum = 0;
+ var inc = a ? 100 : 200;
+ var x = a ? 5 : 6;
+ var y = a ? 7 : 8;
+ for (var i = 0; i < 100000; i++) {
+ sum += inc;
+ }
+ return sum ? x : y;
+}
+
+function baz(a) {
+ var limit = a ? 100001 : 100002;
+ var r = 1;
+ var x = a ? 1 : 2;
+ var y = a ? 3 : 4;
+ for (var i = 0; i < limit; i++) {
+ r = r * -1;
+ }
+ return r > 0 ? x == y : x != y;
+}
+
+function qux(a) {
+ var limit = a ? 100001 : 100002;
+ var r = 1;
+ var x = a ? 1 : 2;
+ var y = a ? 3 : 4;
+ for (var i = 0; i < limit; i++) {
+ r = r * -1;
+ }
+ var w = r > 0 ? x : y;
+ var z = r > 0 ? y : x;
+ return w === z;
+}
+
+function test(func, tv, fv) {
+ assertEquals(tv, func(true));
+ assertEquals(fv, func(false));
+ assertEquals(tv, func(true));
+ assertEquals(fv, func(false));
+}
+
+test(foo, 10000100, 20000200);
+test(bar, 5, 6);
+test(baz, true, false);
+test(qux, false, false);
« no previous file with comments | « src/compiler/x64/linkage-x64.cc ('k') | test/mjsunit/compiler/osr-forin.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698