[INFER] Use initialized length instead of capacity in Array.join optimization, bug 655769.

This commit is contained in:
Brian Hackett
2011-05-14 07:39:42 -07:00
parent 273c962715
commit 559928f279
2 changed files with 4 additions and 4 deletions

View File

@@ -1405,9 +1405,9 @@ array_toString_sub(JSContext *cx, JSObject *obj, JSBool locale,
StringBuffer sb(cx);
if (!locale && !seplen && obj->isDenseArray() && !js_PrototypeHasIndexedProperties(cx, obj)) {
/* Elements beyond 'capacity' are 'undefined' and thus can be ignored. */
/* Elements beyond the initialized length are 'undefined' and thus can be ignored. */
Value *beg = obj->getDenseArrayElements();
Value *end = beg + Min(length, obj->getDenseArrayCapacity());
Value *end = beg + Min(length, obj->getDenseArrayInitializedLength());
for (Value *vp = beg; vp != end; ++vp) {
if (!JS_CHECK_OPERATION_LIMIT(cx))
return false;