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 1525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1536 if (function->shared()->HasBuiltinFunctionId()) { | 1536 if (function->shared()->HasBuiltinFunctionId()) { |
1537 switch (function->shared()->builtin_function_id()) { | 1537 switch (function->shared()->builtin_function_id()) { |
1538 case kMathRandom: | 1538 case kMathRandom: |
1539 return Type::OrderedNumber(); | 1539 return Type::OrderedNumber(); |
1540 case kMathFloor: | 1540 case kMathFloor: |
1541 case kMathCeil: | 1541 case kMathCeil: |
1542 case kMathRound: | 1542 case kMathRound: |
1543 case kMathTrunc: | 1543 case kMathTrunc: |
1544 return t->cache_.kIntegerOrMinusZeroOrNaN; | 1544 return t->cache_.kIntegerOrMinusZeroOrNaN; |
1545 // Unary math functions. | 1545 // Unary math functions. |
| 1546 case kMathExp: |
| 1547 return Type::Union(Type::PlainNumber(), Type::NaN(), t->zone()); |
1546 case kMathAbs: | 1548 case kMathAbs: |
1547 case kMathLog: | 1549 case kMathLog: |
1548 case kMathExp: | |
1549 case kMathSqrt: | 1550 case kMathSqrt: |
1550 case kMathCos: | 1551 case kMathCos: |
1551 case kMathSin: | 1552 case kMathSin: |
1552 case kMathTan: | 1553 case kMathTan: |
1553 case kMathAcos: | 1554 case kMathAcos: |
1554 case kMathAsin: | 1555 case kMathAsin: |
1555 case kMathAtan: | 1556 case kMathAtan: |
1556 case kMathFround: | 1557 case kMathFround: |
1557 return Type::Number(); | 1558 return Type::Number(); |
1558 // Binary math functions. | 1559 // Binary math functions. |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1793 Type* Typer::Visitor::TypeNumberFloor(Node* node) { | 1794 Type* Typer::Visitor::TypeNumberFloor(Node* node) { |
1794 return TypeUnaryOp(node, NumberFloor); | 1795 return TypeUnaryOp(node, NumberFloor); |
1795 } | 1796 } |
1796 | 1797 |
1797 Type* Typer::Visitor::TypeNumberFround(Node* node) { return Type::Number(); } | 1798 Type* Typer::Visitor::TypeNumberFround(Node* node) { return Type::Number(); } |
1798 | 1799 |
1799 Type* Typer::Visitor::TypeNumberAtan(Node* node) { return Type::Number(); } | 1800 Type* Typer::Visitor::TypeNumberAtan(Node* node) { return Type::Number(); } |
1800 | 1801 |
1801 Type* Typer::Visitor::TypeNumberAtan2(Node* node) { return Type::Number(); } | 1802 Type* Typer::Visitor::TypeNumberAtan2(Node* node) { return Type::Number(); } |
1802 | 1803 |
| 1804 Type* Typer::Visitor::TypeNumberExp(Node* node) { |
| 1805 return Type::Union(Type::PlainNumber(), Type::NaN(), zone()); |
| 1806 } |
| 1807 |
1803 Type* Typer::Visitor::TypeNumberLog(Node* node) { return Type::Number(); } | 1808 Type* Typer::Visitor::TypeNumberLog(Node* node) { return Type::Number(); } |
1804 | 1809 |
1805 Type* Typer::Visitor::TypeNumberLog1p(Node* node) { return Type::Number(); } | 1810 Type* Typer::Visitor::TypeNumberLog1p(Node* node) { return Type::Number(); } |
1806 | 1811 |
1807 Type* Typer::Visitor::TypeNumberLog2(Node* node) { return Type::Number(); } | 1812 Type* Typer::Visitor::TypeNumberLog2(Node* node) { return Type::Number(); } |
1808 | 1813 |
1809 Type* Typer::Visitor::TypeNumberLog10(Node* node) { return Type::Number(); } | 1814 Type* Typer::Visitor::TypeNumberLog10(Node* node) { return Type::Number(); } |
1810 | 1815 |
1811 Type* Typer::Visitor::TypeNumberRound(Node* node) { | 1816 Type* Typer::Visitor::TypeNumberRound(Node* node) { |
1812 return TypeUnaryOp(node, NumberRound); | 1817 return TypeUnaryOp(node, NumberRound); |
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2552 | 2557 |
2553 Type* Typer::Visitor::TypeFloat64Abs(Node* node) { | 2558 Type* Typer::Visitor::TypeFloat64Abs(Node* node) { |
2554 // TODO(turbofan): We should be able to infer a better type here. | 2559 // TODO(turbofan): We should be able to infer a better type here. |
2555 return Type::Number(); | 2560 return Type::Number(); |
2556 } | 2561 } |
2557 | 2562 |
2558 Type* Typer::Visitor::TypeFloat64Atan(Node* node) { return Type::Number(); } | 2563 Type* Typer::Visitor::TypeFloat64Atan(Node* node) { return Type::Number(); } |
2559 | 2564 |
2560 Type* Typer::Visitor::TypeFloat64Atan2(Node* node) { return Type::Number(); } | 2565 Type* Typer::Visitor::TypeFloat64Atan2(Node* node) { return Type::Number(); } |
2561 | 2566 |
| 2567 Type* Typer::Visitor::TypeFloat64Exp(Node* node) { return Type::Number(); } |
| 2568 |
2562 Type* Typer::Visitor::TypeFloat64Log(Node* node) { return Type::Number(); } | 2569 Type* Typer::Visitor::TypeFloat64Log(Node* node) { return Type::Number(); } |
2563 | 2570 |
2564 Type* Typer::Visitor::TypeFloat64Log1p(Node* node) { return Type::Number(); } | 2571 Type* Typer::Visitor::TypeFloat64Log1p(Node* node) { return Type::Number(); } |
2565 | 2572 |
2566 Type* Typer::Visitor::TypeFloat64Log2(Node* node) { return Type::Number(); } | 2573 Type* Typer::Visitor::TypeFloat64Log2(Node* node) { return Type::Number(); } |
2567 | 2574 |
2568 Type* Typer::Visitor::TypeFloat64Log10(Node* node) { return Type::Number(); } | 2575 Type* Typer::Visitor::TypeFloat64Log10(Node* node) { return Type::Number(); } |
2569 | 2576 |
2570 Type* Typer::Visitor::TypeFloat64Sqrt(Node* node) { return Type::Number(); } | 2577 Type* Typer::Visitor::TypeFloat64Sqrt(Node* node) { return Type::Number(); } |
2571 | 2578 |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2728 } | 2735 } |
2729 if (Type::IsInteger(*value)) { | 2736 if (Type::IsInteger(*value)) { |
2730 return Type::Range(value->Number(), value->Number(), zone()); | 2737 return Type::Range(value->Number(), value->Number(), zone()); |
2731 } | 2738 } |
2732 return Type::Constant(value, zone()); | 2739 return Type::Constant(value, zone()); |
2733 } | 2740 } |
2734 | 2741 |
2735 } // namespace compiler | 2742 } // namespace compiler |
2736 } // namespace internal | 2743 } // namespace internal |
2737 } // namespace v8 | 2744 } // namespace v8 |
OLD | NEW |