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

Unified Diff: src/typing-asm.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 | « no previous file | test/cctest/test-asm-validator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/typing-asm.cc
diff --git a/src/typing-asm.cc b/src/typing-asm.cc
index 2390e7e7b12a824229e8d68768896c35791836d4..085c544a6084f14891ddd76259982c6e8c122382 100644
--- a/src/typing-asm.cc
+++ b/src/typing-asm.cc
@@ -1299,6 +1299,16 @@ void AsmTyper::VisitBinaryOperation(BinaryOperation* expr) {
FAIL(expr, "too many consecutive multiplicative ops");
}
}
+ if (expr->op() == Token::MOD || expr->op() == Token::DIV) {
+ if (!((left_type->Is(cache_.kAsmSigned) &&
+ right_type->Is(cache_.kAsmSigned)) ||
+ (left_type->Is(cache_.kAsmUnsigned) &&
+ right_type->Is(cache_.kAsmUnsigned)))) {
+ FAIL(expr,
+ "left and right side of integer / or % "
+ "must match and be signed or unsigned");
+ }
+ }
RECURSE(IntersectResult(expr, cache_.kAsmInt));
return;
}
« no previous file with comments | « no previous file | test/cctest/test-asm-validator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698