Bug 1021001 - Fix some GCC warnings. r=terrence.
authorJason Orendorff <jorendorff@mozilla.com>
Thu, 05 Jun 2014 13:18:40 -0400
changeset 207524 6775154c5cf22a6fbea4be62b576516e67f9fb82
parent 207523 fc02eb625f9e8cb8d974147b785b96bff54741f6
child 207525 056fd938efc7344a4cb266974505aa1eeae79699
push id494
push userraliiev@mozilla.com
push dateMon, 25 Aug 2014 18:42:16 +0000
treeherdermozilla-release@a3cc3e46b571 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersterrence
bugs1021001
milestone32.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 1021001 - Fix some GCC warnings. r=terrence.
js/src/NamespaceImports.h
js/src/gc/Zone.cpp
js/src/gc/Zone.h
--- a/js/src/NamespaceImports.h
+++ b/js/src/NamespaceImports.h
@@ -37,17 +37,17 @@ template <typename T> class AutoVectorRo
 template<typename K, typename V> class AutoHashMapRooter;
 template<typename T> class AutoHashSetRooter;
 template<typename T> class RootedGeneric;
 
 class MOZ_STACK_CLASS SourceBufferHolder;
 
 class HandleValueArray;
 
-class JS_PUBLIC_API(AutoCheckCannotGC);
+class AutoCheckCannotGC;
 
 }
 
 // Do the importing.
 namespace js {
 
 using JS::Value;
 using JS::BooleanValue;
--- a/js/src/gc/Zone.cpp
+++ b/js/src/gc/Zone.cpp
@@ -260,16 +260,34 @@ Zone::hasMarkedCompartments()
 {
     for (CompartmentsInZoneIter comp(this); !comp.done(); comp.next()) {
         if (comp->marked)
             return true;
     }
     return false;
 }
 
+bool
+Zone::canCollect()
+{
+    // Zones cannot be collected while in use by other threads.
+    if (usedByExclusiveThread)
+        return false;
+    JSRuntime *rt = runtimeFromAnyThread();
+    if (rt->isAtomsZone(this) && rt->exclusiveThreadsPresent())
+        return false;
+    return true;
+}
+
 JS::Zone *
 js::ZoneOfValue(const JS::Value &value)
 {
     JS_ASSERT(value.isMarkable());
     if (value.isObject())
         return value.toObject().zone();
     return static_cast<js::gc::Cell *>(value.toGCThing())->tenuredZone();
 }
+
+bool
+js::ZonesIter::atAtomsZone(JSRuntime *rt)
+{
+    return rt->isAtomsZone(*it);
+}
--- a/js/src/gc/Zone.h
+++ b/js/src/gc/Zone.h
@@ -132,25 +132,17 @@ struct Zone : public JS::shadow::Zone,
 
     void scheduleGC() { JS_ASSERT(!runtimeFromMainThread()->isHeapBusy()); gcScheduled_ = true; }
     void unscheduleGC() { gcScheduled_ = false; }
     bool isGCScheduled() { return gcScheduled_ && canCollect(); }
 
     void setPreservingCode(bool preserving) { gcPreserveCode_ = preserving; }
     bool isPreservingCode() const { return gcPreserveCode_; }
 
-    bool canCollect() {
-        // Zones cannot be collected while in use by other threads.
-        if (usedByExclusiveThread)
-            return false;
-        JSRuntime *rt = runtimeFromAnyThread();
-        if (rt->isAtomsZone(this) && rt->exclusiveThreadsPresent())
-            return false;
-        return true;
-    }
+    bool canCollect();
 
     enum GCState {
         NoGC,
         Mark,
         MarkGray,
         Sweep,
         Finished
     };
@@ -301,21 +293,23 @@ class ZonesIter
     JS::Zone **it, **end;
 
   public:
     ZonesIter(JSRuntime *rt, ZoneSelector selector) {
         it = rt->gc.zones.begin();
         end = rt->gc.zones.end();
 
         if (selector == SkipAtoms) {
-            JS_ASSERT(rt->isAtomsZone(*it));
+            MOZ_ASSERT(atAtomsZone(rt));
             it++;
         }
     }
 
+    bool atAtomsZone(JSRuntime *rt);
+
     bool done() const { return it == end; }
 
     void next() {
         JS_ASSERT(!done());
         do {
             it++;
         } while (!done() && (*it)->usedByExclusiveThread);
     }