Remove gcIteratorTable (557914, r=brendan).
This commit is contained in:
@@ -87,15 +87,15 @@ CloseGenerator(JSContext *cx, JSObject *genobj);
|
||||
* Shared code to close iterator's state either through an explicit call or
|
||||
* when GC detects that the iterator is no longer reachable.
|
||||
*/
|
||||
void
|
||||
js_CloseNativeIterator(JSContext *cx, JSObject *iterobj)
|
||||
static void
|
||||
CloseNativeIterator(JSContext *cx, JSObject *iterobj)
|
||||
{
|
||||
jsval state;
|
||||
JSObject *iterable;
|
||||
|
||||
JS_ASSERT(iterobj->getClass() == &js_IteratorClass);
|
||||
|
||||
/* Avoid double work if js_CloseNativeIterator was called on obj. */
|
||||
/* Avoid double work if CloseNativeIterator was called on obj. */
|
||||
state = iterobj->getSlot(JSSLOT_ITER_STATE);
|
||||
if (JSVAL_IS_NULL(state))
|
||||
return;
|
||||
@@ -115,6 +115,12 @@ js_CloseNativeIterator(JSContext *cx, JSObject *iterobj)
|
||||
iterobj->setSlot(JSSLOT_ITER_STATE, JSVAL_NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
iterator_finalize(JSContext *cx, JSObject *obj)
|
||||
{
|
||||
CloseNativeIterator(cx, obj);
|
||||
}
|
||||
|
||||
static void
|
||||
iterator_trace(JSTracer *trc, JSObject *obj)
|
||||
{
|
||||
@@ -138,9 +144,9 @@ JSClass js_IteratorClass = {
|
||||
JSCLASS_HAS_RESERVED_SLOTS(2) | /* slots for state and flags */
|
||||
JSCLASS_HAS_CACHED_PROTO(JSProto_Iterator) |
|
||||
JSCLASS_MARK_IS_TRACE,
|
||||
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL,
|
||||
NULL, NULL, NULL, NULL,
|
||||
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, iterator_finalize,
|
||||
NULL, NULL, NULL, NULL,
|
||||
NULL, NULL, JS_CLASS_TRACE(iterator_trace), NULL
|
||||
};
|
||||
|
||||
@@ -156,8 +162,6 @@ InitNativeIterator(JSContext *cx, JSObject *iterobj, JSObject *obj, uintN flags)
|
||||
iterobj->setParent(obj);
|
||||
iterobj->setSlot(JSSLOT_ITER_STATE, JSVAL_NULL);
|
||||
iterobj->setSlot(JSSLOT_ITER_FLAGS, INT_TO_JSVAL(flags));
|
||||
if (!js_RegisterCloseableIterator(cx, iterobj))
|
||||
return JS_FALSE;
|
||||
if (!obj)
|
||||
return JS_TRUE;
|
||||
|
||||
@@ -447,7 +451,7 @@ js_CloseIterator(JSContext *cx, jsval v)
|
||||
clasp = obj->getClass();
|
||||
|
||||
if (clasp == &js_IteratorClass) {
|
||||
js_CloseNativeIterator(cx, obj);
|
||||
CloseNativeIterator(cx, obj);
|
||||
|
||||
/*
|
||||
* Note that we don't care what kind of iterator we close here. Even if it
|
||||
|
||||
Reference in New Issue
Block a user