OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/type-hints.h" | 5 #include "src/compiler/type-hints.h" |
6 | 6 |
7 namespace v8 { | 7 namespace v8 { |
8 namespace internal { | 8 namespace internal { |
9 namespace compiler { | 9 namespace compiler { |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 } | 25 } |
26 UNREACHABLE(); | 26 UNREACHABLE(); |
27 return os; | 27 return os; |
28 } | 28 } |
29 | 29 |
30 | 30 |
31 std::ostream& operator<<(std::ostream& os, BinaryOperationHints hints) { | 31 std::ostream& operator<<(std::ostream& os, BinaryOperationHints hints) { |
32 return os << hints.left() << "*" << hints.right() << "->" << hints.result(); | 32 return os << hints.left() << "*" << hints.right() << "->" << hints.result(); |
33 } | 33 } |
34 | 34 |
| 35 |
| 36 std::ostream& operator<<(std::ostream& os, ToBooleanHint hint) { |
| 37 switch (hint) { |
| 38 case ToBooleanHint::kNone: |
| 39 return os << "None"; |
| 40 case ToBooleanHint::kUndefined: |
| 41 return os << "Undefined"; |
| 42 case ToBooleanHint::kBoolean: |
| 43 return os << "Boolean"; |
| 44 case ToBooleanHint::kNull: |
| 45 return os << "Null"; |
| 46 case ToBooleanHint::kSmallInteger: |
| 47 return os << "SmallInteger"; |
| 48 case ToBooleanHint::kReceiver: |
| 49 return os << "Receiver"; |
| 50 case ToBooleanHint::kString: |
| 51 return os << "String"; |
| 52 case ToBooleanHint::kSymbol: |
| 53 return os << "Symbol"; |
| 54 case ToBooleanHint::kHeapNumber: |
| 55 return os << "HeapNumber"; |
| 56 case ToBooleanHint::kSimdValue: |
| 57 return os << "SimdValue"; |
| 58 case ToBooleanHint::kAny: |
| 59 return os << "Any"; |
| 60 } |
| 61 UNREACHABLE(); |
| 62 return os; |
| 63 } |
| 64 |
| 65 |
| 66 std::ostream& operator<<(std::ostream& os, ToBooleanHints hints) { |
| 67 if (hints == ToBooleanHint::kAny) return os << "Any"; |
| 68 if (hints == ToBooleanHint::kNone) return os << "None"; |
| 69 bool first = true; |
| 70 for (ToBooleanHints::mask_type i = 0; i < sizeof(i) * CHAR_BIT; ++i) { |
| 71 ToBooleanHint const hint = static_cast<ToBooleanHint>(1u << i); |
| 72 if (hints & hint) { |
| 73 if (!first) os << "|"; |
| 74 first = false; |
| 75 os << hint; |
| 76 } |
| 77 } |
| 78 return os; |
| 79 } |
| 80 |
35 } // namespace compiler | 81 } // namespace compiler |
36 } // namespace internal | 82 } // namespace internal |
37 } // namespace v8 | 83 } // namespace v8 |
OLD | NEW |