Bug 1627618 - Part 10: Remove no longer used codegen for non-number binary arith instructions. r=jandem
authorAndré Bargull <andre.bargull@gmail.com>
Tue, 07 Apr 2020 08:38:39 +0000
changeset 522655 d4fa8213b43761ca227facf6beb6cecb0a1eaed8
parent 522654 13791501ae5dbd8f871846c275a96638117df11d
child 522656 5b587fcde948c41ae5cdcf40d2494f4af99dfcfc
push id112239
push userccoroiu@mozilla.com
push dateTue, 07 Apr 2020 15:04:11 +0000
treeherderautoland@5b653e25e757 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs1627618
milestone77.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1627618 - Part 10: Remove no longer used codegen for non-number binary arith instructions. r=jandem MBinaryArithInstruction no longer uses non-number specialisations, so we can remove the codegen support for it. Differential Revision: https://phabricator.services.mozilla.com/D69790
js/src/jit/CodeGenerator.cpp
js/src/jit/Lowering.cpp
js/src/jit/VMFunctionList-inl.h
--- a/js/src/jit/CodeGenerator.cpp
+++ b/js/src/jit/CodeGenerator.cpp
@@ -8219,36 +8219,16 @@ void CodeGenerator::visitModD(LModD* ins
 
 void CodeGenerator::visitBinaryV(LBinaryV* lir) {
   pushArg(ToValue(lir, LBinaryV::RhsInput));
   pushArg(ToValue(lir, LBinaryV::LhsInput));
 
   using Fn = bool (*)(JSContext*, MutableHandleValue, MutableHandleValue,
                       MutableHandleValue);
   switch (lir->jsop()) {
-    case JSOp::Add:
-      callVM<Fn, js::AddValues>(lir);
-      break;
-
-    case JSOp::Sub:
-      callVM<Fn, js::SubValues>(lir);
-      break;
-
-    case JSOp::Mul:
-      callVM<Fn, js::MulValues>(lir);
-      break;
-
-    case JSOp::Div:
-      callVM<Fn, js::DivValues>(lir);
-      break;
-
-    case JSOp::Mod:
-      callVM<Fn, js::ModValues>(lir);
-      break;
-
     case JSOp::BitAnd:
       callVM<Fn, js::BitAnd>(lir);
       break;
 
     case JSOp::BitOr:
       callVM<Fn, js::BitOr>(lir);
       break;
 
--- a/js/src/jit/Lowering.cpp
+++ b/js/src/jit/Lowering.cpp
@@ -1617,16 +1617,17 @@ static void MaybeSetRecoversInput(S* mir
   lir->snapshot()->rewriteRecoveredInput(*input);
 }
 
 void LIRGenerator::visitAdd(MAdd* ins) {
   MDefinition* lhs = ins->getOperand(0);
   MDefinition* rhs = ins->getOperand(1);
 
   MOZ_ASSERT(lhs->type() == rhs->type());
+  MOZ_ASSERT(IsNumberType(ins->specialization()));
 
   if (ins->specialization() == MIRType::Int32) {
     MOZ_ASSERT(lhs->type() == MIRType::Int32);
     ReorderCommutative(&lhs, &rhs, ins);
     LAddI* lir = new (alloc()) LAddI;
 
     if (ins->fallible()) {
       assignSnapshot(lir, Bailout_OverflowInvalidate);
@@ -1654,24 +1655,25 @@ void LIRGenerator::visitAdd(MAdd* ins) {
 
   if (ins->specialization() == MIRType::Float32) {
     MOZ_ASSERT(lhs->type() == MIRType::Float32);
     ReorderCommutative(&lhs, &rhs, ins);
     lowerForFPU(new (alloc()) LMathF(JSOp::Add), ins, lhs, rhs);
     return;
   }
 
-  lowerBinaryV(JSOp::Add, ins);
+  MOZ_CRASH("Unhandled number specialization");
 }
 
 void LIRGenerator::visitSub(MSub* ins) {
   MDefinition* lhs = ins->lhs();
   MDefinition* rhs = ins->rhs();
 
   MOZ_ASSERT(lhs->type() == rhs->type());
+  MOZ_ASSERT(IsNumberType(ins->specialization()));
 
   if (ins->specialization() == MIRType::Int32) {
     MOZ_ASSERT(lhs->type() == MIRType::Int32);
 
     LSubI* lir = new (alloc()) LSubI;
     if (ins->fallible()) {
       assignSnapshot(lir, Bailout_Overflow);
     }
@@ -1695,23 +1697,24 @@ void LIRGenerator::visitSub(MSub* ins) {
   }
 
   if (ins->specialization() == MIRType::Float32) {
     MOZ_ASSERT(lhs->type() == MIRType::Float32);
     lowerForFPU(new (alloc()) LMathF(JSOp::Sub), ins, lhs, rhs);
     return;
   }
 
-  lowerBinaryV(JSOp::Sub, ins);
+  MOZ_CRASH("Unhandled number specialization");
 }
 
 void LIRGenerator::visitMul(MMul* ins) {
   MDefinition* lhs = ins->lhs();
   MDefinition* rhs = ins->rhs();
   MOZ_ASSERT(lhs->type() == rhs->type());
+  MOZ_ASSERT(IsNumberType(ins->specialization()));
 
   if (ins->specialization() == MIRType::Int32) {
     MOZ_ASSERT(lhs->type() == MIRType::Int32);
     ReorderCommutative(&lhs, &rhs, ins);
 
     // If our RHS is a constant -1 and we don't have to worry about
     // overflow, we can optimize to an LNegI.
     if (!ins->fallible() && rhs->isConstant() &&
@@ -1754,23 +1757,24 @@ void LIRGenerator::visitMul(MMul* ins) {
         rhs->toConstant()->toFloat32() == -1.0f) {
       defineReuseInput(new (alloc()) LNegF(useRegisterAtStart(lhs)), ins, 0);
     } else {
       lowerForFPU(new (alloc()) LMathF(JSOp::Mul), ins, lhs, rhs);
     }
     return;
   }
 
-  lowerBinaryV(JSOp::Mul, ins);
+  MOZ_CRASH("Unhandled number specialization");
 }
 
 void LIRGenerator::visitDiv(MDiv* ins) {
   MDefinition* lhs = ins->lhs();
   MDefinition* rhs = ins->rhs();
   MOZ_ASSERT(lhs->type() == rhs->type());
+  MOZ_ASSERT(IsNumberType(ins->specialization()));
 
   if (ins->specialization() == MIRType::Int32) {
     MOZ_ASSERT(lhs->type() == MIRType::Int32);
     lowerDivI(ins);
     return;
   }
 
   if (ins->specialization() == MIRType::Int64) {
@@ -1786,21 +1790,22 @@ void LIRGenerator::visitDiv(MDiv* ins) {
   }
 
   if (ins->specialization() == MIRType::Float32) {
     MOZ_ASSERT(lhs->type() == MIRType::Float32);
     lowerForFPU(new (alloc()) LMathF(JSOp::Div), ins, lhs, rhs);
     return;
   }
 
-  lowerBinaryV(JSOp::Div, ins);
+  MOZ_CRASH("Unhandled number specialization");
 }
 
 void LIRGenerator::visitMod(MMod* ins) {
   MOZ_ASSERT(ins->lhs()->type() == ins->rhs()->type());
+  MOZ_ASSERT(IsNumberType(ins->specialization()));
 
   if (ins->specialization() == MIRType::Int32) {
     MOZ_ASSERT(ins->type() == MIRType::Int32);
     MOZ_ASSERT(ins->lhs()->type() == MIRType::Int32);
     lowerModI(ins);
     return;
   }
 
@@ -1823,17 +1828,17 @@ void LIRGenerator::visitMod(MMod* ins) {
 
     // Note: useRegisterAtStart is safe here, the temp is not a FP register.
     LModD* lir = new (alloc()) LModD(useRegisterAtStart(ins->lhs()),
                                      useRegisterAtStart(ins->rhs()), maybeTemp);
     defineReturn(lir, ins);
     return;
   }
 
-  lowerBinaryV(JSOp::Mod, ins);
+  MOZ_CRASH("Unhandled number specialization");
 }
 
 void LIRGenerator::lowerBinaryV(JSOp op, MBinaryInstruction* ins) {
   MDefinition* lhs = ins->getOperand(0);
   MDefinition* rhs = ins->getOperand(1);
 
   MOZ_ASSERT(lhs->type() == MIRType::Value);
   MOZ_ASSERT(rhs->type() == MIRType::Value);
--- a/js/src/jit/VMFunctionList-inl.h
+++ b/js/src/jit/VMFunctionList-inl.h
@@ -29,17 +29,16 @@
 namespace js {
 namespace jit {
 
 // List of all VM functions to be used with callVM. Each entry stores the name
 // (must be unique, used for the VMFunctionId enum and profiling) and the C++
 // function to be called. This list must be sorted on the name field.
 #define VMFUNCTION_LIST(_)                                                     \
   _(AddOrUpdateSparseElementHelper, js::AddOrUpdateSparseElementHelper)        \
-  _(AddValues, js::AddValues)                                                  \
   _(ArgumentsObjectCreateForIon, js::ArgumentsObject::createForIon)            \
   _(ArrayConstructorOneArg, js::ArrayConstructorOneArg)                        \
   _(ArrayJoin, js::jit::ArrayJoin)                                             \
   _(ArrayPopDense, js::jit::ArrayPopDense)                                     \
   _(ArrayPushDense, js::jit::ArrayPushDense)                                   \
   _(ArrayShiftDense, js::jit::ArrayShiftDense)                                 \
   _(ArraySliceDense, js::ArraySliceDense)                                      \
   _(AsyncFunctionAwait, js::AsyncFunctionAwait)                                \
@@ -114,17 +113,16 @@ namespace jit {
   _(DefLexicalOperation, js::DefLexicalOperation)                              \
   _(DefVarOperation, js::DefVarOperation)                                      \
   _(DelElemOperationNonStrict, js::DelElemOperation<false>)                    \
   _(DelElemOperationStrict, js::DelElemOperation<true>)                        \
   _(DelPropOperationNonStrict, js::DelPropOperation<false>)                    \
   _(DelPropOperationStrict, js::DelPropOperation<true>)                        \
   _(DeleteNameOperation, js::DeleteNameOperation)                              \
   _(DirectEvalStringFromIon, js::DirectEvalStringFromIon)                      \
-  _(DivValues, js::DivValues)                                                  \
   _(DoCallFallback, js::jit::DoCallFallback)                                   \
   _(DoConcatStringObject, js::jit::DoConcatStringObject)                       \
   _(DoSpreadCallFallback, js::jit::DoSpreadCallFallback)                       \
   _(DoToNumeric, js::jit::DoToNumeric)                                         \
   _(DoTypeUpdateFallback, js::jit::DoTypeUpdateFallback)                       \
   _(EnterWith, js::jit::EnterWith)                                             \
   _(FinalSuspend, js::jit::FinalSuspend)                                       \
   _(FinishBoundFunctionInit, JSFunction::finishBoundFunctionInit)              \
@@ -186,18 +184,16 @@ namespace jit {
   _(LambdaArrow, js::LambdaArrow)                                              \
   _(LeaveWith, js::jit::LeaveWith)                                             \
   _(LessThan, js::jit::LessThan)                                               \
   _(LessThanOrEqual, js::jit::LessThanOrEqual)                                 \
   _(LexicalEnvironmentObjectCreate, js::LexicalEnvironmentObject::create)      \
   _(LooselyEqual, js::jit::LooselyEqual<js::jit::EqualityKind::Equal>)         \
   _(LooselyNotEqual, js::jit::LooselyEqual<js::jit::EqualityKind::NotEqual>)   \
   _(MakeDefaultConstructor, js::MakeDefaultConstructor)                        \
-  _(ModValues, js::ModValues)                                                  \
-  _(MulValues, js::MulValues)                                                  \
   _(MutatePrototype, js::jit::MutatePrototype)                                 \
   _(NamedLambdaObjectCreateTemplateObject,                                     \
     js::NamedLambdaObject::createTemplateObject)                               \
   _(NativeGetElement, js::NativeGetElement)                                    \
   _(NewArgumentsObject, js::jit::NewArgumentsObject)                           \
   _(NewArrayCopyOnWriteOperation, js::NewArrayCopyOnWriteOperation)            \
   _(NewArrayIteratorObject, js::NewArrayIteratorObject)                        \
   _(NewArrayOperation, js::NewArrayOperation)                                  \
@@ -261,17 +257,16 @@ namespace jit {
   _(StringToLowerCase, js::StringToLowerCase)                                  \
   _(StringToNumber, js::StringToNumber)                                        \
   _(StringToUpperCase, js::StringToUpperCase)                                  \
   _(StringsCompareGreaterThanOrEquals,                                         \
     js::jit::StringsCompare<ComparisonKind::GreaterThanOrEqual>)               \
   _(StringsCompareLessThan, js::jit::StringsCompare<ComparisonKind::LessThan>) \
   _(StringsEqual, js::jit::StringsEqual<js::jit::EqualityKind::Equal>)         \
   _(StringsNotEqual, js::jit::StringsEqual<js::jit::EqualityKind::NotEqual>)   \
-  _(SubValues, js::SubValues)                                                  \
   _(SubstringKernel, js::SubstringKernel)                                      \
   _(ThrowBadDerivedReturn, js::jit::ThrowBadDerivedReturn)                     \
   _(ThrowBadDerivedReturnOrUninitializedThis,                                  \
     js::jit::ThrowBadDerivedReturnOrUninitializedThis)                         \
   _(ThrowCheckIsObject, js::ThrowCheckIsObject)                                \
   _(ThrowHomeObjectNotObject, js::ThrowHomeObjectNotObject)                    \
   _(ThrowInitializedThis, js::ThrowInitializedThis)                            \
   _(ThrowMsgOperation, js::ThrowMsgOperation)                                  \