Ejemplo n.º 1
0
bool
ObjectValueMap::findZoneEdges()
{
    /*
     * For unmarked weakmap keys with delegates in a different zone, add a zone
     * edge to ensure that the delegate zone does finish marking after the key
     * zone.
     */
    JS::AutoSuppressGCAnalysis nogc;
    Zone* mapZone = compartment->zone();
    for (Range r = all(); !r.empty(); r.popFront()) {
        JSObject* key = r.front().key();
        if (key->asTenured().isMarked(BLACK) && !key->asTenured().isMarked(GRAY))
            continue;
        JSWeakmapKeyDelegateOp op = key->getClass()->ext.weakmapKeyDelegateOp;
        if (!op)
            continue;
        JSObject* delegate = op(key);
        if (!delegate)
            continue;
        Zone* delegateZone = delegate->zone();
        if (delegateZone == mapZone)
            continue;
        if (!delegateZone->gcZoneGroupEdges.put(key->zone()))
            return false;
    }
    return true;
}
Ejemplo n.º 2
0
bool ObjectValueMap::findZoneEdges() {
  /*
   * For unmarked weakmap keys with delegates in a different zone, add a zone
   * edge to ensure that the delegate zone finishes marking before the key
   * zone.
   */
  JS::AutoSuppressGCAnalysis nogc;
  for (Range r = all(); !r.empty(); r.popFront()) {
    JSObject* key = r.front().key();
    if (key->asTenured().isMarkedBlack()) {
      continue;
    }
    JSObject* delegate = getDelegate(key);
    if (!delegate) {
      continue;
    }
    Zone* delegateZone = delegate->zone();
    if (delegateZone == zone() || !delegateZone->isGCMarking()) {
      continue;
    }
    if (!delegateZone->gcSweepGroupEdges().put(key->zone())) {
      return false;
    }
  }
  return true;
}
Ejemplo n.º 3
0
bool
Wrapper::finalizeInBackground(const Value& priv) const
{
    if (!priv.isObject())
        return true;

    /*
     * Make the 'background-finalized-ness' of the wrapper the same as the
     * wrapped object, to allow transplanting between them.
     */
    JSObject* wrapped = MaybeForwarded(&priv.toObject());
    gc::AllocKind wrappedKind;
    if (IsInsideNursery(wrapped)) {
        JSRuntime *rt = wrapped->runtimeFromActiveCooperatingThread();
        wrappedKind = wrapped->allocKindForTenure(rt->gc.nursery());
    } else {
        wrappedKind = wrapped->asTenured().getAllocKind();
    }
    return IsBackgroundFinalized(wrappedKind);
}