Bug 1149352 - Part 0: Only mark live entries when marking a range; r=meow
authorTerrence Cole <terrence@mozilla.com>
Wed, 01 Apr 2015 14:50:43 -0700
changeset 237586 2db51fec311ebf20efa90cc31cad6972f5278a6d
parent 237585 bca3bd57a71e6cc2db9d4596894bf22b55ff83c3
child 237587 f980ddcf36789627fb13562148ca3b7d0c901d3a
push id28540
push userphilringnalda@gmail.com
push dateSat, 04 Apr 2015 17:42:19 +0000
treeherdermozilla-central@035959eef3f9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmeow
bugs1149352
milestone40.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 1149352 - Part 0: Only mark live entries when marking a range; r=meow
js/src/gc/Marking.cpp
js/src/gc/Marking.h
--- a/js/src/gc/Marking.cpp
+++ b/js/src/gc/Marking.cpp
@@ -426,29 +426,33 @@ void
 js::TraceRoot(JSTracer* trc, T* thingp, const char* name)
 {
     JS_ROOT_MARKING_ASSERT(trc);
     DispatchToTracer(trc, ConvertToBase(thingp), name, JSTracer::InvalidIndex);
 }
 
 template <typename T>
 void
-js::TraceRange(JSTracer* trc, size_t len, BarrieredBase<T>* thingp, const char* name)
+js::TraceRange(JSTracer* trc, size_t len, BarrieredBase<T>* vec, const char* name)
 {
-    for (auto i : MakeRange(len))
-        DispatchToTracer(trc, ConvertToBase(thingp[i].unsafeGet()), name, i);
+    for (auto i : MakeRange(len)) {
+        if (InternalGCMethods<T>::isMarkable(vec[i].get()))
+            DispatchToTracer(trc, ConvertToBase(vec[i].unsafeGet()), name, i);
+    }
 }
 
 template <typename T>
 void
-js::TraceRootRange(JSTracer* trc, size_t len, T* thingp, const char* name)
+js::TraceRootRange(JSTracer* trc, size_t len, T* vec, const char* name)
 {
     JS_ROOT_MARKING_ASSERT(trc);
-    for (auto i : MakeRange(len))
-        DispatchToTracer(trc, ConvertToBase(&thingp[i]), name, i);
+    for (auto i : MakeRange(len)) {
+        if (InternalGCMethods<T>::isMarkable(vec[i]))
+            DispatchToTracer(trc, ConvertToBase(&vec[i]), name, i);
+    }
 }
 
 // Instantiate a copy of the Tracing templates for each derived type.
 #define INSTANTIATE_ALL_VALID_TRACE_FUNCTIONS(type) \
     template void js::TraceEdge<type>(JSTracer*, BarrieredBase<type>*, const char*); \
     template void js::TraceManuallyBarrieredEdge<type>(JSTracer*, type*, const char*); \
     template void js::TraceRoot<type>(JSTracer*, type*, const char*); \
     template void js::TraceRange<type>(JSTracer*, size_t, BarrieredBase<type>*, const char*); \
--- a/js/src/gc/Marking.h
+++ b/js/src/gc/Marking.h
@@ -57,22 +57,22 @@ TraceRoot(JSTracer* trc, T* thingp, cons
 // separate from TraceEdge to make accidental use of such edges more obvious.
 template <typename T>
 void
 TraceManuallyBarrieredEdge(JSTracer* trc, T* thingp, const char* name);
 
 // Trace all edges contained in the given array.
 template <typename T>
 void
-TraceRange(JSTracer* trc, size_t len, BarrieredBase<T>* thingp, const char* name);
+TraceRange(JSTracer* trc, size_t len, BarrieredBase<T>* vec, const char* name);
 
 // Trace all root edges in the given array.
 template <typename T>
 void
-TraceRootRange(JSTracer* trc, size_t len, T* thingp, const char* name);
+TraceRootRange(JSTracer* trc, size_t len, T* vec, const char* name);
 
 // Trace an edge that crosses compartment boundaries. If the compartment of the
 // destination thing is not being GC'd, then the edge will not be traced.
 template <typename T>
 void
 TraceCrossCompartmentEdge(JSTracer* trc, JSObject* src, BarrieredBase<T>* dst,
                           const char* name);