OLD | NEW |
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 1281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1292 intish_ = left_intish + right_intish + 1; | 1292 intish_ = left_intish + right_intish + 1; |
1293 if (expr->op() == Token::ADD || expr->op() == Token::SUB) { | 1293 if (expr->op() == Token::ADD || expr->op() == Token::SUB) { |
1294 if (intish_ > kMaxUncombinedAdditiveSteps) { | 1294 if (intish_ > kMaxUncombinedAdditiveSteps) { |
1295 FAIL(expr, "too many consecutive additive ops"); | 1295 FAIL(expr, "too many consecutive additive ops"); |
1296 } | 1296 } |
1297 } else { | 1297 } else { |
1298 if (intish_ > kMaxUncombinedMultiplicativeSteps) { | 1298 if (intish_ > kMaxUncombinedMultiplicativeSteps) { |
1299 FAIL(expr, "too many consecutive multiplicative ops"); | 1299 FAIL(expr, "too many consecutive multiplicative ops"); |
1300 } | 1300 } |
1301 } | 1301 } |
| 1302 if (expr->op() == Token::MOD || expr->op() == Token::DIV) { |
| 1303 if (!((left_type->Is(cache_.kAsmSigned) && |
| 1304 right_type->Is(cache_.kAsmSigned)) || |
| 1305 (left_type->Is(cache_.kAsmUnsigned) && |
| 1306 right_type->Is(cache_.kAsmUnsigned)))) { |
| 1307 FAIL(expr, |
| 1308 "left and right side of integer / or % " |
| 1309 "must match and be signed or unsigned"); |
| 1310 } |
| 1311 } |
1302 RECURSE(IntersectResult(expr, cache_.kAsmInt)); | 1312 RECURSE(IntersectResult(expr, cache_.kAsmInt)); |
1303 return; | 1313 return; |
1304 } | 1314 } |
1305 } else if (expr->op() == Token::MUL && expr->right()->IsLiteral() && | 1315 } else if (expr->op() == Token::MUL && expr->right()->IsLiteral() && |
1306 right_type->Is(cache_.kAsmDouble) && | 1316 right_type->Is(cache_.kAsmDouble) && |
1307 expr->right()->AsLiteral()->raw_value()->ContainsDot() && | 1317 expr->right()->AsLiteral()->raw_value()->ContainsDot() && |
1308 expr->right()->AsLiteral()->raw_value()->AsNumber() == 1.0) { | 1318 expr->right()->AsLiteral()->raw_value()->AsNumber() == 1.0) { |
1309 // For unary +, expressed as x * 1.0 | 1319 // For unary +, expressed as x * 1.0 |
1310 if (expr->left()->IsCall() && | 1320 if (expr->left()->IsCall() && |
1311 Type::Number()->Is(bounds_.get(expr->left()).upper)) { | 1321 Type::Number()->Is(bounds_.get(expr->left()).upper)) { |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1637 } | 1647 } |
1638 | 1648 |
1639 | 1649 |
1640 void AsmTyper::VisitRewritableExpression(RewritableExpression* expr) { | 1650 void AsmTyper::VisitRewritableExpression(RewritableExpression* expr) { |
1641 RECURSE(Visit(expr->expression())); | 1651 RECURSE(Visit(expr->expression())); |
1642 } | 1652 } |
1643 | 1653 |
1644 | 1654 |
1645 } // namespace internal | 1655 } // namespace internal |
1646 } // namespace v8 | 1656 } // namespace v8 |
OLD | NEW |