Bug 910771 (part 3) - Include gc/StoreBuffer.h in gc/Barrier.h. r=terrence.
authorNicholas Nethercote <nnethercote@mozilla.com>
Wed, 04 Sep 2013 19:19:05 -0700
changeset 146166 f3bd74c444d99cda051343ccdbfc20966bca144c
parent 146165 10e767f5eb9eb5e413f7d40b2a0b248edd90b389
child 146167 17fcd21b3d3a84bc2982ac386df340a05594264a
push id25244
push userryanvm@gmail.com
push dateMon, 09 Sep 2013 20:03:14 +0000
treeherdermozilla-central@f320b8c034bd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersterrence
bugs910771
milestone26.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 910771 (part 3) - Include gc/StoreBuffer.h in gc/Barrier.h. r=terrence.
js/src/gc/Barrier.h
js/src/gc/Nursery.h
js/src/gc/StoreBuffer.h
--- a/js/src/gc/Barrier.h
+++ b/js/src/gc/Barrier.h
@@ -5,16 +5,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef gc_Barrier_h
 #define gc_Barrier_h
 
 #include "NamespaceImports.h"
 
 #include "gc/Heap.h"
+#include "gc/StoreBuffer.h"
 #include "js/HashTable.h"
 #include "js/Id.h"
 #include "js/RootingAPI.h"
 
 /*
  * A write barrier is a mechanism used by incremental or generation GCs to
  * ensure that every value that needs to be marked is marked. In general, the
  * write barrier should be invoked whenever a write can cause the set of things
--- a/js/src/gc/Nursery.h
+++ b/js/src/gc/Nursery.h
@@ -5,27 +5,37 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef gc_Nursery_h
 #define gc_Nursery_h
 
 #ifdef JSGC_GENERATIONAL
 
-#include "jsgc.h"
+#include "jsalloc.h"
 #include "jspubtd.h"
 
 #include "ds/BitArray.h"
+#include "gc/Heap.h"
+#include "js/GCAPI.h"
 #include "js/HashTable.h"
+#include "js/HeapAPI.h"
+#include "js/Value.h"
+
+namespace JS {
+struct Zone;
+}
 
 namespace js {
 
 class ObjectElements;
+class HeapSlot;
 
 namespace gc {
+class Cell;
 class MinorCollectionTracer;
 } /* namespace gc */
 
 namespace jit {
 class CodeGenerator;
 class MacroAssembler;
 class ICStubCompiler;
 class BaselineCompiler;
@@ -123,17 +133,17 @@ class Nursery
      * The set of externally malloced slots potentially kept live by objects
      * stored in the nursery. Any external slots that do not belong to a
      * tenured thing at the end of a minor GC must be freed.
      */
     typedef HashSet<HeapSlot *, PointerHasher<HeapSlot *, 3>, SystemAllocPolicy> HugeSlotsSet;
     HugeSlotsSet hugeSlots;
 
     /* The marking bitmap for the fallback marker. */
-    const static size_t ThingAlignment = sizeof(Value);
+    const static size_t ThingAlignment = sizeof(JS::Value);
     const static size_t FallbackBitmapBits = NurserySize / ThingAlignment;
     BitArray<FallbackBitmapBits> fallbackBitmap;
 
 #ifdef DEBUG
     /*
      * In DEBUG builds, these bytes indicate the state of an unused segment of
      * nursery-allocated memory.
      */
@@ -198,17 +208,17 @@ class Nursery
     void *addressOfPosition() const { return (void*)&position_; }
 
     JSRuntime *runtime() const { return runtime_; }
 
     /* Allocates and registers external slots with the nursery. */
     HeapSlot *allocateHugeSlots(JSContext *cx, size_t nslots);
 
     /* Allocates a new GC thing from the tenured generation during minor GC. */
-    void *allocateFromTenured(Zone *zone, gc::AllocKind thingKind);
+    void *allocateFromTenured(JS::Zone *zone, gc::AllocKind thingKind);
 
     /*
      * Move the object at |src| in the Nursery to an already-allocated cell
      * |dst| in Tenured.
      */
     void collectToFixedPoint(gc::MinorCollectionTracer *trc);
     JS_ALWAYS_INLINE void traceObject(gc::MinorCollectionTracer *trc, JSObject *src);
     JS_ALWAYS_INLINE void markSlots(gc::MinorCollectionTracer *trc, HeapSlot *vp, uint32_t nslots);
--- a/js/src/gc/StoreBuffer.h
+++ b/js/src/gc/StoreBuffer.h
@@ -15,16 +15,17 @@
 
 #include "mozilla/DebugOnly.h"
 #include "mozilla/ReentrancyGuard.h"
 
 #include "jsalloc.h"
 
 #include "ds/LifoAlloc.h"
 #include "gc/Nursery.h"
+#include "js/Tracer.h"
 
 namespace js {
 namespace gc {
 
 class AccumulateEdgesTracer;
 
 /*
  * BufferableRef represents an abstract reference for use in the generational
@@ -246,50 +247,50 @@ class StoreBuffer
     };
 
     class ValueEdge
     {
         friend class StoreBuffer;
         friend class StoreBuffer::MonoTypeBuffer<ValueEdge>;
         friend class StoreBuffer::RelocatableMonoTypeBuffer<ValueEdge>;
 
-        Value *edge;
+        JS::Value *edge;
 
-        explicit ValueEdge(Value *v) : edge(v) {}
+        explicit ValueEdge(JS::Value *v) : edge(v) {}
         bool operator==(const ValueEdge &other) const { return edge == other.edge; }
         bool operator!=(const ValueEdge &other) const { return edge != other.edge; }
 
         void *deref() const { return edge->isGCThing() ? edge->toGCThing() : NULL; }
         void *location() const { return (void *)untagged().edge; }
 
         bool inRememberedSet(const Nursery &nursery) const {
             return !nursery.isInside(edge) && nursery.isInside(deref());
         }
 
         bool isNullEdge() const {
             return !deref();
         }
 
         void mark(JSTracer *trc);
 
-        ValueEdge tagged() const { return ValueEdge((Value *)(uintptr_t(edge) | 1)); }
-        ValueEdge untagged() const { return ValueEdge((Value *)(uintptr_t(edge) & ~1)); }
+        ValueEdge tagged() const { return ValueEdge((JS::Value *)(uintptr_t(edge) | 1)); }
+        ValueEdge untagged() const { return ValueEdge((JS::Value *)(uintptr_t(edge) & ~1)); }
         bool isTagged() const { return bool(uintptr_t(edge) & 1); }
     };
 
     struct SlotEdge
     {
         friend class StoreBuffer;
         friend class StoreBuffer::MonoTypeBuffer<SlotEdge>;
 
         JSObject *object;
         uint32_t offset;
-        HeapSlot::Kind kind;
+        int kind; // this is really just HeapSlot::Kind, but we can't see that type easily here
 
-        SlotEdge(JSObject *object, HeapSlot::Kind kind, uint32_t offset)
+        SlotEdge(JSObject *object, int kind, uint32_t offset)
           : object(object), offset(offset), kind(kind)
         {}
 
         bool operator==(const SlotEdge &other) const {
             return object == other.object && offset == other.offset && kind == other.kind;
         }
 
         bool operator!=(const SlotEdge &other) const {
@@ -378,53 +379,53 @@ class StoreBuffer
     bool isEnabled() { return enabled; }
 
     bool clear();
 
     /* Get the overflowed status. */
     bool isAboutToOverflow() const { return aboutToOverflow; }
 
     /* Insert a single edge into the buffer/remembered set. */
-    void putValue(Value *valuep) {
+    void putValue(JS::Value *valuep) {
         ValueEdge edge(valuep);
         if (!edge.inRememberedSet(nursery_))
             return;
         bufferVal.put(edge);
     }
     void putCell(Cell **cellp) {
         CellPtrEdge edge(cellp);
         if (!edge.inRememberedSet(nursery_))
             return;
         bufferCell.put(edge);
     }
-    void putSlot(JSObject *obj, HeapSlot::Kind kind, uint32_t slot, void *target) {
+    void putSlot(JSObject *obj, int kind, uint32_t slot, void *target) {
         SlotEdge edge(obj, kind, slot);
         /* This is manually inlined because slotLocation cannot be defined here. */
         if (nursery_.isInside(obj) || !nursery_.isInside(target))
             return;
         bufferSlot.put(edge);
     }
     void putWholeCell(Cell *cell) {
         bufferWholeCell.put(WholeCellEdges(cell));
     }
 
     /* Insert or update a single edge in the Relocatable buffer. */
-    void putRelocatableValue(Value *valuep) {
+    void putRelocatableValue(JS::Value *valuep) {
         ValueEdge edge(valuep);
         if (!edge.inRememberedSet(nursery_))
             return;
         bufferRelocVal.put(edge);
     }
     void putRelocatableCell(Cell **cellp) {
         CellPtrEdge edge(cellp);
         if (!edge.inRememberedSet(nursery_))
             return;
         bufferRelocCell.put(edge);
     }
-    void removeRelocatableValue(Value *valuep) {
+    void removeRelocatableValue(JS::Value *valuep) {
         ValueEdge edge(valuep);
         if (!edge.inRememberedSet(nursery_))
             return;
         bufferRelocVal.unput(edge);
     }
     void removeRelocatableCell(Cell **cellp) {
         CellPtrEdge edge(cellp);
         if (!edge.inRememberedSet(nursery_))