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 |
(...skipping 26 matching lines...) Expand all Loading... |
37 if (value->IsSmi()) return HType::Smi(); | 37 if (value->IsSmi()) return HType::Smi(); |
38 if (value->IsNull()) return HType::Null(); | 38 if (value->IsNull()) return HType::Null(); |
39 if (value->IsHeapNumber()) { | 39 if (value->IsHeapNumber()) { |
40 double n = Handle<v8::internal::HeapNumber>::cast(value)->value(); | 40 double n = Handle<v8::internal::HeapNumber>::cast(value)->value(); |
41 return IsSmiDouble(n) ? HType::Smi() : HType::HeapNumber(); | 41 return IsSmiDouble(n) ? HType::Smi() : HType::HeapNumber(); |
42 } | 42 } |
43 if (value->IsString()) return HType::String(); | 43 if (value->IsString()) return HType::String(); |
44 if (value->IsBoolean()) return HType::Boolean(); | 44 if (value->IsBoolean()) return HType::Boolean(); |
45 if (value->IsUndefined()) return HType::Undefined(); | 45 if (value->IsUndefined()) return HType::Undefined(); |
46 if (value->IsJSArray()) { | 46 if (value->IsJSArray()) { |
47 DCHECK(!value->IsUndetectableObject()); | 47 DCHECK(!value->IsUndetectable()); |
48 return HType::JSArray(); | 48 return HType::JSArray(); |
49 } | 49 } |
50 if (value->IsJSObject() && !value->IsUndetectableObject()) { | 50 if (value->IsJSObject() && !value->IsUndetectable()) { |
51 return HType::JSObject(); | 51 return HType::JSObject(); |
52 } | 52 } |
53 DCHECK(value->IsHeapObject()); | 53 DCHECK(value->IsHeapObject()); |
54 return HType::HeapObject(); | 54 return HType::HeapObject(); |
55 } | 55 } |
56 | 56 |
57 | 57 |
58 std::ostream& operator<<(std::ostream& os, const HType& t) { | 58 std::ostream& operator<<(std::ostream& os, const HType& t) { |
59 // Note: The c1visualizer syntax for locals allows only a sequence of the | 59 // Note: The c1visualizer syntax for locals allows only a sequence of the |
60 // following characters: A-Za-z0-9_-|: | 60 // following characters: A-Za-z0-9_-|: |
61 switch (t.kind_) { | 61 switch (t.kind_) { |
62 #define DEFINE_CASE(Name, mask) \ | 62 #define DEFINE_CASE(Name, mask) \ |
63 case HType::k##Name: \ | 63 case HType::k##Name: \ |
64 return os << #Name; | 64 return os << #Name; |
65 HTYPE_LIST(DEFINE_CASE) | 65 HTYPE_LIST(DEFINE_CASE) |
66 #undef DEFINE_CASE | 66 #undef DEFINE_CASE |
67 } | 67 } |
68 UNREACHABLE(); | 68 UNREACHABLE(); |
69 return os; | 69 return os; |
70 } | 70 } |
71 | 71 |
72 } // namespace internal | 72 } // namespace internal |
73 } // namespace v8 | 73 } // namespace v8 |
OLD | NEW |