Index: src/ic.cc |
diff --git a/src/ic.cc b/src/ic.cc |
index 8a25504564640c17e7a8f5f067889a2b6aececa8..b548bc68609675d7fa100e1c32c78fe6bdb4f93c 100644 |
--- a/src/ic.cc |
+++ b/src/ic.cc |
@@ -2329,7 +2329,10 @@ BinaryOpIC::State::State(ExtraICState extra_ic_state) { |
1 << FixedRightArgValueField::decode(extra_ic_state)); |
left_kind_ = LeftKindField::decode(extra_ic_state); |
if (fixed_right_arg_.has_value) { |
- right_kind_ = Smi::IsValid(fixed_right_arg_.value) ? SMI : INT32; |
+ // We have only 4 bits to encode the log2 of the fixed right arg, so the |
+ // max value is 2^(2^4), which is always a SMI. |
+ ASSERT(Smi::IsValid(fixed_right_arg_.value)); |
+ right_kind_ = SMI; |
} else { |
right_kind_ = RightKindField::decode(extra_ic_state); |
} |
@@ -2582,6 +2585,17 @@ void BinaryOpIC::State::GenerateAheadOfTime( |
} |
+Handle<Type> BinaryOpIC::State::GetRightType(Isolate* isolate) const { |
+ if (fixed_right_arg_.has_value) { |
+ Handle<Smi> value = handle(Smi::FromInt(fixed_right_arg_.value), isolate); |
+ Handle<Type> type = handle(Type::Constant(value, isolate), isolate); |
+ ASSERT(type->Is(KindToType(right_kind_, isolate))); |
+ return type; |
+ } |
+ return KindToType(right_kind_, isolate); |
+} |
+ |
+ |
Handle<Type> BinaryOpIC::State::GetResultType(Isolate* isolate) const { |
Kind result_kind = result_kind_; |
if (HasSideEffects()) { |