(totalLiveCount * 100.) / livePropCapacity);
(totalLiveCount * 100.0) / livePropCapacity);
js_SweepScopeProperties(JSRuntime *rt){    JSArena **ap, *a;    JSScopeProperty *limit, *sprop, *parent, *kids, *kid;    uintN liveCount;    PropTreeKidsChunk *chunk, *nextChunk;    uintN i;#ifdef DEBUG_brendan    uint32 livePropCapacity = 0, totalLiveCount = 0;    static FILE *logfp;    if (!logfp)        logfp = fopen("/tmp/proptree.stats", "a");    MeterKidCount(rt->propertyTreeHash.entryCount);    JS_DHashTableEnumerate(&rt->propertyTreeHash, js_MeterPropertyTree, NULL);    {        double mean = 0., var = 0., sigma = 0.;        double nodesum = rt->livePropTreeNodes;        double kidsum = js_nkids_sum;        if (nodesum > 0 && kidsum >= 0) {            mean = kidsum / nodesum;            var = nodesum * js_nkids_sqsum - kidsum * kidsum;            if (var < 0.0 || nodesum <= 1)                var = 0.0;            else                var /= nodesum * (nodesum - 1);            /* Windows says sqrt(0.0) is "-1.#J" (?!) so we must test. */            sigma = (var != 0.) ? sqrt(var) : 0.;        }        fprintf(logfp,                "props %u nodes %g beta %g meankids %g sigma %g max %u",                rt->liveScopeProps, nodesum, nodesum / rt->liveScopeProps,                mean, sigma, js_nkids_max);    }    fprintf(logfp, " histogram %u %u %u %u %u %u %u %u %u %u %u",            js_nkids_hist[0], js_nkids_hist[1],            js_nkids_hist[2], js_nkids_hist[3],            js_nkids_hist[4], js_nkids_hist[5],            js_nkids_hist[6], js_nkids_hist[7],            js_nkids_hist[8], js_nkids_hist[9],            js_nkids_hist[10]);    js_nkids_sum = js_nkids_max = 0;    js_nkids_sqsum = 0;    memset(js_nkids_hist, 0, sizeof js_nkids_hist);#endif    ap = &rt->propertyArenaPool.first.next;    while ((a = *ap) != NULL) {        limit = (JSScopeProperty *) a->avail;        liveCount = 0;        for (sprop = (JSScopeProperty *) a->base; sprop < limit; sprop++) {            /* If the id is null, sprop is already on the freelist. */            if (sprop->id == JSVAL_NULL)                continue;            /* If the mark bit is set, sprop is alive, so we skip it. */            if (sprop->flags & SPROP_MARK) {                sprop->flags &= ~SPROP_MARK;                liveCount++;                continue;            }            /* Ok, sprop is garbage to collect: unlink it from its parent. */            RemovePropertyTreeChild(rt, sprop);            /* Take care to reparent all sprop's kids to their grandparent. */            kids = sprop->kids;            if (kids) {                sprop->kids = NULL;                parent = sprop->parent;                if (KIDS_IS_CHUNKY(kids)) {                    chunk = KIDS_TO_CHUNK(kids);                    do {                        for (i = 0; i < MAX_KIDS_PER_CHUNK; i++) {                            kid = chunk->kids[i];                            if (!kid)                                break;                            JS_ASSERT(kid->parent == sprop);                            InsertPropertyTreeChild(rt, parent, kid);                        }                        nextChunk = chunk->next;                        DestroyPropTreeKidsChunk(rt, chunk);                    } while ((chunk = nextChunk) != NULL);                } else {                    kid = kids;                    InsertPropertyTreeChild(rt, parent, kid);                }            }            /* Clear id so we know (above) that sprop is on the freelist. */            sprop->id = JSVAL_NULL;            FREENODE_INSERT(rt->propertyFreeList, sprop);            JS_RUNTIME_UNMETER(rt, livePropTreeNodes);        }        /* If a contains no live properties, return it to the malloc heap. */        if (liveCount == 0) {            for (sprop = (JSScopeProperty *) a->base; sprop < limit; sprop++)                FREENODE_REMOVE(sprop);            JS_ARENA_DESTROY(&rt->propertyArenaPool, a, ap);        } else {#ifdef DEBUG_brendan            livePropCapacity += limit - (JSScopeProperty *) a->base;            totalLiveCount += liveCount;#endif            ap = &a->next;        }    }#ifdef DEBUG_brendan    fprintf(logfp, " arenautil %g%%\n",            (totalLiveCount * 100.) / livePropCapacity);    fflush(logfp);#endif}