blob: 97cb72c00703037c714295cbce4f21efed44a4cb [file] [log] [blame]
--- Marking.h
+++ Marking.h
@@ -11,16 +11,17 @@
#include "mozilla/HashFunctions.h"
#include "jsfriendapi.h"
#include "ds/OrderedHashTable.h"
#include "gc/Heap.h"
#include "gc/Tracer.h"
#include "js/GCAPI.h"
+#include "js/HeapAPI.h"
#include "js/SliceBudget.h"
#include "js/TracingAPI.h"
class JSLinearString;
class JSRope;
namespace js {
class BaseShape;
class GCMarker;
@@ -141,17 +142,27 @@ namespace gc {
struct WeakKeyTableHashPolicy {
typedef JS::GCCellPtr Lookup;
static HashNumber hash(const Lookup& v) { return mozilla::HashGeneric(v.asCell()); }
static bool match(const JS::GCCellPtr& k, const Lookup& l) { return k == l; }
static bool isEmpty(const JS::GCCellPtr& v) { return !v; }
static void makeEmpty(JS::GCCellPtr* vp) { *vp = nullptr; }
};
-typedef Vector<WeakMapBase*, 2, js::SystemAllocPolicy> WeakEntryVector;
+struct WeakMarkable {
+ WeakMapBase* weakmap;
+ JS::GCCellPtr key;
+
+ WeakMarkable(WeakMapBase* weakmapArg, JS::GCCellPtr&& keyArg)
+ : weakmap(weakmapArg), key(keyArg) {}
+ WeakMarkable(WeakMapBase* weakmapArg, JS::GCCellPtr keyArg)
+ : weakmap(weakmapArg), key(keyArg) {}
+};
+
+typedef Vector<WeakMarkable, 2, js::SystemAllocPolicy> WeakEntryVector;
typedef OrderedHashMap<JS::GCCellPtr,
WeakEntryVector,
WeakKeyTableHashPolicy,
js::SystemAllocPolicy> WeakKeyTable;
} /* namespace gc */
@@ -203,16 +214,20 @@ class GCMarker : public JSTracer
}
void endWeakMarkingPhase() {
MOZ_ASSERT_IF(weakMapAction() == ExpandWeakMaps, tag_ == TracerKindTag::WeakMarking);
tag_ = TracerKindTag::Marking;
weakKeys.clear();
}
+ void abortLinearWeakMarking() {
+ endWeakMarkingPhase();
+ }
+
void delayMarkingArena(gc::ArenaHeader* aheader);
void delayMarkingChildren(const void* thing);
void markDelayedChildren(gc::ArenaHeader* aheader);
bool markDelayedChildren(SliceBudget& budget);
bool hasDelayedChildren() const {
return !!unmarkedArenaStackTop;
}
@@ -228,17 +243,17 @@ class GCMarker : public JSTracer
#ifdef DEBUG
bool shouldCheckCompartments() { return strictCompartmentChecking; }
#endif
/* This is public exclusively for ScanRope. */
MarkStack stack;
- void markEphemeronValues(gc::Cell* oldKey, gc::WeakEntryVector& entry);
+ void markEphemeronValues(gc::Cell* markedCell, gc::WeakEntryVector& entry);
/*
* Mapping from not yet marked keys to a vector of all values that the key
* maps to in any live weak map.
*/
gc::WeakKeyTable weakKeys;
private: