[INFER] Fixes for botched merge.

This commit is contained in:
Brian Hackett 2010-12-20 12:10:57 -08:00
parent 4374d1fbe2
commit 637c0ef693
3 changed files with 10 additions and 4 deletions

View File

@ -4118,8 +4118,10 @@ JS_NewArrayObject(JSContext *cx, jsint length, jsval *vector)
assertSameCompartment(cx, JSValueArray(vector, vector ? (jsuint)length : 0));
#ifdef DEBUG
for (int i = 0; i < length; i++)
JS_ASSERT(!Valueify(vector[i]).isMagic(JS_ARRAY_HOLE));
if (vector) {
for (int i = 0; i < length; i++)
JS_ASSERT(!Valueify(vector[i]).isMagic(JS_ARRAY_HOLE));
}
#endif
return NewDenseCopiedArray(cx, (jsuint)length, Valueify(vector));

View File

@ -3475,10 +3475,13 @@ NewDenseCopiedArray(JSContext *cx, uintN length, Value *vp, JSObject *proto)
JSObject* obj = NewArray<true>(cx, length, proto);
JS_ASSERT(obj->getDenseArrayCapacity() >= length);
if (vp)
if (vp) {
memcpy(obj->getDenseArrayElements(), vp, length * sizeof(Value));
obj->setDenseArrayInitializedLength(length);
} else {
obj->setDenseArrayInitializedLength(0);
}
obj->setDenseArrayInitializedLength(length);
return obj;
}

View File

@ -2975,6 +2975,7 @@ js_CreateThisFromTrace(JSContext *cx, Class *clasp, JSObject *ctor)
* A primitive value in .prototype means to use Object.prototype
* for proto. See ES5 13.2.2 step 7.
*/
proto = objProto;
}
}