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

Unified Diff: src/machine-type.cc

Issue 1513543003: [turbofan] Make MachineType a pair of enums. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Moar rebase 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/machine-type.h ('k') | test/cctest/compiler/c-signature.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/machine-type.cc
diff --git a/src/machine-type.cc b/src/machine-type.cc
index c7dc0b47c8926b03bdd4a14051cdea5323f8326e..1fb886ca5254897f908c85e490318b62dc3e5705 100644
--- a/src/machine-type.cc
+++ b/src/machine-type.cc
@@ -8,37 +8,68 @@
namespace v8 {
namespace internal {
-#define PRINT(bit) \
- if (type & bit) { \
- if (before) os << "|"; \
- os << #bit; \
- before = true; \
+std::ostream& operator<<(std::ostream& os, MachineRepresentation rep) {
+ switch (rep) {
+ case MachineRepresentation::kNone:
+ return os << "kMachNone";
+ case MachineRepresentation::kBit:
+ return os << "kRepBit";
+ case MachineRepresentation::kWord8:
+ return os << "kRepWord8";
+ case MachineRepresentation::kWord16:
+ return os << "kRepWord16";
+ case MachineRepresentation::kWord32:
+ return os << "kRepWord32";
+ case MachineRepresentation::kWord64:
+ return os << "kRepWord64";
+ case MachineRepresentation::kFloat32:
+ return os << "kRepFloat32";
+ case MachineRepresentation::kFloat64:
+ return os << "kRepFloat64";
+ case MachineRepresentation::kTagged:
+ return os << "kRepTagged";
}
+ UNREACHABLE();
+ return os;
+}
-std::ostream& operator<<(std::ostream& os, const MachineType& type) {
- bool before = false;
- PRINT(kRepBit);
- PRINT(kRepWord8);
- PRINT(kRepWord16);
- PRINT(kRepWord32);
- PRINT(kRepWord64);
- PRINT(kRepFloat32);
- PRINT(kRepFloat64);
- PRINT(kRepTagged);
-
- PRINT(kTypeBool);
- PRINT(kTypeInt32);
- PRINT(kTypeUint32);
- PRINT(kTypeInt64);
- PRINT(kTypeUint64);
- PRINT(kTypeNumber);
- PRINT(kTypeAny);
+std::ostream& operator<<(std::ostream& os, MachineSemantic type) {
+ switch (type) {
+ case MachineSemantic::kNone:
+ return os << "kMachNone";
+ case MachineSemantic::kBool:
+ return os << "kTypeBool";
+ case MachineSemantic::kInt32:
+ return os << "kTypeInt32";
+ case MachineSemantic::kUint32:
+ return os << "kTypeUint32";
+ case MachineSemantic::kInt64:
+ return os << "kTypeInt64";
+ case MachineSemantic::kUint64:
+ return os << "kTypeUint64";
+ case MachineSemantic::kNumber:
+ return os << "kTypeNumber";
+ case MachineSemantic::kAny:
+ return os << "kTypeAny";
+ }
+ UNREACHABLE();
return os;
}
-#undef PRINT
+std::ostream& operator<<(std::ostream& os, MachineType type) {
+ if (type == MachineType::None()) {
+ return os;
+ } else if (type.representation() == MachineRepresentation::kNone) {
+ return os << type.semantic();
+ } else if (type.semantic() == MachineSemantic::kNone) {
+ return os << type.representation();
+ } else {
+ return os << type.representation() << "|" << type.semantic();
+ }
+ return os;
+}
} // namespace internal
} // namespace v8
« no previous file with comments | « src/machine-type.h ('k') | test/cctest/compiler/c-signature.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698