| 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 913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 924 } | 924 } |
| 925 if (lhs->IsHeapConstant() && rhs->Is(lhs)) { | 925 if (lhs->IsHeapConstant() && rhs->Is(lhs)) { |
| 926 // Types are equal and are inhabited only by a single semantic value, | 926 // Types are equal and are inhabited only by a single semantic value, |
| 927 // which is not nan due to the earlier check. | 927 // which is not nan due to the earlier check. |
| 928 return t->singleton_true_; | 928 return t->singleton_true_; |
| 929 } | 929 } |
| 930 return Type::Boolean(); | 930 return Type::Boolean(); |
| 931 } | 931 } |
| 932 | 932 |
| 933 | 933 |
| 934 Type* Typer::Visitor::JSStrictNotEqualTyper(Type* lhs, Type* rhs, Typer* t) { | |
| 935 return Invert(JSStrictEqualTyper(lhs, rhs, t), t); | |
| 936 } | |
| 937 | |
| 938 | |
| 939 // The EcmaScript specification defines the four relational comparison operators | 934 // The EcmaScript specification defines the four relational comparison operators |
| 940 // (<, <=, >=, >) with the help of a single abstract one. It behaves like < | 935 // (<, <=, >=, >) with the help of a single abstract one. It behaves like < |
| 941 // but returns undefined when the inputs cannot be compared. | 936 // but returns undefined when the inputs cannot be compared. |
| 942 // We implement the typing analogously. | 937 // We implement the typing analogously. |
| 943 Typer::Visitor::ComparisonOutcome Typer::Visitor::JSCompareTyper(Type* lhs, | 938 Typer::Visitor::ComparisonOutcome Typer::Visitor::JSCompareTyper(Type* lhs, |
| 944 Type* rhs, | 939 Type* rhs, |
| 945 Typer* t) { | 940 Typer* t) { |
| 946 lhs = ToPrimitive(lhs, t); | 941 lhs = ToPrimitive(lhs, t); |
| 947 rhs = ToPrimitive(rhs, t); | 942 rhs = ToPrimitive(rhs, t); |
| 948 if (lhs->Maybe(Type::String()) && rhs->Maybe(Type::String())) { | 943 if (lhs->Maybe(Type::String()) && rhs->Maybe(Type::String())) { |
| (...skipping 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1984 Type* Typer::Visitor::TypeConstant(Handle<Object> value) { | 1979 Type* Typer::Visitor::TypeConstant(Handle<Object> value) { |
| 1985 if (Type::IsInteger(*value)) { | 1980 if (Type::IsInteger(*value)) { |
| 1986 return Type::Range(value->Number(), value->Number(), zone()); | 1981 return Type::Range(value->Number(), value->Number(), zone()); |
| 1987 } | 1982 } |
| 1988 return Type::NewConstant(value, zone()); | 1983 return Type::NewConstant(value, zone()); |
| 1989 } | 1984 } |
| 1990 | 1985 |
| 1991 } // namespace compiler | 1986 } // namespace compiler |
| 1992 } // namespace internal | 1987 } // namespace internal |
| 1993 } // namespace v8 | 1988 } // namespace v8 |
| OLD | NEW |