elements[elements_length++] = e;
}
elements.length = elements_length;
- var result = %_FastAsciiArrayJoin(elements, '');
+ var result = %_FastOneByteArrayJoin(elements, '');
if (!IS_UNDEFINED(result)) return result;
return %StringBuilderConcat(elements, elements_length, '');
}
elements[i] = e;
}
}
- var result = %_FastAsciiArrayJoin(elements, separator);
+ var result = %_FastOneByteArrayJoin(elements, separator);
if (!IS_UNDEFINED(result)) return result;
return %StringBuilderJoin(elements, length, separator);
separator = NonStringToString(separator);
}
- var result = %_FastAsciiArrayJoin(array, separator);
+ var result = %_FastOneByteArrayJoin(array, separator);
if (!IS_UNDEFINED(result)) return result;
return Join(array, length, separator, ConvertToString);
var t_array = [];
// Use both 'from' and 'to' to determine the pivot candidates.
var increment = 200 + ((to - from) & 15);
- for (var i = from + 1; i < to - 1; i += increment) {
- t_array.push([i, a[i]]);
+ for (var i = from + 1, j = 0; i < to - 1; i += increment, j++) {
+ t_array[j] = [i, a[i]];
}
- t_array.sort(function(a, b) {
- return %_CallFunction(receiver, a[1], b[1], comparefn) } );
+ %_CallFunction(t_array, function(a, b) {
+ return %_CallFunction(receiver, a[1], b[1], comparefn);
+ }, ArraySort);
var third_index = t_array[t_array.length >> 1][0];
return third_index;
}
// It's an interval.
var proto_length = indices;
for (var i = 0; i < proto_length; i++) {
- if (!obj.hasOwnProperty(i) && proto.hasOwnProperty(i)) {
+ if (!HAS_OWN_PROPERTY(obj, i) && HAS_OWN_PROPERTY(proto, i)) {
obj[i] = proto[i];
if (i >= max) { max = i + 1; }
}
} else {
for (var i = 0; i < indices.length; i++) {
var index = indices[i];
- if (!IS_UNDEFINED(index) &&
- !obj.hasOwnProperty(index) && proto.hasOwnProperty(index)) {
+ if (!IS_UNDEFINED(index) && !HAS_OWN_PROPERTY(obj, index)
+ && HAS_OWN_PROPERTY(proto, index)) {
obj[index] = proto[index];
if (index >= max) { max = index + 1; }
}
// It's an interval.
var proto_length = indices;
for (var i = from; i < proto_length; i++) {
- if (proto.hasOwnProperty(i)) {
+ if (HAS_OWN_PROPERTY(proto, i)) {
obj[i] = UNDEFINED;
}
}
for (var i = 0; i < indices.length; i++) {
var index = indices[i];
if (!IS_UNDEFINED(index) && from <= index &&
- proto.hasOwnProperty(index)) {
+ HAS_OWN_PROPERTY(proto, index)) {
obj[index] = UNDEFINED;
}
}
}
// Maintain the invariant num_holes = the number of holes in the original
// array with indices <= first_undefined or > last_defined.
- if (!obj.hasOwnProperty(first_undefined)) {
+ if (!HAS_OWN_PROPERTY(obj, first_undefined)) {
num_holes++;
}
// Find last defined element.
while (first_undefined < last_defined &&
IS_UNDEFINED(obj[last_defined])) {
- if (!obj.hasOwnProperty(last_defined)) {
+ if (!HAS_OWN_PROPERTY(obj, last_defined)) {
num_holes++;
}
last_defined--;