| 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 1141 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1152       IntersectResult(expr, computed_type_); |  1152       IntersectResult(expr, computed_type_); | 
|  1153       return; |  1153       return; | 
|  1154     } |  1154     } | 
|  1155     case Token::OR: |  1155     case Token::OR: | 
|  1156     case Token::AND: |  1156     case Token::AND: | 
|  1157       FAIL(expr, "illegal logical operator"); |  1157       FAIL(expr, "illegal logical operator"); | 
|  1158     case Token::BIT_OR: { |  1158     case Token::BIT_OR: { | 
|  1159       // BIT_OR allows Any since it is used as a type coercion. |  1159       // BIT_OR allows Any since it is used as a type coercion. | 
|  1160       VisitIntegerBitwiseOperator(expr, Type::Any(), cache_.kAsmIntQ, |  1160       VisitIntegerBitwiseOperator(expr, Type::Any(), cache_.kAsmIntQ, | 
|  1161                                   cache_.kAsmSigned, true); |  1161                                   cache_.kAsmSigned, true); | 
|  1162       if (expr->left()->IsCall() && expr->op() == Token::BIT_OR) { |  1162       if (expr->left()->IsCall() && expr->op() == Token::BIT_OR && | 
 |  1163           Type::Number()->Is(expr->left()->bounds().upper)) { | 
 |  1164         // Force the return types of foreign functions. | 
|  1163         expr->left()->set_bounds(Bounds(cache_.kAsmSigned)); |  1165         expr->left()->set_bounds(Bounds(cache_.kAsmSigned)); | 
|  1164       } |  1166       } | 
|  1165       return; |  1167       return; | 
|  1166     } |  1168     } | 
|  1167     case Token::BIT_XOR: { |  1169     case Token::BIT_XOR: { | 
|  1168       // Handle booleans specially to handle de-sugared ! |  1170       // Handle booleans specially to handle de-sugared ! | 
|  1169       Literal* left = expr->left()->AsLiteral(); |  1171       Literal* left = expr->left()->AsLiteral(); | 
|  1170       if (left && left->value()->IsBoolean()) { |  1172       if (left && left->value()->IsBoolean()) { | 
|  1171         if (left->ToBooleanIsTrue()) { |  1173         if (left->ToBooleanIsTrue()) { | 
|  1172           left->set_bounds(Bounds(cache_.kSingletonOne)); |  1174           left->set_bounds(Bounds(cache_.kSingletonOne)); | 
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1246             if (intish_ > kMaxUncombinedMultiplicativeSteps) { |  1248             if (intish_ > kMaxUncombinedMultiplicativeSteps) { | 
|  1247               FAIL(expr, "too many consecutive multiplicative ops"); |  1249               FAIL(expr, "too many consecutive multiplicative ops"); | 
|  1248             } |  1250             } | 
|  1249           } |  1251           } | 
|  1250           IntersectResult(expr, cache_.kAsmInt); |  1252           IntersectResult(expr, cache_.kAsmInt); | 
|  1251           return; |  1253           return; | 
|  1252         } |  1254         } | 
|  1253       } else if (expr->op() == Token::MUL && expr->right()->IsLiteral() && |  1255       } else if (expr->op() == Token::MUL && expr->right()->IsLiteral() && | 
|  1254                  right_type->Is(cache_.kAsmDouble)) { |  1256                  right_type->Is(cache_.kAsmDouble)) { | 
|  1255         // For unary +, expressed as x * 1.0 |  1257         // For unary +, expressed as x * 1.0 | 
|  1256         if (expr->left()->IsCall() && expr->op() == Token::MUL) { |  1258         if (expr->left()->IsCall() && expr->op() == Token::MUL && | 
 |  1259             Type::Number()->Is(expr->left()->bounds().upper)) { | 
 |  1260           // Force the return types of foreign functions. | 
|  1257           expr->left()->set_bounds(Bounds(cache_.kAsmDouble)); |  1261           expr->left()->set_bounds(Bounds(cache_.kAsmDouble)); | 
|  1258         } |  1262         } | 
|  1259         IntersectResult(expr, cache_.kAsmDouble); |  1263         IntersectResult(expr, cache_.kAsmDouble); | 
|  1260         return; |  1264         return; | 
|  1261       } else if (expr->op() == Token::MUL && left_type->Is(cache_.kAsmDouble) && |  1265       } else if (expr->op() == Token::MUL && left_type->Is(cache_.kAsmDouble) && | 
|  1262                  expr->right()->IsLiteral() && |  1266                  expr->right()->IsLiteral() && | 
|  1263                  !expr->right()->AsLiteral()->raw_value()->ContainsDot() && |  1267                  !expr->right()->AsLiteral()->raw_value()->ContainsDot() && | 
|  1264                  expr->right()->AsLiteral()->raw_value()->AsNumber() == -1.0) { |  1268                  expr->right()->AsLiteral()->raw_value()->AsNumber() == -1.0) { | 
|  1265         // For unary -, expressed as x * -1 |  1269         // For unary -, expressed as x * -1 | 
|  1266         expr->right()->set_bounds(Bounds(cache_.kAsmDouble)); |  1270         expr->right()->set_bounds(Bounds(cache_.kAsmDouble)); | 
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1568 } |  1572 } | 
|  1569  |  1573  | 
|  1570  |  1574  | 
|  1571 void AsmTyper::VisitRewritableExpression(RewritableExpression* expr) { |  1575 void AsmTyper::VisitRewritableExpression(RewritableExpression* expr) { | 
|  1572   RECURSE(Visit(expr->expression())); |  1576   RECURSE(Visit(expr->expression())); | 
|  1573 } |  1577 } | 
|  1574  |  1578  | 
|  1575  |  1579  | 
|  1576 }  // namespace internal |  1580 }  // namespace internal | 
|  1577 }  // namespace v8 |  1581 }  // namespace v8 | 
| OLD | NEW |