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/hydrogen-types.h" | 5 #include "src/hydrogen-types.h" |
6 | 6 |
7 #include "src/types-inl.h" | 7 #include "src/types-inl.h" |
8 | 8 |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 if (value->IsString()) return HType::String(); | 45 if (value->IsString()) return HType::String(); |
46 if (value->IsBoolean()) return HType::Boolean(); | 46 if (value->IsBoolean()) return HType::Boolean(); |
47 if (value->IsUndefined()) return HType::Undefined(); | 47 if (value->IsUndefined()) return HType::Undefined(); |
48 if (value->IsJSArray()) return HType::JSArray(); | 48 if (value->IsJSArray()) return HType::JSArray(); |
49 if (value->IsJSObject()) return HType::JSObject(); | 49 if (value->IsJSObject()) return HType::JSObject(); |
50 ASSERT(value->IsHeapObject()); | 50 ASSERT(value->IsHeapObject()); |
51 return HType::HeapObject(); | 51 return HType::HeapObject(); |
52 } | 52 } |
53 | 53 |
54 | 54 |
55 const char* HType::ToString() const { | 55 OStream& operator<<(OStream& os, const HType& t) { |
56 // Note: The c1visualizer syntax for locals allows only a sequence of the | 56 // Note: The c1visualizer syntax for locals allows only a sequence of the |
57 // following characters: A-Za-z0-9_-|: | 57 // following characters: A-Za-z0-9_-|: |
58 switch (kind_) { | 58 switch (t.kind_) { |
59 #define DEFINE_CASE(Name, mask) case k##Name: return #Name; | 59 #define DEFINE_CASE(Name, mask) \ |
| 60 case HType::k##Name: \ |
| 61 return os << #Name; |
60 HTYPE_LIST(DEFINE_CASE) | 62 HTYPE_LIST(DEFINE_CASE) |
61 #undef DEFINE_CASE | 63 #undef DEFINE_CASE |
62 } | 64 } |
63 UNREACHABLE(); | 65 UNREACHABLE(); |
64 return NULL; | 66 return os; |
65 } | 67 } |
66 | 68 |
67 } } // namespace v8::internal | 69 } } // namespace v8::internal |
OLD | NEW |