Bug 1319468 - P1: Use Rooted for AutoRooterGetterSetter::Inner. r=jonco
authorYoshi Cheng-Hao Huang <allstars.chh@gmail.com>
Thu, 31 Jan 2019 11:02:21 +0100
changeset 519618 7a0de0939e2fcc6a3abc11f010fbe5d8ca209cf4
parent 519617 a31acecd037201c9ae8953cb8b0c543fa6eb1ce0
child 519619 ba49b929457a6df36413a33ce0270af65ad472e1
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjonco
bugs1319468
milestone67.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 1319468 - P1: Use Rooted for AutoRooterGetterSetter::Inner. r=jonco
js/src/vm/Shape-inl.h
js/src/vm/Shape.h
--- a/js/src/vm/Shape-inl.h
+++ b/js/src/vm/Shape-inl.h
@@ -221,29 +221,28 @@ template <class ObjectSubclass>
 
   // Cache the initial shape for non-prototype objects, however, so that
   // future instances will begin life with that shape.
   RootedObject proto(cx, obj->staticPrototype());
   EmptyShape::insertInitialShape(cx, shape, proto);
   return true;
 }
 
-inline AutoRooterGetterSetter::Inner::Inner(JSContext* cx, uint8_t attrs,
+inline AutoRooterGetterSetter::Inner::Inner(uint8_t attrs,
                                             GetterOp* pgetter_,
                                             SetterOp* psetter_)
-    : CustomAutoRooter(cx),
-      attrs(attrs),
+    : attrs(attrs),
       pgetter(pgetter_),
       psetter(psetter_) {}
 
 inline AutoRooterGetterSetter::AutoRooterGetterSetter(
     JSContext* cx, uint8_t attrs, GetterOp* pgetter,
     SetterOp* psetter MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL) {
   if (attrs & (JSPROP_GETTER | JSPROP_SETTER)) {
-    inner.emplace(cx, attrs, pgetter, psetter);
+    inner.emplace(cx, Inner(attrs, pgetter, psetter));
   }
   MOZ_GUARD_OBJECT_NOTIFIER_INIT;
 }
 
 static inline uint8_t GetPropertyAttributes(JSObject* obj,
                                             PropertyResult prop) {
   MOZ_ASSERT(obj->isNative());
 
--- a/js/src/vm/Shape.h
+++ b/js/src/vm/Shape.h
@@ -1435,36 +1435,35 @@ class AccessorShape : public Shape {
   /* Get a shape identical to this one, without parent/kids information. */
   inline AccessorShape(const StackShape& other, uint32_t nfixed);
 };
 
 inline StackBaseShape::StackBaseShape(Shape* shape)
     : flags(shape->getObjectFlags()), clasp(shape->getObjectClass()) {}
 
 class MOZ_RAII AutoRooterGetterSetter {
-  class Inner final : private JS::CustomAutoRooter {
+  class Inner {
    public:
-    inline Inner(JSContext* cx, uint8_t attrs, GetterOp* pgetter_,
-                 SetterOp* psetter_);
+    inline Inner(uint8_t attrs, GetterOp* pgetter_, SetterOp* psetter_);
+
+    void trace(JSTracer* trc);
 
    private:
-    virtual void trace(JSTracer* trc) override;
-
     uint8_t attrs;
     GetterOp* pgetter;
     SetterOp* psetter;
   };
 
  public:
   inline AutoRooterGetterSetter(JSContext* cx, uint8_t attrs, GetterOp* pgetter,
                                 SetterOp* psetter
-                                    MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
+                                MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
 
  private:
-  mozilla::Maybe<Inner> inner;
+  mozilla::Maybe<Rooted<Inner>> inner;
   MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
 };
 
 struct EmptyShape : public js::Shape {
   EmptyShape(UnownedBaseShape* base, uint32_t nfixed)
       : js::Shape(base, nfixed) {}
 
   static Shape* new_(JSContext* cx, Handle<UnownedBaseShape*> base,