Bug 1627618 - Part 12: Inline binaryBitOpEmit into its single caller. r=jandem
authorAndré Bargull <andre.bargull@gmail.com>
Tue, 07 Apr 2020 08:39:31 +0000
changeset 522657 40a10f393143edf9b8389729f6217b88914c4e47
parent 522656 5b587fcde948c41ae5cdcf40d2494f4af99dfcfc
child 522658 4802a1f034483e52f749b8981d837e60caf8804c
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 12: Inline binaryBitOpEmit into its single caller. r=jandem Inline `binaryBitOpEmit()` into `binaryBitOpTrySpecialized()`. This makes it easier to see that both operands are "simple bit-operands" when applying this optimisation. This change is useful for the next part, which will remove `MBinaryBitwiseInstruction::infer()`, because `infer()` also tests that the operands are "simple bit-operands". Differential Revision: https://phabricator.services.mozilla.com/D69792
js/src/jit/IonBuilder.cpp
js/src/jit/IonBuilder.h
--- a/js/src/jit/IonBuilder.cpp
+++ b/js/src/jit/IonBuilder.cpp
@@ -3442,18 +3442,29 @@ AbortReasonOr<Ok> IonBuilder::jsop_bitno
     if (emitted) {
       return Ok();
     }
   }
 
   return arithUnaryBinaryCache(JSOp::BitNot, nullptr, input);
 }
 
-AbortReasonOr<MBinaryBitwiseInstruction*> IonBuilder::binaryBitOpEmit(
-    JSOp op, MDefinition* left, MDefinition* right) {
+AbortReasonOr<Ok> IonBuilder::binaryBitOpTrySpecialized(bool* emitted, JSOp op,
+                                                        MDefinition* left,
+                                                        MDefinition* right) {
+  MOZ_ASSERT(*emitted == false);
+
+  // Try to emit a specialized binary instruction based on the input types
+  // of the operands.
+
+  // Anything complex - objects, symbols, and bigints - are not specialized
+  if (!SimpleBitOpOperand(left) || !SimpleBitOpOperand(right)) {
+    return Ok();
+  }
+
   MBinaryBitwiseInstruction* ins;
   switch (op) {
     case JSOp::BitAnd:
       ins = MBitAnd::New(alloc(), left, right);
       break;
 
     case JSOp::BitOr:
       ins = MBitOr::New(alloc(), left, right);
@@ -3486,34 +3497,16 @@ AbortReasonOr<MBinaryBitwiseInstruction*
   MOZ_ASSERT(ins->specialization() == MIRType::Int32 ||
              (op == JSOp::Ursh && ins->specialization() == MIRType::Double));
 
   current->push(ins);
   if (ins->isEffectful()) {
     MOZ_TRY(resumeAfter(ins));
   }
 
-  return ins;
-}
-
-AbortReasonOr<Ok> IonBuilder::binaryBitOpTrySpecialized(bool* emitted, JSOp op,
-                                                        MDefinition* left,
-                                                        MDefinition* right) {
-  MOZ_ASSERT(*emitted == false);
-
-  // Try to emit a specialized binary instruction based on the input types
-  // of the operands.
-
-  // Anything complex - objects, symbols, and bigints - are not specialized
-  if (!SimpleBitOpOperand(left) || !SimpleBitOpOperand(right)) {
-    return Ok();
-  }
-
-  MOZ_TRY(binaryBitOpEmit(op, left, right));
-
   *emitted = true;
   return Ok();
 }
 
 AbortReasonOr<Ok> IonBuilder::jsop_bitop(JSOp op) {
   // Pop inputs.
   MDefinition* right = current->pop();
   MDefinition* left = current->pop();
--- a/js/src/jit/IonBuilder.h
+++ b/js/src/jit/IonBuilder.h
@@ -391,19 +391,16 @@ class MOZ_STACK_CLASS IonBuilder {
   AbortReasonOr<Ok> binaryArithTrySpecialized(bool* emitted, JSOp op,
                                               MDefinition* left,
                                               MDefinition* right);
   AbortReasonOr<Ok> binaryArithTrySpecializedOnBaselineInspector(
       bool* emitted, JSOp op, MDefinition* left, MDefinition* right);
   MDefinition* maybeConvertToNumber(MDefinition* def);
 
   // jsop_bitop helpers.
-  AbortReasonOr<MBinaryBitwiseInstruction*> binaryBitOpEmit(JSOp op,
-                                                            MDefinition* left,
-                                                            MDefinition* right);
   AbortReasonOr<Ok> binaryBitOpTrySpecialized(bool* emitted, JSOp op,
                                               MDefinition* left,
                                               MDefinition* right);
 
   // jsop_bitnot helpers.
   AbortReasonOr<Ok> bitnotTrySpecialized(bool* emitted, MDefinition* input);
 
   // jsop_inc_or_dec helpers.