@@ -3807,28 +3807,28 @@ bool Instr::BinaryCalculatorT(T src1Const, T src2Const, int64 *pResult, bool che
38073807template bool Instr::BinaryCalculatorT<int >(int src1Const64, int src2Const64, int64 *pResult, bool checkWouldTrap);
38083808template bool Instr::BinaryCalculatorT<int64>(int64 src1Const64, int64 src2Const64, int64 *pResult, bool checkWouldTrap);
38093809
3810- bool Instr::BinaryCalculator (IntConstType src1Const, IntConstType src2Const, IntConstType *pResult)
3810+ bool Instr::BinaryCalculator (IntConstType src1Const, IntConstType src2Const, IntConstType *pResult, IRType type )
38113811{
38123812 IntConstType value = 0 ;
38133813
38143814 switch (this ->m_opcode )
38153815 {
38163816 case Js::OpCode::Add_A:
3817- if (IntConstMath::Add (src1Const, src2Const, &value))
3817+ if (IntConstMath::Add (src1Const, src2Const, type, &value))
38183818 {
38193819 return false ;
38203820 }
38213821 break ;
38223822
38233823 case Js::OpCode::Sub_A:
3824- if (IntConstMath::Sub (src1Const, src2Const, &value))
3824+ if (IntConstMath::Sub (src1Const, src2Const, type, &value))
38253825 {
38263826 return false ;
38273827 }
38283828 break ;
38293829
38303830 case Js::OpCode::Mul_A:
3831- if (IntConstMath::Mul (src1Const, src2Const, &value))
3831+ if (IntConstMath::Mul (src1Const, src2Const, type, &value))
38323832 {
38333833 return false ;
38343834 }
@@ -3852,7 +3852,7 @@ bool Instr::BinaryCalculator(IntConstType src1Const, IntConstType src2Const, Int
38523852 // folds to -0. Bail for now...
38533853 return false ;
38543854 }
3855- if (IntConstMath::Div (src1Const, src2Const, &value))
3855+ if (IntConstMath::Div (src1Const, src2Const, type, &value))
38563856 {
38573857 return false ;
38583858 }
@@ -3870,7 +3870,7 @@ bool Instr::BinaryCalculator(IntConstType src1Const, IntConstType src2Const, Int
38703870 // Bail for now...
38713871 return false ;
38723872 }
3873- if (IntConstMath::Mod (src1Const, src2Const, &value))
3873+ if (IntConstMath::Mod (src1Const, src2Const, type, &value))
38743874 {
38753875 return false ;
38763876 }
@@ -3884,17 +3884,15 @@ bool Instr::BinaryCalculator(IntConstType src1Const, IntConstType src2Const, Int
38843884
38853885 case Js::OpCode::Shl_A:
38863886 // We don't care about overflow here
3887- IntConstMath::Shl ( src1Const, src2Const & 0x1F , &value );
3887+ value = src1Const << ( src2Const & 0x1F );
38883888 break ;
38893889
38903890 case Js::OpCode::Shr_A:
3891- // We don't care about overflow here, and there shouldn't be any
3892- IntConstMath::Shr (src1Const, src2Const & 0x1F , &value);
3891+ value = src1Const >> (src2Const & 0x1F );
38933892 break ;
38943893
38953894 case Js::OpCode::ShrU_A:
3896- // We don't care about overflow here, and there shouldn't be any
3897- IntConstMath::ShrU (src1Const, src2Const & 0x1F , &value);
3895+ value = ((UIntConstType)src1Const) >> (src2Const & 0x1F );
38983896 if (value < 0 )
38993897 {
39003898 // ShrU produces a UInt32. If it doesn't fit in an Int32, bail as we don't
@@ -3904,18 +3902,15 @@ bool Instr::BinaryCalculator(IntConstType src1Const, IntConstType src2Const, Int
39043902 break ;
39053903
39063904 case Js::OpCode::And_A:
3907- // We don't care about overflow here, and there shouldn't be any
3908- IntConstMath::And (src1Const, src2Const, &value);
3905+ value = src1Const & src2Const;
39093906 break ;
39103907
39113908 case Js::OpCode::Or_A:
3912- // We don't care about overflow here, and there shouldn't be any
3913- IntConstMath::Or (src1Const, src2Const, &value);
3909+ value = src1Const | src2Const;
39143910 break ;
39153911
39163912 case Js::OpCode::Xor_A:
3917- // We don't care about overflow here, and there shouldn't be any
3918- IntConstMath::Xor (src1Const, src2Const, &value);
3913+ value = src1Const ^ src2Const;
39193914 break ;
39203915
39213916 case Js::OpCode::InlineMathMin:
@@ -3935,7 +3930,7 @@ bool Instr::BinaryCalculator(IntConstType src1Const, IntConstType src2Const, Int
39353930 return true ;
39363931}
39373932
3938- bool Instr::UnaryCalculator (IntConstType src1Const, IntConstType *pResult)
3933+ bool Instr::UnaryCalculator (IntConstType src1Const, IntConstType *pResult, IRType type )
39393934{
39403935 IntConstType value = 0 ;
39413936
@@ -3948,14 +3943,14 @@ bool Instr::UnaryCalculator(IntConstType src1Const, IntConstType *pResult)
39483943 return false ;
39493944 }
39503945
3951- if (IntConstMath::Neg (src1Const, &value))
3946+ if (IntConstMath::Neg (src1Const, type, &value))
39523947 {
39533948 return false ;
39543949 }
39553950 break ;
39563951
39573952 case Js::OpCode::Not_A:
3958- IntConstMath::Not (src1Const, & value) ;
3953+ value = ~src1Const ;
39593954 break ;
39603955
39613956 case Js::OpCode::Ld_A:
@@ -3973,14 +3968,14 @@ bool Instr::UnaryCalculator(IntConstType src1Const, IntConstType *pResult)
39733968 break ;
39743969
39753970 case Js::OpCode::Incr_A:
3976- if (IntConstMath::Inc (src1Const, &value))
3971+ if (IntConstMath::Inc (src1Const, type, &value))
39773972 {
39783973 return false ;
39793974 }
39803975 break ;
39813976
39823977 case Js::OpCode::Decr_A:
3983- if (IntConstMath::Dec (src1Const, &value))
3978+ if (IntConstMath::Dec (src1Const, type, &value))
39843979 {
39853980 return false ;
39863981 }
0 commit comments