Bug 595975: diagnostic patch to collect Shape contents, r=billm, a=blocker
☠☠ backed out by ed90ba2b8945 ☠ ☠
authorDavid Mandelin <dmandelin@mozilla.com>
Mon, 27 Dec 2010 17:36:03 -0800
changeset 59701 e5e50e5a281645dffd2e57ff5499ecfdc003510b
parent 59700 23e08ae80f4905f0ef6b1490f9dfbd8c94988460
child 59702 ad38ee61ff527b163653a355efe826f94b7860e1
child 59731 ed90ba2b89454305ed8099f9a4220dfe9f99396e
push id1
push usershaver@mozilla.com
push dateTue, 04 Jan 2011 17:58:04 +0000
reviewersbillm, blocker
bugs595975
milestone2.0b9pre
Bug 595975: diagnostic patch to collect Shape contents, r=billm, a=blocker
js/src/jsscope.h
--- a/js/src/jsscope.h
+++ b/js/src/jsscope.h
@@ -824,16 +824,24 @@ extern JS_FRIEND_DATA(JSScopeStats) js_s
 
 # define METER(x)       JS_ATOMIC_INCREMENT(&js_scope_stats.x)
 #else
 # define METER(x)       /* nothing */
 #endif
 
 namespace js {
 
+inline static volatile int *vcopy(volatile int *dst, int *src, size_t bytes)
+{
+    int *end = src + bytes / sizeof(int);
+    for (; src < end; ++src, ++dst)
+        *dst = *src;
+    return dst;
+}
+
 JS_ALWAYS_INLINE js::Shape **
 Shape::search(js::Shape **startp, jsid id, bool adding)
 {
     METER(searches);
     if (!(*startp)->table) {
         /*
          * Not enough properties to justify hashing: search from *startp.
          *
@@ -847,16 +855,23 @@ Shape::search(js::Shape **startp, jsid i
             if (shape->id == id) {
                 METER(hits);
                 return spp;
             }
         }
         METER(misses);
         return spp;
     }
+    {
+        char blackbox[sizeof(Shape) + 8];
+        volatile int *p = (int *) blackbox;
+        *p++ = 0xfcfcfcfc;
+        p = vcopy(p, (int *) *startp, sizeof(Shape));
+        *p = 0xfdfdfdfd;
+    }
     return (*startp)->table->search(id, adding);
 }
 
 #undef METER
 
 inline bool
 Shape::isSharedPermanent() const
 {