зеркало из https://github.com/mozilla/pjs.git
Bug 348810: Removal of a broken optimization in array_sort that was supposed to shrink the temporary array when there are holes in the array. VM games are off for now. r=mrbkap
This commit is contained in:
Родитель
b0a4f2abb2
Коммит
f5b63a5157
|
@ -1098,20 +1098,7 @@ array_sort(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
|||
++newlen;
|
||||
}
|
||||
|
||||
/*
|
||||
* Here len == newlen + undefs + number_of_holes. We want to shrink the
|
||||
* array to relieve the memory pressure from VM in case of many holes.
|
||||
*/
|
||||
if (newlen != len) {
|
||||
vec = JS_realloc(cx, vec, newlen * sizeof vec[0]);
|
||||
if (!vec) {
|
||||
/* realloc that can not shrink. */
|
||||
vec = tvr.u.array;
|
||||
} else {
|
||||
tvr.u.array = vec;
|
||||
}
|
||||
}
|
||||
|
||||
/* Here len == newlen + undefs + number_of_holes. */
|
||||
ca.context = cx;
|
||||
ca.fval = fval;
|
||||
ca.localroot = argv + argc; /* local GC root for temporary string */
|
||||
|
|
Загрузка…
Ссылка в новой задаче