Bug 737365 - stop using the cx during finalization, part 1.

This part changes the signatures for various finalization API to take
not JSContext* but rather either JSFreeOp structure or its
library-private counterpart FreeOp. These structures wrap parameters
that are passed to the finalizers removing most of explicit dependencies
on JSContext in the finalization code.
This commit is contained in:
Igor Bukanov
2012-03-19 15:34:55 +01:00
parent 054cc031c2
commit c7e7021207
90 changed files with 435 additions and 328 deletions

View File

@@ -84,7 +84,7 @@ using namespace mozilla;
using namespace js;
using namespace js::gc;
static void iterator_finalize(JSContext *cx, JSObject *obj);
static void iterator_finalize(FreeOp *fop, JSObject *obj);
static void iterator_trace(JSTracer *trc, JSObject *obj);
static JSObject *iterator_iterator(JSContext *cx, JSObject *obj, JSBool keysonly);
@@ -151,14 +151,14 @@ NativeIterator::mark(JSTracer *trc)
}
static void
iterator_finalize(JSContext *cx, JSObject *obj)
iterator_finalize(FreeOp *fop, JSObject *obj)
{
JS_ASSERT(obj->isIterator());
NativeIterator *ni = obj->getNativeIterator();
if (ni) {
obj->setPrivate(NULL);
cx->free_(ni);
fop->free_(ni);
}
}
@@ -1331,7 +1331,7 @@ Class js::StopIterationClass = {
#if JS_HAS_GENERATORS
static void
generator_finalize(JSContext *cx, JSObject *obj)
generator_finalize(FreeOp *fop, JSObject *obj)
{
JSGenerator *gen = (JSGenerator *) obj->getPrivate();
if (!gen)
@@ -1344,7 +1344,7 @@ generator_finalize(JSContext *cx, JSObject *obj)
JS_ASSERT(gen->state == JSGEN_NEWBORN ||
gen->state == JSGEN_CLOSED ||
gen->state == JSGEN_OPEN);
cx->free_(gen);
fop->free_(gen);
}
static void