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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/wasm/asm-wasm-builder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/typing-asm.h" 5 #include "src/typing-asm.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "src/v8.h" 9 #include "src/v8.h"
10 10
(...skipping 1263 matching lines...) Expand 10 before | Expand all | Expand 10 after
1274 } 1274 }
1275 } else { 1275 } else {
1276 if (intish_ > kMaxUncombinedMultiplicativeSteps) { 1276 if (intish_ > kMaxUncombinedMultiplicativeSteps) {
1277 FAIL(expr, "too many consecutive multiplicative ops"); 1277 FAIL(expr, "too many consecutive multiplicative ops");
1278 } 1278 }
1279 } 1279 }
1280 IntersectResult(expr, cache_.kAsmInt); 1280 IntersectResult(expr, cache_.kAsmInt);
1281 return; 1281 return;
1282 } 1282 }
1283 } else if (expr->op() == Token::MUL && expr->right()->IsLiteral() && 1283 } else if (expr->op() == Token::MUL && expr->right()->IsLiteral() &&
1284 right_type->Is(cache_.kAsmDouble)) { 1284 right_type->Is(cache_.kAsmDouble) &&
1285 expr->right()->AsLiteral()->raw_value()->ContainsDot() &&
1286 expr->right()->AsLiteral()->raw_value()->AsNumber() == 1.0) {
1285 // For unary +, expressed as x * 1.0 1287 // For unary +, expressed as x * 1.0
1286 if (expr->left()->IsCall() && expr->op() == Token::MUL && 1288 if (expr->left()->IsCall() &&
1287 Type::Number()->Is(expr->left()->bounds().upper)) { 1289 Type::Number()->Is(expr->left()->bounds().upper)) {
1288 // Force the return types of foreign functions. 1290 // Force the return types of foreign functions.
1289 expr->left()->set_bounds(Bounds(cache_.kAsmDouble)); 1291 expr->left()->set_bounds(Bounds(cache_.kAsmDouble));
1292 left_type = expr->left()->bounds().upper;
1293 }
1294 if (!(expr->left()->IsProperty() &&
1295 Type::Number()->Is(expr->left()->bounds().upper))) {
1296 if (!left_type->Is(cache_.kAsmSigned) &&
1297 !left_type->Is(cache_.kAsmUnsigned) &&
1298 !left_type->Is(cache_.kAsmFixnum) &&
1299 !left_type->Is(cache_.kAsmFloatQ) &&
1300 !left_type->Is(cache_.kAsmDoubleQ)) {
1301 FAIL(
1302 expr->left(),
1303 "unary + only allowed on signed, unsigned, float?, or double?");
1304 }
1290 } 1305 }
1291 IntersectResult(expr, cache_.kAsmDouble); 1306 IntersectResult(expr, cache_.kAsmDouble);
1292 return; 1307 return;
1293 } else if (expr->op() == Token::MUL && left_type->Is(cache_.kAsmDouble) && 1308 } else if (expr->op() == Token::MUL && left_type->Is(cache_.kAsmDouble) &&
1294 expr->right()->IsLiteral() && 1309 expr->right()->IsLiteral() &&
1295 !expr->right()->AsLiteral()->raw_value()->ContainsDot() && 1310 !expr->right()->AsLiteral()->raw_value()->ContainsDot() &&
1296 expr->right()->AsLiteral()->raw_value()->AsNumber() == -1.0) { 1311 expr->right()->AsLiteral()->raw_value()->AsNumber() == -1.0) {
1297 // For unary -, expressed as x * -1 1312 // For unary -, expressed as x * -1
1298 expr->right()->set_bounds(Bounds(cache_.kAsmDouble)); 1313 expr->right()->set_bounds(Bounds(cache_.kAsmDouble));
1299 IntersectResult(expr, cache_.kAsmDouble); 1314 IntersectResult(expr, cache_.kAsmDouble);
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
1600 } 1615 }
1601 1616
1602 1617
1603 void AsmTyper::VisitRewritableExpression(RewritableExpression* expr) { 1618 void AsmTyper::VisitRewritableExpression(RewritableExpression* expr) {
1604 RECURSE(Visit(expr->expression())); 1619 RECURSE(Visit(expr->expression()));
1605 } 1620 }
1606 1621
1607 1622
1608 } // namespace internal 1623 } // namespace internal
1609 } // namespace v8 1624 } // namespace v8
OLDNEW
« 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