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 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
803 Type* Typer::Visitor::TypeProjection(Node* node) { | 803 Type* Typer::Visitor::TypeProjection(Node* node) { |
804 Type* const type = Operand(node, 0); | 804 Type* const type = Operand(node, 0); |
805 if (type->Is(Type::None())) return Type::None(); | 805 if (type->Is(Type::None())) return Type::None(); |
806 int const index = static_cast<int>(ProjectionIndexOf(node->op())); | 806 int const index = static_cast<int>(ProjectionIndexOf(node->op())); |
807 if (type->IsTuple() && index < type->AsTuple()->Arity()) { | 807 if (type->IsTuple() && index < type->AsTuple()->Arity()) { |
808 return type->AsTuple()->Element(index); | 808 return type->AsTuple()->Element(index); |
809 } | 809 } |
810 return Type::Any(); | 810 return Type::Any(); |
811 } | 811 } |
812 | 812 |
813 | 813 Type* Typer::Visitor::TypeDead(Node* node) { return Type::None(); } |
814 Type* Typer::Visitor::TypeDead(Node* node) { return Type::Any(); } | |
815 | |
816 | 814 |
817 // JS comparison operators. | 815 // JS comparison operators. |
818 | 816 |
819 | 817 |
820 Type* Typer::Visitor::JSEqualTyper(Type* lhs, Type* rhs, Typer* t) { | 818 Type* Typer::Visitor::JSEqualTyper(Type* lhs, Type* rhs, Typer* t) { |
821 if (lhs->Is(Type::NaN()) || rhs->Is(Type::NaN())) return t->singleton_false_; | 819 if (lhs->Is(Type::NaN()) || rhs->Is(Type::NaN())) return t->singleton_false_; |
822 if (lhs->Is(Type::NullOrUndefined()) && rhs->Is(Type::NullOrUndefined())) { | 820 if (lhs->Is(Type::NullOrUndefined()) && rhs->Is(Type::NullOrUndefined())) { |
823 return t->singleton_true_; | 821 return t->singleton_true_; |
824 } | 822 } |
825 if (lhs->Is(Type::Number()) && rhs->Is(Type::Number()) && | 823 if (lhs->Is(Type::Number()) && rhs->Is(Type::Number()) && |
(...skipping 1780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2606 } | 2604 } |
2607 if (Type::IsInteger(*value)) { | 2605 if (Type::IsInteger(*value)) { |
2608 return Type::Range(value->Number(), value->Number(), zone()); | 2606 return Type::Range(value->Number(), value->Number(), zone()); |
2609 } | 2607 } |
2610 return Type::Constant(value, zone()); | 2608 return Type::Constant(value, zone()); |
2611 } | 2609 } |
2612 | 2610 |
2613 } // namespace compiler | 2611 } // namespace compiler |
2614 } // namespace internal | 2612 } // namespace internal |
2615 } // namespace v8 | 2613 } // namespace v8 |
OLD | NEW |