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 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
586 Type* Typer::Visitor::TypeFloat64Constant(Node* node) { | 586 Type* Typer::Visitor::TypeFloat64Constant(Node* node) { |
587 UNREACHABLE(); | 587 UNREACHABLE(); |
588 return nullptr; | 588 return nullptr; |
589 } | 589 } |
590 | 590 |
591 | 591 |
592 Type* Typer::Visitor::TypeNumberConstant(Node* node) { | 592 Type* Typer::Visitor::TypeNumberConstant(Node* node) { |
593 Factory* f = isolate()->factory(); | 593 Factory* f = isolate()->factory(); |
594 double number = OpParameter<double>(node); | 594 double number = OpParameter<double>(node); |
595 if (Type::IsInteger(number)) { | 595 if (Type::IsInteger(number)) { |
596 return Type::Range(number, number, zone()); | 596 return Type::Range(number, number, zone()); |
mvstanton
2016/09/28 14:47:44
Type::IsInteger... remove that! Factory covers it!
mvstanton
2016/10/04 11:55:55
Done.
| |
597 } | 597 } |
598 return Type::Constant(f->NewNumber(number), zone()); | 598 return Type::NewConstant(f->NewNumber(number), zone()); |
599 } | 599 } |
600 | 600 |
601 | 601 |
602 Type* Typer::Visitor::TypeHeapConstant(Node* node) { | 602 Type* Typer::Visitor::TypeHeapConstant(Node* node) { |
603 return TypeConstant(OpParameter<Handle<HeapObject>>(node)); | 603 return TypeConstant(OpParameter<Handle<HeapObject>>(node)); |
604 } | 604 } |
605 | 605 |
606 | 606 |
607 Type* Typer::Visitor::TypeExternalConstant(Node* node) { | 607 Type* Typer::Visitor::TypeExternalConstant(Node* node) { |
608 return Type::Internal(); | 608 return Type::Internal(); |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1017 } else if (type->Is(Type::Union(Type::Undefined(), Type::OtherUndetectable(), | 1017 } else if (type->Is(Type::Union(Type::Undefined(), Type::OtherUndetectable(), |
1018 t->zone()))) { | 1018 t->zone()))) { |
1019 return Type::Constant(f->undefined_string(), t->zone()); | 1019 return Type::Constant(f->undefined_string(), t->zone()); |
1020 } else if (type->Is(Type::Null())) { | 1020 } else if (type->Is(Type::Null())) { |
1021 return Type::Constant(f->object_string(), t->zone()); | 1021 return Type::Constant(f->object_string(), t->zone()); |
1022 } else if (type->Is(Type::Function())) { | 1022 } else if (type->Is(Type::Function())) { |
1023 return Type::Constant(f->function_string(), t->zone()); | 1023 return Type::Constant(f->function_string(), t->zone()); |
1024 } else if (type->IsConstant()) { | 1024 } else if (type->IsConstant()) { |
1025 return Type::Constant( | 1025 return Type::Constant( |
1026 Object::TypeOf(t->isolate(), type->AsConstant()->Value()), t->zone()); | 1026 Object::TypeOf(t->isolate(), type->AsConstant()->Value()), t->zone()); |
1027 } else if (type->IsNumberConstant()) { | |
1028 return Type::Constant(f->number_string(), t->zone()); | |
1027 } | 1029 } |
1028 return Type::InternalizedString(); | 1030 return Type::InternalizedString(); |
1029 } | 1031 } |
1030 | 1032 |
1031 | 1033 |
1032 Type* Typer::Visitor::TypeJSTypeOf(Node* node) { | 1034 Type* Typer::Visitor::TypeJSTypeOf(Node* node) { |
1033 return TypeUnaryOp(node, JSTypeOfTyper); | 1035 return TypeUnaryOp(node, JSTypeOfTyper); |
1034 } | 1036 } |
1035 | 1037 |
1036 | 1038 |
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1710 Type* Typer::Visitor::TypeArrayBufferWasNeutered(Node* node) { | 1712 Type* Typer::Visitor::TypeArrayBufferWasNeutered(Node* node) { |
1711 return Type::Boolean(); | 1713 return Type::Boolean(); |
1712 } | 1714 } |
1713 | 1715 |
1714 // Heap constants. | 1716 // Heap constants. |
1715 | 1717 |
1716 Type* Typer::Visitor::TypeConstant(Handle<Object> value) { | 1718 Type* Typer::Visitor::TypeConstant(Handle<Object> value) { |
1717 if (Type::IsInteger(*value)) { | 1719 if (Type::IsInteger(*value)) { |
1718 return Type::Range(value->Number(), value->Number(), zone()); | 1720 return Type::Range(value->Number(), value->Number(), zone()); |
1719 } | 1721 } |
1720 return Type::Constant(value, zone()); | 1722 return Type::NewConstant(value, zone()); |
1721 } | 1723 } |
1722 | 1724 |
1723 } // namespace compiler | 1725 } // namespace compiler |
1724 } // namespace internal | 1726 } // namespace internal |
1725 } // namespace v8 | 1727 } // namespace v8 |
OLD | NEW |