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

Unified Diff: src/asmjs/typing-asm.cc

Issue 2138243002: [wasm] allow array access with unsigned indices (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: [wasm] allow array access with unsigned indices Created 4 years, 5 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/asmjs/typing-asm.cc
diff --git a/src/asmjs/typing-asm.cc b/src/asmjs/typing-asm.cc
index 01db88aa94ad0acdab6a9d776a97fcf0084a9357..cc0c5e62400ea0ac1fe318583ae5f2e3ba9325f2 100644
--- a/src/asmjs/typing-asm.cc
+++ b/src/asmjs/typing-asm.cc
@@ -763,14 +763,14 @@ void AsmTyper::VisitHeapAccess(Property* expr, bool assigning,
// FAIL(right, "call mask must match function table");
// }
// bin->set_bounds(Bounds(cache_.kAsmSigned));
- RECURSE(VisitWithExpectation(expr->key(), cache_.kAsmSigned,
- "must be integer"));
+ RECURSE(
+ VisitWithExpectation(expr->key(), cache_.kAsmSigned, "must be int"));
RECURSE(IntersectResult(expr, type));
} else {
Literal* literal = expr->key()->AsLiteral();
if (literal) {
- RECURSE(VisitWithExpectation(literal, cache_.kAsmSigned,
- "array index expected to be integer"));
+ RECURSE(VisitWithExpectation(literal, cache_.kAsmUnsigned,
+ "array index expected to be unsigned"));
} else {
int expected_shift = ElementShiftSize(type);
if (expected_shift == 0) {
@@ -780,20 +780,20 @@ void AsmTyper::VisitHeapAccess(Property* expr, bool assigning,
if (bin == nullptr || bin->op() != Token::SAR) {
FAIL(expr->key(), "expected >> in heap access");
}
- RECURSE(VisitWithExpectation(bin->left(), cache_.kAsmSigned,
+ RECURSE(VisitWithExpectation(bin->left(), cache_.kAsmInt,
"array index expected to be integer"));
Literal* right = bin->right()->AsLiteral();
if (right == nullptr || right->raw_value()->ContainsDot()) {
FAIL(bin->right(), "heap access shift must be integer");
}
- RECURSE(VisitWithExpectation(bin->right(), cache_.kAsmSigned,
- "array shift expected to be integer"));
+ RECURSE(VisitWithExpectation(bin->right(), cache_.kAsmFixnum,
+ "array shift expected to be Fixnum"));
int n = static_cast<int>(right->raw_value()->AsNumber());
if (expected_shift < 0 || n != expected_shift) {
FAIL(right, "heap access shift must match element size");
}
}
- bounds_.set(expr->key(), Bounds(cache_.kAsmSigned));
+ bounds_.set(expr->key(), Bounds(cache_.kAsmUnsigned));
}
Type* result_type;
if (type->Is(cache_.kAsmIntArrayElement)) {
« 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