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

Unified Diff: test/cctest/test-asm-validator.cc

Issue 2107683002: [wasm] Forbid sign mismatch in asm typer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 | « src/typing-asm.cc ('k') | test/mjsunit/regress/regress-wasm-crbug-618602.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-asm-validator.cc
diff --git a/test/cctest/test-asm-validator.cc b/test/cctest/test-asm-validator.cc
index 39d490e7a931761924ac310a62635d51145383b2..acbe9dac6f06eb83ff27d057bb8e35717b63a180 100644
--- a/test/cctest/test-asm-validator.cc
+++ b/test/cctest/test-asm-validator.cc
@@ -1318,7 +1318,40 @@ TEST(Division4) {
CHECK_FUNC_ERROR(
"function bar() { var x = 1; var y = 2; return (x/y/x/y)|0; }\n"
"function foo() { bar(); }",
- "asm: line 1: too many consecutive multiplicative ops\n");
+ "asm: line 1: left and right side of integer / or % "
+ "must match and be signed or unsigned\n");
+}
+
+TEST(ModInt) {
+ CHECK_FUNC_ERROR(
+ "function bar() { var x = 1; var y = 2; return (x%y)|0; }\n"
+ "function foo() { bar(); }",
+ "asm: line 1: left and right side of integer / or % "
+ "must match and be signed or unsigned\n");
+}
+
+TEST(DivInt) {
+ CHECK_FUNC_ERROR(
+ "function bar() { var x = 1; var y = 2; return (x/y)|0; }\n"
+ "function foo() { bar(); }",
+ "asm: line 1: left and right side of integer / or % "
+ "must match and be signed or unsigned\n");
+}
+
+TEST(ModIntMismatch) {
+ CHECK_FUNC_ERROR(
+ "function bar() { var x = 1; var y = 2; return ((x|0)%(y>>>0))|0; }\n"
+ "function foo() { bar(); }",
+ "asm: line 1: left and right side of integer / or % "
+ "must match and be signed or unsigned\n");
+}
+
+TEST(DivIntMismatch) {
+ CHECK_FUNC_ERROR(
+ "function bar() { var x = 1; var y = 2; return ((x|0)/(y>>>0))|0; }\n"
+ "function foo() { bar(); }",
+ "asm: line 1: left and right side of integer / or % "
+ "must match and be signed or unsigned\n");
}
« no previous file with comments | « src/typing-asm.cc ('k') | test/mjsunit/regress/regress-wasm-crbug-618602.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698