Bug 572577 - Change NativeIterator::allocate to accept a vector of ids rather than separate pointer/length. r=gal

--HG--
extra : rebase_source : a7b3993ec46a83e3f70bb1c2975028e1273bb044
This commit is contained in:
Jeff Walden 2010-06-16 16:17:45 -07:00
parent e993047657
commit 5fbb5b9367
2 changed files with 6 additions and 7 deletions

View File

@ -232,8 +232,9 @@ EnumerateDenseArrayProperties(JSContext *cx, JSObject *obj, JSObject *pobj, uint
NativeIterator *
NativeIterator::allocate(JSContext *cx, JSObject *obj, uintN flags, uint32 *sarray, uint32 slength,
uint32 key, jsval *parray, uint32 plength)
uint32 key, AutoValueVector &props)
{
size_t plength = props.length();
NativeIterator *ni = (NativeIterator *)
cx->malloc(sizeof(NativeIterator) + plength * sizeof(jsval) + slength * sizeof(uint32));
if (!ni)
@ -242,7 +243,7 @@ NativeIterator::allocate(JSContext *cx, JSObject *obj, uintN flags, uint32 *sarr
ni->props_array = ni->props_cursor = (jsval *) (ni + 1);
ni->props_end = ni->props_array + plength;
if (plength)
memcpy(ni->props_array, parray, plength * sizeof(jsval));
memcpy(ni->props_array, props.begin(), plength * sizeof(jsval));
ni->shapes_array = (uint32 *) ni->props_end;
ni->shapes_length = slength;
ni->shapes_key = key;
@ -414,8 +415,7 @@ IdVectorToIterator(JSContext *cx, JSObject *obj, uintN flags, AutoValueVector &p
*vp = OBJECT_TO_JSVAL(iterobj);
NativeIterator *ni = NativeIterator::allocate(cx, obj, flags, NULL, 0, 0,
props.begin(), props.length());
NativeIterator *ni = NativeIterator::allocate(cx, obj, flags, NULL, 0, 0, props);
if (!ni)
return false;
@ -496,8 +496,7 @@ GetIterator(JSContext *cx, JSObject *obj, uintN flags, jsval *vp)
return false;
NativeIterator *ni =
NativeIterator::allocate(cx, obj, flags, shapes.begin(), shapes.length(), key,
props.begin(), props.length());
NativeIterator::allocate(cx, obj, flags, shapes.begin(), shapes.length(), key, props);
if (!ni)
return false;

View File

@ -73,7 +73,7 @@ struct NativeIterator {
static NativeIterator *allocate(JSContext *cx, JSObject *obj, uintN flags,
uint32 *sarray, uint32 slength, uint32 key,
jsval *parray, uint32 plength);
js::AutoValueVector &props);
void mark(JSTracer *trc);
};