зеркало из https://github.com/mozilla/gecko-dev.git
bug 549010 - fixing and silencing MSVC warnings. r=brendan,igor
This commit is contained in:
Родитель
73aa8d23f6
Коммит
9cab0c75a6
|
@ -1481,10 +1481,10 @@ FindObjectClass(JSObject* aGlobalObject)
|
|||
JSObject *obj, *proto = aGlobalObject;
|
||||
do {
|
||||
obj = proto;
|
||||
proto = STOBJ_GET_PROTO(obj);
|
||||
proto = obj->getProto();
|
||||
} while (proto);
|
||||
|
||||
sObjectClass = STOBJ_GET_CLASS(obj);
|
||||
sObjectClass = obj->getClass();
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -6413,7 +6413,7 @@ nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
|||
#ifdef DEBUG
|
||||
if (!win->IsChromeWindow()) {
|
||||
NS_ASSERTION(JSVAL_IS_OBJECT(v) &&
|
||||
!strcmp(STOBJ_GET_CLASS(JSVAL_TO_OBJECT(v))->name,
|
||||
!strcmp(JSVAL_TO_OBJECT(v)->getClass()->name,
|
||||
"XPCCrossOriginWrapper"),
|
||||
"Didn't wrap a window!");
|
||||
}
|
||||
|
@ -6526,7 +6526,7 @@ nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
|||
#ifdef DEBUG
|
||||
if (!win->IsChromeWindow()) {
|
||||
NS_ASSERTION(JSVAL_IS_OBJECT(v) &&
|
||||
!strcmp(STOBJ_GET_CLASS(JSVAL_TO_OBJECT(v))->name,
|
||||
!strcmp(JSVAL_TO_OBJECT(v)->getClass()->name,
|
||||
"XPCCrossOriginWrapper"),
|
||||
"Didn't wrap a location object!");
|
||||
}
|
||||
|
@ -6732,7 +6732,7 @@ nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
|||
wrapper->GetJSObject(&realObj);
|
||||
|
||||
if (obj == realObj) {
|
||||
JSObject *proto = STOBJ_GET_PROTO(obj);
|
||||
JSObject *proto = obj->getProto();
|
||||
if (proto) {
|
||||
jsid interned_id;
|
||||
JSObject *pobj = NULL;
|
||||
|
@ -8474,8 +8474,8 @@ nsHTMLDocumentSH::DocumentAllGetProperty(JSContext *cx, JSObject *obj,
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
while (STOBJ_GET_CLASS(obj) != &sHTMLDocumentAllClass) {
|
||||
obj = STOBJ_GET_PROTO(obj);
|
||||
while (obj->getClass() != &sHTMLDocumentAllClass) {
|
||||
obj = obj->getProto();
|
||||
|
||||
if (!obj) {
|
||||
NS_ERROR("The JS engine lies!");
|
||||
|
|
|
@ -1145,9 +1145,9 @@ js_InitFunctionAndObjectClasses(JSContext *cx, JSObject *obj)
|
|||
}
|
||||
|
||||
/* Function.prototype and the global object delegate to Object.prototype. */
|
||||
OBJ_SET_PROTO(cx, fun_proto, obj_proto);
|
||||
if (!OBJ_GET_PROTO(cx, obj))
|
||||
OBJ_SET_PROTO(cx, obj, obj_proto);
|
||||
fun_proto->setProto(obj_proto);
|
||||
if (!obj->getProto())
|
||||
obj->setProto(obj_proto);
|
||||
|
||||
out:
|
||||
/* If resolving, remove the other entry (Object or Function) from table. */
|
||||
|
@ -1409,7 +1409,7 @@ JS_ResolveStandardClass(JSContext *cx, JSObject *obj, jsval id,
|
|||
}
|
||||
}
|
||||
|
||||
if (!stdnm && !OBJ_GET_PROTO(cx, obj)) {
|
||||
if (!stdnm && !obj->getProto()) {
|
||||
/*
|
||||
* Try even less frequently used names delegated from the global
|
||||
* object to Object.prototype, but only if the Object class hasn't
|
||||
|
@ -2659,7 +2659,7 @@ JS_GetPrototype(JSContext *cx, JSObject *obj)
|
|||
JSObject *proto;
|
||||
|
||||
CHECK_REQUEST(cx);
|
||||
proto = OBJ_GET_PROTO(cx, obj);
|
||||
proto = obj->getProto();
|
||||
|
||||
/* Beware ref to dead object (we may be called from obj's finalizer). */
|
||||
return proto && proto->map ? proto : NULL;
|
||||
|
@ -2745,7 +2745,7 @@ JS_SealObject(JSContext *cx, JSObject *obj, JSBool deep)
|
|||
uint32 nslots, i;
|
||||
jsval v;
|
||||
|
||||
if (OBJ_IS_DENSE_ARRAY(cx, obj) && !js_MakeArraySlow(cx, obj))
|
||||
if (obj->isDenseArray() && !js_MakeArraySlow(cx, obj))
|
||||
return JS_FALSE;
|
||||
|
||||
if (!OBJ_IS_NATIVE(obj)) {
|
||||
|
@ -3064,7 +3064,7 @@ LookupResult(JSContext *cx, JSObject *obj, JSObject *obj2, JSProperty *prop,
|
|||
*vp = SPROP_HAS_VALID_SLOT(sprop, OBJ_SCOPE(obj2))
|
||||
? LOCKED_OBJ_GET_SLOT(obj2, sprop->slot)
|
||||
: JSVAL_TRUE;
|
||||
} else if (OBJ_IS_DENSE_ARRAY(cx, obj2)) {
|
||||
} else if (obj2->isDenseArray()) {
|
||||
ok = js_GetDenseArrayElementValue(cx, obj2, prop, vp);
|
||||
} else {
|
||||
/* XXX bad API: no way to return "defined but value unknown" */
|
||||
|
@ -3644,7 +3644,7 @@ JS_NewArrayObject(JSContext *cx, jsint length, jsval *vector)
|
|||
JS_PUBLIC_API(JSBool)
|
||||
JS_IsArrayObject(JSContext *cx, JSObject *obj)
|
||||
{
|
||||
return OBJ_IS_ARRAY(cx, js_GetWrappedObject(cx, obj));
|
||||
return js_GetWrappedObject(cx, obj)->isArray();
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
|
@ -5583,7 +5583,8 @@ JS_ClearPendingException(JSContext *cx)
|
|||
JS_PUBLIC_API(JSBool)
|
||||
JS_ReportPendingException(JSContext *cx)
|
||||
{
|
||||
JSBool save, ok;
|
||||
JSBool ok;
|
||||
JSPackedBool save;
|
||||
|
||||
CHECK_REQUEST(cx);
|
||||
|
||||
|
|
|
@ -226,7 +226,7 @@ ValueIsLength(JSContext *cx, jsval* vp)
|
|||
JSBool
|
||||
js_GetLengthProperty(JSContext *cx, JSObject *obj, jsuint *lengthp)
|
||||
{
|
||||
if (OBJ_IS_ARRAY(cx, obj)) {
|
||||
if (obj->isArray()) {
|
||||
*lengthp = obj->fslots[JSSLOT_ARRAY_LENGTH];
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
@ -444,7 +444,7 @@ GetArrayElement(JSContext *cx, JSObject *obj, jsdouble index, JSBool *hole,
|
|||
jsval *vp)
|
||||
{
|
||||
JS_ASSERT(index >= 0);
|
||||
if (OBJ_IS_DENSE_ARRAY(cx, obj) && index < js_DenseArrayCapacity(obj) &&
|
||||
if (obj->isDenseArray() && index < js_DenseArrayCapacity(obj) &&
|
||||
(*vp = obj->dslots[jsuint(index)]) != JSVAL_HOLE) {
|
||||
*hole = JS_FALSE;
|
||||
return JS_TRUE;
|
||||
|
@ -484,7 +484,7 @@ SetArrayElement(JSContext *cx, JSObject *obj, jsdouble index, jsval v)
|
|||
{
|
||||
JS_ASSERT(index >= 0);
|
||||
|
||||
if (OBJ_IS_DENSE_ARRAY(cx, obj)) {
|
||||
if (obj->isDenseArray()) {
|
||||
/* Predicted/prefetched code should favor the remains-dense case. */
|
||||
if (index <= jsuint(-1)) {
|
||||
jsuint idx = jsuint(index);
|
||||
|
@ -518,7 +518,7 @@ static JSBool
|
|||
DeleteArrayElement(JSContext *cx, JSObject *obj, jsdouble index)
|
||||
{
|
||||
JS_ASSERT(index >= 0);
|
||||
if (OBJ_IS_DENSE_ARRAY(cx, obj)) {
|
||||
if (obj->isDenseArray()) {
|
||||
if (index <= jsuint(-1)) {
|
||||
jsuint idx = jsuint(index);
|
||||
if (!INDEX_TOO_SPARSE(obj, idx) && idx < js_DenseArrayCapacity(obj)) {
|
||||
|
@ -615,9 +615,9 @@ static JSBool
|
|||
array_length_getter(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
do {
|
||||
if (OBJ_IS_ARRAY(cx, obj))
|
||||
if (obj->isArray())
|
||||
return IndexToValue(cx, obj->fslots[JSSLOT_ARRAY_LENGTH], vp);
|
||||
} while ((obj = OBJ_GET_PROTO(cx, obj)) != NULL);
|
||||
} while ((obj = obj->getProto()) != NULL);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
@ -630,7 +630,7 @@ array_length_setter(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
JSTempValueRooter tvr;
|
||||
JSBool ok;
|
||||
|
||||
if (!OBJ_IS_ARRAY(cx, obj)) {
|
||||
if (!obj->isArray()) {
|
||||
jsid lengthId = ATOM_TO_JSID(cx->runtime->atomState.lengthAtom);
|
||||
|
||||
return obj->defineProperty(cx, lengthId, *vp, NULL, NULL, JSPROP_ENUMERATE);
|
||||
|
@ -652,7 +652,7 @@ array_length_setter(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
if (OBJ_IS_DENSE_ARRAY(cx, obj)) {
|
||||
if (obj->isDenseArray()) {
|
||||
/* Don't reallocate if we're not actually shrinking our slots. */
|
||||
jsuint capacity = js_DenseArrayCapacity(obj);
|
||||
if (capacity > newlen && !ResizeSlots(cx, obj, capacity, newlen))
|
||||
|
@ -709,7 +709,7 @@ array_length_setter(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
static inline bool
|
||||
IsDenseArrayId(JSContext *cx, JSObject *obj, jsid id)
|
||||
{
|
||||
JS_ASSERT(OBJ_IS_DENSE_ARRAY(cx, obj));
|
||||
JS_ASSERT(obj->isDenseArray());
|
||||
|
||||
uint32 i;
|
||||
return id == ATOM_TO_JSID(cx->runtime->atomState.lengthAtom) ||
|
||||
|
@ -723,7 +723,7 @@ static JSBool
|
|||
array_lookupProperty(JSContext *cx, JSObject *obj, jsid id, JSObject **objp,
|
||||
JSProperty **propp)
|
||||
{
|
||||
if (!OBJ_IS_DENSE_ARRAY(cx, obj))
|
||||
if (!obj->isDenseArray())
|
||||
return js_LookupProperty(cx, obj, id, objp, propp);
|
||||
|
||||
if (IsDenseArrayId(cx, obj, id)) {
|
||||
|
@ -732,7 +732,7 @@ array_lookupProperty(JSContext *cx, JSObject *obj, jsid id, JSObject **objp,
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JSObject *proto = STOBJ_GET_PROTO(obj);
|
||||
JSObject *proto = obj->getProto();
|
||||
if (!proto) {
|
||||
*objp = NULL;
|
||||
*propp = NULL;
|
||||
|
@ -776,7 +776,7 @@ array_getProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
if (!OBJ_IS_DENSE_ARRAY(cx, obj))
|
||||
if (!obj->isDenseArray())
|
||||
return js_GetProperty(cx, obj, id, vp);
|
||||
|
||||
if (!js_IdIsIndex(ID_TO_VALUE(id), &i) || i >= js_DenseArrayCapacity(obj) ||
|
||||
|
@ -785,7 +785,7 @@ array_getProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
|
|||
JSProperty *prop;
|
||||
JSScopeProperty *sprop;
|
||||
|
||||
JSObject *proto = STOBJ_GET_PROTO(obj);
|
||||
JSObject *proto = obj->getProto();
|
||||
if (!proto) {
|
||||
*vp = JSVAL_VOID;
|
||||
return JS_TRUE;
|
||||
|
@ -862,7 +862,7 @@ array_setProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
|
|||
if (id == ATOM_TO_JSID(cx->runtime->atomState.lengthAtom))
|
||||
return array_length_setter(cx, obj, id, vp);
|
||||
|
||||
if (!OBJ_IS_DENSE_ARRAY(cx, obj))
|
||||
if (!obj->isDenseArray())
|
||||
return js_SetProperty(cx, obj, id, vp);
|
||||
|
||||
if (!js_IdIsIndex(id, &i) || INDEX_TOO_SPARSE(obj, i)) {
|
||||
|
@ -947,7 +947,7 @@ dense_grow(JSContext* cx, JSObject* obj, jsint i, jsval v)
|
|||
JSBool FASTCALL
|
||||
js_Array_dense_setelem(JSContext* cx, JSObject* obj, jsint i, jsval v)
|
||||
{
|
||||
JS_ASSERT(OBJ_IS_DENSE_ARRAY(cx, obj));
|
||||
JS_ASSERT(obj->isDenseArray());
|
||||
return dense_grow(cx, obj, i, v);
|
||||
}
|
||||
JS_DEFINE_CALLINFO_4(extern, BOOL, js_Array_dense_setelem, CONTEXT, OBJECT, INT32, JSVAL, 0,
|
||||
|
@ -956,7 +956,7 @@ JS_DEFINE_CALLINFO_4(extern, BOOL, js_Array_dense_setelem, CONTEXT, OBJECT, INT3
|
|||
JSBool FASTCALL
|
||||
js_Array_dense_setelem_int(JSContext* cx, JSObject* obj, jsint i, int32 j)
|
||||
{
|
||||
JS_ASSERT(OBJ_IS_DENSE_ARRAY(cx, obj));
|
||||
JS_ASSERT(obj->isDenseArray());
|
||||
|
||||
jsval v;
|
||||
if (JS_LIKELY(INT_FITS_IN_JSVAL(j))) {
|
||||
|
@ -975,7 +975,7 @@ JS_DEFINE_CALLINFO_4(extern, BOOL, js_Array_dense_setelem_int, CONTEXT, OBJECT,
|
|||
JSBool FASTCALL
|
||||
js_Array_dense_setelem_double(JSContext* cx, JSObject* obj, jsint i, jsdouble d)
|
||||
{
|
||||
JS_ASSERT(OBJ_IS_DENSE_ARRAY(cx, obj));
|
||||
JS_ASSERT(obj->isDenseArray());
|
||||
|
||||
jsval v;
|
||||
jsint j;
|
||||
|
@ -1004,7 +1004,7 @@ array_defineProperty(JSContext *cx, JSObject *obj, jsid id, jsval value,
|
|||
return JS_TRUE;
|
||||
|
||||
isIndex = js_IdIsIndex(ID_TO_VALUE(id), &i);
|
||||
if (!isIndex || attrs != JSPROP_ENUMERATE || !OBJ_IS_DENSE_ARRAY(cx, obj) || INDEX_TOO_SPARSE(obj, i)) {
|
||||
if (!isIndex || attrs != JSPROP_ENUMERATE || !obj->isDenseArray() || INDEX_TOO_SPARSE(obj, i)) {
|
||||
if (!ENSURE_SLOW_ARRAY(cx, obj))
|
||||
return JS_FALSE;
|
||||
return js_DefineProperty(cx, obj, id, value, getter, setter, attrs);
|
||||
|
@ -1036,7 +1036,7 @@ array_deleteProperty(JSContext *cx, JSObject *obj, jsval id, jsval *rval)
|
|||
{
|
||||
uint32 i;
|
||||
|
||||
if (!OBJ_IS_DENSE_ARRAY(cx, obj))
|
||||
if (!obj->isDenseArray())
|
||||
return js_DeleteProperty(cx, obj, id, rval);
|
||||
|
||||
if (id == ATOM_TO_JSID(cx->runtime->atomState.lengthAtom)) {
|
||||
|
@ -1124,7 +1124,7 @@ array_enumerate(JSContext *cx, JSObject *obj, JSIterateOp enum_op,
|
|||
|
||||
switch (enum_op) {
|
||||
case JSENUMERATE_INIT:
|
||||
JS_ASSERT(OBJ_IS_DENSE_ARRAY(cx, obj));
|
||||
JS_ASSERT(obj->isDenseArray());
|
||||
capacity = js_DenseArrayCapacity(obj);
|
||||
if (idp)
|
||||
*idp = INT_TO_JSVAL(obj->fslots[JSSLOT_ARRAY_COUNT]);
|
||||
|
@ -1646,7 +1646,7 @@ InitArrayElements(JSContext *cx, JSObject *obj, jsuint start, jsuint count, jsva
|
|||
* Optimize for dense arrays so long as adding the given set of elements
|
||||
* wouldn't otherwise make the array slow.
|
||||
*/
|
||||
if (OBJ_IS_DENSE_ARRAY(cx, obj) && !js_PrototypeHasIndexedProperties(cx, obj) &&
|
||||
if (obj->isDenseArray() && !js_PrototypeHasIndexedProperties(cx, obj) &&
|
||||
start <= MAXINDEX - count && !INDEX_TOO_BIG(start + count)) {
|
||||
|
||||
#ifdef DEBUG_jwalden
|
||||
|
@ -1713,7 +1713,7 @@ InitArrayElements(JSContext *cx, JSObject *obj, jsuint start, jsuint count, jsva
|
|||
return JS_TRUE;
|
||||
|
||||
/* Finish out any remaining elements past the max array index. */
|
||||
if (OBJ_IS_DENSE_ARRAY(cx, obj) && !ENSURE_SLOW_ARRAY(cx, obj))
|
||||
if (obj->isDenseArray() && !ENSURE_SLOW_ARRAY(cx, obj))
|
||||
return JS_FALSE;
|
||||
|
||||
JS_ASSERT(start == MAXINDEX);
|
||||
|
@ -1740,7 +1740,7 @@ static JSBool
|
|||
InitArrayObject(JSContext *cx, JSObject *obj, jsuint length, jsval *vector,
|
||||
JSBool holey = JS_FALSE)
|
||||
{
|
||||
JS_ASSERT(OBJ_IS_ARRAY(cx, obj));
|
||||
JS_ASSERT(obj->isArray());
|
||||
|
||||
obj->fslots[JSSLOT_ARRAY_LENGTH] = length;
|
||||
|
||||
|
@ -1819,7 +1819,7 @@ array_reverse(JSContext *cx, uintN argc, jsval *vp)
|
|||
return JS_FALSE;
|
||||
*vp = OBJECT_TO_JSVAL(obj);
|
||||
|
||||
if (OBJ_IS_DENSE_ARRAY(cx, obj) && !js_PrototypeHasIndexedProperties(cx, obj)) {
|
||||
if (obj->isDenseArray() && !js_PrototypeHasIndexedProperties(cx, obj)) {
|
||||
/* An empty array or an array with no elements is already reversed. */
|
||||
if (len == 0 || !obj->dslots)
|
||||
return JS_TRUE;
|
||||
|
@ -2410,7 +2410,7 @@ array_push1_dense(JSContext* cx, JSObject* obj, jsval v, jsval *rval)
|
|||
JSBool JS_FASTCALL
|
||||
js_ArrayCompPush(JSContext *cx, JSObject *obj, jsval v)
|
||||
{
|
||||
JS_ASSERT(OBJ_IS_DENSE_ARRAY(cx, obj));
|
||||
JS_ASSERT(obj->isDenseArray());
|
||||
uint32_t length = (uint32_t) obj->fslots[JSSLOT_ARRAY_LENGTH];
|
||||
JS_ASSERT(length <= js_DenseArrayCapacity(obj));
|
||||
|
||||
|
@ -2437,7 +2437,7 @@ static jsval FASTCALL
|
|||
Array_p_push1(JSContext* cx, JSObject* obj, jsval v)
|
||||
{
|
||||
JSAutoTempValueRooter tvr(cx, v);
|
||||
if (OBJ_IS_DENSE_ARRAY(cx, obj)
|
||||
if (obj->isDenseArray()
|
||||
? array_push1_dense(cx, obj, v, tvr.addr())
|
||||
: array_push_slowly(cx, obj, 1, tvr.addr(), tvr.addr())) {
|
||||
return tvr.value();
|
||||
|
@ -2456,7 +2456,7 @@ array_push(JSContext *cx, uintN argc, jsval *vp)
|
|||
obj = JS_THIS_OBJECT(cx, vp);
|
||||
if (!obj)
|
||||
return JS_FALSE;
|
||||
if (argc != 1 || !OBJ_IS_DENSE_ARRAY(cx, obj))
|
||||
if (argc != 1 || !obj->isDenseArray())
|
||||
return array_push_slowly(cx, obj, argc, vp + 2, vp);
|
||||
|
||||
return array_push1_dense(cx, obj, vp[2], vp);
|
||||
|
@ -2509,7 +2509,7 @@ static jsval FASTCALL
|
|||
Array_p_pop(JSContext* cx, JSObject* obj)
|
||||
{
|
||||
JSAutoTempValueRooter tvr(cx);
|
||||
if (OBJ_IS_DENSE_ARRAY(cx, obj)
|
||||
if (obj->isDenseArray()
|
||||
? array_pop_dense(cx, obj, tvr.addr())
|
||||
: array_pop_slowly(cx, obj, tvr.addr())) {
|
||||
return tvr.value();
|
||||
|
@ -2527,7 +2527,7 @@ array_pop(JSContext *cx, uintN argc, jsval *vp)
|
|||
obj = JS_THIS_OBJECT(cx, vp);
|
||||
if (!obj)
|
||||
return JS_FALSE;
|
||||
if (OBJ_IS_DENSE_ARRAY(cx, obj))
|
||||
if (obj->isDenseArray())
|
||||
return array_pop_dense(cx, obj, vp);
|
||||
return array_pop_slowly(cx, obj, vp);
|
||||
}
|
||||
|
@ -2547,7 +2547,7 @@ array_shift(JSContext *cx, uintN argc, jsval *vp)
|
|||
} else {
|
||||
length--;
|
||||
|
||||
if (OBJ_IS_DENSE_ARRAY(cx, obj) && !js_PrototypeHasIndexedProperties(cx, obj) &&
|
||||
if (obj->isDenseArray() && !js_PrototypeHasIndexedProperties(cx, obj) &&
|
||||
length < js_DenseArrayCapacity(obj)) {
|
||||
if (JS_LIKELY(obj->dslots != NULL)) {
|
||||
*vp = obj->dslots[0];
|
||||
|
@ -2606,7 +2606,7 @@ array_unshift(JSContext *cx, uintN argc, jsval *vp)
|
|||
/* Slide up the array to make room for argc at the bottom. */
|
||||
argv = JS_ARGV(cx, vp);
|
||||
if (length > 0) {
|
||||
if (OBJ_IS_DENSE_ARRAY(cx, obj) && !js_PrototypeHasIndexedProperties(cx, obj) &&
|
||||
if (obj->isDenseArray() && !js_PrototypeHasIndexedProperties(cx, obj) &&
|
||||
!INDEX_TOO_SPARSE(obj, unsigned(newlen + argc))) {
|
||||
JS_ASSERT(newlen + argc == length + argc);
|
||||
if (!EnsureCapacity(cx, obj, length + argc))
|
||||
|
@ -2711,7 +2711,7 @@ array_splice(JSContext *cx, uintN argc, jsval *vp)
|
|||
|
||||
/* If there are elements to remove, put them into the return value. */
|
||||
if (count > 0) {
|
||||
if (OBJ_IS_DENSE_ARRAY(cx, obj) && !js_PrototypeHasIndexedProperties(cx, obj) &&
|
||||
if (obj->isDenseArray() && !js_PrototypeHasIndexedProperties(cx, obj) &&
|
||||
!js_PrototypeHasIndexedProperties(cx, obj2) &&
|
||||
end <= js_DenseArrayCapacity(obj)) {
|
||||
if (!InitArrayObject(cx, obj2, count, obj->dslots + begin,
|
||||
|
@ -2740,7 +2740,7 @@ array_splice(JSContext *cx, uintN argc, jsval *vp)
|
|||
if (argc > count) {
|
||||
delta = (jsuint)argc - count;
|
||||
last = length;
|
||||
if (OBJ_IS_DENSE_ARRAY(cx, obj) && !js_PrototypeHasIndexedProperties(cx, obj) &&
|
||||
if (obj->isDenseArray() && !js_PrototypeHasIndexedProperties(cx, obj) &&
|
||||
length <= js_DenseArrayCapacity(obj) &&
|
||||
(length == 0 || obj->dslots[length - 1] != JSVAL_HOLE)) {
|
||||
if (!EnsureCapacity(cx, obj, length + delta))
|
||||
|
@ -2767,7 +2767,7 @@ array_splice(JSContext *cx, uintN argc, jsval *vp)
|
|||
length += delta;
|
||||
} else if (argc < count) {
|
||||
delta = count - (jsuint)argc;
|
||||
if (OBJ_IS_DENSE_ARRAY(cx, obj) && !js_PrototypeHasIndexedProperties(cx, obj) &&
|
||||
if (obj->isDenseArray() && !js_PrototypeHasIndexedProperties(cx, obj) &&
|
||||
length <= js_DenseArrayCapacity(obj)) {
|
||||
/* (uint) end could be 0, so we can't use a vanilla >= test. */
|
||||
for (last = end; last < length; last++) {
|
||||
|
@ -2816,7 +2816,7 @@ array_concat(JSContext *cx, uintN argc, jsval *vp)
|
|||
|
||||
/* Create a new Array object and root it using *vp. */
|
||||
aobj = JS_THIS_OBJECT(cx, vp);
|
||||
if (OBJ_IS_DENSE_ARRAY(cx, aobj)) {
|
||||
if (aobj->isDenseArray()) {
|
||||
/*
|
||||
* Clone aobj but pass the minimum of its length and capacity, to
|
||||
* handle a = [1,2,3]; a.length = 10000 "dense" cases efficiently. In
|
||||
|
@ -2858,7 +2858,7 @@ array_concat(JSContext *cx, uintN argc, jsval *vp)
|
|||
|
||||
aobj = JSVAL_TO_OBJECT(v);
|
||||
wobj = js_GetWrappedObject(cx, aobj);
|
||||
if (OBJ_IS_ARRAY(cx, wobj)) {
|
||||
if (wobj->isArray()) {
|
||||
jsid id = ATOM_TO_JSID(cx->runtime->atomState.lengthAtom);
|
||||
if (!aobj->getProperty(cx, id, tvr.addr()))
|
||||
return false;
|
||||
|
@ -2943,7 +2943,7 @@ array_slice(JSContext *cx, uintN argc, jsval *vp)
|
|||
if (begin > end)
|
||||
begin = end;
|
||||
|
||||
if (OBJ_IS_DENSE_ARRAY(cx, obj) && end <= js_DenseArrayCapacity(obj) &&
|
||||
if (obj->isDenseArray() && end <= js_DenseArrayCapacity(obj) &&
|
||||
!js_PrototypeHasIndexedProperties(cx, obj)) {
|
||||
nobj = js_NewArrayObject(cx, end - begin, obj->dslots + begin,
|
||||
obj->fslots[JSSLOT_ARRAY_COUNT] !=
|
||||
|
@ -3302,7 +3302,7 @@ array_isArray(JSContext *cx, uintN argc, jsval *vp)
|
|||
{
|
||||
*vp = BOOLEAN_TO_JSVAL(argc > 0 &&
|
||||
!JSVAL_IS_PRIMITIVE(vp[2]) &&
|
||||
OBJ_IS_ARRAY(cx, js_GetWrappedObject(cx, JSVAL_TO_OBJECT(vp[2]))));
|
||||
js_GetWrappedObject(cx, JSVAL_TO_OBJECT(vp[2]))->isArray());
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
@ -3400,7 +3400,7 @@ JS_STATIC_ASSERT(JSSLOT_ARRAY_LENGTH + 1 == JSSLOT_ARRAY_COUNT);
|
|||
JSObject* JS_FASTCALL
|
||||
js_NewEmptyArray(JSContext* cx, JSObject* proto)
|
||||
{
|
||||
JS_ASSERT(OBJ_IS_ARRAY(cx, proto));
|
||||
JS_ASSERT(proto->isArray());
|
||||
|
||||
JSObject* obj = js_NewGCObject(cx);
|
||||
if (!obj)
|
||||
|
@ -3517,15 +3517,15 @@ js_ArrayInfo(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
|||
if (!bytes)
|
||||
return JS_FALSE;
|
||||
if (JSVAL_IS_PRIMITIVE(argv[i]) ||
|
||||
!OBJ_IS_ARRAY(cx, (array = JSVAL_TO_OBJECT(argv[i])))) {
|
||||
!(array = JSVAL_TO_OBJECT(argv[i]))->isArray()) {
|
||||
fprintf(stderr, "%s: not array\n", bytes);
|
||||
cx->free(bytes);
|
||||
continue;
|
||||
}
|
||||
fprintf(stderr, "%s: %s (len %lu", bytes,
|
||||
OBJ_IS_DENSE_ARRAY(cx, array) ? "dense" : "sparse",
|
||||
array->isDenseArray()) ? "dense" : "sparse",
|
||||
array->fslots[JSSLOT_ARRAY_LENGTH]);
|
||||
if (OBJ_IS_DENSE_ARRAY(cx, array)) {
|
||||
if (array->isDenseArray()) {
|
||||
fprintf(stderr, ", count %lu, capacity %lu",
|
||||
array->fslots[JSSLOT_ARRAY_COUNT],
|
||||
js_DenseArrayCapacity(array));
|
||||
|
|
|
@ -67,9 +67,6 @@ JSObject::isArray() const
|
|||
return isDenseArray() || getClass() == &js_SlowArrayClass;
|
||||
}
|
||||
|
||||
#define OBJ_IS_DENSE_ARRAY(cx,obj) (obj)->isDenseArray()
|
||||
#define OBJ_IS_ARRAY(cx,obj) (obj)->isArray()
|
||||
|
||||
/*
|
||||
* Dense arrays are not native (OBJ_IS_NATIVE(cx, aobj) for a dense array aobj
|
||||
* results in false, meaning aobj->map does not point to a JSScope).
|
||||
|
@ -90,9 +87,9 @@ JSObject::isArray() const
|
|||
* (obj) for the |this| value of a getter, setter, or method call (bug 476447).
|
||||
*/
|
||||
static JS_INLINE JSObject *
|
||||
js_GetProtoIfDenseArray(JSContext *cx, JSObject *obj)
|
||||
js_GetProtoIfDenseArray(JSObject *obj)
|
||||
{
|
||||
return OBJ_IS_DENSE_ARRAY(cx, obj) ? OBJ_GET_PROTO(cx, obj) : obj;
|
||||
return obj->isDenseArray() ? obj->getProto() : obj;
|
||||
}
|
||||
|
||||
extern JSObject *
|
||||
|
|
|
@ -288,7 +288,7 @@ static JSBool
|
|||
HasProperty(JSContext* cx, JSObject* obj, jsid id)
|
||||
{
|
||||
// Check that we know how the lookup op will behave.
|
||||
for (JSObject* pobj = obj; pobj; pobj = OBJ_GET_PROTO(cx, pobj)) {
|
||||
for (JSObject* pobj = obj; pobj; pobj = pobj->getProto()) {
|
||||
if (pobj->map->ops->lookupProperty != js_LookupProperty)
|
||||
return JSVAL_TO_SPECIAL(JSVAL_VOID);
|
||||
JSClass* clasp = OBJ_GET_CLASS(cx, pobj);
|
||||
|
|
|
@ -1653,7 +1653,7 @@ js_ReportErrorNumberVA(JSContext *cx, uintN flags, JSErrorCallback callback,
|
|||
PopulateReportBlame(cx, &report);
|
||||
|
||||
if (!js_ExpandErrorArguments(cx, callback, userRef, errorNumber,
|
||||
&message, &report, charArgs, ap)) {
|
||||
&message, &report, !!charArgs, ap)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -63,6 +63,13 @@
|
|||
#include "jsvector.h"
|
||||
#include "jshashtable.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4100) /* Silence unreferenced formal parameter warnings */
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4355) /* Silence warning about "this" used in base member initializer list */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* js_GetSrcNote cache to avoid O(n^2) growth in finding a source note for a
|
||||
* given pc in a script. We use the script->code pointer to tag the cache,
|
||||
|
@ -125,7 +132,7 @@ struct TreeFragment;
|
|||
struct InterpState;
|
||||
template<typename T> class Queue;
|
||||
typedef Queue<uint16> SlotList;
|
||||
struct TypeMap;
|
||||
class TypeMap;
|
||||
struct REFragment;
|
||||
typedef nanojit::HashMap<REHashKey, REFragment*, REHashFn> REHashMap;
|
||||
|
||||
|
@ -283,7 +290,7 @@ class CallStack
|
|||
return suspendedFrame;
|
||||
}
|
||||
|
||||
bool isSuspended() const { return suspendedFrame; }
|
||||
bool isSuspended() const { return !!suspendedFrame; }
|
||||
|
||||
void setPrevious(CallStack *cs) { previous = cs; }
|
||||
CallStack *getPrevious() const { return previous; }
|
||||
|
@ -417,9 +424,9 @@ struct TraceMonitor {
|
|||
*/
|
||||
REHashMap* reFragments;
|
||||
|
||||
// Cached temporary typemap to avoid realloc'ing every time we create one.
|
||||
// Cached temporary typemap to avoid realloc'ing every time we create one.
|
||||
// This must be used in only one place at a given time. It must be cleared
|
||||
// before use.
|
||||
// before use.
|
||||
TypeMap* cachedTempTypeMap;
|
||||
|
||||
#ifdef DEBUG
|
||||
|
@ -1801,6 +1808,10 @@ class JSAutoIdArray {
|
|||
JSIdArray * const idArray;
|
||||
JSTempValueRooter tvr;
|
||||
JS_DECL_USE_GUARD_OBJECT_NOTIFIER
|
||||
|
||||
/* No copy or assignment semantics. */
|
||||
JSAutoIdArray(JSAutoIdArray &);
|
||||
void operator=(JSAutoIdArray &);
|
||||
};
|
||||
|
||||
/* The auto-root for enumeration object and its state. */
|
||||
|
@ -2280,4 +2291,9 @@ ContextAllocPolicy::reportAllocOverflow() const
|
|||
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif /* jscntxt_h___ */
|
||||
|
|
|
@ -1465,7 +1465,7 @@ JS_GetPropertyDesc(JSContext *cx, JSObject *obj, JSScopeProperty *sprop,
|
|||
{
|
||||
pd->id = ID_TO_VALUE(sprop->id);
|
||||
|
||||
bool wasThrowing = cx->throwing;
|
||||
JSBool wasThrowing = cx->throwing;
|
||||
JSAutoTempValueRooter lastException(cx, cx->exception);
|
||||
cx->throwing = JS_FALSE;
|
||||
|
||||
|
|
|
@ -1178,7 +1178,7 @@ call_resolve(JSContext *cx, JSObject *obj, jsval idval, uintN flags,
|
|||
uintN slot, attrs;
|
||||
|
||||
JS_ASSERT(STOBJ_GET_CLASS(obj) == &js_CallClass);
|
||||
JS_ASSERT(!STOBJ_GET_PROTO(obj));
|
||||
JS_ASSERT(!obj->getProto());
|
||||
|
||||
if (!JSVAL_IS_STRING(idval))
|
||||
return JS_TRUE;
|
||||
|
@ -1357,7 +1357,7 @@ fun_getProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
JS_GetInstancePrivate(cx, obj, &js_FunctionClass, NULL))) {
|
||||
if (slot != FUN_LENGTH)
|
||||
return JS_TRUE;
|
||||
obj = OBJ_GET_PROTO(cx, obj);
|
||||
obj = obj->getProto();
|
||||
if (!obj)
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
@ -1614,7 +1614,7 @@ js_XDRFunctionObject(JSXDRState *xdr, JSObject **objp)
|
|||
if (!fun)
|
||||
return JS_FALSE;
|
||||
STOBJ_CLEAR_PARENT(FUN_OBJECT(fun));
|
||||
STOBJ_CLEAR_PROTO(FUN_OBJECT(fun));
|
||||
FUN_OBJECT(fun)->clearProto();
|
||||
#ifdef __GNUC__
|
||||
nvars = nargs = nupvars = 0; /* quell GCC uninitialized warning */
|
||||
#endif
|
||||
|
@ -2448,7 +2448,7 @@ js_NewFunction(JSContext *cx, JSObject *funobj, JSNative native, uintN nargs,
|
|||
fun = (JSFunction *) funobj;
|
||||
|
||||
/* Initialize all function members. */
|
||||
fun->nargs = nargs;
|
||||
fun->nargs = uint16(nargs);
|
||||
fun->flags = flags & (JSFUN_FLAGS_MASK | JSFUN_KINDMASK | JSFUN_TRCINFO);
|
||||
if ((flags & JSFUN_KINDMASK) >= JSFUN_INTERPRETED) {
|
||||
JS_ASSERT(!native);
|
||||
|
|
|
@ -346,7 +346,7 @@ struct JSGCArena {
|
|||
return reinterpret_cast<JSGCArena *>(pageStart);
|
||||
}
|
||||
|
||||
bool hasPrevUnmarked() const { return info.prevUnmarkedPage; }
|
||||
bool hasPrevUnmarked() const { return !!info.prevUnmarkedPage; }
|
||||
|
||||
JSGCArena *getPrevUnmarked() const {
|
||||
JS_ASSERT(hasPrevUnmarked());
|
||||
|
@ -520,7 +520,7 @@ IsMarkedGCThing(JSGCArena *a, void *thing)
|
|||
{
|
||||
JS_ASSERT(a == JSGCArena::fromGCThing(thing));
|
||||
jsuword index = ThingToGCCellIndex(thing);
|
||||
return JS_TEST_BIT(a->markBitmap, index);
|
||||
return !!JS_TEST_BIT(a->markBitmap, index);
|
||||
}
|
||||
|
||||
inline bool
|
||||
|
@ -529,7 +529,7 @@ IsMarkedGCThing(JSGCArena *a, jsuword thingOffset)
|
|||
JS_ASSERT(thingOffset < GC_ARENA_CELLS_SIZE);
|
||||
JS_ASSERT(!(thingOffset & GC_CELL_MASK));
|
||||
jsuword index = thingOffset >> GC_CELL_SHIFT;
|
||||
return JS_TEST_BIT(a->markBitmap, index);
|
||||
return !!JS_TEST_BIT(a->markBitmap, index);
|
||||
}
|
||||
|
||||
inline bool
|
||||
|
@ -1060,7 +1060,7 @@ js_DumpGCStats(JSRuntime *rt, FILE *fp)
|
|||
sumThings += st->nthings;
|
||||
sumMaxThings += st->maxthings;
|
||||
sumThingSize += thingSize * st->nthings;
|
||||
sumTotalThingSize += thingSize * st->totalthings;
|
||||
sumTotalThingSize += size_t(thingSize * st->totalthings);
|
||||
sumArenaCapacity += thingSize * thingsPerArena * st->narenas;
|
||||
sumTotalArenaCapacity += thingSize * thingsPerArena * st->totalarenas;
|
||||
sumAlloc += st->alloc;
|
||||
|
|
|
@ -155,7 +155,7 @@ js_FillPropertyCache(JSContext *cx, JSObject *obj,
|
|||
|
||||
protoIndex = 1;
|
||||
for (;;) {
|
||||
tmp = OBJ_GET_PROTO(cx, tmp);
|
||||
tmp = tmp->getProto();
|
||||
|
||||
/*
|
||||
* We cannot cache properties coming from native objects behind
|
||||
|
@ -295,7 +295,7 @@ js_FillPropertyCache(JSContext *cx, JSObject *obj,
|
|||
* matching empty scope. In unusual cases involving
|
||||
* __proto__ assignment we may not find one.
|
||||
*/
|
||||
JSObject *proto = STOBJ_GET_PROTO(obj);
|
||||
JSObject *proto = obj->getProto();
|
||||
if (!proto || !OBJ_IS_NATIVE(proto))
|
||||
return JS_NO_PROP_CACHE_FILL;
|
||||
JSScope *protoscope = OBJ_SCOPE(proto);
|
||||
|
@ -335,7 +335,7 @@ js_FillPropertyCache(JSContext *cx, JSObject *obj,
|
|||
#ifdef DEBUG
|
||||
if (scopeIndex == 0) {
|
||||
JS_ASSERT(protoIndex != 0);
|
||||
JS_ASSERT((protoIndex == 1) == (OBJ_GET_PROTO(cx, obj) == pobj));
|
||||
JS_ASSERT((protoIndex == 1) == (obj->getProto() == pobj));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -454,7 +454,7 @@ js_FullTestPropertyCache(JSContext *cx, jsbytecode *pc,
|
|||
}
|
||||
|
||||
while (vcap & PCVCAP_PROTOMASK) {
|
||||
tmp = OBJ_GET_PROTO(cx, pobj);
|
||||
tmp = pobj->getProto();
|
||||
if (!tmp || !OBJ_IS_NATIVE(tmp))
|
||||
break;
|
||||
pobj = tmp;
|
||||
|
@ -783,7 +783,7 @@ js_GetScopeChain(JSContext *cx, JSStackFrame *fp)
|
|||
* be a block either. So we can just grab limitClone's prototype here
|
||||
* regardless of its type or which frame it belongs to.
|
||||
*/
|
||||
limitBlock = OBJ_GET_PROTO(cx, limitClone);
|
||||
limitBlock = limitClone->getProto();
|
||||
|
||||
/* If the innermost block has already been cloned, we are done. */
|
||||
if (limitBlock == sharedBlock)
|
||||
|
@ -808,7 +808,7 @@ js_GetScopeChain(JSContext *cx, JSStackFrame *fp)
|
|||
*/
|
||||
JSObject *newChild = innermostNewChild;
|
||||
for (;;) {
|
||||
JS_ASSERT(OBJ_GET_PROTO(cx, newChild) == sharedBlock);
|
||||
JS_ASSERT(newChild->getProto() == sharedBlock);
|
||||
sharedBlock = OBJ_GET_PARENT(cx, sharedBlock);
|
||||
|
||||
/* Sometimes limitBlock will be NULL, so check that first. */
|
||||
|
|
|
@ -190,12 +190,17 @@ StackBase(JSStackFrame *fp)
|
|||
return fp->slots + fp->script->nfixed;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
void
|
||||
JSStackFrame::assertValidStackDepth(uintN depth)
|
||||
{
|
||||
JS_ASSERT(0 <= regs->sp - StackBase(this));
|
||||
JS_ASSERT(depth <= uintptr_t(regs->sp - StackBase(this)));
|
||||
}
|
||||
#else
|
||||
void
|
||||
JSStackFrame::assertValidStackDepth(uintN /*depth*/){}
|
||||
#endif
|
||||
|
||||
static JS_INLINE uintN
|
||||
GlobalVarCount(JSStackFrame *fp)
|
||||
|
@ -416,7 +421,7 @@ js_FillPropertyCache(JSContext *cx, JSObject *obj,
|
|||
pobj = obj; \
|
||||
JS_ASSERT(PCVCAP_TAG(entry->vcap) <= 1); \
|
||||
if (PCVCAP_TAG(entry->vcap) == 1 && \
|
||||
(tmp_ = OBJ_GET_PROTO(cx, pobj)) != NULL) { \
|
||||
(tmp_ = pobj->getProto()) != NULL) { \
|
||||
pobj = tmp_; \
|
||||
} \
|
||||
\
|
||||
|
|
|
@ -180,7 +180,7 @@ InitNativeIterator(JSContext *cx, JSObject *iterobj, JSObject *obj, uintN flags)
|
|||
* store the original object.
|
||||
*/
|
||||
JS_ASSERT(obj != iterobj);
|
||||
STOBJ_SET_PROTO(iterobj, obj);
|
||||
iterobj->setProto(obj);
|
||||
}
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
@ -484,7 +484,7 @@ CallEnumeratorNext(JSContext *cx, JSObject *iterobj, uintN flags, jsval *rval)
|
|||
JS_ASSERT(STOBJ_GET_CLASS(iterobj) == &js_IteratorClass);
|
||||
|
||||
obj = STOBJ_GET_PARENT(iterobj);
|
||||
origobj = STOBJ_GET_PROTO(iterobj);
|
||||
origobj = iterobj->getProto();
|
||||
state = STOBJ_GET_SLOT(iterobj, JSSLOT_ITER_STATE);
|
||||
if (JSVAL_IS_NULL(state))
|
||||
goto stop;
|
||||
|
@ -530,7 +530,7 @@ CallEnumeratorNext(JSContext *cx, JSObject *iterobj, uintN flags, jsval *rval)
|
|||
} else
|
||||
#endif
|
||||
{
|
||||
obj = OBJ_GET_PROTO(cx, obj);
|
||||
obj = obj->getProto();
|
||||
if (obj) {
|
||||
STOBJ_SET_PARENT(iterobj, obj);
|
||||
if (!obj->enumerate(cx, JSENUMERATE_INIT, &state, NULL))
|
||||
|
|
|
@ -421,7 +421,7 @@ num_toString(JSContext *cx, uintN argc, jsval *vp)
|
|||
static JSBool
|
||||
num_toLocaleString(JSContext *cx, uintN argc, jsval *vp)
|
||||
{
|
||||
char thousandsLength, decimalLength;
|
||||
size_t thousandsLength, decimalLength;
|
||||
const char *numGrouping, *tmpGroup;
|
||||
JSRuntime *rt;
|
||||
JSString *numStr, *str;
|
||||
|
@ -885,7 +885,7 @@ js_NumberToStringWithBase(JSContext *cx, jsdouble d, jsint base)
|
|||
if (jsuint(i) < jsuint(base)) {
|
||||
if (i < 10)
|
||||
return JSString::intString(i);
|
||||
return JSString::unitString('a' + i - 10);
|
||||
return JSString::unitString(jschar('a' + i - 10));
|
||||
}
|
||||
}
|
||||
numStr = NumberToCString(cx, d, base, buf, sizeof buf);
|
||||
|
|
|
@ -305,7 +305,7 @@ js_SetProtoOrParent(JSContext *cx, JSObject *obj, uint32 slot, JSObject *pobj,
|
|||
JS_LOCK_OBJ(cx, oldproto);
|
||||
JSScope *scope = OBJ_SCOPE(oldproto);
|
||||
scope->protoShapeChange(cx);
|
||||
JSObject *tmp = STOBJ_GET_PROTO(oldproto);
|
||||
JSObject *tmp = oldproto->getProto();
|
||||
JS_UNLOCK_OBJ(cx, oldproto);
|
||||
oldproto = tmp;
|
||||
}
|
||||
|
@ -1595,7 +1595,7 @@ obj_watch(JSContext *cx, uintN argc, jsval *vp)
|
|||
return JS_TRUE;
|
||||
*vp = JSVAL_VOID;
|
||||
|
||||
if (OBJ_IS_DENSE_ARRAY(cx, obj) && !js_MakeArraySlow(cx, obj))
|
||||
if (obj->isDenseArray() && !js_MakeArraySlow(cx, obj))
|
||||
return JS_FALSE;
|
||||
return JS_SetWatchPoint(cx, obj, userid, obj_watch_handler, callable);
|
||||
}
|
||||
|
@ -2571,7 +2571,7 @@ DefinePropertyArray(JSContext *cx, JSObject *obj, const PropertyDescriptor &desc
|
|||
* attributes). Such definitions are probably unlikely, so we don't bother
|
||||
* for now.
|
||||
*/
|
||||
if (OBJ_IS_DENSE_ARRAY(cx, obj) && !js_MakeArraySlow(cx, obj))
|
||||
if (obj->isDenseArray() && !js_MakeArraySlow(cx, obj))
|
||||
return JS_FALSE;
|
||||
|
||||
jsuint oldLen = obj->fslots[JSSLOT_ARRAY_LENGTH];
|
||||
|
@ -2616,7 +2616,7 @@ static JSBool
|
|||
DefineProperty(JSContext *cx, JSObject *obj, const PropertyDescriptor &desc, bool throwError,
|
||||
bool *rval)
|
||||
{
|
||||
if (OBJ_IS_ARRAY(cx, obj))
|
||||
if (obj->isArray())
|
||||
return DefinePropertyArray(cx, obj, desc, throwError, rval);
|
||||
|
||||
if (!OBJ_IS_NATIVE(obj))
|
||||
|
@ -2831,7 +2831,7 @@ static inline bool
|
|||
InitScopeForObject(JSContext* cx, JSObject* obj, JSObject* proto, JSObjectOps* ops)
|
||||
{
|
||||
JS_ASSERT(ops->isNative());
|
||||
JS_ASSERT(proto == OBJ_GET_PROTO(cx, obj));
|
||||
JS_ASSERT(proto == obj->getProto());
|
||||
|
||||
/* Share proto's emptyScope only if obj is similar to proto. */
|
||||
JSClass *clasp = OBJ_GET_CLASS(cx, obj);
|
||||
|
@ -3243,7 +3243,7 @@ with_LookupProperty(JSContext *cx, JSObject *obj, jsid id, JSObject **objp,
|
|||
flags = js_InferFlags(cx, flags);
|
||||
flags |= JSRESOLVE_WITH;
|
||||
JSAutoResolveFlags rf(cx, flags);
|
||||
JSObject *proto = OBJ_GET_PROTO(cx, obj);
|
||||
JSObject *proto = obj->getProto();
|
||||
if (!proto)
|
||||
return js_LookupProperty(cx, obj, id, objp, propp);
|
||||
return proto->lookupProperty(cx, id, objp, propp);
|
||||
|
@ -3252,7 +3252,7 @@ with_LookupProperty(JSContext *cx, JSObject *obj, jsid id, JSObject **objp,
|
|||
static JSBool
|
||||
with_GetProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
|
||||
{
|
||||
JSObject *proto = OBJ_GET_PROTO(cx, obj);
|
||||
JSObject *proto = obj->getProto();
|
||||
if (!proto)
|
||||
return js_GetProperty(cx, obj, id, vp);
|
||||
return proto->getProperty(cx, id, vp);
|
||||
|
@ -3261,7 +3261,7 @@ with_GetProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
|
|||
static JSBool
|
||||
with_SetProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
|
||||
{
|
||||
JSObject *proto = OBJ_GET_PROTO(cx, obj);
|
||||
JSObject *proto = obj->getProto();
|
||||
if (!proto)
|
||||
return js_SetProperty(cx, obj, id, vp);
|
||||
return proto->setProperty(cx, id, vp);
|
||||
|
@ -3271,7 +3271,7 @@ static JSBool
|
|||
with_GetAttributes(JSContext *cx, JSObject *obj, jsid id, JSProperty *prop,
|
||||
uintN *attrsp)
|
||||
{
|
||||
JSObject *proto = OBJ_GET_PROTO(cx, obj);
|
||||
JSObject *proto = obj->getProto();
|
||||
if (!proto)
|
||||
return js_GetAttributes(cx, obj, id, prop, attrsp);
|
||||
return proto->getAttributes(cx, id, prop, attrsp);
|
||||
|
@ -3281,7 +3281,7 @@ static JSBool
|
|||
with_SetAttributes(JSContext *cx, JSObject *obj, jsid id, JSProperty *prop,
|
||||
uintN *attrsp)
|
||||
{
|
||||
JSObject *proto = OBJ_GET_PROTO(cx, obj);
|
||||
JSObject *proto = obj->getProto();
|
||||
if (!proto)
|
||||
return js_SetAttributes(cx, obj, id, prop, attrsp);
|
||||
return proto->setAttributes(cx, id, prop, attrsp);
|
||||
|
@ -3290,7 +3290,7 @@ with_SetAttributes(JSContext *cx, JSObject *obj, jsid id, JSProperty *prop,
|
|||
static JSBool
|
||||
with_DeleteProperty(JSContext *cx, JSObject *obj, jsid id, jsval *rval)
|
||||
{
|
||||
JSObject *proto = OBJ_GET_PROTO(cx, obj);
|
||||
JSObject *proto = obj->getProto();
|
||||
if (!proto)
|
||||
return js_DeleteProperty(cx, obj, id, rval);
|
||||
return proto->deleteProperty(cx, id, rval);
|
||||
|
@ -3299,7 +3299,7 @@ with_DeleteProperty(JSContext *cx, JSObject *obj, jsid id, jsval *rval)
|
|||
static JSBool
|
||||
with_DefaultValue(JSContext *cx, JSObject *obj, JSType hint, jsval *vp)
|
||||
{
|
||||
JSObject *proto = OBJ_GET_PROTO(cx, obj);
|
||||
JSObject *proto = obj->getProto();
|
||||
if (!proto)
|
||||
return js_DefaultValue(cx, obj, hint, vp);
|
||||
return proto->defaultValue(cx, hint, vp);
|
||||
|
@ -3309,7 +3309,7 @@ static JSBool
|
|||
with_Enumerate(JSContext *cx, JSObject *obj, JSIterateOp enum_op,
|
||||
jsval *statep, jsid *idp)
|
||||
{
|
||||
JSObject *proto = OBJ_GET_PROTO(cx, obj);
|
||||
JSObject *proto = obj->getProto();
|
||||
if (!proto)
|
||||
return js_Enumerate(cx, obj, enum_op, statep, idp);
|
||||
return proto->enumerate(cx, enum_op, statep, idp);
|
||||
|
@ -3319,7 +3319,7 @@ static JSBool
|
|||
with_CheckAccess(JSContext *cx, JSObject *obj, jsid id, JSAccessMode mode,
|
||||
jsval *vp, uintN *attrsp)
|
||||
{
|
||||
JSObject *proto = OBJ_GET_PROTO(cx, obj);
|
||||
JSObject *proto = obj->getProto();
|
||||
if (!proto)
|
||||
return js_CheckAccess(cx, obj, id, mode, vp, attrsp);
|
||||
return proto->checkAccess(cx, id, mode, vp, attrsp);
|
||||
|
@ -3334,7 +3334,7 @@ with_TypeOf(JSContext *cx, JSObject *obj)
|
|||
static JSObject *
|
||||
with_ThisObject(JSContext *cx, JSObject *obj)
|
||||
{
|
||||
JSObject *proto = OBJ_GET_PROTO(cx, obj);
|
||||
JSObject *proto = obj->getProto();
|
||||
if (!proto)
|
||||
return obj;
|
||||
return proto->thisObject(cx);
|
||||
|
@ -3804,7 +3804,7 @@ js_InitClass(JSContext *cx, JSObject *obj, JSObject *parent_proto,
|
|||
|
||||
/* Bootstrap Function.prototype (see also JS_InitStandardClasses). */
|
||||
if (OBJ_GET_CLASS(cx, ctor) == clasp)
|
||||
OBJ_SET_PROTO(cx, ctor, proto);
|
||||
ctor->setProto(proto);
|
||||
}
|
||||
|
||||
/* Add properties and methods to the prototype and the constructor. */
|
||||
|
@ -4308,7 +4308,7 @@ PurgeProtoChain(JSContext *cx, JSObject *obj, jsid id)
|
|||
|
||||
while (obj) {
|
||||
if (!OBJ_IS_NATIVE(obj)) {
|
||||
obj = OBJ_GET_PROTO(cx, obj);
|
||||
obj = obj->getProto();
|
||||
continue;
|
||||
}
|
||||
JS_LOCK_OBJ(cx, obj);
|
||||
|
@ -4675,7 +4675,7 @@ js_LookupPropertyWithFlags(JSContext *cx, JSObject *obj, jsid id, uintN flags,
|
|||
}
|
||||
protoIndex = 0;
|
||||
for (proto = start; proto && proto != obj2;
|
||||
proto = OBJ_GET_PROTO(cx, proto)) {
|
||||
proto = proto->getProto()) {
|
||||
protoIndex++;
|
||||
}
|
||||
if (!OBJ_IS_NATIVE(obj2)) {
|
||||
|
@ -4815,7 +4815,7 @@ js_FindPropertyHelper(JSContext *cx, jsid id, JSBool cacheResult,
|
|||
JS_ASSERT(protoIndex == 1);
|
||||
} else {
|
||||
/* Call and DeclEnvClass objects have no prototypes. */
|
||||
JS_ASSERT(!OBJ_GET_PROTO(cx, obj));
|
||||
JS_ASSERT(!obj->getProto());
|
||||
JS_ASSERT(protoIndex == 0);
|
||||
}
|
||||
}
|
||||
|
@ -5072,7 +5072,7 @@ js_GetPropertyHelper(JSContext *cx, JSObject *obj, jsid id, uintN getHow,
|
|||
/* Convert string indices to integers if appropriate. */
|
||||
id = js_CheckForStringIndex(id);
|
||||
|
||||
aobj = js_GetProtoIfDenseArray(cx, obj);
|
||||
aobj = js_GetProtoIfDenseArray(obj);
|
||||
protoIndex = js_LookupPropertyWithFlags(cx, aobj, id, cx->resolveFlags,
|
||||
&obj2, &prop);
|
||||
if (protoIndex < 0)
|
||||
|
@ -5172,7 +5172,7 @@ js_GetMethod(JSContext *cx, JSObject *obj, jsid id, uintN getHow, jsval *vp)
|
|||
obj->map->ops->getProperty == js_GetProperty) {
|
||||
return js_GetPropertyHelper(cx, obj, id, getHow, vp);
|
||||
}
|
||||
JS_ASSERT_IF(getHow & JSGET_CACHE_RESULT, OBJ_IS_DENSE_ARRAY(cx, obj));
|
||||
JS_ASSERT_IF(getHow & JSGET_CACHE_RESULT, obj->isDenseArray());
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
if (OBJECT_IS_XML(cx, obj))
|
||||
return js_GetXMLMethod(cx, obj, id, vp);
|
||||
|
@ -5962,7 +5962,7 @@ js_CheckAccess(JSContext *cx, JSObject *obj, jsid id, JSAccessMode mode,
|
|||
case JSACC_PROTO:
|
||||
pobj = obj;
|
||||
if (!writing)
|
||||
*vp = OBJECT_TO_JSVAL(OBJ_GET_PROTO(cx, obj));
|
||||
*vp = OBJECT_TO_JSVAL(obj->getProto());
|
||||
*attrsp = JSPROP_PERMANENT;
|
||||
break;
|
||||
|
||||
|
@ -6208,7 +6208,7 @@ js_IsDelegate(JSContext *cx, JSObject *obj, jsval v, JSBool *bp)
|
|||
if (JSVAL_IS_PRIMITIVE(v))
|
||||
return JS_TRUE;
|
||||
obj2 = js_GetWrappedObject(cx, JSVAL_TO_OBJECT(v));
|
||||
while ((obj2 = OBJ_GET_PROTO(cx, obj2)) != NULL) {
|
||||
while ((obj2 = obj2->getProto()) != NULL) {
|
||||
if (obj2 == obj) {
|
||||
*bp = JS_TRUE;
|
||||
break;
|
||||
|
@ -6814,7 +6814,7 @@ JSObject::isCallable()
|
|||
if (isNative())
|
||||
return isFunction() || getClass()->call;
|
||||
|
||||
return map->ops->call;
|
||||
return !!map->ops->call;
|
||||
}
|
||||
|
||||
JSBool
|
||||
|
@ -7018,7 +7018,7 @@ js_DumpObject(JSObject *obj)
|
|||
}
|
||||
|
||||
fprintf(stderr, "proto ");
|
||||
dumpValue(OBJECT_TO_JSVAL(STOBJ_GET_PROTO(obj)));
|
||||
dumpValue(OBJECT_TO_JSVAL(obj->getProto()));
|
||||
fputc('\n', stderr);
|
||||
|
||||
fprintf(stderr, "parent ");
|
||||
|
|
|
@ -188,6 +188,11 @@ struct JSObjectMap {
|
|||
explicit JSObjectMap(const JSObjectOps *ops, uint32 shape) : ops(ops), shape(shape) {}
|
||||
|
||||
enum { SHAPELESS = 0xffffffff };
|
||||
|
||||
private:
|
||||
/* No copy or assignment semantics. */
|
||||
JSObjectMap(JSObjectMap &);
|
||||
void operator=(JSObjectMap &);
|
||||
};
|
||||
|
||||
const uint32 JS_INITIAL_NSLOTS = 5;
|
||||
|
@ -362,7 +367,7 @@ struct JSObject {
|
|||
inline void initSharingEmptyScope(JSClass *clasp, JSObject *proto, JSObject *parent,
|
||||
jsval privateSlotValue);
|
||||
|
||||
inline bool hasSlotsArray() const { return dslots; }
|
||||
inline bool hasSlotsArray() const { return !!dslots; }
|
||||
|
||||
/* This method can only be called when hasSlotsArray() returns true. */
|
||||
inline void freeSlotsArray(JSContext *cx);
|
||||
|
@ -441,18 +446,10 @@ struct JSObject {
|
|||
/* Compatibility macros. */
|
||||
#define OBJ_IS_NATIVE(obj) ((obj)->isNative())
|
||||
|
||||
#define STOBJ_GET_PROTO(obj) ((obj)->getProto())
|
||||
#define STOBJ_SET_PROTO(obj,proto) ((obj)->setProto(proto))
|
||||
#define STOBJ_CLEAR_PROTO(obj) ((obj)->clearProto())
|
||||
|
||||
#define STOBJ_GET_PARENT(obj) ((obj)->getParent())
|
||||
#define STOBJ_SET_PARENT(obj,parent) ((obj)->setParent(parent))
|
||||
#define STOBJ_CLEAR_PARENT(obj) ((obj)->clearParent())
|
||||
|
||||
#define OBJ_GET_PROTO(cx,obj) STOBJ_GET_PROTO(obj)
|
||||
#define OBJ_SET_PROTO(cx,obj,proto) STOBJ_SET_PROTO(obj, proto)
|
||||
#define OBJ_CLEAR_PROTO(cx,obj) STOBJ_CLEAR_PROTO(obj)
|
||||
|
||||
#define OBJ_GET_PARENT(cx,obj) STOBJ_GET_PARENT(obj)
|
||||
#define OBJ_SET_PARENT(cx,obj,parent) STOBJ_SET_PARENT(obj, parent)
|
||||
#define OBJ_CLEAR_PARENT(cx,obj) STOBJ_CLEAR_PARENT(obj)
|
||||
|
|
|
@ -369,7 +369,7 @@ JO(JSContext *cx, jsval *vp, StringifyContext *scx)
|
|||
if (iterObj) {
|
||||
// Always close the iterator, but make sure not to stomp on OK
|
||||
JS_ASSERT(OBJECT_TO_JSVAL(iterObj) == *keySource);
|
||||
ok &= js_CloseIterator(cx, *keySource);
|
||||
ok &= !!js_CloseIterator(cx, *keySource);
|
||||
}
|
||||
|
||||
if (!ok)
|
||||
|
@ -590,7 +590,7 @@ Walk(JSContext *cx, jsid id, JSObject *holder, jsval reviver, jsval *vp)
|
|||
jsval propValue = JSVAL_NULL;
|
||||
JSAutoTempValueRooter tvr(cx, 1, &propValue);
|
||||
|
||||
if(OBJ_IS_ARRAY(cx, obj)) {
|
||||
if(obj->isArray()) {
|
||||
jsuint length = 0;
|
||||
if (!js_GetLengthProperty(cx, obj, &length))
|
||||
return JS_FALSE;
|
||||
|
@ -778,7 +778,7 @@ static JSBool
|
|||
PushValue(JSContext *cx, JSONParser *jp, JSObject *parent, jsval value)
|
||||
{
|
||||
JSBool ok;
|
||||
if (OBJ_IS_ARRAY(cx, parent)) {
|
||||
if (parent->isArray()) {
|
||||
jsuint len;
|
||||
ok = js_GetLengthProperty(cx, parent, &len);
|
||||
if (ok) {
|
||||
|
|
|
@ -261,6 +261,12 @@ extern uintN js_NumCodeSpecs;
|
|||
extern const char *js_CodeName[];
|
||||
extern const char js_EscapeMap[];
|
||||
|
||||
/* Silence unreferenced formal parameter warnings */
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4100)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Return a GC'ed string containing the chars in str, with any non-printing
|
||||
* chars or quotes (' or " as specified by the quote argument) escaped, and
|
||||
|
@ -464,6 +470,10 @@ js_DecompileValueGenerator(JSContext *cx, intN spindex, jsval v,
|
|||
extern uintN
|
||||
js_ReconstructStackDepth(JSContext *cx, JSScript *script, jsbytecode *pc);
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
JS_END_EXTERN_C
|
||||
|
||||
#endif /* jsopcode_h___ */
|
||||
|
|
|
@ -1490,7 +1490,7 @@ BEGIN_CASE(JSOP_GETXPROP)
|
|||
* assuming any property gets it does (e.g., for 'toString'
|
||||
* from JSOP_NEW) will not be leaked to the calling script.
|
||||
*/
|
||||
aobj = js_GetProtoIfDenseArray(cx, obj);
|
||||
aobj = js_GetProtoIfDenseArray(obj);
|
||||
if (JS_LIKELY(aobj->map->ops->getProperty == js_GetProperty)) {
|
||||
PROPERTY_CACHE_TEST(cx, regs.pc, aobj, obj2, entry, atom);
|
||||
if (!atom) {
|
||||
|
@ -1540,7 +1540,7 @@ BEGIN_CASE(JSOP_LENGTH)
|
|||
str = JSVAL_TO_STRING(lval);
|
||||
regs.sp[-1] = INT_TO_JSVAL(str->length());
|
||||
} else if (!JSVAL_IS_PRIMITIVE(lval) &&
|
||||
(obj = JSVAL_TO_OBJECT(lval), OBJ_IS_ARRAY(cx, obj))) {
|
||||
(obj = JSVAL_TO_OBJECT(lval), obj->isArray())) {
|
||||
jsuint length;
|
||||
|
||||
/*
|
||||
|
@ -1586,7 +1586,7 @@ BEGIN_CASE(JSOP_CALLPROP)
|
|||
goto error;
|
||||
}
|
||||
|
||||
aobj = js_GetProtoIfDenseArray(cx, obj);
|
||||
aobj = js_GetProtoIfDenseArray(obj);
|
||||
if (JS_LIKELY(aobj->map->ops->getProperty == js_GetProperty)) {
|
||||
PROPERTY_CACHE_TEST(cx, regs.pc, aobj, obj2, entry, atom);
|
||||
if (!atom) {
|
||||
|
@ -1731,7 +1731,7 @@ BEGIN_CASE(JSOP_SETMETHOD)
|
|||
bool checkForAdd;
|
||||
if (sprop->attrs & JSPROP_SHARED) {
|
||||
if (PCVCAP_TAG(entry->vcap) == 0 ||
|
||||
((obj2 = OBJ_GET_PROTO(cx, obj)) &&
|
||||
((obj2 = obj->getProto()) &&
|
||||
OBJ_IS_NATIVE(obj2) &&
|
||||
OBJ_SHAPE(obj2) == PCVCAP_SHAPE(entry->vcap))) {
|
||||
goto fast_set_propcache_hit;
|
||||
|
@ -1897,7 +1897,7 @@ BEGIN_CASE(JSOP_GETELEM)
|
|||
|
||||
VALUE_TO_OBJECT(cx, -2, lval, obj);
|
||||
if (JSVAL_IS_INT(rval)) {
|
||||
if (OBJ_IS_DENSE_ARRAY(cx, obj)) {
|
||||
if (obj->isDenseArray()) {
|
||||
jsuint length;
|
||||
|
||||
length = js_DenseArrayCapacity(obj);
|
||||
|
@ -1946,7 +1946,7 @@ BEGIN_CASE(JSOP_SETELEM)
|
|||
FETCH_OBJECT(cx, -3, lval, obj);
|
||||
FETCH_ELEMENT_ID(obj, -2, id);
|
||||
do {
|
||||
if (OBJ_IS_DENSE_ARRAY(cx, obj) && JSID_IS_INT(id)) {
|
||||
if (obj->isDenseArray() && JSID_IS_INT(id)) {
|
||||
jsuint length;
|
||||
|
||||
length = js_DenseArrayCapacity(obj);
|
||||
|
@ -3528,7 +3528,7 @@ BEGIN_CASE(JSOP_INITELEM)
|
|||
* initialiser, set the array length to one greater than id.
|
||||
*/
|
||||
if (rval == JSVAL_HOLE) {
|
||||
JS_ASSERT(OBJ_IS_ARRAY(cx, obj));
|
||||
JS_ASSERT(obj->isArray());
|
||||
JS_ASSERT(JSID_IS_INT(id));
|
||||
JS_ASSERT(jsuint(JSID_TO_INT(id)) < JS_ARGS_LENGTH_MAX);
|
||||
if (js_GetOpcode(cx, script, regs.pc + JSOP_INITELEM_LENGTH) == JSOP_ENDINIT &&
|
||||
|
@ -4026,7 +4026,7 @@ BEGIN_CASE(JSOP_ENTERBLOCK)
|
|||
obj2 = OBJ_GET_PARENT(cx, obj2);
|
||||
if (clasp == &js_BlockClass &&
|
||||
obj2->getPrivate() == fp) {
|
||||
JSObject *youngestProto = OBJ_GET_PROTO(cx, obj2);
|
||||
JSObject *youngestProto = obj2->getProto();
|
||||
JS_ASSERT(!OBJ_IS_CLONED_BLOCK(youngestProto));
|
||||
parent = obj;
|
||||
while ((parent = OBJ_GET_PARENT(cx, parent)) != youngestProto)
|
||||
|
@ -4052,7 +4052,7 @@ BEGIN_CASE(JSOP_LEAVEBLOCK)
|
|||
* the stack into the clone, and pop it off the chain.
|
||||
*/
|
||||
obj = fp->scopeChain;
|
||||
if (OBJ_GET_PROTO(cx, obj) == fp->blockChain) {
|
||||
if (obj->getProto() == fp->blockChain) {
|
||||
JS_ASSERT (OBJ_GET_CLASS(cx, obj) == &js_BlockClass);
|
||||
if (!js_PutBlockObject(cx, JS_TRUE))
|
||||
goto error;
|
||||
|
|
|
@ -1826,7 +1826,7 @@ JSCompiler::newFunction(JSTreeContext *tc, JSAtom *atom, uintN lambda)
|
|||
|
||||
if (fun && !(tc->flags & TCF_COMPILE_N_GO)) {
|
||||
STOBJ_CLEAR_PARENT(FUN_OBJECT(fun));
|
||||
STOBJ_CLEAR_PROTO(FUN_OBJECT(fun));
|
||||
FUN_OBJECT(fun)->clearProto();
|
||||
}
|
||||
return fun;
|
||||
}
|
||||
|
@ -8605,7 +8605,7 @@ PrimaryExpr(JSContext *cx, JSTokenStream *ts, JSTreeContext *tc,
|
|||
return NULL;
|
||||
if (!(tc->flags & TCF_COMPILE_N_GO)) {
|
||||
STOBJ_CLEAR_PARENT(obj);
|
||||
STOBJ_CLEAR_PROTO(obj);
|
||||
obj->clearProto();
|
||||
}
|
||||
|
||||
pn->pn_objbox = tc->compiler->newObjectBox(obj);
|
||||
|
|
|
@ -147,7 +147,7 @@ extern "C++" {
|
|||
namespace js {
|
||||
|
||||
class TraceRecorder;
|
||||
class TraceMonitor;
|
||||
struct TraceMonitor;
|
||||
class CallStack;
|
||||
|
||||
class ContextAllocPolicy;
|
||||
|
|
|
@ -236,7 +236,7 @@ TraceRecorder::upRecursion()
|
|||
*/
|
||||
fi->spdist = cx->fp->down->regs->sp - cx->fp->down->slots;
|
||||
JS_ASSERT(cx->fp->argc == cx->fp->down->argc);
|
||||
fi->set_argc(cx->fp->argc, false);
|
||||
fi->set_argc(uint16(cx->fp->argc), false);
|
||||
fi->callerHeight = downPostSlots;
|
||||
fi->callerArgc = cx->fp->down->argc;
|
||||
|
||||
|
|
|
@ -502,7 +502,7 @@ ProcessOp(CompilerState *state, REOpData *opData, RENode **operandStack,
|
|||
(state->flags & JSREG_FOLD) == 0) {
|
||||
result->op = REOP_ALTPREREQ2;
|
||||
result->u.altprereq.ch1 = ((RENode *) result->u.kid2)->u.flat.chr;
|
||||
result->u.altprereq.ch2 = ((RENode *) result->kid)->u.ucclass.index;
|
||||
result->u.altprereq.ch2 = jschar(((RENode *) result->kid)->u.ucclass.index);
|
||||
/* ALTPREREQ2, <end>, uch1, uch2, <next>, ...,
|
||||
JUMP, <end> ... ENDALT */
|
||||
state->progLength += 13;
|
||||
|
@ -515,7 +515,7 @@ ProcessOp(CompilerState *state, REOpData *opData, RENode **operandStack,
|
|||
result->op = REOP_ALTPREREQ2;
|
||||
result->u.altprereq.ch1 = ((RENode *) result->kid)->u.flat.chr;
|
||||
result->u.altprereq.ch2 =
|
||||
((RENode *) result->u.kid2)->u.ucclass.index;
|
||||
jschar(((RENode *) result->u.kid2)->u.ucclass.index);
|
||||
/* ALTPREREQ2, <end>, uch1, uch2, <next>, ...,
|
||||
JUMP, <end> ... ENDALT */
|
||||
state->progLength += 13;
|
||||
|
@ -934,7 +934,7 @@ CalculateBitmapSize(CompilerState *state, RENode *target, const jschar *src,
|
|||
|
||||
while (src != end) {
|
||||
JSBool canStartRange = JS_TRUE;
|
||||
uintN localMax = 0;
|
||||
jschar localMax = 0;
|
||||
|
||||
switch (*src) {
|
||||
case '\\':
|
||||
|
@ -987,7 +987,7 @@ lexHex:
|
|||
}
|
||||
n = (n << 4) | digit;
|
||||
}
|
||||
localMax = n;
|
||||
localMax = jschar(n);
|
||||
break;
|
||||
case 'd':
|
||||
canStartRange = JS_FALSE;
|
||||
|
@ -1048,7 +1048,7 @@ lexHex:
|
|||
src--;
|
||||
}
|
||||
}
|
||||
localMax = n;
|
||||
localMax = jschar(n);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -1089,8 +1089,8 @@ lexHex:
|
|||
for (i = rangeStart; i <= localMax; i++) {
|
||||
jschar uch, dch;
|
||||
|
||||
uch = upcase(i);
|
||||
dch = inverse_upcase(i);
|
||||
uch = jschar(upcase(i));
|
||||
dch = inverse_upcase(jschar(i));
|
||||
maxch = JS_MAX(maxch, uch);
|
||||
maxch = JS_MAX(maxch, dch);
|
||||
}
|
||||
|
@ -1098,9 +1098,9 @@ lexHex:
|
|||
}
|
||||
|
||||
if (localMax > max)
|
||||
max = localMax;
|
||||
max = uintN(localMax);
|
||||
}
|
||||
target->u.ucclass.bmsize = max;
|
||||
target->u.ucclass.bmsize = uint16(max);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
@ -1973,7 +1973,7 @@ CompileRegExpToAST(JSContext* cx, JSTokenStream* ts,
|
|||
return JS_FALSE;
|
||||
state.cpbegin = state.cp;
|
||||
state.cpend = state.cp + len;
|
||||
state.flags = flags;
|
||||
state.flags = uint16(flags);
|
||||
state.parenCount = 0;
|
||||
state.classCount = 0;
|
||||
state.progLength = 0;
|
||||
|
@ -3405,7 +3405,7 @@ js_NewRegExp(JSContext *cx, JSTokenStream *ts,
|
|||
re = tmp;
|
||||
}
|
||||
|
||||
re->flags = flags;
|
||||
re->flags = uint16(flags);
|
||||
re->parenCount = state.parenCount;
|
||||
re->source = str;
|
||||
|
||||
|
@ -3888,9 +3888,9 @@ ProcessCharSet(JSContext *cx, JSRegExp *re, RECharSet *charSet)
|
|||
for (i = rangeStart; i <= thisCh; i++) {
|
||||
jschar uch, dch;
|
||||
|
||||
AddCharacterToCharSet(charSet, i);
|
||||
uch = upcase(i);
|
||||
dch = inverse_upcase(i);
|
||||
AddCharacterToCharSet(charSet, jschar(i));
|
||||
uch = jschar(upcase(i));
|
||||
dch = inverse_upcase(jschar(i));
|
||||
if (i != uch)
|
||||
AddCharacterToCharSet(charSet, uch);
|
||||
if (i != dch)
|
||||
|
@ -3902,7 +3902,7 @@ ProcessCharSet(JSContext *cx, JSRegExp *re, RECharSet *charSet)
|
|||
inRange = JS_FALSE;
|
||||
} else {
|
||||
if (re->flags & JSREG_FOLD) {
|
||||
AddCharacterToCharSet(charSet, upcase(thisCh));
|
||||
AddCharacterToCharSet(charSet, jschar(upcase(thisCh)));
|
||||
AddCharacterToCharSet(charSet, inverse_upcase(thisCh));
|
||||
} else {
|
||||
AddCharacterToCharSet(charSet, thisCh);
|
||||
|
@ -4977,7 +4977,7 @@ js_ExecuteRegExp(JSContext *cx, JSRegExp *re, JSString *str, size_t *indexp,
|
|||
|
||||
res = &cx->regExpStatics;
|
||||
res->input = str;
|
||||
res->parenCount = re->parenCount;
|
||||
res->parenCount = uint16(re->parenCount);
|
||||
if (re->parenCount == 0) {
|
||||
res->lastParen = js_EmptySubString;
|
||||
} else {
|
||||
|
@ -5115,7 +5115,7 @@ regexp_getProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
if (!JSVAL_IS_INT(id))
|
||||
return JS_TRUE;
|
||||
while (OBJ_GET_CLASS(cx, obj) != &js_RegExpClass) {
|
||||
obj = OBJ_GET_PROTO(cx, obj);
|
||||
obj = obj->getProto();
|
||||
if (!obj)
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
@ -5161,7 +5161,7 @@ regexp_setProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
if (!JSVAL_IS_INT(id))
|
||||
return ok;
|
||||
while (OBJ_GET_CLASS(cx, obj) != &js_RegExpClass) {
|
||||
obj = OBJ_GET_PROTO(cx, obj);
|
||||
obj = obj->getProto();
|
||||
if (!obj)
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
@ -5438,7 +5438,7 @@ js_XDRRegExpObject(JSXDRState *xdr, JSObject **objp)
|
|||
if (!obj)
|
||||
return JS_FALSE;
|
||||
STOBJ_CLEAR_PARENT(obj);
|
||||
STOBJ_CLEAR_PROTO(obj);
|
||||
obj->clearProto();
|
||||
re = js_NewRegExp(xdr->cx, NULL, source, (uint8)flagsword, JS_FALSE);
|
||||
if (!re)
|
||||
return JS_FALSE;
|
||||
|
|
|
@ -494,7 +494,8 @@ ReportCompileErrorNumberVA(JSContext *cx, JSTokenStream *ts, JSParseNode *pn,
|
|||
size_t linelength;
|
||||
jschar *linechars;
|
||||
char *linebytes;
|
||||
JSBool warning, ok;
|
||||
bool warning;
|
||||
JSBool ok;
|
||||
JSTokenPos *tp;
|
||||
uintN index, i;
|
||||
JSErrorReporter onError;
|
||||
|
@ -522,7 +523,7 @@ ReportCompileErrorNumberVA(JSContext *cx, JSTokenStream *ts, JSParseNode *pn,
|
|||
errorNumber, &message, &report,
|
||||
!(flags & JSREPORT_UC), ap);
|
||||
if (!ok) {
|
||||
warning = JS_FALSE;
|
||||
warning = false;
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
@ -541,14 +542,14 @@ ReportCompileErrorNumberVA(JSContext *cx, JSTokenStream *ts, JSParseNode *pn,
|
|||
linelength = ts->linebuf.limit - ts->linebuf.base;
|
||||
linechars = (jschar *)cx->malloc((linelength + 1) * sizeof(jschar));
|
||||
if (!linechars) {
|
||||
warning = JS_FALSE;
|
||||
warning = false;
|
||||
goto out;
|
||||
}
|
||||
memcpy(linechars, ts->linebuf.base, linelength * sizeof(jschar));
|
||||
linechars[linelength] = 0;
|
||||
linebytes = js_DeflateString(cx, linechars, linelength);
|
||||
if (!linebytes) {
|
||||
warning = JS_FALSE;
|
||||
warning = false;
|
||||
goto out;
|
||||
}
|
||||
report.linebuf = linebytes;
|
||||
|
|
|
@ -56,6 +56,8 @@
|
|||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4800)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4100) /* Silence unreferenced formal parameter warnings */
|
||||
#endif
|
||||
|
||||
JS_BEGIN_EXTERN_C
|
||||
|
@ -553,7 +555,7 @@ js_CastAsObjectJSVal(JSPropertyOp op)
|
|||
}
|
||||
|
||||
struct JSScopeProperty {
|
||||
friend class JSScope;
|
||||
friend struct JSScope;
|
||||
friend void js_SweepScopeProperties(JSContext *cx);
|
||||
friend JSScopeProperty * js_GetPropertyTreeChild(JSContext *cx, JSScopeProperty *parent,
|
||||
const JSScopeProperty &child);
|
||||
|
@ -600,8 +602,8 @@ private:
|
|||
|
||||
JSScopeProperty(jsid id, JSPropertyOp getter, JSPropertyOp setter, uint32 slot,
|
||||
uintN attrs, uintN flags, intN shortid)
|
||||
: id(id), rawGetter(getter), rawSetter(setter), slot(slot), attrs(attrs),
|
||||
flags(flags), shortid(shortid)
|
||||
: id(id), rawGetter(getter), rawSetter(setter), slot(slot), attrs(uint8(attrs)),
|
||||
flags(uint8(flags)), shortid(int16(shortid))
|
||||
{
|
||||
JS_ASSERT_IF(getter && (attrs & JSPROP_GETTER),
|
||||
JSVAL_TO_OBJECT(getterValue())->isCallable());
|
||||
|
@ -964,6 +966,7 @@ JS_END_EXTERN_C
|
|||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif /* jsscope_h___ */
|
||||
|
|
|
@ -130,7 +130,7 @@ JSScope::methodReadBarrier(JSContext *cx, JSScopeProperty *sprop, jsval *vp)
|
|||
if (!funobj)
|
||||
return false;
|
||||
*vp = OBJECT_TO_JSVAL(funobj);
|
||||
return js_SetPropertyHelper(cx, object, sprop->id, 0, vp);
|
||||
return !!js_SetPropertyHelper(cx, object, sprop->id, 0, vp);
|
||||
}
|
||||
|
||||
inline bool
|
||||
|
|
|
@ -1019,7 +1019,7 @@ js_NewScriptFromCG(JSContext *cx, JSCodeGenerator *cg)
|
|||
goto bad;
|
||||
}
|
||||
script->nslots = script->nfixed + cg->maxStackDepth;
|
||||
script->staticLevel = cg->staticLevel;
|
||||
script->staticLevel = uint16(cg->staticLevel);
|
||||
script->principals = cg->compiler->principals;
|
||||
if (script->principals)
|
||||
JSPRINCIPALS_HOLD(cx, script->principals);
|
||||
|
|
|
@ -2753,7 +2753,7 @@ TraceMonitor::mark(JSTracer* trc)
|
|||
bool
|
||||
NativeToValue(JSContext* cx, jsval& v, TraceType type, double* slot)
|
||||
{
|
||||
bool ok;
|
||||
JSBool ok;
|
||||
jsint i;
|
||||
jsdouble d;
|
||||
switch (type) {
|
||||
|
@ -3549,13 +3549,13 @@ TraceRecorder::importGlobalSlot(unsigned slot)
|
|||
|
||||
/* Add the slot to the list of interned global slots. */
|
||||
TraceType type;
|
||||
int index = tree->globalSlots->offsetOf(slot);
|
||||
int index = tree->globalSlots->offsetOf(uint16(slot));
|
||||
if (index == -1) {
|
||||
type = getCoercedType(*vp);
|
||||
if (type == TT_INT32 && oracle.isGlobalSlotUndemotable(cx, slot))
|
||||
type = TT_DOUBLE;
|
||||
index = (int)tree->globalSlots->length();
|
||||
tree->globalSlots->add(slot);
|
||||
tree->globalSlots->add(uint16(slot));
|
||||
tree->typeMap.add(type);
|
||||
SpecializeTreesToMissingGlobals(cx, globalObj, tree);
|
||||
JS_ASSERT(tree->nGlobalTypes() == tree->globalSlots->length());
|
||||
|
@ -3677,7 +3677,7 @@ TraceRecorder::get(jsval* p)
|
|||
return x;
|
||||
if (isGlobal(p)) {
|
||||
unsigned slot = nativeGlobalSlot(p);
|
||||
JS_ASSERT(tree->globalSlots->offsetOf(slot) != -1);
|
||||
JS_ASSERT(tree->globalSlots->offsetOf(uint16(slot)) != -1);
|
||||
importGlobalSlot(slot);
|
||||
} else {
|
||||
unsigned slot = nativeStackSlot(p);
|
||||
|
@ -3864,7 +3864,7 @@ TraceRecorder::determineSlotType(jsval* vp)
|
|||
if (i) {
|
||||
m = isPromoteInt(i) ? TT_INT32 : TT_DOUBLE;
|
||||
} else if (isGlobal(vp)) {
|
||||
int offset = tree->globalSlots->offsetOf(nativeGlobalSlot(vp));
|
||||
int offset = tree->globalSlots->offsetOf(uint16(nativeGlobalSlot(vp)));
|
||||
JS_ASSERT(offset != -1);
|
||||
m = importTypeMap[importStackSlots + offset];
|
||||
} else {
|
||||
|
@ -4353,6 +4353,10 @@ class SlotMap : public SlotVisitorBase
|
|||
{
|
||||
}
|
||||
|
||||
virtual ~SlotMap()
|
||||
{
|
||||
}
|
||||
|
||||
JS_REQUIRES_STACK JS_ALWAYS_INLINE void
|
||||
visitGlobalSlot(jsval *vp, unsigned n, unsigned slot)
|
||||
{
|
||||
|
@ -4415,7 +4419,7 @@ class SlotMap : public SlotVisitorBase
|
|||
if (LIns* i = mRecorder.getFromTracker(vp)) {
|
||||
promoteInt = isPromoteInt(i);
|
||||
} else if (mRecorder.isGlobal(vp)) {
|
||||
int offset = mRecorder.tree->globalSlots->offsetOf(mRecorder.nativeGlobalSlot(vp));
|
||||
int offset = mRecorder.tree->globalSlots->offsetOf(uint16(mRecorder.nativeGlobalSlot(vp)));
|
||||
JS_ASSERT(offset != -1);
|
||||
promoteInt = mRecorder.importTypeMap[mRecorder.importStackSlots + offset] ==
|
||||
TT_INT32;
|
||||
|
@ -4520,6 +4524,10 @@ class DefaultSlotMap : public SlotMap
|
|||
DefaultSlotMap(TraceRecorder& tr) : SlotMap(tr)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~DefaultSlotMap()
|
||||
{
|
||||
}
|
||||
|
||||
JS_REQUIRES_STACK JS_ALWAYS_INLINE bool
|
||||
visitStackSlots(jsval *vp, size_t count, JSStackFrame* fp)
|
||||
|
@ -7801,7 +7809,7 @@ TraceRecorder::scopeChainProp(JSObject* chainHead, jsval*& vp, LIns*& ins, NameR
|
|||
JSObject* obj2;
|
||||
JSProperty* prop;
|
||||
JSObject *obj = chainHead;
|
||||
bool ok = js_FindProperty(cx, ATOM_TO_JSID(atom), &obj, &obj2, &prop);
|
||||
JSBool ok = js_FindProperty(cx, ATOM_TO_JSID(atom), &obj, &obj2, &prop);
|
||||
|
||||
/* js_FindProperty can reenter the interpreter and kill |this|. */
|
||||
if (!localtm.recorder)
|
||||
|
@ -9131,9 +9139,9 @@ TraceRecorder::test_property_cache(JSObject* obj, LIns* obj_ins, JSObject*& obj2
|
|||
// hop along the proto chain when accessing a named (not indexed) property,
|
||||
// typically to find Array.prototype methods.
|
||||
JSObject* aobj = obj;
|
||||
if (OBJ_IS_DENSE_ARRAY(cx, obj)) {
|
||||
if (obj->isDenseArray()) {
|
||||
guardDenseArray(obj, obj_ins, BRANCH_EXIT);
|
||||
aobj = OBJ_GET_PROTO(cx, obj);
|
||||
aobj = obj->getProto();
|
||||
obj_ins = stobj_get_proto(obj_ins);
|
||||
}
|
||||
|
||||
|
@ -11267,7 +11275,7 @@ TraceRecorder::setProp(jsval &l, JSPropCacheEntry* entry, JSScopeProperty* sprop
|
|||
for (jsuword i = PCVCAP_TAG(entry->vcap) >> PCVCAP_PROTOBITS; i; i--)
|
||||
obj2 = OBJ_GET_PARENT(cx, obj2);
|
||||
for (jsuword j = PCVCAP_TAG(entry->vcap) & PCVCAP_PROTOMASK; j; j--)
|
||||
obj2 = OBJ_GET_PROTO(cx, obj2);
|
||||
obj2 = obj2->getProto();
|
||||
scope = OBJ_SCOPE(obj2);
|
||||
JS_ASSERT_IF(entry->adding(), obj2 == obj);
|
||||
|
||||
|
@ -12106,7 +12114,7 @@ TraceRecorder::setElem(int lval_spindex, int idx_spindex, int v_spindex)
|
|||
} else {
|
||||
RETURN_STOP_A("can't trace setting typed array element to non-number value");
|
||||
}
|
||||
} else if (JSVAL_TO_INT(idx) < 0 || !OBJ_IS_DENSE_ARRAY(cx, obj)) {
|
||||
} else if (JSVAL_TO_INT(idx) < 0 || !obj->isDenseArray()) {
|
||||
CHECK_STATUS_A(initOrSetPropertyByIndex(obj_ins, idx_ins, &v,
|
||||
*cx->fp->regs->pc == JSOP_INITELEM));
|
||||
} else {
|
||||
|
@ -12464,7 +12472,7 @@ TraceRecorder::interpretedFunctionCall(jsval& fval, JSFunction* fun, uintN argc,
|
|||
fi->pc = fp->regs->pc;
|
||||
fi->imacpc = fp->imacpc;
|
||||
fi->spdist = fp->regs->sp - fp->slots;
|
||||
fi->set_argc(argc, constructing);
|
||||
fi->set_argc(uint16(argc), constructing);
|
||||
fi->callerHeight = stackSlots - (2 + argc);
|
||||
fi->callerArgc = fp->argc;
|
||||
|
||||
|
@ -12577,7 +12585,7 @@ TraceRecorder::record_JSOP_APPLY()
|
|||
* We trace dense arrays and arguments objects. The code we generate
|
||||
* for apply uses imacros to handle a specific number of arguments.
|
||||
*/
|
||||
if (OBJ_IS_DENSE_ARRAY(cx, aobj)) {
|
||||
if (aobj->isDenseArray()) {
|
||||
guardDenseArray(aobj, aobj_ins);
|
||||
length = jsuint(aobj->fslots[JSSLOT_ARRAY_LENGTH]);
|
||||
guard(true,
|
||||
|
@ -13754,7 +13762,7 @@ TraceRecorder::record_JSOP_IN()
|
|||
|
||||
JSObject* obj2;
|
||||
JSProperty* prop;
|
||||
bool ok = obj->lookupProperty(cx, id, &obj2, &prop);
|
||||
JSBool ok = obj->lookupProperty(cx, id, &obj2, &prop);
|
||||
|
||||
/* lookupProperty can reenter the interpreter and kill |this|. */
|
||||
if (!localtm.recorder) {
|
||||
|
@ -14733,7 +14741,7 @@ TraceRecorder::record_JSOP_ARRAYPUSH()
|
|||
JS_ASSERT(cx->fp->slots + slot < cx->fp->regs->sp - 1);
|
||||
jsval &arrayval = cx->fp->slots[slot];
|
||||
JS_ASSERT(JSVAL_IS_OBJECT(arrayval));
|
||||
JS_ASSERT(OBJ_IS_DENSE_ARRAY(cx, JSVAL_TO_OBJECT(arrayval)));
|
||||
JS_ASSERT(JSVAL_TO_OBJECT(arrayval)->isDenseArray());
|
||||
LIns *array_ins = get(&arrayval);
|
||||
jsval &elt = stackval(-1);
|
||||
LIns *elt_ins = box_jsval(elt, get(&elt));
|
||||
|
@ -14920,7 +14928,7 @@ GetBuiltinFunction(JSContext *cx, uintN index)
|
|||
NULL);
|
||||
if (fun) {
|
||||
funobj = FUN_OBJECT(fun);
|
||||
STOBJ_CLEAR_PROTO(funobj);
|
||||
funobj->clearProto();
|
||||
STOBJ_CLEAR_PARENT(funobj);
|
||||
|
||||
JS_LOCK_GC(rt);
|
||||
|
@ -14996,10 +15004,10 @@ TraceRecorder::record_JSOP_LENGTH()
|
|||
}
|
||||
|
||||
LIns* v_ins;
|
||||
if (OBJ_IS_ARRAY(cx, obj)) {
|
||||
if (OBJ_IS_DENSE_ARRAY(cx, obj)) {
|
||||
if (obj->isArray()) {
|
||||
if (obj->isDenseArray()) {
|
||||
if (!guardDenseArray(obj, obj_ins, BRANCH_EXIT)) {
|
||||
JS_NOT_REACHED("OBJ_IS_DENSE_ARRAY but not?!?");
|
||||
JS_NOT_REACHED("obj->isDenseArray() but not?!?");
|
||||
return ARECORD_STOP;
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -255,7 +255,7 @@ TypedArray::obj_lookupProperty(JSContext *cx, JSObject *obj, jsid id,
|
|||
return true;
|
||||
}
|
||||
|
||||
JSObject *proto = STOBJ_GET_PROTO(obj);
|
||||
JSObject *proto = obj->getProto();
|
||||
if (!proto) {
|
||||
*objp = NULL;
|
||||
*propp = NULL;
|
||||
|
@ -401,7 +401,7 @@ struct uint8_clamped {
|
|||
}
|
||||
|
||||
inline uint8_clamped& operator= (const jsdouble x) {
|
||||
val = js_TypedArray_uint8_clamp_double(x);
|
||||
val = uint8(js_TypedArray_uint8_clamp_double(x));
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -483,7 +483,7 @@ class TypedArrayTemplate
|
|||
JSProperty *prop;
|
||||
JSScopeProperty *sprop;
|
||||
|
||||
JSObject *proto = STOBJ_GET_PROTO(obj);
|
||||
JSObject *proto = obj->getProto();
|
||||
if (!proto) {
|
||||
*vp = JSVAL_VOID;
|
||||
return true;
|
||||
|
@ -1337,31 +1337,31 @@ TypedArrayConstruct(JSContext *cx, jsint atype, uintN argc, jsval *argv, jsval *
|
|||
{
|
||||
switch (atype) {
|
||||
case TypedArray::TYPE_INT8:
|
||||
return Int8Array::class_constructor(cx, cx->globalObject, argc, argv, rv);
|
||||
return !!Int8Array::class_constructor(cx, cx->globalObject, argc, argv, rv);
|
||||
|
||||
case TypedArray::TYPE_UINT8:
|
||||
return Uint8Array::class_constructor(cx, cx->globalObject, argc, argv, rv);
|
||||
return !!Uint8Array::class_constructor(cx, cx->globalObject, argc, argv, rv);
|
||||
|
||||
case TypedArray::TYPE_INT16:
|
||||
return Int16Array::class_constructor(cx, cx->globalObject, argc, argv, rv);
|
||||
return !!Int16Array::class_constructor(cx, cx->globalObject, argc, argv, rv);
|
||||
|
||||
case TypedArray::TYPE_UINT16:
|
||||
return Uint16Array::class_constructor(cx, cx->globalObject, argc, argv, rv);
|
||||
return !!Uint16Array::class_constructor(cx, cx->globalObject, argc, argv, rv);
|
||||
|
||||
case TypedArray::TYPE_INT32:
|
||||
return Int32Array::class_constructor(cx, cx->globalObject, argc, argv, rv);
|
||||
return !!Int32Array::class_constructor(cx, cx->globalObject, argc, argv, rv);
|
||||
|
||||
case TypedArray::TYPE_UINT32:
|
||||
return Uint32Array::class_constructor(cx, cx->globalObject, argc, argv, rv);
|
||||
return !!Uint32Array::class_constructor(cx, cx->globalObject, argc, argv, rv);
|
||||
|
||||
case TypedArray::TYPE_FLOAT32:
|
||||
return Float32Array::class_constructor(cx, cx->globalObject, argc, argv, rv);
|
||||
return !!Float32Array::class_constructor(cx, cx->globalObject, argc, argv, rv);
|
||||
|
||||
case TypedArray::TYPE_FLOAT64:
|
||||
return Float64Array::class_constructor(cx, cx->globalObject, argc, argv, rv);
|
||||
return !!Float64Array::class_constructor(cx, cx->globalObject, argc, argv, rv);
|
||||
|
||||
case TypedArray::TYPE_UINT8_CLAMPED:
|
||||
return Uint8ClampedArray::class_constructor(cx, cx->globalObject, argc, argv, rv);
|
||||
return !!Uint8ClampedArray::class_constructor(cx, cx->globalObject, argc, argv, rv);
|
||||
|
||||
default:
|
||||
JS_NOT_REACHED("shouldn't have gotten here");
|
||||
|
|
|
@ -7492,7 +7492,7 @@ js_GetFunctionNamespace(JSContext *cx, jsval *vp)
|
|||
* refer to this instance in scripts. When used to qualify method
|
||||
* names, its prefix and uri references are copied to the QName.
|
||||
*/
|
||||
OBJ_CLEAR_PROTO(cx, obj);
|
||||
obj->clearProto();
|
||||
OBJ_CLEAR_PARENT(cx, obj);
|
||||
|
||||
JS_LOCK_GC(rt);
|
||||
|
@ -7711,7 +7711,7 @@ js_GetAnyName(JSContext *cx, jsval *vp)
|
|||
ok = JS_FALSE;
|
||||
break;
|
||||
}
|
||||
JS_ASSERT(!OBJ_GET_PROTO(cx, obj));
|
||||
JS_ASSERT(!obj->getProto());
|
||||
JS_ASSERT(!OBJ_GET_PARENT(cx, obj));
|
||||
} while (0);
|
||||
|
||||
|
@ -7766,7 +7766,7 @@ js_FindXMLProperty(JSContext *cx, jsval nameval, JSObject **objp, jsid *idp)
|
|||
/* Skip any With object that can wrap XML. */
|
||||
target = obj;
|
||||
while (OBJ_GET_CLASS(cx, target) == &js_WithClass) {
|
||||
proto = OBJ_GET_PROTO(cx, target);
|
||||
proto = target->getProto();
|
||||
if (!proto)
|
||||
break;
|
||||
target = proto;
|
||||
|
@ -7832,7 +7832,7 @@ GetXMLFunction(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
|
|||
ok = JS_TRUE;
|
||||
goto out;
|
||||
}
|
||||
target = OBJ_GET_PROTO(cx, target);
|
||||
target = target->getProto();
|
||||
if (target == NULL)
|
||||
break;
|
||||
tvr.u.object = target;
|
||||
|
|
|
@ -342,7 +342,7 @@ JSObject *
|
|||
GetWrapper(JSObject *obj)
|
||||
{
|
||||
while (STOBJ_GET_CLASS(obj) != &COWClass.base) {
|
||||
obj = STOBJ_GET_PROTO(obj);
|
||||
obj = obj->getProto();
|
||||
if (!obj) {
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -126,7 +126,7 @@ JSObject *
|
|||
GetWrapper(JSObject *obj)
|
||||
{
|
||||
while (STOBJ_GET_CLASS(obj) != &XPCCrossOriginWrapper::XOWClass.base) {
|
||||
obj = STOBJ_GET_PROTO(obj);
|
||||
obj = obj->getProto();
|
||||
if (!obj) {
|
||||
break;
|
||||
}
|
||||
|
@ -698,7 +698,7 @@ XPC_XOW_GetOrSetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp,
|
|||
JSBool checkProto =
|
||||
(isSet && id == GetRTStringByIndex(cx, XPCJSRuntime::IDX_PROTO));
|
||||
if (checkProto) {
|
||||
proto = STOBJ_GET_PROTO(wrappedObj);
|
||||
proto = wrappedObj->getProto();
|
||||
}
|
||||
|
||||
// Same origin, pass this request along as though nothing interesting
|
||||
|
@ -717,7 +717,7 @@ XPC_XOW_GetOrSetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp,
|
|||
}
|
||||
|
||||
if (checkProto) {
|
||||
JSObject *newProto = STOBJ_GET_PROTO(wrappedObj);
|
||||
JSObject *newProto = wrappedObj->getProto();
|
||||
|
||||
// If code is trying to set obj.__proto__ and we're on obj's
|
||||
// prototype chain, then the JS_GetPropertyById above will do the
|
||||
|
|
|
@ -525,7 +525,7 @@ XPC_NW_FunctionWrapper(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
|
|||
}
|
||||
|
||||
while (obj && !XPCNativeWrapper::IsNativeWrapper(obj)) {
|
||||
obj = STOBJ_GET_PROTO(obj);
|
||||
obj = obj->getProto();
|
||||
}
|
||||
|
||||
if (!obj) {
|
||||
|
@ -600,7 +600,7 @@ XPC_NW_GetOrSetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp,
|
|||
}
|
||||
|
||||
while (!XPCNativeWrapper::IsNativeWrapper(obj)) {
|
||||
obj = STOBJ_GET_PROTO(obj);
|
||||
obj = obj->getProto();
|
||||
if (!obj) {
|
||||
return ThrowException(NS_ERROR_UNEXPECTED, cx);
|
||||
}
|
||||
|
@ -752,7 +752,7 @@ XPC_NW_NewResolve(JSContext *cx, JSObject *obj, jsval id, uintN flags,
|
|||
}
|
||||
|
||||
while (!XPCNativeWrapper::IsNativeWrapper(obj)) {
|
||||
obj = STOBJ_GET_PROTO(obj);
|
||||
obj = obj->getProto();
|
||||
if (!obj) {
|
||||
return ThrowException(NS_ERROR_UNEXPECTED, cx);
|
||||
}
|
||||
|
@ -935,7 +935,7 @@ XPCNativeWrapperCtor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
|
|||
if (JS_FrameIterator(cx, &fp) && JS_IsConstructorFrame(cx, fp)) {
|
||||
constructing = JS_TRUE;
|
||||
|
||||
JSObject *proto = STOBJ_GET_PROTO(obj);
|
||||
JSObject *proto = obj->getProto();
|
||||
if (proto && !XPCNativeWrapper::IsNativeWrapper(proto)) {
|
||||
// Deal with our prototype object specially.
|
||||
|
||||
|
@ -1137,7 +1137,7 @@ XPC_NW_toString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
|
|||
jsval *rval)
|
||||
{
|
||||
while (!XPCNativeWrapper::IsNativeWrapper(obj)) {
|
||||
obj = STOBJ_GET_PROTO(obj);
|
||||
obj = obj->getProto();
|
||||
if (!obj) {
|
||||
return ThrowException(NS_ERROR_UNEXPECTED, cx);
|
||||
}
|
||||
|
|
|
@ -214,7 +214,7 @@ static inline JSObject *
|
|||
FindSafeObject(JSObject *obj)
|
||||
{
|
||||
while (STOBJ_GET_CLASS(obj) != &SJOWClass.base) {
|
||||
obj = STOBJ_GET_PROTO(obj);
|
||||
obj = obj->getProto();
|
||||
|
||||
if (!obj) {
|
||||
break;
|
||||
|
|
|
@ -242,7 +242,7 @@ JSObject *
|
|||
GetWrapper(JSObject *obj)
|
||||
{
|
||||
while (STOBJ_GET_CLASS(obj) != &SOWClass.base) {
|
||||
obj = STOBJ_GET_PROTO(obj);
|
||||
obj = obj->getProto();
|
||||
if (!obj) {
|
||||
break;
|
||||
}
|
||||
|
@ -346,7 +346,7 @@ XPC_SOW_RewrapValue(JSContext *cx, JSObject *wrapperObj, jsval *vp)
|
|||
if (native == XPC_SOW_FunctionWrapper) {
|
||||
// If this is a system function wrapper, make sure its ours, otherwise,
|
||||
// its prototype could come from the wrong scope.
|
||||
if (STOBJ_GET_PROTO(wrapperObj) == STOBJ_GET_PARENT(obj)) {
|
||||
if (wrapperObj->getProto() == STOBJ_GET_PARENT(obj)) {
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -226,7 +226,7 @@ CreateIteratorObj(JSContext *cx, JSObject *tempWrapper,
|
|||
if (!XPCWrapper::Enumerate(cx, iterObj, innerObj)) {
|
||||
return nsnull;
|
||||
}
|
||||
} while ((innerObj = STOBJ_GET_PROTO(innerObj)) != nsnull);
|
||||
} while ((innerObj = innerObj->getProto()) != nsnull);
|
||||
|
||||
JSIdArray *ida = JS_Enumerate(cx, iterObj);
|
||||
if (!ida) {
|
||||
|
|
|
@ -454,7 +454,7 @@ static void PrintObject(JSObject* obj, int depth, ObjectPile* pile)
|
|||
return;
|
||||
|
||||
JSObject* parent = STOBJ_GET_PARENT(obj);
|
||||
JSObject* proto = STOBJ_GET_PROTO(obj);
|
||||
JSObject* proto = obj->getProto();
|
||||
|
||||
printf("%*sparent: ", INDENT(depth+1));
|
||||
if(parent)
|
||||
|
|
|
@ -1570,7 +1570,7 @@ XPCWrappedNative::ReparentWrapperIfFound(XPCCallContext& ccx,
|
|||
// is directly using that of its XPCWrappedNativeProto.
|
||||
|
||||
if(wrapper->HasProto() &&
|
||||
STOBJ_GET_PROTO(flat) == oldProto->GetJSProtoObject())
|
||||
flat->getProto() == oldProto->GetJSProtoObject())
|
||||
{
|
||||
if(!JS_SetPrototype(ccx, flat, newProto->GetJSProtoObject()))
|
||||
{
|
||||
|
@ -1665,7 +1665,7 @@ XPCWrappedNative::GetWrappedNativeOfJSObject(JSContext* cx,
|
|||
}
|
||||
}
|
||||
|
||||
for(cur = obj; cur; cur = STOBJ_GET_PROTO(cur))
|
||||
for(cur = obj; cur; cur = cur->getProto())
|
||||
{
|
||||
// this is on two lines to make the compiler happy given the goto.
|
||||
JSClass* clazz;
|
||||
|
@ -1980,14 +1980,14 @@ XPCWrappedNative::InitTearOff(XPCCallContext& ccx,
|
|||
JSObject* proto = nsnull;
|
||||
JSObject* our_proto = GetProto()->GetJSProtoObject();
|
||||
|
||||
proto = STOBJ_GET_PROTO(jso);
|
||||
proto = jso->getProto();
|
||||
|
||||
NS_ASSERTION(proto && proto != our_proto,
|
||||
"!!! xpconnect/xbl check - wrapper has no special proto");
|
||||
|
||||
PRBool found_our_proto = PR_FALSE;
|
||||
while(proto && !found_our_proto) {
|
||||
proto = STOBJ_GET_PROTO(proto);
|
||||
proto = proto->getProto();
|
||||
|
||||
found_our_proto = proto == our_proto;
|
||||
}
|
||||
|
|
|
@ -228,7 +228,7 @@ XPCNativeMember::Resolve(XPCCallContext& ccx, XPCNativeInterface* iface)
|
|||
AUTO_MARK_JSVAL(ccx, OBJECT_TO_JSVAL(funobj));
|
||||
|
||||
STOBJ_CLEAR_PARENT(funobj);
|
||||
STOBJ_CLEAR_PROTO(funobj);
|
||||
funobj->clearProto();
|
||||
|
||||
if(!JS_SetReservedSlot(ccx, funobj, 0, PRIVATE_TO_JSVAL(iface))||
|
||||
!JS_SetReservedSlot(ccx, funobj, 1, PRIVATE_TO_JSVAL(this)))
|
||||
|
|
Загрузка…
Ссылка в новой задаче