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

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

Issue 2035383003: [turbofan] Type feedback for numeric comparisons. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase, pure ops 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
« no previous file with comments | « src/compiler/type-hint-analyzer.cc ('k') | src/compiler/type-hints.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/type-hints.h
diff --git a/src/compiler/type-hints.h b/src/compiler/type-hints.h
index 6971960153f5c1d84b24ff2f33dba3b719ddc92d..7c9baddd1394dd9355f31459c8cd7e0509f03fc4 100644
--- a/src/compiler/type-hints.h
+++ b/src/compiler/type-hints.h
@@ -64,6 +64,55 @@ class BinaryOperationHints final {
std::ostream& operator<<(std::ostream&, BinaryOperationHints::Hint);
std::ostream& operator<<(std::ostream&, BinaryOperationHints);
+// Type hints for an binary operation.
+class CompareOperationHints final {
+ public:
+ enum Hint {
+ kNone,
+ kBoolean,
+ kSignedSmall,
+ kNumber,
+ kString,
+ kInternalizedString,
+ kUniqueName,
+ kReceiver,
+ kAny
+ };
+
+ CompareOperationHints() : CompareOperationHints(kNone, kNone, kNone) {}
+ CompareOperationHints(Hint left, Hint right, Hint combined)
+ : bit_field_(LeftField::encode(left) | RightField::encode(right) |
+ CombinedField::encode(combined)) {}
+
+ static CompareOperationHints Any() {
+ return CompareOperationHints(kAny, kAny, kAny);
+ }
+
+ Hint left() const { return LeftField::decode(bit_field_); }
+ Hint right() const { return RightField::decode(bit_field_); }
+ Hint combined() const { return CombinedField::decode(bit_field_); }
+
+ bool operator==(CompareOperationHints const& that) const {
+ return this->bit_field_ == that.bit_field_;
+ }
+ bool operator!=(CompareOperationHints const& that) const {
+ return !(*this == that);
+ }
+
+ friend size_t hash_value(CompareOperationHints const& hints) {
+ return hints.bit_field_;
+ }
+
+ private:
+ typedef BitField<Hint, 0, 4> LeftField;
+ typedef BitField<Hint, 4, 4> RightField;
+ typedef BitField<Hint, 8, 4> CombinedField;
+
+ uint32_t bit_field_;
+};
+
+std::ostream& operator<<(std::ostream&, CompareOperationHints::Hint);
+std::ostream& operator<<(std::ostream&, CompareOperationHints);
// Type hints for the ToBoolean type conversion.
enum class ToBooleanHint : uint16_t {
« no previous file with comments | « src/compiler/type-hint-analyzer.cc ('k') | src/compiler/type-hints.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698