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

Unified Diff: test/mjsunit/shr-truncating-nouint32.js

Issue 23496017: Shr should save its Use truncating flag before Canonicalize (Closed) Base URL: https://github.com/v8/v8.git@master
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/x64/lithium-x64.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/shr-truncating-nouint32.js
diff --git a/test/mjsunit/regress/regress-164442.js b/test/mjsunit/shr-truncating-nouint32.js
similarity index 82%
copy from test/mjsunit/regress/regress-164442.js
copy to test/mjsunit/shr-truncating-nouint32.js
index 1160d874f5bc9c73b9f0952627babe59771c1c8f..983a674bbacda6e492f7fe954f3505637e07b5ad 100644
--- a/test/mjsunit/regress/regress-164442.js
+++ b/test/mjsunit/shr-truncating-nouint32.js
@@ -25,21 +25,17 @@
// (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
+// Flags: --allow-natives-syntax --noalways-opt --noopt_safe_uint32_operations
-// Should not take a very long time (n^2 algorithms are bad)
+var two_31 = 1 << 31;
-function ensureNotNegative(x) {
- return Math.max(0, x | 0);
+function shr_0_truncating(a) {
+ return a >>> 0 | 0;
}
-
-ensureNotNegative(1);
-ensureNotNegative(2);
-
-%OptimizeFunctionOnNextCall(ensureNotNegative);
-
-var r = ensureNotNegative(-1);
-
-assertEquals(0, r);
+shr_0_truncating(100);
+shr_0_truncating(100);
+%OptimizeFunctionOnNextCall(shr_0_truncating);
+assertEquals(two_31, shr_0_truncating(two_31));
+assertOptimized(shr_0_truncating);
« no previous file with comments | « src/x64/lithium-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698