Bug 1637704 - Remove unused bailoutKind parameter from MGuardShape. r=tcampbell
authorTom Schuster <evilpies@gmail.com>
Wed, 13 May 2020 19:25:27 +0000
changeset 529714 1d3aa4aa695707492dd148134dded6be2572d66c
parent 529713 d5eab5a42b3e5a444d3f0c46b3c77c2a76d4cf77
child 529715 9dee0cfaa60f7fbc059f4fc2c58065bc958cb29b
push id37414
push usernbeleuzu@mozilla.com
push dateThu, 14 May 2020 02:40:10 +0000
treeherdermozilla-central@045d696faa87 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstcampbell
bugs1637704
milestone78.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 1637704 - Remove unused bailoutKind parameter from MGuardShape. r=tcampbell Differential Revision: https://phabricator.services.mozilla.com/D75167
js/src/jit/IonBuilder.cpp
js/src/jit/IonBuilder.h
js/src/jit/Lowering.cpp
js/src/jit/MIR.h
js/src/jit/WarpCacheIRTranspiler.cpp
--- a/js/src/jit/IonBuilder.cpp
+++ b/js/src/jit/IonBuilder.cpp
@@ -5369,17 +5369,17 @@ MDefinition* IonBuilder::createThisScrip
 
   AutoSweepJitScript sweep(targetScript);
   StackTypeSet* thisTypes = jitScript->thisTypes(sweep, targetScript);
   if (!thisTypes->hasType(TypeSet::ObjectType(templateObject))) {
     return nullptr;
   }
 
   // Shape guard.
-  callee = addShapeGuard(callee, target->lastProperty(), Bailout_ShapeGuard);
+  callee = addShapeGuard(callee, target->lastProperty());
 
   // Guard callee.prototype == proto.
   MOZ_ASSERT(shape->numFixedSlots() == 0, "Must be a dynamic slot");
   MSlots* slots = MSlots::New(alloc(), callee);
   current->add(slots);
   MLoadSlot* prototype = MLoadSlot::New(alloc(), slots, shape->slot());
   current->add(prototype);
   MDefinition* protoConst = constant(ObjectValue(*proto));
@@ -10100,31 +10100,30 @@ AbortReasonOr<bool> IonBuilder::testComm
   // name. In this case, we also have to guard on the globals shape to be able
   // to optimize, because the way global property sets are handled means
   // freezing doesn't work for what we want here. Note that a shape guard is
   // good enough here, even in the proxy case, because we have ensured there
   // are no lookup hooks for this property.
   if (guardGlobal) {
     JSObject* obj = &script()->global();
     MDefinition* globalObj = constant(ObjectValue(*obj));
-    *globalGuard = addShapeGuard(globalObj, globalShape, Bailout_ShapeGuard);
+    *globalGuard = addShapeGuard(globalObj, globalShape);
   }
 
   // If the getter/setter is not configurable we don't have to guard on the
   // proto's shape.
   Shape* propShape = foundProto->lookupPure(id);
   MOZ_ASSERT_IF(isGetter, propShape->getterObject() == getterOrSetter);
   MOZ_ASSERT_IF(!isGetter, propShape->setterObject() == getterOrSetter);
   if (propShape && !propShape->configurable()) {
     return true;
   }
 
   MInstruction* wrapper = constant(ObjectValue(*foundProto));
-  *guard =
-      addShapeGuard(wrapper, foundProto->lastProperty(), Bailout_ShapeGuard);
+  *guard = addShapeGuard(wrapper, foundProto->lastProperty());
   return true;
 }
 
 void IonBuilder::replaceMaybeFallbackFunctionGetter(MGetPropertyCache* cache) {
   // Discard the last prior resume point of the previous MGetPropertyCache.
   WrapMGetPropertyCache rai(maybeFallbackFunctionGetter_);
   maybeFallbackFunctionGetter_ = cache;
 }
@@ -10782,21 +10781,21 @@ AbortReasonOr<Ok> IonBuilder::getPropTry
 MDefinition* IonBuilder::addShapeGuardsForGetterSetter(
     MDefinition* obj, JSObject* holder, Shape* holderShape,
     const BaselineInspector::ReceiverVector& receivers, bool isOwnProperty) {
   MOZ_ASSERT(isOwnProperty == !holder);
   MOZ_ASSERT(holderShape);
 
   if (isOwnProperty) {
     MOZ_ASSERT(receivers.empty());
-    return addShapeGuard(obj, holderShape, Bailout_ShapeGuard);
+    return addShapeGuard(obj, holderShape);
   }
 
   MDefinition* holderDef = constant(ObjectValue(*holder));
-  addShapeGuard(holderDef, holderShape, Bailout_ShapeGuard);
+  addShapeGuard(holderDef, holderShape);
 
   return addGuardReceiverPolymorphic(obj, receivers);
 }
 
 AbortReasonOr<Ok> IonBuilder::getPropTryCommonGetter(bool* emitted,
                                                      MDefinition* obj, jsid id,
                                                      TemporaryTypeSet* types,
                                                      bool innerized) {
@@ -11031,17 +11030,17 @@ AbortReasonOr<Ok> IonBuilder::getPropTry
     rvalType = MIRType::Value;
   }
 
   if (receivers.length() == 1) {
     if (!receivers[0].getGroup()) {
       // Monomorphic load from a native object.
       spew("Inlining monomorphic native GETPROP");
 
-      obj = addShapeGuard(obj, receivers[0].getShape(), Bailout_ShapeGuard);
+      obj = addShapeGuard(obj, receivers[0].getShape());
 
       Shape* shape = receivers[0].getShape()->searchLinear(NameToId(name));
       MOZ_ASSERT(shape);
 
       MOZ_TRY(loadSlot(obj, shape, rvalType, barrier, types));
 
       *emitted = true;
       return Ok();
@@ -11124,17 +11123,17 @@ AbortReasonOr<Ok> IonBuilder::getPropTry
   obj = addGuardReceiverPolymorphic(obj, receivers);
   if (!obj) {
     return abort(AbortReason::Alloc);
   }
 
   // Guard on the holder's shape.
   MInstruction* holderDef = constant(ObjectValue(*holder));
   Shape* holderShape = holder->as<NativeObject>().shape();
-  holderDef = addShapeGuard(holderDef, holderShape, Bailout_ShapeGuard);
+  holderDef = addShapeGuard(holderDef, holderShape);
 
   Shape* propShape = holderShape->searchLinear(NameToId(name));
   MOZ_ASSERT(propShape);
 
   MOZ_TRY(loadSlot(holderDef, propShape, rvalType, barrier, types));
 
   *emitted = true;
   return Ok();
@@ -11612,17 +11611,17 @@ AbortReasonOr<Ok> IonBuilder::setPropTry
     return Ok();
   }
 
   if (receivers.length() == 1) {
     if (!receivers[0].getGroup()) {
       // Monomorphic store to a native object.
       spew("Inlining monomorphic native SETPROP");
 
-      obj = addShapeGuard(obj, receivers[0].getShape(), Bailout_ShapeGuard);
+      obj = addShapeGuard(obj, receivers[0].getShape());
 
       Shape* shape = receivers[0].getShape()->searchLinear(NameToId(name));
       MOZ_ASSERT(shape);
 
       if (needsPostBarrier(value)) {
         current->add(MPostWriteBarrier::New(alloc(), obj, value));
       }
 
@@ -12591,17 +12590,17 @@ AbortReasonOr<Ok> IonBuilder::jsop_insta
     Shape* shape;
     uint32_t slot;
     JSObject* protoObject;
     if (!inspector->instanceOfData(pc, &shape, &slot, &protoObject)) {
       break;
     }
 
     // Shape guard.
-    rhs = addShapeGuard(rhs, shape, Bailout_ShapeGuard);
+    rhs = addShapeGuard(rhs, shape);
 
     // Guard .prototype == protoObject.
     MOZ_ASSERT(shape->numFixedSlots() == 0, "Must be a dynamic slot");
     MSlots* slots = MSlots::New(alloc(), rhs);
     current->add(slots);
     MLoadSlot* prototype = MLoadSlot::New(alloc(), slots, slot);
     current->add(prototype);
     MConstant* protoConst =
@@ -12867,19 +12866,18 @@ MInstruction* IonBuilder::addBoundsCheck
     // without affecting the index masking.
     check = MSpectreMaskIndex::New(alloc(), check, length);
     current->add(check);
   }
 
   return check;
 }
 
-MInstruction* IonBuilder::addShapeGuard(MDefinition* obj, Shape* const shape,
-                                        BailoutKind bailoutKind) {
-  MGuardShape* guard = MGuardShape::New(alloc(), obj, shape, bailoutKind);
+MInstruction* IonBuilder::addShapeGuard(MDefinition* obj, Shape* const shape) {
+  MGuardShape* guard = MGuardShape::New(alloc(), obj, shape);
   current->add(guard);
 
   // If a shape guard failed in the past, don't optimize shape guard.
   if (failedShapeGuard_) {
     guard->setNotMovable();
   }
 
   return guard;
@@ -12904,17 +12902,17 @@ MInstruction* IonBuilder::addGroupGuard(
   return guard;
 }
 
 MInstruction* IonBuilder::addGuardReceiverPolymorphic(
     MDefinition* obj, const BaselineInspector::ReceiverVector& receivers) {
   if (receivers.length() == 1) {
     if (!receivers[0].getGroup()) {
       // Monomorphic guard on a native object.
-      return addShapeGuard(obj, receivers[0].getShape(), Bailout_ShapeGuard);
+      return addShapeGuard(obj, receivers[0].getShape());
     }
   }
 
   MGuardReceiverPolymorphic* guard =
       MGuardReceiverPolymorphic::New(alloc(), obj);
   current->add(guard);
 
   if (failedShapeGuard_) {
--- a/js/src/jit/IonBuilder.h
+++ b/js/src/jit/IonBuilder.h
@@ -286,18 +286,17 @@ class MOZ_STACK_CLASS IonBuilder {
   MDefinition* walkEnvironmentChain(unsigned hops);
 
   MInstruction* addConvertElementsToDoubles(MDefinition* elements);
   MDefinition* addMaybeCopyElementsForWrite(MDefinition* object,
                                             bool checkNative);
 
   MInstruction* addBoundsCheck(MDefinition* index, MDefinition* length);
 
-  MInstruction* addShapeGuard(MDefinition* obj, Shape* const shape,
-                              BailoutKind bailoutKind);
+  MInstruction* addShapeGuard(MDefinition* obj, Shape* const shape);
   MInstruction* addGroupGuard(MDefinition* obj, ObjectGroup* group,
                               BailoutKind bailoutKind);
   MInstruction* addSharedTypedArrayGuard(MDefinition* obj);
 
   MInstruction* addGuardReceiverPolymorphic(
       MDefinition* obj, const BaselineInspector::ReceiverVector& receivers);
 
   bool invalidatedIdempotentCache();
--- a/js/src/jit/Lowering.cpp
+++ b/js/src/jit/Lowering.cpp
@@ -3874,22 +3874,22 @@ void LIRGenerator::visitGuardSpecificAto
 }
 
 void LIRGenerator::visitGuardShape(MGuardShape* ins) {
   MOZ_ASSERT(ins->object()->type() == MIRType::Object);
 
   if (JitOptions.spectreObjectMitigationsMisc) {
     auto* lir =
         new (alloc()) LGuardShape(useRegisterAtStart(ins->object()), temp());
-    assignSnapshot(lir, ins->bailoutKind());
+    assignSnapshot(lir, Bailout_ShapeGuard);
     defineReuseInput(lir, ins, 0);
   } else {
     auto* lir = new (alloc())
         LGuardShape(useRegister(ins->object()), LDefinition::BogusTemp());
-    assignSnapshot(lir, ins->bailoutKind());
+    assignSnapshot(lir, Bailout_ShapeGuard);
     add(lir, ins);
     redefine(ins, ins->object());
   }
 }
 
 void LIRGenerator::visitGuardObjectGroup(MGuardObjectGroup* ins) {
   MOZ_ASSERT(ins->object()->type() == MIRType::Object);
 
--- a/js/src/jit/MIR.h
+++ b/js/src/jit/MIR.h
@@ -8782,45 +8782,38 @@ class MCallBindVar : public MUnaryInstru
   }
 
   AliasSet getAliasSet() const override { return AliasSet::None(); }
 };
 
 // Guard on an object's shape.
 class MGuardShape : public MUnaryInstruction, public SingleObjectPolicy::Data {
   CompilerShape shape_;
-  BailoutKind bailoutKind_;
-
-  MGuardShape(MDefinition* obj, Shape* shape, BailoutKind bailoutKind)
-      : MUnaryInstruction(classOpcode, obj),
-        shape_(shape),
-        bailoutKind_(bailoutKind) {
+
+  MGuardShape(MDefinition* obj, Shape* shape)
+      : MUnaryInstruction(classOpcode, obj), shape_(shape) {
     setGuard();
     setMovable();
     setResultType(MIRType::Object);
     setResultTypeSet(obj->resultTypeSet());
   }
 
  public:
   INSTRUCTION_HEADER(GuardShape)
   TRIVIAL_NEW_WRAPPERS
   NAMED_OPERANDS((0, object))
 
   const Shape* shape() const { return shape_; }
-  BailoutKind bailoutKind() const { return bailoutKind_; }
   bool congruentTo(const MDefinition* ins) const override {
     if (!ins->isGuardShape()) {
       return false;
     }
     if (shape() != ins->toGuardShape()->shape()) {
       return false;
     }
-    if (bailoutKind() != ins->toGuardShape()->bailoutKind()) {
-      return false;
-    }
     return congruentIfOperandsEqual(ins);
   }
   AliasSet getAliasSet() const override {
     return AliasSet::Load(AliasSet::ObjectFields);
   }
   bool appendRoots(MRootList& roots) const override {
     return roots.append(shape_);
   }
--- a/js/src/jit/WarpCacheIRTranspiler.cpp
+++ b/js/src/jit/WarpCacheIRTranspiler.cpp
@@ -182,17 +182,17 @@ bool WarpCacheIRTranspiler::emitGuardCla
   return true;
 }
 
 bool WarpCacheIRTranspiler::emitGuardShape(ObjOperandId objId,
                                            uint32_t shapeOffset) {
   MDefinition* def = getOperand(objId);
   Shape* shape = shapeStubField(shapeOffset);
 
-  auto* ins = MGuardShape::New(alloc(), def, shape, Bailout_ShapeGuard);
+  auto* ins = MGuardShape::New(alloc(), def, shape);
   add(ins);
 
   setOperand(objId, ins);
   return true;
 }
 
 bool WarpCacheIRTranspiler::emitGuardSpecificAtom(StringOperandId strId,
                                                   uint32_t expectedOffset) {