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