Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: src/compiler/type-hints.cc

Issue 1494973002: [turbofan] Introduce ToBooleanHints on ToBoolean operators. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/type-hints.h ('k') | test/unittests/compiler/js-operator-unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « src/compiler/type-hints.h ('k') | test/unittests/compiler/js-operator-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698