@@ -2126,23 +2126,6 @@ impl Function {
21262126 self . push_insn ( block, Insn :: GuardType { val, guard_type, state } )
21272127 }
21282128
2129- fn likely_is_fixnum ( & self , val : InsnId , profiled_type : ProfiledType ) -> bool {
2130- self . is_a ( val, types:: Fixnum ) || profiled_type. is_fixnum ( )
2131- }
2132-
2133- fn coerce_to_fixnum ( & mut self , block : BlockId , val : InsnId , state : InsnId ) -> InsnId {
2134- if self . is_a ( val, types:: Fixnum ) { return val; }
2135- self . push_insn ( block, Insn :: GuardType { val, guard_type : types:: Fixnum , state } )
2136- }
2137-
2138- fn arguments_likely_fixnums ( & mut self , left : InsnId , right : InsnId , state : InsnId ) -> bool {
2139- let frame_state = self . frame_state ( state) ;
2140- let iseq_insn_idx = frame_state. insn_idx ;
2141- let left_profiled_type = self . profiled_type_of_at ( left, iseq_insn_idx) . unwrap_or_default ( ) ;
2142- let right_profiled_type = self . profiled_type_of_at ( right, iseq_insn_idx) . unwrap_or_default ( ) ;
2143- self . likely_is_fixnum ( left, left_profiled_type) && self . likely_is_fixnum ( right, right_profiled_type)
2144- }
2145-
21462129 fn count_fancy_call_features ( & mut self , block : BlockId , ci_flags : c_uint ) {
21472130 use Counter :: * ;
21482131 if 0 != ci_flags & VM_CALL_ARGS_SPLAT { self . push_insn ( block, Insn :: IncrCounter ( fancy_arg_pass_caller_splat) ) ; }
@@ -2161,14 +2144,14 @@ impl Function {
21612144 self . push_insn_id ( block, orig_insn_id) ;
21622145 return ;
21632146 }
2164- if self . arguments_likely_fixnums ( left, right, state) {
2147+ if self . likely_a ( left, types :: Fixnum , state ) && self . likely_a ( right, types :: Fixnum , state) {
21652148 if bop == BOP_NEQ {
21662149 // For opt_neq, the interpreter checks that both neq and eq are unchanged.
21672150 self . push_insn ( block, Insn :: PatchPoint { invariant : Invariant :: BOPRedefined { klass : INTEGER_REDEFINED_OP_FLAG , bop : BOP_EQ } , state } ) ;
21682151 }
21692152 self . push_insn ( block, Insn :: PatchPoint { invariant : Invariant :: BOPRedefined { klass : INTEGER_REDEFINED_OP_FLAG , bop } , state } ) ;
2170- let left = self . coerce_to_fixnum ( block, left, state) ;
2171- let right = self . coerce_to_fixnum ( block, right, state) ;
2153+ let left = self . coerce_to ( block, left, types :: Fixnum , state) ;
2154+ let right = self . coerce_to ( block, right, types :: Fixnum , state) ;
21722155 let result = self . push_insn ( block, f ( left, right) ) ;
21732156 self . make_equal_to ( orig_insn_id, result) ;
21742157 self . insn_types [ result. 0 ] = self . infer_type ( result) ;
@@ -2567,8 +2550,8 @@ impl Function {
25672550 let high_is_fix = self . is_a ( high, types:: Fixnum ) ;
25682551
25692552 if low_is_fix || high_is_fix {
2570- let low_fix = self . coerce_to_fixnum ( block, low, state) ;
2571- let high_fix = self . coerce_to_fixnum ( block, high, state) ;
2553+ let low_fix = self . coerce_to ( block, low, types :: Fixnum , state) ;
2554+ let high_fix = self . coerce_to ( block, high, types :: Fixnum , state) ;
25722555 let replacement = self . push_insn ( block, Insn :: NewRangeFixnum { low : low_fix, high : high_fix, flag, state } ) ;
25732556 self . make_equal_to ( insn_id, replacement) ;
25742557 self . insn_types [ replacement. 0 ] = self . infer_type ( replacement) ;
0 commit comments