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

Unified Diff: src/typing-asm.cc

Issue 1832603002: Properly handle unsigned literals, fix typing issue with unary +. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: drop print Created 4 years, 9 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 | src/wasm/asm-wasm-builder.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 75057b93ffb57d238f19172474274d623d01da70..24e6d08daabcf6c4f62de7b480f8c7e7e56a2fe7 100644
--- a/src/typing-asm.cc
+++ b/src/typing-asm.cc
@@ -1281,12 +1281,27 @@ void AsmTyper::VisitBinaryOperation(BinaryOperation* expr) {
return;
}
} else if (expr->op() == Token::MUL && expr->right()->IsLiteral() &&
- right_type->Is(cache_.kAsmDouble)) {
+ right_type->Is(cache_.kAsmDouble) &&
+ expr->right()->AsLiteral()->raw_value()->ContainsDot() &&
+ expr->right()->AsLiteral()->raw_value()->AsNumber() == 1.0) {
// For unary +, expressed as x * 1.0
- if (expr->left()->IsCall() && expr->op() == Token::MUL &&
+ if (expr->left()->IsCall() &&
Type::Number()->Is(expr->left()->bounds().upper)) {
// Force the return types of foreign functions.
expr->left()->set_bounds(Bounds(cache_.kAsmDouble));
+ left_type = expr->left()->bounds().upper;
+ }
+ if (!(expr->left()->IsProperty() &&
+ Type::Number()->Is(expr->left()->bounds().upper))) {
+ if (!left_type->Is(cache_.kAsmSigned) &&
+ !left_type->Is(cache_.kAsmUnsigned) &&
+ !left_type->Is(cache_.kAsmFixnum) &&
+ !left_type->Is(cache_.kAsmFloatQ) &&
+ !left_type->Is(cache_.kAsmDoubleQ)) {
+ FAIL(
+ expr->left(),
+ "unary + only allowed on signed, unsigned, float?, or double?");
+ }
}
IntersectResult(expr, cache_.kAsmDouble);
return;
« no previous file with comments | « no previous file | src/wasm/asm-wasm-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698