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

Unified Diff: src/compiler/type-hints.cc

Issue 2035383003: [turbofan] Type feedback for numeric comparisons. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixes Created 4 years, 6 months 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
Index: src/compiler/type-hints.cc
diff --git a/src/compiler/type-hints.cc b/src/compiler/type-hints.cc
index 19ebd2f24cd7f4eeeadc717eaa491a0f8dafc12e..9562a5db0fe31be40d3a4127bcfd1ae6ac4da37a 100644
--- a/src/compiler/type-hints.cc
+++ b/src/compiler/type-hints.cc
@@ -27,11 +27,33 @@ std::ostream& operator<<(std::ostream& os, BinaryOperationHints::Hint hint) {
return os;
}
-
std::ostream& operator<<(std::ostream& os, BinaryOperationHints hints) {
return os << hints.left() << "*" << hints.right() << "->" << hints.result();
}
+std::ostream& operator<<(std::ostream& os, CompareOperationHints::Hint hint) {
+ switch (hint) {
+ case CompareOperationHints::kNone:
+ return os << "None";
+ case CompareOperationHints::kSignedSmall:
+ return os << "SignedSmall";
+ case CompareOperationHints::kSigned32:
+ return os << "Signed32";
+ case CompareOperationHints::kNumberOrUndefined:
+ return os << "NumberOrUndefined";
+ case CompareOperationHints::kString:
+ return os << "String";
+ case CompareOperationHints::kAny:
+ return os << "Any";
+ }
+ UNREACHABLE();
+ return os;
+}
+
+std::ostream& operator<<(std::ostream& os, CompareOperationHints hints) {
+ return os << hints.left() << "*" << hints.right() << " (" << hints.combined()
+ << ")";
+}
std::ostream& operator<<(std::ostream& os, ToBooleanHint hint) {
switch (hint) {
@@ -62,7 +84,6 @@ std::ostream& operator<<(std::ostream& os, ToBooleanHint hint) {
return os;
}
-
std::ostream& operator<<(std::ostream& os, ToBooleanHints hints) {
if (hints == ToBooleanHint::kAny) return os << "Any";
if (hints == ToBooleanHint::kNone) return os << "None";
@@ -82,17 +103,20 @@ std::ostream& operator<<(std::ostream& os, ToBooleanHints hints) {
bool BinaryOperationHints::Is(Hint h1, Hint h2) {
if (h1 == h2) return true;
switch (h1) {
- case kNone:
+ case BinaryOperationHints::kNone:
Benedikt Meurer 2016/06/07 04:11:00 This change doesn't seem necessary?
Jarin 2016/06/09 13:37:32 Done.
return true;
- case kSignedSmall:
- return h2 == kSigned32 || h2 == kNumberOrUndefined || h2 == kAny;
- case kSigned32:
- return h2 == kNumberOrUndefined || h2 == kAny;
- case kNumberOrUndefined:
- return h2 == kAny;
- case kString:
- return h2 == kAny;
- case kAny:
+ case BinaryOperationHints::kSignedSmall:
+ return h2 == BinaryOperationHints::kSigned32 ||
+ h2 == BinaryOperationHints::kNumberOrUndefined ||
+ h2 == BinaryOperationHints::kAny;
+ case BinaryOperationHints::kSigned32:
+ return h2 == BinaryOperationHints::kNumberOrUndefined ||
+ h2 == BinaryOperationHints::kAny;
+ case BinaryOperationHints::kNumberOrUndefined:
+ return h2 == BinaryOperationHints::kAny;
+ case BinaryOperationHints::kString:
+ return h2 == BinaryOperationHints::kAny;
+ case BinaryOperationHints::kAny:
return false;
}
UNREACHABLE();
@@ -103,7 +127,7 @@ bool BinaryOperationHints::Is(Hint h1, Hint h2) {
BinaryOperationHints::Hint BinaryOperationHints::Combine(Hint h1, Hint h2) {
if (Is(h1, h2)) return h2;
if (Is(h2, h1)) return h1;
- return kAny;
+ return BinaryOperationHints::kAny;
Benedikt Meurer 2016/06/07 04:11:00 This change doesn't seem necessary?
Jarin 2016/06/09 13:37:32 Done.
}
} // namespace compiler

Powered by Google App Engine
This is Rietveld 408576698