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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/type-hints.cc
diff --git a/src/compiler/type-hints.cc b/src/compiler/type-hints.cc
index 2cf8f4d6c0ac2174c2aa872bbb6cc325306dd20e..06abad6380ef77f15981b41454c716311d89ce59 100644
--- a/src/compiler/type-hints.cc
+++ b/src/compiler/type-hints.cc
@@ -32,6 +32,52 @@ std::ostream& operator<<(std::ostream& os, BinaryOperationHints hints) {
return os << hints.left() << "*" << hints.right() << "->" << hints.result();
}
+
+std::ostream& operator<<(std::ostream& os, ToBooleanHint hint) {
+ switch (hint) {
+ case ToBooleanHint::kNone:
+ return os << "None";
+ case ToBooleanHint::kUndefined:
+ return os << "Undefined";
+ case ToBooleanHint::kBoolean:
+ return os << "Boolean";
+ case ToBooleanHint::kNull:
+ return os << "Null";
+ case ToBooleanHint::kSmallInteger:
+ return os << "SmallInteger";
+ case ToBooleanHint::kReceiver:
+ return os << "Receiver";
+ case ToBooleanHint::kString:
+ return os << "String";
+ case ToBooleanHint::kSymbol:
+ return os << "Symbol";
+ case ToBooleanHint::kHeapNumber:
+ return os << "HeapNumber";
+ case ToBooleanHint::kSimdValue:
+ return os << "SimdValue";
+ case ToBooleanHint::kAny:
+ return os << "Any";
+ }
+ UNREACHABLE();
+ return os;
+}
+
+
+std::ostream& operator<<(std::ostream& os, ToBooleanHints hints) {
+ if (hints == ToBooleanHint::kAny) return os << "Any";
+ if (hints == ToBooleanHint::kNone) return os << "None";
+ bool first = true;
+ for (ToBooleanHints::mask_type i = 0; i < sizeof(i) * CHAR_BIT; ++i) {
+ ToBooleanHint const hint = static_cast<ToBooleanHint>(1u << i);
+ if (hints & hint) {
+ if (!first) os << "|";
+ first = false;
+ os << hint;
+ }
+ }
+ return os;
+}
+
} // namespace compiler
} // namespace internal
} // namespace v8
« 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