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 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
585 | 585 |
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 return Type::NewConstant(f->NewNumber(number), zone()); |
Jarin
2016/10/04 13:14:55
How about having a factory from a double value?
mvstanton
2016/10/05 13:51:10
Done.
Jarin
2016/10/05 14:06:53
How about using it, then?
mvstanton
2016/10/05 14:14:44
My apologies. This time I have used it.
| |
596 return Type::Range(number, number, zone()); | |
597 } | |
598 return Type::Constant(f->NewNumber(number), zone()); | |
599 } | 596 } |
600 | 597 |
601 | |
602 Type* Typer::Visitor::TypeHeapConstant(Node* node) { | 598 Type* Typer::Visitor::TypeHeapConstant(Node* node) { |
603 return TypeConstant(OpParameter<Handle<HeapObject>>(node)); | 599 return TypeConstant(OpParameter<Handle<HeapObject>>(node)); |
604 } | 600 } |
605 | 601 |
606 | 602 |
607 Type* Typer::Visitor::TypeExternalConstant(Node* node) { | 603 Type* Typer::Visitor::TypeExternalConstant(Node* node) { |
608 return Type::Internal(); | 604 return Type::Internal(); |
609 } | 605 } |
610 | 606 |
611 | 607 |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1017 } else if (type->Is(Type::Union(Type::Undefined(), Type::OtherUndetectable(), | 1013 } else if (type->Is(Type::Union(Type::Undefined(), Type::OtherUndetectable(), |
1018 t->zone()))) { | 1014 t->zone()))) { |
1019 return Type::Constant(f->undefined_string(), t->zone()); | 1015 return Type::Constant(f->undefined_string(), t->zone()); |
1020 } else if (type->Is(Type::Null())) { | 1016 } else if (type->Is(Type::Null())) { |
1021 return Type::Constant(f->object_string(), t->zone()); | 1017 return Type::Constant(f->object_string(), t->zone()); |
1022 } else if (type->Is(Type::Function())) { | 1018 } else if (type->Is(Type::Function())) { |
1023 return Type::Constant(f->function_string(), t->zone()); | 1019 return Type::Constant(f->function_string(), t->zone()); |
1024 } else if (type->IsConstant()) { | 1020 } else if (type->IsConstant()) { |
1025 return Type::Constant( | 1021 return Type::Constant( |
1026 Object::TypeOf(t->isolate(), type->AsConstant()->Value()), t->zone()); | 1022 Object::TypeOf(t->isolate(), type->AsConstant()->Value()), t->zone()); |
1023 } else if (type->IsOtherNumberConstant()) { | |
1024 return Type::Constant(f->number_string(), t->zone()); | |
1027 } | 1025 } |
1028 return Type::InternalizedString(); | 1026 return Type::InternalizedString(); |
1029 } | 1027 } |
1030 | 1028 |
1031 | 1029 |
1032 Type* Typer::Visitor::TypeJSTypeOf(Node* node) { | 1030 Type* Typer::Visitor::TypeJSTypeOf(Node* node) { |
1033 return TypeUnaryOp(node, JSTypeOfTyper); | 1031 return TypeUnaryOp(node, JSTypeOfTyper); |
1034 } | 1032 } |
1035 | 1033 |
1036 | 1034 |
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1710 Type* Typer::Visitor::TypeArrayBufferWasNeutered(Node* node) { | 1708 Type* Typer::Visitor::TypeArrayBufferWasNeutered(Node* node) { |
1711 return Type::Boolean(); | 1709 return Type::Boolean(); |
1712 } | 1710 } |
1713 | 1711 |
1714 // Heap constants. | 1712 // Heap constants. |
1715 | 1713 |
1716 Type* Typer::Visitor::TypeConstant(Handle<Object> value) { | 1714 Type* Typer::Visitor::TypeConstant(Handle<Object> value) { |
1717 if (Type::IsInteger(*value)) { | 1715 if (Type::IsInteger(*value)) { |
1718 return Type::Range(value->Number(), value->Number(), zone()); | 1716 return Type::Range(value->Number(), value->Number(), zone()); |
1719 } | 1717 } |
1720 return Type::Constant(value, zone()); | 1718 return Type::NewConstant(value, zone()); |
1721 } | 1719 } |
1722 | 1720 |
1723 } // namespace compiler | 1721 } // namespace compiler |
1724 } // namespace internal | 1722 } // namespace internal |
1725 } // namespace v8 | 1723 } // namespace v8 |
OLD | NEW |