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

Unified Diff: test/mjsunit/wasm/asm-wasm.js

Issue 2101923003: [wasm] fix loops and if-else to take int type instead of signed (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: [wasm] fix loops and if-else to take int type instead of signed Created 4 years, 6 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/regress/regress-617526.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/wasm/asm-wasm.js
diff --git a/test/mjsunit/wasm/asm-wasm.js b/test/mjsunit/wasm/asm-wasm.js
index 4391e039ebfb977a24f31ef7802a3abb36ed423d..a66ce98f25dba2c35d43ab85c72eb3e219975e17 100644
--- a/test/mjsunit/wasm/asm-wasm.js
+++ b/test/mjsunit/wasm/asm-wasm.js
@@ -1542,3 +1542,54 @@ assertWasm(1, TestXor);
Wasm.instantiateModuleFromAsm('var x = 3;');
});
})();
+
+(function TestIfWithUnsigned() {
+ function asmModule() {
+ "use asm";
+ function main() {
+ if (2147483658) { // 2^31 + 10
+ return 231;
+ }
+ return 0;
+ }
+ return {main:main};
+ }
+ var wasm = Wasm.instantiateModuleFromAsm(asmModule.toString());
+ assertEquals(231, wasm.main());
+})();
+
+(function TestLoopsWithUnsigned() {
+ function asmModule() {
+ "use asm";
+ function main() {
+ var val = 1;
+ var count = 0;
+ for (val = 2147483648; 2147483648;) {
+ val = 2147483649;
+ break;
+ }
+ while (val>>>0) {
+ val = (val + 1) | 0;
+ count = (count + 1)|0;
+ if ((count|0) == 9) {
+ break;
+ }
+ }
+ count = 0;
+ do {
+ val = (val + 2) | 0;
+ count = (count + 1)|0;
+ if ((count|0) == 5) {
+ break;
+ }
+ } while (0xffffffff);
+ if ((val>>>0) == 2147483668) {
+ return 323;
+ }
+ return 0;
+ }
+ return {main:main};
+ }
+ var wasm = Wasm.instantiateModuleFromAsm(asmModule.toString());
+ assertEquals(323, wasm.main());
+})();
« no previous file with comments | « test/mjsunit/regress/regress-617526.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698