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

Unified Diff: test/mjsunit/regress/regress-phi-truncation.js

Issue 23075003: Fix bug in HPhi::SimplifyConstantInput (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 4 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/hydrogen-instructions.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/regress/regress-phi-truncation.js
diff --git a/test/mjsunit/regress/regress-247688.js b/test/mjsunit/regress/regress-phi-truncation.js
similarity index 63%
copy from test/mjsunit/regress/regress-247688.js
copy to test/mjsunit/regress/regress-phi-truncation.js
index 80e2884c705ef230e96a93ede8e5815175b01363..940efe335731c50f4afd1a9221ecbfc233138821 100644
--- a/test/mjsunit/regress/regress-247688.js
+++ b/test/mjsunit/regress/regress-phi-truncation.js
@@ -27,54 +27,63 @@
// Flags: --allow-natives-syntax
-var a = {};
-a.x = 1
-a.y = 1.5
+function test(fun, expectation) {
+ assertEquals(1, fun(1));
+ %OptimizeFunctionOnNextCall(fun);
+ assertEquals(expectation, fun(0));
+}
-var b = {}
-b.x = 1.5;
-b.y = 1;
+test(function(x) {
+ var a = x ? true : false;
+ return a | 0;
+}, 0);
-var c = {}
-c.x = 1.5;
+test(function(x) {
+ var a = x ? true : true;
+ return a | 0;
+}, 1);
-var d = {}
-d.x = 1.5;
+test(function(x) {
+ var a = x ? true : "0";
+ return a | 0;
+}, 0);
-var e = {}
-e.x = 1.5;
+test(function(x) {
+ var a = x ? true : "1";
+ return a | 0;
+}, 1);
-var f = {}
-f.x = 1.5;
+test(function(x) {
+ var a = x ? true : "-1";
+ return a | 0;
+}, -1);
-var g = {}
-g.x = 1.5;
+test(function(x) {
+ var a = x ? true : "-0";
+ return a | 0;
+}, 0);
-var h = {}
-h.x = 1.5;
+test(function(x) {
+ var a = x ? true : "0x1234";
+ return a | 0;
+}, 0x1234);
-var i = {}
-i.x = 1.5;
+test(function(x) {
+ var a = x ? true : { valueOf: function() { return 2; } };
+ return a | 0;
+}, 2);
-var o = {}
-var p = {y : 10, z : 1}
-o.__proto__ = p;
-delete p.z
+test(function(x) {
+ var a = x ? true : undefined;
+ return a | 0;
+}, 0);
-function foo(v, w) {
- // Make load via IC in optimized code. Its target will get overwritten by
- // lazy deopt patch for the stack check.
- v.y;
- // Make store with transition to make this code dependent on the map.
- w.y = 1;
- return b.y;
-}
+test(function(x) {
+ var a = x ? true : null;
+ return a | 0;
+}, 0);
-foo(o, c);
-foo(o, d);
-foo(o, e);
-%OptimizeFunctionOnNextCall(foo);
-foo(b, f);
-foo(b, g);
-foo(b, h);
-foo(a, i);
+test(function(x) {
+ var a = x ? true : "";
+ return a | 0;
+}, 0);
« no previous file with comments | « src/hydrogen-instructions.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698