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

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

Issue 2555323003: [wasm][asm.js] Confirm literals are Numbers before using AsNumber, refactor. (Closed)
Patch Set: fix Created 4 years 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/asmjs/asm-typer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/asm/asm-validation.js
diff --git a/test/mjsunit/asm/asm-validation.js b/test/mjsunit/asm/asm-validation.js
index 06799dab67a3cb53c9209c87d061acba3125f58d..d4c6fff1cf76f5c8cbaf8cbb374fb3dba92168a5 100644
--- a/test/mjsunit/asm/asm-validation.js
+++ b/test/mjsunit/asm/asm-validation.js
@@ -295,3 +295,37 @@ function assertValidAsm(func) {
assertTrue(%IsNotAsmWasmCode(Module));
assertEquals(0xffffffff, m.foo());
})();
+
+(function TestBadBooleanAnnotation() {
+ function Module() {
+ "use asm";
+ function foo(x) {
+ x = x | true;
+ return x;
+ }
+ return { foo: foo };
+ }
+ var m = Module();
+ assertTrue(%IsNotAsmWasmCode(Module));
+ assertEquals(3, m.foo(3));
+})();
+
+(function TestBadCase() {
+ function Module() {
+ "use asm";
+ function foo(x) {
+ x = x | 0;
+ switch (x|0) {
+ case true:
+ return 42;
+ default:
+ return 43;
+ }
+ return 0;
+ }
+ return { foo: foo };
+ }
+ var m = Module();
+ assertTrue(%IsNotAsmWasmCode(Module));
+ assertEquals(43, m.foo(3));
+})();
« no previous file with comments | « src/asmjs/asm-typer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698