OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/field-type.h" | 5 #include "src/field-type.h" |
6 | 6 |
7 #include "src/handles-inl.h" | 7 #include "src/handles-inl.h" |
8 #include "src/ostreams.h" | 8 #include "src/ostreams.h" |
9 #include "src/types.h" | 9 #include "src/types.h" |
10 | 10 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 if (other->IsNone()) return false; | 63 if (other->IsNone()) return false; |
64 if (IsAny()) return false; | 64 if (IsAny()) return false; |
65 DCHECK(IsClass()); | 65 DCHECK(IsClass()); |
66 DCHECK(other->IsClass()); | 66 DCHECK(other->IsClass()); |
67 return this == other; | 67 return this == other; |
68 } | 68 } |
69 | 69 |
70 bool FieldType::NowIs(Handle<FieldType> other) { return NowIs(*other); } | 70 bool FieldType::NowIs(Handle<FieldType> other) { return NowIs(*other); } |
71 | 71 |
72 Type* FieldType::Convert(Zone* zone) { | 72 Type* FieldType::Convert(Zone* zone) { |
73 if (IsAny()) return Type::Any(); | 73 if (IsAny()) return Type::NonInternal(); |
74 if (IsNone()) return Type::None(); | 74 if (IsNone()) return Type::None(); |
75 DCHECK(IsClass()); | 75 DCHECK(IsClass()); |
76 return Type::Class(AsClass(), zone); | 76 return Type::Class(AsClass(), zone); |
77 } | 77 } |
78 | 78 |
79 void FieldType::PrintTo(std::ostream& os) { | 79 void FieldType::PrintTo(std::ostream& os) { |
80 if (IsAny()) { | 80 if (IsAny()) { |
81 os << "Any"; | 81 os << "Any"; |
82 } else if (IsNone()) { | 82 } else if (IsNone()) { |
83 os << "None"; | 83 os << "None"; |
84 } else { | 84 } else { |
85 DCHECK(IsClass()); | 85 DCHECK(IsClass()); |
86 os << "Class(" << static_cast<void*>(*AsClass()) << ")"; | 86 os << "Class(" << static_cast<void*>(*AsClass()) << ")"; |
87 } | 87 } |
88 } | 88 } |
89 | 89 |
90 } // namespace internal | 90 } // namespace internal |
91 } // namespace v8 | 91 } // namespace v8 |
OLD | NEW |