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/crankshaft/hydrogen-types.h" | 5 #include "src/crankshaft/hydrogen-types.h" |
6 | 6 |
7 #include "src/field-type.h" | 7 #include "src/field-type.h" |
8 #include "src/handles-inl.h" | 8 #include "src/handles-inl.h" |
9 #include "src/ostreams.h" | 9 #include "src/ostreams.h" |
10 | 10 |
11 namespace v8 { | 11 namespace v8 { |
12 namespace internal { | 12 namespace internal { |
13 | 13 |
14 // static | 14 // static |
15 HType HType::FromType(Type* type) { | 15 HType HType::FromType(AstType* type) { |
16 if (Type::Any()->Is(type)) return HType::Any(); | 16 if (AstType::Any()->Is(type)) return HType::Any(); |
17 if (!type->IsInhabited()) return HType::None(); | 17 if (!type->IsInhabited()) return HType::None(); |
18 if (type->Is(Type::SignedSmall())) return HType::Smi(); | 18 if (type->Is(AstType::SignedSmall())) return HType::Smi(); |
19 if (type->Is(Type::Number())) return HType::TaggedNumber(); | 19 if (type->Is(AstType::Number())) return HType::TaggedNumber(); |
20 if (type->Is(Type::Null())) return HType::Null(); | 20 if (type->Is(AstType::Null())) return HType::Null(); |
21 if (type->Is(Type::String())) return HType::String(); | 21 if (type->Is(AstType::String())) return HType::String(); |
22 if (type->Is(Type::Boolean())) return HType::Boolean(); | 22 if (type->Is(AstType::Boolean())) return HType::Boolean(); |
23 if (type->Is(Type::Undefined())) return HType::Undefined(); | 23 if (type->Is(AstType::Undefined())) return HType::Undefined(); |
24 if (type->Is(Type::Object())) return HType::JSObject(); | 24 if (type->Is(AstType::Object())) return HType::JSObject(); |
25 if (type->Is(Type::DetectableReceiver())) return HType::JSReceiver(); | 25 if (type->Is(AstType::DetectableReceiver())) return HType::JSReceiver(); |
26 return HType::Tagged(); | 26 return HType::Tagged(); |
27 } | 27 } |
28 | 28 |
29 | 29 |
30 // static | 30 // static |
31 HType HType::FromFieldType(Handle<FieldType> type, Zone* temp_zone) { | 31 HType HType::FromFieldType(Handle<FieldType> type, Zone* temp_zone) { |
32 return FromType(type->Convert(temp_zone)); | 32 return FromType(type->Convert(temp_zone)); |
33 } | 33 } |
34 | 34 |
35 // static | 35 // static |
(...skipping 30 matching lines...) Expand all Loading... |
66 return os << #Name; | 66 return os << #Name; |
67 HTYPE_LIST(DEFINE_CASE) | 67 HTYPE_LIST(DEFINE_CASE) |
68 #undef DEFINE_CASE | 68 #undef DEFINE_CASE |
69 } | 69 } |
70 UNREACHABLE(); | 70 UNREACHABLE(); |
71 return os; | 71 return os; |
72 } | 72 } |
73 | 73 |
74 } // namespace internal | 74 } // namespace internal |
75 } // namespace v8 | 75 } // namespace v8 |
OLD | NEW |