Bug 1548903 - Remove unused JS TypeInference methods. r=iain
authorTed Campbell <tcampbell@mozilla.com>
Fri, 03 May 2019 18:17:39 +0000
changeset 472546 eb5b01e0b309d50231f2412721353b1183aff117
parent 472545 24bc67a8d261462be0958e9bd9e4e7101e35ee76
child 472547 fa013d593d02e29d9062900f89a14fd40a9ba687
child 472557 0d9d2bb7e7b8b0dec603f7b52f55f53b1554e8aa
child 472597 b2c30fabdfea56e77e325e3eb8793b0ce47ef262
push id35958
push usermalexandru@mozilla.com
push dateFri, 03 May 2019 21:56:39 +0000
treeherdermozilla-central@eb5b01e0b309 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersiain
bugs1548903
milestone68.0a1
first release with
nightly linux32
eb5b01e0b309 / 68.0a1 / 20190503215639 / files
nightly linux64
eb5b01e0b309 / 68.0a1 / 20190503215639 / files
nightly mac
eb5b01e0b309 / 68.0a1 / 20190503215639 / files
nightly win32
eb5b01e0b309 / 68.0a1 / 20190503215639 / files
nightly win64
eb5b01e0b309 / 68.0a1 / 20190503215639 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1548903 - Remove unused JS TypeInference methods. r=iain Differential Revision: https://phabricator.services.mozilla.com/D29865
js/src/vm/ObjectGroup.h
js/src/vm/TypeInference-inl.h
js/src/vm/TypeInference.cpp
--- a/js/src/vm/ObjectGroup.h
+++ b/js/src/vm/ObjectGroup.h
@@ -394,17 +394,16 @@ class ObjectGroup : public gc::TenuredCe
   inline unsigned getPropertyCount(const AutoSweepObjectGroup& sweep);
   inline Property* getProperty(const AutoSweepObjectGroup& sweep, unsigned i);
 
   /* Helpers */
 
   void updateNewPropertyTypes(const AutoSweepObjectGroup& sweep, JSContext* cx,
                               JSObject* obj, jsid id, HeapTypeSet* types);
   void addDefiniteProperties(JSContext* cx, Shape* shape);
-  bool matchDefiniteProperties(HandleObject obj);
   void markPropertyNonData(JSContext* cx, JSObject* obj, jsid id);
   void markPropertyNonWritable(JSContext* cx, JSObject* obj, jsid id);
   void markStateChange(const AutoSweepObjectGroup& sweep, JSContext* cx);
   void setFlags(const AutoSweepObjectGroup& sweep, JSContext* cx,
                 ObjectGroupFlags flags);
   void markUnknown(const AutoSweepObjectGroup& sweep, JSContext* cx);
   void maybeClearNewScriptOnOOM();
   void clearNewScript(JSContext* cx, ObjectGroup* replacement = nullptr);
--- a/js/src/vm/TypeInference-inl.h
+++ b/js/src/vm/TypeInference-inl.h
@@ -346,19 +346,16 @@ class TypeNewScript {
 
   void registerNewObject(PlainObject* res);
   bool maybeAnalyze(JSContext* cx, ObjectGroup* group, bool* regenerate,
                     bool force = false);
 
   bool rollbackPartiallyInitializedObjects(JSContext* cx, ObjectGroup* group);
 
   static bool make(JSContext* cx, ObjectGroup* group, JSFunction* fun);
-  static TypeNewScript* makeNativeVersion(JSContext* cx,
-                                          TypeNewScript* newScript,
-                                          PlainObject* templateObject);
 
   size_t sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const;
 
   static size_t offsetOfPreliminaryObjects() {
     return offsetof(TypeNewScript, preliminaryObjects);
   }
 };
 
@@ -430,18 +427,16 @@ struct MOZ_RAII AutoEnterAnalysis {
     }
   }
 };
 
 /////////////////////////////////////////////////////////////////////
 // Interface functions
 /////////////////////////////////////////////////////////////////////
 
-void MarkIteratorUnknownSlow(JSContext* cx);
-
 void TypeMonitorCallSlow(JSContext* cx, JSObject* callee, const CallArgs& args,
                          bool constructing);
 
 /*
  * Monitor a javascript call, either on entry to the interpreter or made
  * from within the interpreter.
  */
 inline void TypeMonitorCall(JSContext* cx, const js::CallArgs& args,
--- a/js/src/vm/TypeInference.cpp
+++ b/js/src/vm/TypeInference.cpp
@@ -2869,45 +2869,16 @@ void ObjectGroup::addDefiniteProperties(
         types->setDefinite(shape->slot());
       }
     }
 
     shape = shape->previous();
   }
 }
 
-bool ObjectGroup::matchDefiniteProperties(HandleObject obj) {
-  AutoSweepObjectGroup sweep(this);
-  unsigned count = getPropertyCount(sweep);
-  for (unsigned i = 0; i < count; i++) {
-    Property* prop = getProperty(sweep, i);
-    if (!prop) {
-      continue;
-    }
-    if (prop->types.definiteProperty()) {
-      unsigned slot = prop->types.definiteSlot();
-
-      bool found = false;
-      Shape* shape = obj->as<NativeObject>().lastProperty();
-      while (!shape->isEmptyShape()) {
-        if (shape->slot() == slot && shape->propid() == prop->id) {
-          found = true;
-          break;
-        }
-        shape = shape->previous();
-      }
-      if (!found) {
-        return false;
-      }
-    }
-  }
-
-  return true;
-}
-
 void js::AddTypePropertyId(JSContext* cx, ObjectGroup* group, JSObject* obj,
                            jsid id, TypeSet::Type type) {
   MOZ_ASSERT(id == IdToTypeId(id));
 
   AutoSweepObjectGroup sweep(group);
   if (group->unknownProperties(sweep)) {
     return;
   }
@@ -3798,51 +3769,16 @@ bool TypeNewScript::make(JSContext* cx, 
   }
 
   group->setNewScript(newScript.release());
 
   gc::gcTracer.traceTypeNewScript(group);
   return true;
 }
 
-// Make a TypeNewScript with the same initializer list as |newScript| but with
-// a new template object.
-/* static */
-TypeNewScript* TypeNewScript::makeNativeVersion(JSContext* cx,
-                                                TypeNewScript* newScript,
-                                                PlainObject* templateObject) {
-  MOZ_RELEASE_ASSERT(cx->zone()->types.activeAnalysis);
-
-  auto nativeNewScript = cx->make_unique<TypeNewScript>();
-  if (!nativeNewScript) {
-    return nullptr;
-  }
-
-  nativeNewScript->function_ = newScript->function();
-  nativeNewScript->templateObject_ = templateObject;
-
-  TypeNewScriptInitializer* cursor = newScript->initializerList;
-  while (cursor->kind != TypeNewScriptInitializer::DONE) {
-    cursor++;
-  }
-
-  size_t initializerLength = cursor - newScript->initializerList + 1;
-
-  nativeNewScript->initializerList =
-      cx->pod_calloc<TypeNewScriptInitializer>(initializerLength);
-  if (!nativeNewScript->initializerList) {
-    return nullptr;
-  }
-
-  PodCopy(nativeNewScript->initializerList, newScript->initializerList,
-          initializerLength);
-
-  return nativeNewScript.release();
-}
-
 size_t TypeNewScript::sizeOfIncludingThis(
     mozilla::MallocSizeOf mallocSizeOf) const {
   size_t n = mallocSizeOf(this);
   n += mallocSizeOf(preliminaryObjects);
   n += mallocSizeOf(initializerList);
   return n;
 }