| 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 <iomanip> | 7 #include <iomanip> |
| 8 | 8 |
| 9 #include "src/base/flags.h" | 9 #include "src/base/flags.h" |
| 10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
| (...skipping 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1045 return NumberDivide(ToNumber(lhs, t), ToNumber(rhs, t), t); | 1045 return NumberDivide(ToNumber(lhs, t), ToNumber(rhs, t), t); |
| 1046 } | 1046 } |
| 1047 | 1047 |
| 1048 Type* Typer::Visitor::JSModulusTyper(Type* lhs, Type* rhs, Typer* t) { | 1048 Type* Typer::Visitor::JSModulusTyper(Type* lhs, Type* rhs, Typer* t) { |
| 1049 return NumberModulus(ToNumber(lhs, t), ToNumber(rhs, t), t); | 1049 return NumberModulus(ToNumber(lhs, t), ToNumber(rhs, t), t); |
| 1050 } | 1050 } |
| 1051 | 1051 |
| 1052 | 1052 |
| 1053 // JS unary operators. | 1053 // JS unary operators. |
| 1054 | 1054 |
| 1055 Type* Typer::Visitor::TypeJSClassOf(Node* node) { |
| 1056 return Type::InternalizedStringOrNull(); |
| 1057 } |
| 1055 | 1058 |
| 1056 Type* Typer::Visitor::TypeJSTypeOf(Node* node) { | 1059 Type* Typer::Visitor::TypeJSTypeOf(Node* node) { |
| 1057 return Type::InternalizedString(); | 1060 return Type::InternalizedString(); |
| 1058 } | 1061 } |
| 1059 | 1062 |
| 1060 | 1063 |
| 1061 // JS conversion operators. | 1064 // JS conversion operators. |
| 1062 | 1065 |
| 1063 | 1066 |
| 1064 Type* Typer::Visitor::TypeJSToBoolean(Node* node) { | 1067 Type* Typer::Visitor::TypeJSToBoolean(Node* node) { |
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1554 case Runtime::kInlineToInteger: | 1557 case Runtime::kInlineToInteger: |
| 1555 return TypeUnaryOp(node, ToInteger); | 1558 return TypeUnaryOp(node, ToInteger); |
| 1556 case Runtime::kInlineToLength: | 1559 case Runtime::kInlineToLength: |
| 1557 return TypeUnaryOp(node, ToLength); | 1560 return TypeUnaryOp(node, ToLength); |
| 1558 case Runtime::kInlineToNumber: | 1561 case Runtime::kInlineToNumber: |
| 1559 return TypeUnaryOp(node, ToNumber); | 1562 return TypeUnaryOp(node, ToNumber); |
| 1560 case Runtime::kInlineToObject: | 1563 case Runtime::kInlineToObject: |
| 1561 return TypeUnaryOp(node, ToObject); | 1564 return TypeUnaryOp(node, ToObject); |
| 1562 case Runtime::kInlineToString: | 1565 case Runtime::kInlineToString: |
| 1563 return TypeUnaryOp(node, ToString); | 1566 return TypeUnaryOp(node, ToString); |
| 1564 case Runtime::kClassOf: | |
| 1565 case Runtime::kInlineClassOf: | 1567 case Runtime::kInlineClassOf: |
| 1566 return Type::Union(Type::InternalizedString(), Type::Null(), zone()); | 1568 return Type::InternalizedStringOrNull(); |
| 1567 case Runtime::kHasInPrototypeChain: | 1569 case Runtime::kHasInPrototypeChain: |
| 1568 return Type::Boolean(); | 1570 return Type::Boolean(); |
| 1569 default: | 1571 default: |
| 1570 break; | 1572 break; |
| 1571 } | 1573 } |
| 1572 // TODO(turbofan): This should be Type::NonInternal(), but unfortunately we | 1574 // TODO(turbofan): This should be Type::NonInternal(), but unfortunately we |
| 1573 // have a few weird runtime calls that return the hole or even FixedArrays; | 1575 // have a few weird runtime calls that return the hole or even FixedArrays; |
| 1574 // change this once those weird runtime calls have been removed. | 1576 // change this once those weird runtime calls have been removed. |
| 1575 return Type::Any(); | 1577 return Type::Any(); |
| 1576 } | 1578 } |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1881 Type* Typer::Visitor::TypeConstant(Handle<Object> value) { | 1883 Type* Typer::Visitor::TypeConstant(Handle<Object> value) { |
| 1882 if (Type::IsInteger(*value)) { | 1884 if (Type::IsInteger(*value)) { |
| 1883 return Type::Range(value->Number(), value->Number(), zone()); | 1885 return Type::Range(value->Number(), value->Number(), zone()); |
| 1884 } | 1886 } |
| 1885 return Type::NewConstant(value, zone()); | 1887 return Type::NewConstant(value, zone()); |
| 1886 } | 1888 } |
| 1887 | 1889 |
| 1888 } // namespace compiler | 1890 } // namespace compiler |
| 1889 } // namespace internal | 1891 } // namespace internal |
| 1890 } // namespace v8 | 1892 } // namespace v8 |
| OLD | NEW |