Backout bug 506125.

This commit is contained in:
Andreas Gal
2009-08-18 17:30:05 -07:00
parent 44f5973970
commit 131c227fc9
15 changed files with 335 additions and 315 deletions

View File

@@ -4971,6 +4971,11 @@ js_Enumerate(JSContext *cx, JSObject *obj, JSIterateOp enum_op,
JS_ASSERT(ne->cursor == (jsword) length);
if (allocated != 0) {
JS_LOCK_GC(cx->runtime);
if (!js_AddAsGCBytes(cx, allocated)) {
/* js_AddAsGCBytes releases the GC lock on failures. */
cx->free(ne);
return JS_FALSE;
}
ne->next = cx->runtime->nativeEnumerators;
cx->runtime->nativeEnumerators = ne;
JS_ASSERT(((jsuword) ne & (jsuword) 1) == (jsuword) 0);
@@ -5059,6 +5064,7 @@ js_TraceNativeEnumerators(JSTracer *trc)
js_TraceId(trc, *cursor);
} while (++cursor != end);
} else if (doGC) {
js_RemoveAsGCBytes(rt, NativeEnumeratorSize(ne->length));
*nep = ne->next;
trc->context->free(ne);
continue;