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 1539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1550 Type* Typer::Visitor::TypeJSGeneratorRestoreRegister(Node* node) { | 1550 Type* Typer::Visitor::TypeJSGeneratorRestoreRegister(Node* node) { |
1551 return Type::Any(); | 1551 return Type::Any(); |
1552 } | 1552 } |
1553 | 1553 |
1554 Type* Typer::Visitor::TypeJSStackCheck(Node* node) { return Type::Any(); } | 1554 Type* Typer::Visitor::TypeJSStackCheck(Node* node) { return Type::Any(); } |
1555 | 1555 |
1556 // Simplified operators. | 1556 // Simplified operators. |
1557 | 1557 |
1558 Type* Typer::Visitor::TypeBooleanNot(Node* node) { return Type::Boolean(); } | 1558 Type* Typer::Visitor::TypeBooleanNot(Node* node) { return Type::Boolean(); } |
1559 | 1559 |
1560 Type* Typer::Visitor::TypeBooleanToNumber(Node* node) { | |
1561 return TypeUnaryOp(node, ToNumber); | |
1562 } | |
1563 | |
1564 Type* Typer::Visitor::TypeNumberEqual(Node* node) { return Type::Boolean(); } | 1560 Type* Typer::Visitor::TypeNumberEqual(Node* node) { return Type::Boolean(); } |
1565 | 1561 |
1566 Type* Typer::Visitor::TypeNumberLessThan(Node* node) { return Type::Boolean(); } | 1562 Type* Typer::Visitor::TypeNumberLessThan(Node* node) { return Type::Boolean(); } |
1567 | 1563 |
1568 Type* Typer::Visitor::TypeNumberLessThanOrEqual(Node* node) { | 1564 Type* Typer::Visitor::TypeNumberLessThanOrEqual(Node* node) { |
1569 return Type::Boolean(); | 1565 return Type::Boolean(); |
1570 } | 1566 } |
1571 | 1567 |
1572 Type* Typer::Visitor::TypeSpeculativeNumberEqual(Node* node) { | 1568 Type* Typer::Visitor::TypeSpeculativeNumberEqual(Node* node) { |
1573 return Type::Boolean(); | 1569 return Type::Boolean(); |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1772 Handle<String> string = f->LookupSingleCharacterStringFromCode(code); | 1768 Handle<String> string = f->LookupSingleCharacterStringFromCode(code); |
1773 return Type::Constant(string, t->zone()); | 1769 return Type::Constant(string, t->zone()); |
1774 } | 1770 } |
1775 return Type::String(); | 1771 return Type::String(); |
1776 } | 1772 } |
1777 | 1773 |
1778 Type* Typer::Visitor::TypeStringFromCharCode(Node* node) { | 1774 Type* Typer::Visitor::TypeStringFromCharCode(Node* node) { |
1779 return TypeUnaryOp(node, StringFromCharCodeTyper); | 1775 return TypeUnaryOp(node, StringFromCharCodeTyper); |
1780 } | 1776 } |
1781 | 1777 |
1782 Type* Typer::Visitor::TypeStringToNumber(Node* node) { | |
1783 return TypeUnaryOp(node, ToNumber); | |
1784 } | |
1785 | |
1786 Type* Typer::Visitor::TypeCheckBounds(Node* node) { | 1778 Type* Typer::Visitor::TypeCheckBounds(Node* node) { |
1787 // TODO(bmeurer): We could do better here based on the limit. | 1779 // TODO(bmeurer): We could do better here based on the limit. |
1788 return Type::Unsigned31(); | 1780 return Type::Unsigned31(); |
1789 } | 1781 } |
1790 | 1782 |
1791 Type* Typer::Visitor::TypeCheckNumber(Node* node) { | 1783 Type* Typer::Visitor::TypeCheckNumber(Node* node) { |
1792 Type* arg = Operand(node, 0); | 1784 Type* arg = Operand(node, 0); |
1793 return Type::Intersect(arg, Type::Number(), zone()); | 1785 return Type::Intersect(arg, Type::Number(), zone()); |
1794 } | 1786 } |
1795 | 1787 |
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2570 } | 2562 } |
2571 if (Type::IsInteger(*value)) { | 2563 if (Type::IsInteger(*value)) { |
2572 return Type::Range(value->Number(), value->Number(), zone()); | 2564 return Type::Range(value->Number(), value->Number(), zone()); |
2573 } | 2565 } |
2574 return Type::Constant(value, zone()); | 2566 return Type::Constant(value, zone()); |
2575 } | 2567 } |
2576 | 2568 |
2577 } // namespace compiler | 2569 } // namespace compiler |
2578 } // namespace internal | 2570 } // namespace internal |
2579 } // namespace v8 | 2571 } // namespace v8 |
OLD | NEW |