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

Unified Diff: src/ic/ic-state.h

Issue 2228983002: [turbofan] Simplify BinaryOperationHints and CompareOperationHints. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix compile for realz Created 4 years, 4 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.cc ('k') | test/cctest/compiler/test-js-typed-lowering.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ic/ic-state.h
diff --git a/src/ic/ic-state.h b/src/ic/ic-state.h
index b12b17d3e20b2eb3a04cecbc27189ceed5a1ffb3..ec33e8d0e9eec55497d15e074eebc214c4cd2ac7 100644
--- a/src/ic/ic-state.h
+++ b/src/ic/ic-state.h
@@ -128,11 +128,15 @@ class BinaryOpICState final BASE_EMBEDDED {
Isolate* isolate() const { return isolate_; }
+ enum Kind { NONE, SMI, INT32, NUMBER, STRING, GENERIC };
+ Kind kind() const {
+ return KindGeneralize(KindGeneralize(left_kind_, right_kind_),
+ result_kind_);
+ }
+
private:
friend std::ostream& operator<<(std::ostream& os, const BinaryOpICState& s);
- enum Kind { NONE, SMI, INT32, NUMBER, STRING, GENERIC };
-
Kind UpdateKind(Handle<Object> object, Kind kind) const;
static const char* KindToString(Kind kind);
@@ -140,6 +144,18 @@ class BinaryOpICState final BASE_EMBEDDED {
static bool KindMaybeSmi(Kind kind) {
return (kind >= SMI && kind <= NUMBER) || kind == GENERIC;
}
+ static bool KindLessGeneralThan(Kind kind1, Kind kind2) {
+ if (kind1 == NONE) return true;
+ if (kind1 == kind2) return true;
+ if (kind2 == GENERIC) return true;
+ if (kind2 == STRING) return false;
+ return kind1 <= kind2;
+ }
+ static Kind KindGeneralize(Kind kind1, Kind kind2) {
+ if (KindLessGeneralThan(kind1, kind2)) return kind2;
+ if (KindLessGeneralThan(kind2, kind1)) return kind1;
+ return GENERIC;
+ }
// We truncate the last bit of the token.
STATIC_ASSERT(LAST_TOKEN - FIRST_TOKEN < (1 << 4));
« no previous file with comments | « src/compiler/type-hints.cc ('k') | test/cctest/compiler/test-js-typed-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698