Commit e8e8567a authored by Jon Coppeard's avatar Jon Coppeard
Browse files

Bug 1412912 - Move a few more things to GCInternals.h r=sfink

parent 39d701f4
Loading
Loading
Loading
Loading
+28 −0
Original line number Diff line number Diff line
@@ -4,6 +4,10 @@
 * 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/. */

/*
 * GC-internal definitions.
 */

#ifndef gc_GCInternals_h
#define gc_GCInternals_h

@@ -235,6 +239,30 @@ class MOZ_RAII AutoEmptyNursery : public AutoAssertEmptyNursery
    explicit AutoEmptyNursery(JSContext* cx);
};

extern void
DelayCrossCompartmentGrayMarking(JSObject* src);

inline bool
IsOOMReason(JS::gcreason::Reason reason)
{
    return reason == JS::gcreason::LAST_DITCH ||
           reason == JS::gcreason::MEM_PRESSURE;
}

inline void
RelocationOverlay::forwardTo(Cell* cell)
{
    MOZ_ASSERT(!isForwarded());
    // The location of magic_ is important because it must never be valid to see
    // the value Relocated there in a GC thing that has not been moved.
    static_assert(offsetof(RelocationOverlay, magic_) == offsetof(JSObject, group_) &&
                  offsetof(RelocationOverlay, magic_) == offsetof(js::Shape, base_) &&
                  offsetof(RelocationOverlay, magic_) == offsetof(JSString, d.u1.flags),
                  "RelocationOverlay::magic_ is in the wrong location");
    magic_ = Relocated;
    newLocation_ = cell;
}

} /* namespace gc */
} /* namespace js */

+1 −1
Original line number Diff line number Diff line
@@ -5049,7 +5049,7 @@ NextIncomingCrossCompartmentPointer(JSObject* prev, bool unlink)
}

void
js::DelayCrossCompartmentGrayMarking(JSObject* src)
js::gc::DelayCrossCompartmentGrayMarking(JSObject* src)
{
    MOZ_ASSERT(IsGrayListObject(src));

+0 −10
Original line number Diff line number Diff line
@@ -61,9 +61,6 @@ PrepareForDebugGC(JSRuntime* rt);

/* Functions for managing cross compartment gray pointers. */

extern void
DelayCrossCompartmentGrayMarking(JSObject* src);

extern void
NotifyGCNukeWrapper(JSObject* o);

@@ -190,13 +187,6 @@ NewMemoryStatisticsObject(JSContext* cx);
const char*
StateName(State state);

inline bool
IsOOMReason(JS::gcreason::Reason reason)
{
    return reason == JS::gcreason::LAST_DITCH ||
           reason == JS::gcreason::MEM_PRESSURE;
}

} /* namespace gc */

/* Use this to avoid assertions when manipulating the wrapper map. */
+0 −15
Original line number Diff line number Diff line
@@ -11,7 +11,6 @@
#include "mozilla/Maybe.h"

#include "gc/GCTrace.h"
#include "gc/RelocationOverlay.h"
#include "gc/Zone.h"

#include "gc/ArenaList-inl.h"
@@ -345,20 +344,6 @@ class ZoneCellIter : public ZoneCellIter<TenuredCell> {
    GCType* operator ->() const { return get(); }
};

inline void
RelocationOverlay::forwardTo(Cell* cell)
{
    MOZ_ASSERT(!isForwarded());
    // The location of magic_ is important because it must never be valid to see
    // the value Relocated there in a GC thing that has not been moved.
    static_assert(offsetof(RelocationOverlay, magic_) == offsetof(JSObject, group_) &&
                  offsetof(RelocationOverlay, magic_) == offsetof(js::Shape, base_) &&
                  offsetof(RelocationOverlay, magic_) == offsetof(JSString, d.u1.flags),
                  "RelocationOverlay::magic_ is in the wrong location");
    magic_ = Relocated;
    newLocation_ = cell;
}

} /* namespace gc */
} /* namespace js */