Bug 637905 - Add (asserted-infallible) append methods to js::Vector, for use when the vector in question has previously had space reserved, and use them a bunch of places. r=luke

This commit is contained in:
Jeff Walden
2011-02-18 18:32:29 -08:00
parent a8fbcda6a6
commit 70e937e769
13 changed files with 150 additions and 58 deletions

View File

@@ -3257,7 +3257,7 @@ js_CloneDensePrimitiveArray(JSContext *cx, JSObject *obj, JSObject **clone)
*/
jsuint jsvalCount = JS_MIN(obj->getDenseArrayCapacity(), length);
js::AutoValueVector vector(cx);
AutoValueVector vector(cx);
if (!vector.reserve(jsvalCount))
return JS_FALSE;
@@ -3277,7 +3277,7 @@ js_CloneDensePrimitiveArray(JSContext *cx, JSObject *obj, JSObject **clone)
return JS_TRUE;
}
vector.append(val);
vector.infallibleAppend(val);
}
*clone = NewDenseCopiedArray(cx, jsvalCount, vector.begin());