Back out changeset 0d285589f47a (Bug 839673) - Broken Merge
authorTerrence Cole <terrence@mozilla.com>
Wed, 13 Feb 2013 11:04:25 -0800
changeset 121772 3dbb55c627b60881c231aecaac3e31ec6b1df4e6
parent 121771 0d285589f47a438f01b9f091538579b523ded863
child 121773 bbb9c1daf95d763b3c18b42400976d24bd7d4e45
push id22907
push usertcole@mozilla.com
push dateWed, 13 Feb 2013 19:02:19 +0000
treeherdermozilla-inbound@3dbb55c627b6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs839673
milestone21.0a1
backs out0d285589f47a438f01b9f091538579b523ded863
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
Back out changeset 0d285589f47a (Bug 839673) - Broken Merge
js/public/HashTable.h
js/src/jsweakmap.cpp
js/src/jsweakmap.h
js/src/vm/Debugger.cpp
js/src/vm/Debugger.h
js/src/vm/ScopeObject.cpp
--- a/js/public/HashTable.h
+++ b/js/public/HashTable.h
@@ -166,19 +166,16 @@ class HashMap
     // Table resize may occur in Enum's destructor. Also see the definition of
     // Enum in HashTable above (with T = Entry).
     typedef typename Impl::Enum Enum;
 
     // Remove all entries. This does not shrink the table. For that consider
     // using the finish() method.
     void clear()                                      { impl.clear(); }
 
-    // Remove all entries without triggering destructors. This method is unsafe.
-    void clearWithoutCallingDestructors()             { impl.clearWithoutCallingDestructors(); }
-
     // Remove all the entries and release all internal buffers. The map must
     // be initialized again before any use.
     void finish()                                     { impl.finish(); }
 
     // Does the table contain any entries?
     bool empty() const                                { return impl.empty(); }
 
     // Number of live elements in the map.
@@ -618,17 +615,16 @@ class HashTableEntry
         Swap(mem, other->mem);
     }
 
     T &get() { JS_ASSERT(isLive()); return *mem.addr(); }
 
     bool isFree() const    { return keyHash == sFreeKey; }
     void clearLive()       { JS_ASSERT(isLive()); keyHash = sFreeKey; mem.addr()->~T(); }
     void clear()           { if (isLive()) mem.addr()->~T(); keyHash = sFreeKey; }
-    void clearNoDtor()     { keyHash = sFreeKey; }
     bool isRemoved() const { return keyHash == sRemovedKey; }
     void removeLive()      { JS_ASSERT(isLive()); keyHash = sRemovedKey; mem.addr()->~T(); }
     bool isLive() const    { return isLiveHash(keyHash); }
     void setCollision()               { JS_ASSERT(isLive()); keyHash |= sCollisionBit; }
     void setCollision(HashNumber bit) { JS_ASSERT(isLive()); keyHash |= bit; }
     void unsetCollision()             { keyHash &= ~sCollisionBit; }
     bool hasCollision() const         { return keyHash & sCollisionBit; }
     bool matchHash(HashNumber hn)     { return (keyHash & ~sCollisionBit) == hn; }
@@ -1261,30 +1257,16 @@ class HashTable : private AllocPolicy
             for (Entry *e = table, *end = table + tableCapacity; e < end; ++e)
                 e->clear();
         }
         removedCount = 0;
         entryCount = 0;
         mutationCount++;
     }
 
-    void clearWithoutCallingDestructors()
-    {
-        if (tl::IsPodType<Entry>::result) {
-            memset(table, 0, sizeof(*table) * capacity());
-        } else {
-            uint32_t tableCapacity = capacity();
-            for (Entry *e = table, *end = table + tableCapacity; e < end; ++e)
-                e->clearNoDtor();
-        }
-        removedCount = 0;
-        entryCount = 0;
-        mutationCount++;
-    }
-
     void finish()
     {
         JS_ASSERT(!entered);
 
         if (!table)
             return;
 
         destroyTable(*this, table, capacity());
--- a/js/src/jsweakmap.cpp
+++ b/js/src/jsweakmap.cpp
@@ -368,21 +368,16 @@ WeakMap_mark(JSTracer *trc, RawObject ob
         map->trace(trc);
 }
 
 static void
 WeakMap_finalize(FreeOp *fop, RawObject obj)
 {
     if (ObjectValueMap *map = GetObjectMap(obj)) {
         map->check();
-        /*
-         * The map may contain finalized entries, so drop them before destructing to avoid calling
-         * ~EncapsulatedPtr.
-         */
-        map->clearWithoutCallingDestructors();
 #ifdef DEBUG
         map->~ObjectValueMap();
         memset(static_cast<void *>(map), 0xdc, sizeof(*map));
         fop->free_(map);
 #else
         fop->delete_(map);
 #endif
     }
--- a/js/src/jsweakmap.h
+++ b/js/src/jsweakmap.h
@@ -211,19 +211,21 @@ class WeakMap : public HashMap<Key, Valu
         }
     }
 
 protected:
     void assertEntriesNotAboutToBeFinalized() {
 #if DEBUG
         for (Range r = Base::all(); !r.empty(); r.popFront()) {
             Key k(r.front().key);
+            Value v(r.front().value);
             JS_ASSERT(!gc::IsAboutToBeFinalized(&k));
-            JS_ASSERT(!gc::IsAboutToBeFinalized(&r.front().value));
+            JS_ASSERT(!gc::IsAboutToBeFinalized(&v));
             JS_ASSERT(k == r.front().key);
+            JS_ASSERT(v == r.front().value);
         }
 #endif
     }
 };
 
 } /* namespace js */
 
 extern JSObject *
--- a/js/src/vm/Debugger.cpp
+++ b/js/src/vm/Debugger.cpp
@@ -373,24 +373,16 @@ Debugger::Debugger(JSContext *cx, JSObje
 Debugger::~Debugger()
 {
     JS_ASSERT(debuggees.empty());
 
     /* This always happens in the GC thread, so no locking is required. */
     JS_ASSERT(object->compartment()->rt->isHeapBusy());
 
     /*
-     * These maps may contain finalized entries, so drop them before destructing to avoid calling
-     * ~EncapsulatedPtr.
-     */
-    scripts.clearWithoutCallingDestructors();
-    objects.clearWithoutCallingDestructors();
-    environments.clearWithoutCallingDestructors();
-
-    /*
      * Since the inactive state for this link is a singleton cycle, it's always
      * safe to apply JS_REMOVE_LINK to it, regardless of whether we're in the list or not.
      */
     JS_REMOVE_LINK(&onNewGlobalObjectWatchersLink);
 }
 
 bool
 Debugger::init(JSContext *cx)
--- a/js/src/vm/Debugger.h
+++ b/js/src/vm/Debugger.h
@@ -66,20 +66,16 @@ class DebuggerWeakMap : private WeakMap<
     typedef typename Base::Range Range;
     typedef typename Base::Enum Enum;
     typedef typename Base::Lookup Lookup;
 
     bool init(uint32_t len = 16) {
         return Base::init(len) && zoneCounts.init();
     }
 
-    void clearWithoutCallingDestructors() {
-        Base::clearWithoutCallingDestructors();
-    }
-
     AddPtr lookupForAdd(const Lookup &l) const {
         return Base::lookupForAdd(l);
     }
 
     template<typename KeyInput, typename ValueInput>
     bool relookupOrAdd(AddPtr &p, const KeyInput &k, const ValueInput &v) {
         JS_ASSERT(v->compartment() == Base::compartment);
         if (!incZoneCount(k->zone()))
@@ -120,16 +116,17 @@ class DebuggerWeakMap : private WeakMap<
         return p;
     }
 
   private:
     /* Override sweep method to also update our edge cache. */
     void sweep() {
         for (Enum e(*static_cast<Base *>(this)); !e.empty(); e.popFront()) {
             Key k(e.front().key);
+            Value v(e.front().value);
             if (gc::IsAboutToBeFinalized(&k)) {
                 e.removeFront();
                 decZoneCount(k->zone());
             }
         }
         Base::assertEntriesNotAboutToBeFinalized();
     }
 
--- a/js/src/vm/ScopeObject.cpp
+++ b/js/src/vm/ScopeObject.cpp
@@ -1890,25 +1890,19 @@ DebugScopes::onGeneratorFrameChange(Abst
     }
 }
 
 void
 DebugScopes::onCompartmentLeaveDebugMode(JSCompartment *c)
 {
     DebugScopes *scopes = c->debugScopes;
     if (scopes) {
-        if (c->rt->isHeapBusy()) {
-            scopes->proxiedScopes.clearWithoutCallingDestructors();
-            scopes->missingScopes.clearWithoutCallingDestructors();
-            scopes->liveScopes.clearWithoutCallingDestructors();
-        } else {
-            scopes->proxiedScopes.clear();
-            scopes->missingScopes.clear();
-            scopes->liveScopes.clear();
-        }
+        scopes->proxiedScopes.clear();
+        scopes->missingScopes.clear();
+        scopes->liveScopes.clear();
     }
 }
 
 bool
 DebugScopes::updateLiveScopes(JSContext *cx)
 {
     JS_CHECK_RECURSION(cx, return false);