| 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));
|
|
|