Back out 2f276de2e526 (burning)

This commit is contained in:
Bill McCloskey 2011-11-16 10:48:51 -08:00
parent 2081c52fa6
commit 247c04ed42
4 changed files with 25 additions and 20 deletions

View File

@ -1947,7 +1947,7 @@ AutoGCRooter::trace(JSTracer *trc)
case NAMESPACES: {
JSXMLArray<JSObject> &array = static_cast<AutoNamespaceArray *>(this)->array;
MarkObjectRange(trc, array.length, array.vector, "JSXMLArray.vector");
js_XMLArrayCursorTrace(trc, array.cursors);
array.cursors->trace(trc);
return;
}

View File

@ -210,12 +210,6 @@ Mark(JSTracer *trc, const MarkablePtr<JSObject> &o, const char *name)
MarkObject(trc, o, name);
}
inline void
Mark(JSTracer *trc, const MarkablePtr<JSXML> &xml, const char *name)
{
MarkXML(trc, xml, name);
}
inline bool
IsMarked(JSContext *cx, const js::Value &v)
{

View File

@ -874,14 +874,27 @@ attr_identity(const JSXML *xmla, const JSXML *xmlb)
return qname_identity(xmla->name, xmlb->name);
}
template<class T>
template<>
void
js_XMLArrayCursorTrace(JSTracer *trc, JSXMLArrayCursor<T> *cursor)
JSXMLArrayCursor<JSXML>::trace(JSTracer *trc)
{
for (; cursor; cursor = cursor->next) {
if (cursor->root)
Mark(trc, (const MarkablePtr<T> &)cursor->root, "cursor_root");
}
for (JSXMLArrayCursor<JSXML> *cursor = this; cursor; cursor = cursor->next)
MarkXML(trc, cursor->root, "cursor_root");
}
template<>
void
JSXMLArrayCursor<JSObject>::trace(JSTracer *trc)
{
for (JSXMLArrayCursor<JSObject> *cursor = this; cursor; cursor = cursor->next)
MarkObject(trc, cursor->root, "cursor_root");
}
template<class T>
static void
XMLArrayCursorTrace(JSTracer *trc, JSXMLArrayCursor<T> *cursor)
{
cursor->trace(trc);
}
template<class T>
@ -7347,7 +7360,7 @@ js_TraceXML(JSTracer *trc, JSXML *xml)
}
MarkXMLRange(trc, xml->xml_kids.length, xml->xml_kids.vector, "xml_kids");
js_XMLArrayCursorTrace(trc, xml->xml_kids.cursors);
XMLArrayCursorTrace(trc, xml->xml_kids.cursors);
if (xml->xml_class == JSXML_CLASS_LIST) {
if (xml->xml_target)
@ -7358,10 +7371,10 @@ js_TraceXML(JSTracer *trc, JSXML *xml)
MarkObjectRange(trc, xml->xml_namespaces.length,
xml->xml_namespaces.vector,
"xml_namespaces");
js_XMLArrayCursorTrace(trc, xml->xml_namespaces.cursors);
XMLArrayCursorTrace(trc, xml->xml_namespaces.cursors);
MarkXMLRange(trc, xml->xml_attrs.length, xml->xml_attrs.vector, "xml_attrs");
js_XMLArrayCursorTrace(trc, xml->xml_attrs.cursors);
XMLArrayCursorTrace(trc, xml->xml_attrs.cursors);
}
}

View File

@ -121,11 +121,9 @@ struct JSXMLArrayCursor
return NULL;
return root = array->vector[index];
}
};
template<class T>
void
js_XMLArrayCursorTrace(JSTracer *trc, JSXMLArrayCursor<T> *cursor);
void trace(JSTracer *trc);
};
#define JSXML_PRESET_CAPACITY JS_BIT(31)
#define JSXML_CAPACITY_MASK JS_BITMASK(31)