OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/compiler/typer.h" | 5 #include "src/compiler/typer.h" |
6 | 6 |
7 #include "src/base/flags.h" | 7 #include "src/base/flags.h" |
8 #include "src/bootstrapper.h" | 8 #include "src/bootstrapper.h" |
9 #include "src/compilation-dependencies.h" | 9 #include "src/compilation-dependencies.h" |
10 #include "src/compiler/common-operator.h" | 10 #include "src/compiler/common-operator.h" |
(...skipping 1352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1363 if (function->shared()->HasBuiltinFunctionId()) { | 1363 if (function->shared()->HasBuiltinFunctionId()) { |
1364 switch (function->shared()->builtin_function_id()) { | 1364 switch (function->shared()->builtin_function_id()) { |
1365 case kMathRandom: | 1365 case kMathRandom: |
1366 return Type::OrderedNumber(); | 1366 return Type::OrderedNumber(); |
1367 case kMathFloor: | 1367 case kMathFloor: |
1368 case kMathCeil: | 1368 case kMathCeil: |
1369 case kMathRound: | 1369 case kMathRound: |
1370 case kMathTrunc: | 1370 case kMathTrunc: |
1371 return t->cache_.kIntegerOrMinusZeroOrNaN; | 1371 return t->cache_.kIntegerOrMinusZeroOrNaN; |
1372 // Unary math functions. | 1372 // Unary math functions. |
| 1373 case kMathAbs: |
1373 case kMathExp: | 1374 case kMathExp: |
1374 return Type::Union(Type::PlainNumber(), Type::NaN(), t->zone()); | 1375 return Type::Union(Type::PlainNumber(), Type::NaN(), t->zone()); |
1375 case kMathAbs: | |
1376 case kMathLog: | 1376 case kMathLog: |
1377 case kMathSqrt: | 1377 case kMathSqrt: |
1378 case kMathCos: | 1378 case kMathCos: |
1379 case kMathSin: | 1379 case kMathSin: |
1380 case kMathTan: | 1380 case kMathTan: |
1381 case kMathAcos: | 1381 case kMathAcos: |
1382 case kMathAsin: | 1382 case kMathAsin: |
1383 case kMathAtan: | 1383 case kMathAtan: |
1384 case kMathFround: | 1384 case kMathFround: |
1385 return Type::Number(); | 1385 return Type::Number(); |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1656 Type* Typer::Visitor::TypeNumberLog(Node* node) { return Type::Number(); } | 1656 Type* Typer::Visitor::TypeNumberLog(Node* node) { return Type::Number(); } |
1657 | 1657 |
1658 Type* Typer::Visitor::TypeNumberLog1p(Node* node) { return Type::Number(); } | 1658 Type* Typer::Visitor::TypeNumberLog1p(Node* node) { return Type::Number(); } |
1659 | 1659 |
1660 Type* Typer::Visitor::TypeNumberLog2(Node* node) { return Type::Number(); } | 1660 Type* Typer::Visitor::TypeNumberLog2(Node* node) { return Type::Number(); } |
1661 | 1661 |
1662 Type* Typer::Visitor::TypeNumberLog10(Node* node) { return Type::Number(); } | 1662 Type* Typer::Visitor::TypeNumberLog10(Node* node) { return Type::Number(); } |
1663 | 1663 |
1664 Type* Typer::Visitor::TypeNumberCbrt(Node* node) { return Type::Number(); } | 1664 Type* Typer::Visitor::TypeNumberCbrt(Node* node) { return Type::Number(); } |
1665 | 1665 |
| 1666 Type* Typer::Visitor::TypeNumberPow(Node* node) { return Type::Number(); } |
| 1667 |
1666 Type* Typer::Visitor::TypeNumberRound(Node* node) { | 1668 Type* Typer::Visitor::TypeNumberRound(Node* node) { |
1667 return TypeUnaryOp(node, NumberRound); | 1669 return TypeUnaryOp(node, NumberRound); |
1668 } | 1670 } |
1669 | 1671 |
1670 Type* Typer::Visitor::TypeNumberSin(Node* node) { return Type::Number(); } | 1672 Type* Typer::Visitor::TypeNumberSin(Node* node) { return Type::Number(); } |
1671 | 1673 |
1672 Type* Typer::Visitor::TypeNumberSqrt(Node* node) { return Type::Number(); } | 1674 Type* Typer::Visitor::TypeNumberSqrt(Node* node) { return Type::Number(); } |
1673 | 1675 |
1674 Type* Typer::Visitor::TypeNumberTan(Node* node) { return Type::Number(); } | 1676 Type* Typer::Visitor::TypeNumberTan(Node* node) { return Type::Number(); } |
1675 | 1677 |
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2428 // TODO(turbofan): We should be able to infer a better type here. | 2430 // TODO(turbofan): We should be able to infer a better type here. |
2429 return Type::Number(); | 2431 return Type::Number(); |
2430 } | 2432 } |
2431 | 2433 |
2432 Type* Typer::Visitor::TypeFloat64Atan(Node* node) { return Type::Number(); } | 2434 Type* Typer::Visitor::TypeFloat64Atan(Node* node) { return Type::Number(); } |
2433 | 2435 |
2434 Type* Typer::Visitor::TypeFloat64Atan2(Node* node) { return Type::Number(); } | 2436 Type* Typer::Visitor::TypeFloat64Atan2(Node* node) { return Type::Number(); } |
2435 | 2437 |
2436 Type* Typer::Visitor::TypeFloat64Atanh(Node* node) { return Type::Number(); } | 2438 Type* Typer::Visitor::TypeFloat64Atanh(Node* node) { return Type::Number(); } |
2437 | 2439 |
| 2440 Type* Typer::Visitor::TypeFloat64Cbrt(Node* node) { return Type::Number(); } |
| 2441 |
2438 Type* Typer::Visitor::TypeFloat64Cos(Node* node) { return Type::Number(); } | 2442 Type* Typer::Visitor::TypeFloat64Cos(Node* node) { return Type::Number(); } |
2439 | 2443 |
2440 Type* Typer::Visitor::TypeFloat64Exp(Node* node) { return Type::Number(); } | 2444 Type* Typer::Visitor::TypeFloat64Exp(Node* node) { return Type::Number(); } |
2441 | 2445 |
2442 Type* Typer::Visitor::TypeFloat64Expm1(Node* node) { return Type::Number(); } | 2446 Type* Typer::Visitor::TypeFloat64Expm1(Node* node) { return Type::Number(); } |
2443 | 2447 |
2444 Type* Typer::Visitor::TypeFloat64Log(Node* node) { return Type::Number(); } | 2448 Type* Typer::Visitor::TypeFloat64Log(Node* node) { return Type::Number(); } |
2445 | 2449 |
2446 Type* Typer::Visitor::TypeFloat64Log1p(Node* node) { return Type::Number(); } | 2450 Type* Typer::Visitor::TypeFloat64Log1p(Node* node) { return Type::Number(); } |
2447 | 2451 |
| 2452 Type* Typer::Visitor::TypeFloat64Log10(Node* node) { return Type::Number(); } |
| 2453 |
2448 Type* Typer::Visitor::TypeFloat64Log2(Node* node) { return Type::Number(); } | 2454 Type* Typer::Visitor::TypeFloat64Log2(Node* node) { return Type::Number(); } |
2449 | 2455 |
2450 Type* Typer::Visitor::TypeFloat64Log10(Node* node) { return Type::Number(); } | 2456 Type* Typer::Visitor::TypeFloat64Pow(Node* node) { return Type::Number(); } |
2451 | |
2452 Type* Typer::Visitor::TypeFloat64Cbrt(Node* node) { return Type::Number(); } | |
2453 | 2457 |
2454 Type* Typer::Visitor::TypeFloat64Sin(Node* node) { return Type::Number(); } | 2458 Type* Typer::Visitor::TypeFloat64Sin(Node* node) { return Type::Number(); } |
2455 | 2459 |
2456 Type* Typer::Visitor::TypeFloat64Sqrt(Node* node) { return Type::Number(); } | 2460 Type* Typer::Visitor::TypeFloat64Sqrt(Node* node) { return Type::Number(); } |
2457 | 2461 |
2458 Type* Typer::Visitor::TypeFloat64Tan(Node* node) { return Type::Number(); } | 2462 Type* Typer::Visitor::TypeFloat64Tan(Node* node) { return Type::Number(); } |
2459 | 2463 |
2460 Type* Typer::Visitor::TypeFloat64Equal(Node* node) { return Type::Boolean(); } | 2464 Type* Typer::Visitor::TypeFloat64Equal(Node* node) { return Type::Boolean(); } |
2461 | 2465 |
2462 | 2466 |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2615 } | 2619 } |
2616 if (Type::IsInteger(*value)) { | 2620 if (Type::IsInteger(*value)) { |
2617 return Type::Range(value->Number(), value->Number(), zone()); | 2621 return Type::Range(value->Number(), value->Number(), zone()); |
2618 } | 2622 } |
2619 return Type::Constant(value, zone()); | 2623 return Type::Constant(value, zone()); |
2620 } | 2624 } |
2621 | 2625 |
2622 } // namespace compiler | 2626 } // namespace compiler |
2623 } // namespace internal | 2627 } // namespace internal |
2624 } // namespace v8 | 2628 } // namespace v8 |
OLD | NEW |