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

Unified Diff: src/typing-asm.cc

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 | « no previous file | test/mjsunit/regress/regress-617526.js » ('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 26a85442360066ff3435a0fbb4dd4d14b65d6c31..f3d2fe53a697d28640d7a440c4843404fdee4b67 100644
--- a/src/typing-asm.cc
+++ b/src/typing-asm.cc
@@ -340,8 +340,11 @@ void AsmTyper::VisitIfStatement(IfStatement* stmt) {
if (!in_function_) {
FAIL(stmt, "if statement inside module body");
}
- RECURSE(VisitWithExpectation(stmt->condition(), cache_.kAsmSigned,
+ RECURSE(VisitWithExpectation(stmt->condition(), cache_.kAsmInt,
"if condition expected to be integer"));
+ if (intish_ != 0) {
+ FAIL(stmt, "if condition expected to be signed or unsigned");
+ }
RECURSE(Visit(stmt->then_statement()));
RECURSE(Visit(stmt->else_statement()));
}
@@ -434,8 +437,11 @@ void AsmTyper::VisitDoWhileStatement(DoWhileStatement* stmt) {
FAIL(stmt, "do statement inside module body");
}
RECURSE(Visit(stmt->body()));
- RECURSE(VisitWithExpectation(stmt->cond(), cache_.kAsmSigned,
+ RECURSE(VisitWithExpectation(stmt->cond(), cache_.kAsmInt,
"do condition expected to be integer"));
+ if (intish_ != 0) {
+ FAIL(stmt, "do condition expected to be signed or unsigned");
+ }
}
@@ -443,8 +449,11 @@ void AsmTyper::VisitWhileStatement(WhileStatement* stmt) {
if (!in_function_) {
FAIL(stmt, "while statement inside module body");
}
- RECURSE(VisitWithExpectation(stmt->cond(), cache_.kAsmSigned,
+ RECURSE(VisitWithExpectation(stmt->cond(), cache_.kAsmInt,
"while condition expected to be integer"));
+ if (intish_ != 0) {
+ FAIL(stmt, "while condition expected to be signed or unsigned");
+ }
RECURSE(Visit(stmt->body()));
}
@@ -457,9 +466,12 @@ void AsmTyper::VisitForStatement(ForStatement* stmt) {
RECURSE(Visit(stmt->init()));
}
if (stmt->cond() != nullptr) {
- RECURSE(VisitWithExpectation(stmt->cond(), cache_.kAsmSigned,
+ RECURSE(VisitWithExpectation(stmt->cond(), cache_.kAsmInt,
"for condition expected to be integer"));
}
+ if (intish_ != 0) {
+ FAIL(stmt, "for condition expected to be signed or unsigned");
+ }
if (stmt->next() != nullptr) {
RECURSE(Visit(stmt->next()));
}
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-617526.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698