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

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

Issue 1921563002: [turbofan] Initial version of number type feedback. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 4 years, 7 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
« no previous file with comments | « src/compiler/type-hints.h ('k') | src/compiler/typer.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 06abad6380ef77f15981b41454c716311d89ce59..19ebd2f24cd7f4eeeadc717eaa491a0f8dafc12e 100644
--- a/src/compiler/type-hints.cc
+++ b/src/compiler/type-hints.cc
@@ -16,8 +16,8 @@ std::ostream& operator<<(std::ostream& os, BinaryOperationHints::Hint hint) {
return os << "SignedSmall";
case BinaryOperationHints::kSigned32:
return os << "Signed32";
- case BinaryOperationHints::kNumber:
- return os << "Number";
+ case BinaryOperationHints::kNumberOrUndefined:
+ return os << "NumberOrUndefined";
case BinaryOperationHints::kString:
return os << "String";
case BinaryOperationHints::kAny:
@@ -78,6 +78,34 @@ std::ostream& operator<<(std::ostream& os, ToBooleanHints hints) {
return os;
}
+// static
+bool BinaryOperationHints::Is(Hint h1, Hint h2) {
+ if (h1 == h2) return true;
+ switch (h1) {
+ case kNone:
+ 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:
+ return false;
+ }
+ UNREACHABLE();
+ return false;
+}
+
+// static
+BinaryOperationHints::Hint BinaryOperationHints::Combine(Hint h1, Hint h2) {
+ if (Is(h1, h2)) return h2;
+ if (Is(h2, h1)) return h1;
+ return kAny;
+}
+
} // namespace compiler
} // namespace internal
} // namespace v8
« no previous file with comments | « src/compiler/type-hints.h ('k') | src/compiler/typer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698