Bug 945846 - Stop barriers going off during store buffer marking for ctypes r=terrence
authorJon Coppeard <jcoppeard@mozilla.com>
Thu, 05 Dec 2013 11:15:51 +0000
changeset 173612 27dd92819372e46131d22751bbdf2686fe08a869
parent 173611 757952431e858d5386ad89fd3bc20c1c1974e1ef
child 173613 66bd8afba72543581b300396c1145fbee5a61911
push id3224
push userlsblakk@mozilla.com
push dateTue, 04 Feb 2014 01:06:49 +0000
treeherdermozilla-beta@60c04d0987f1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersterrence
bugs945846
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 945846 - Stop barriers going off during store buffer marking for ctypes r=terrence
js/src/ctypes/CTypes.cpp
js/src/ctypes/CTypes.h
--- a/js/src/ctypes/CTypes.cpp
+++ b/js/src/ctypes/CTypes.cpp
@@ -4757,18 +4757,23 @@ StructType::Create(JSContext* cx, unsign
 
   args.rval().setObject(*result);
   return true;
 }
 
 static void
 PostBarrierCallback(JSTracer *trc, void *k, void *d)
 {
+    typedef HashMap<JSFlatString*,
+                    UnbarrieredFieldInfo,
+                    FieldHashPolicy,
+                    SystemAllocPolicy> UnbarrieredFieldInfoHash;
+
     JSString *prior = static_cast<JSString*>(k);
-    FieldInfoHash *table = static_cast<FieldInfoHash*>(d);
+    UnbarrieredFieldInfoHash *table = reinterpret_cast<UnbarrieredFieldInfoHash*>(d);
     JSString *key = prior;
     JS_CallStringTracer(trc, &key, "CType fieldName");
     table->rekeyIfMoved(JS_ASSERT_STRING_IS_FLAT(prior), JS_ASSERT_STRING_IS_FLAT(key));
 }
 
 bool
 StructType::DefineInternal(JSContext* cx, JSObject* typeObj_, JSObject* fieldsObj_)
 {
--- a/js/src/ctypes/CTypes.h
+++ b/js/src/ctypes/CTypes.h
@@ -214,16 +214,25 @@ enum TypeCode {
 // as the key to the hash entry.
 struct FieldInfo
 {
   JS::Heap<JSObject*> mType;    // CType of the field
   size_t              mIndex;   // index of the field in the struct (first is 0)
   size_t              mOffset;  // offset of the field in the struct, in bytes
 };
 
+struct UnbarrieredFieldInfo
+{
+  JSObject*           mType;    // CType of the field
+  size_t              mIndex;   // index of the field in the struct (first is 0)
+  size_t              mOffset;  // offset of the field in the struct, in bytes
+};
+static_assert(sizeof(UnbarrieredFieldInfo) == sizeof(FieldInfo),
+              "UnbarrieredFieldInfo should be the same as FieldInfo but with unbarriered mType");
+
 // Hash policy for FieldInfos.
 struct FieldHashPolicy : DefaultHasher<JSFlatString*>
 {
   typedef JSFlatString* Key;
   typedef Key Lookup;
 
   static uint32_t hash(const Lookup &l) {
     const jschar* s = l->chars();