Bug 662946 - Remove various headers from INSTALLED_HEADERS that shouldn't be there. r=jimb

This commit is contained in:
Jeff Walden
2011-06-09 01:12:21 -07:00
parent 56e1508e30
commit dffc24089c
17 changed files with 14 additions and 539 deletions

View File

@@ -3204,73 +3204,3 @@ js_ArrayInfo(JSContext *cx, uintN argc, jsval *vp)
return true;
}
#endif
JS_FRIEND_API(JSBool)
js_IsDensePrimitiveArray(JSObject *obj)
{
if (!obj || !obj->isDenseArray())
return JS_FALSE;
jsuint capacity = obj->getDenseArrayCapacity();
for (jsuint i = 0; i < capacity; i++) {
if (obj->getDenseArrayElement(i).isObject())
return JS_FALSE;
}
return JS_TRUE;
}
JS_FRIEND_API(JSBool)
js_CloneDensePrimitiveArray(JSContext *cx, JSObject *obj, JSObject **clone)
{
JS_ASSERT(obj);
if (!obj->isDenseArray()) {
/*
* This wasn't a dense array. Return JS_TRUE but a NULL clone to signal
* that no exception was encountered.
*/
*clone = NULL;
return JS_TRUE;
}
jsuint length = obj->getArrayLength();
/*
* Must use the minimum of original array's length and capacity, to handle
* |a = [1,2,3]; a.length = 10000| "dense" cases efficiently. In the normal
* case where length is <= capacity, the clone and original array will have
* the same capacity.
*/
jsuint jsvalCount = JS_MIN(obj->getDenseArrayCapacity(), length);
AutoValueVector vector(cx);
if (!vector.reserve(jsvalCount))
return JS_FALSE;
for (jsuint i = 0; i < jsvalCount; i++) {
const Value &val = obj->getDenseArrayElement(i);
if (val.isString()) {
// Strings must be made immutable before being copied to a clone.
if (!val.toString()->ensureFixed(cx))
return JS_FALSE;
} else if (val.isObject()) {
/*
* This wasn't an array of primitives. Return JS_TRUE but a null
* clone to signal that no exception was encountered.
*/
*clone = NULL;
return JS_TRUE;
}
vector.infallibleAppend(val);
}
*clone = NewDenseCopiedArray(cx, jsvalCount, vector.begin());
if (!*clone)
return JS_FALSE;
/* The length will be set to the JS_MIN, above, but length might be larger. */
(*clone)->setArrayLength(length);
return JS_TRUE;
}