Bug 931812: Remove unnecessary postbarriering of watchpoint map r=terrence
authorJon Coppeard <jcoppeard@mozilla.com>
Fri, 01 Nov 2013 10:20:50 +0000
changeset 153023 625d29cbb867f472e123de7f2f5fcc27bea2c1ab
parent 153022 1962c50770f788f35d38efd144841bb5859448e8
child 153024 cd2d19e4e2581a425a3fc2bace9c3aed5bbd152e
push id25566
push userryanvm@gmail.com
push dateFri, 01 Nov 2013 18:40:05 +0000
treeherdermozilla-central@5bb07c1ae9f5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersterrence
bugs931812
milestone28.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 931812: Remove unnecessary postbarriering of watchpoint map r=terrence
js/src/jswatchpoint.cpp
js/src/jswatchpoint.h
--- a/js/src/jswatchpoint.cpp
+++ b/js/src/jswatchpoint.cpp
@@ -45,57 +45,32 @@ class AutoEntryHolder {
             p = map.lookup(WatchKey(obj, id));
         if (p)
             p->value.held = false;
     }
 };
 
 } /* anonymous namespace */
 
-/*
- * Watchpoint contains a RelocatablePtrObject member, which is conceptually a
- * heap-only class. It's preferable not to allocate these on the stack as they
- * cause unnecessary adding and removal of store buffer entries, so
- * WatchpointStackValue can be used instead.
- */
-struct js::WatchpointStackValue {
-    JSWatchPointHandler handler;
-    HandleObject closure;
-    bool held;
-
-    WatchpointStackValue(JSWatchPointHandler handler, HandleObject closure, bool held)
-      : handler(handler), closure(closure), held(held) {}
-};
-
-inline js::Watchpoint::Watchpoint(const js::WatchpointStackValue& w)
-  : handler(w.handler), closure(w.closure), held(w.held) {}
-
-inline js::Watchpoint &js::Watchpoint::operator=(const js::WatchpointStackValue& w) {
-    handler = w.handler;
-    closure = w.closure;
-    held = w.held;
-    return *this;
-}
-
 bool
 WatchpointMap::init()
 {
     return map.init();
 }
 
 bool
 WatchpointMap::watch(JSContext *cx, HandleObject obj, HandleId id,
                      JSWatchPointHandler handler, HandleObject closure)
 {
     JS_ASSERT(JSID_IS_STRING(id) || JSID_IS_INT(id));
 
     if (!obj->setWatched(cx))
         return false;
 
-    WatchpointStackValue w(handler, closure, false);
+    Watchpoint w(handler, closure, false);
     if (!map.put(WatchKey(obj, id), w)) {
         js_ReportOutOfMemory(cx);
         return false;
     }
     /*
      * For generational GC, we don't need to post-barrier writes to the
      * hashtable here because we mark all watchpoints as part of root marking in
      * markAll().
--- a/js/src/jswatchpoint.h
+++ b/js/src/jswatchpoint.h
@@ -24,24 +24,22 @@ struct WatchKey {
     EncapsulatedPtrObject object;
     EncapsulatedId id;
 
     bool operator!=(const WatchKey &other) const {
         return object != other.object || id != other.id;
     }
 };
 
-struct WatchpointStackValue;
 struct Watchpoint {
     JSWatchPointHandler handler;
-    RelocatablePtrObject closure;
+    EncapsulatedPtrObject closure;  /* This is always marked in minor GCs and so doesn't require a postbarrier. */
     bool held;  /* true if currently running handler */
-
-    inline Watchpoint(const WatchpointStackValue& w);
-    inline Watchpoint &operator=(const WatchpointStackValue& w);
+    Watchpoint(JSWatchPointHandler handler, JSObject* closure, bool held)
+      : handler(handler), closure(closure), held(held) {}
 };
 
 template <>
 struct DefaultHasher<WatchKey>
 {
     typedef WatchKey Lookup;
     static inline js::HashNumber hash(const Lookup &key);