Bug 732306: Remove typedef jsint, r=luke

--HG--
extra : rebase_source : 4d15a8514dbd698c114fa688461e533afab68ffa
This commit is contained in:
David Mandelin 2012-03-01 18:54:01 -08:00
Родитель 34ffc29747
Коммит ed3ba69ec8
39 изменённых файлов: 207 добавлений и 212 удалений

Просмотреть файл

@ -4451,7 +4451,7 @@ nsDOMClassInfo::GetArrayIndexFromId(JSContext *cx, jsid id, bool *aIsNumber)
*aIsNumber = false;
}
jsint i;
int i;
if (JSID_IS_INT(id)) {
i = JSID_TO_INT(id);
} else {

Просмотреть файл

@ -457,7 +457,7 @@ JSValToNPVariant(NPP npp, JSContext *cx, jsval val, NPVariant *variant)
INT32_TO_NPVARIANT(JSVAL_TO_INT(val), *variant);
} else if (JSVAL_IS_DOUBLE(val)) {
double d = JSVAL_TO_DOUBLE(val);
jsint i;
int i;
if (JS_DoubleIsInt32(d, &i)) {
INT32_TO_NPVARIANT(i, *variant);
} else {

Просмотреть файл

@ -157,14 +157,14 @@ NPIdentifierIsInt(NPIdentifier id)
return JSID_IS_INT(NPIdentifierToJSId(id));
}
inline jsint
inline int
NPIdentifierToInt(NPIdentifier id)
{
return JSID_TO_INT(NPIdentifierToJSId(id));
}
inline NPIdentifier
IntToNPIdentifier(jsint i)
IntToNPIdentifier(int i)
{
return JSIdToNPIdentifier(INT_TO_JSID(i));
}

Просмотреть файл

@ -1141,7 +1141,7 @@ static JS_ALWAYS_INLINE bool IsNegative(Type i)
return IsNegativeImpl<Type, numeric_limits<Type>::is_signed>::Test(i);
}
// Implicitly convert val to bool, allowing JSBool, jsint, and double
// Implicitly convert val to bool, allowing JSBool, int, and double
// arguments numerically equal to 0 or 1.
static bool
jsvalToBool(JSContext* cx, jsval val, bool* result)
@ -1151,7 +1151,7 @@ jsvalToBool(JSContext* cx, jsval val, bool* result)
return true;
}
if (JSVAL_IS_INT(val)) {
jsint i = JSVAL_TO_INT(val);
int32_t i = JSVAL_TO_INT(val);
*result = i != 0;
return i == 0 || i == 1;
}
@ -1165,7 +1165,7 @@ jsvalToBool(JSContext* cx, jsval val, bool* result)
return false;
}
// Implicitly convert val to IntegerType, allowing JSBool, jsint, double,
// Implicitly convert val to IntegerType, allowing JSBool, int, double,
// Int64, UInt64, and CData integer types 't' where all values of 't' are
// representable by IntegerType.
template<class IntegerType>
@ -1177,7 +1177,7 @@ jsvalToInteger(JSContext* cx, jsval val, IntegerType* result)
if (JSVAL_IS_INT(val)) {
// Make sure the integer fits in the alotted precision, and has the right
// sign.
jsint i = JSVAL_TO_INT(val);
int32_t i = JSVAL_TO_INT(val);
return ConvertExact(i, result);
}
if (JSVAL_IS_DOUBLE(val)) {
@ -1246,7 +1246,7 @@ jsvalToInteger(JSContext* cx, jsval val, IntegerType* result)
return false;
}
// Implicitly convert val to FloatType, allowing jsint, double,
// Implicitly convert val to FloatType, allowing int, double,
// Int64, UInt64, and CData numeric types 't' where all values of 't' are
// representable by FloatType.
template<class FloatType>
@ -1359,7 +1359,7 @@ StringToInteger(JSContext* cx, JSString* string, IntegerType* result)
return true;
}
// Implicitly convert val to IntegerType, allowing jsint, double,
// Implicitly convert val to IntegerType, allowing int, double,
// Int64, UInt64, and optionally a decimal or hexadecimal string argument.
// (This is common code shared by jsvalToSize and the Int64/UInt64 constructors.)
template<class IntegerType>
@ -1374,7 +1374,7 @@ jsvalToBigInteger(JSContext* cx,
if (JSVAL_IS_INT(val)) {
// Make sure the integer fits in the alotted precision, and has the right
// sign.
jsint i = JSVAL_TO_INT(val);
int32_t i = JSVAL_TO_INT(val);
return ConvertExact(i, result);
}
if (JSVAL_IS_DOUBLE(val)) {
@ -1421,7 +1421,7 @@ jsvalToSize(JSContext* cx, jsval val, bool allowString, size_t* result)
return Convert<size_t>(double(*result)) == *result;
}
// Implicitly convert val to IntegerType, allowing jsint, double,
// Implicitly convert val to IntegerType, allowing int, double,
// Int64, UInt64, and optionally a decimal or hexadecimal string argument.
// (This is common code shared by jsvalToSize and the Int64/UInt64 constructors.)
template<class IntegerType>
@ -1436,7 +1436,7 @@ jsidToBigInteger(JSContext* cx,
if (JSID_IS_INT(val)) {
// Make sure the integer fits in the alotted precision, and has the right
// sign.
jsint i = JSID_TO_INT(val);
int32_t i = JSID_TO_INT(val);
return ConvertExact(i, result);
}
if (allowString && JSID_IS_STRING(val)) {
@ -1525,9 +1525,9 @@ static bool
jsvalToPtrExplicit(JSContext* cx, jsval val, uintptr_t* result)
{
if (JSVAL_IS_INT(val)) {
// jsint always fits in intptr_t. If the integer is negative, cast through
// int32_t always fits in intptr_t. If the integer is negative, cast through
// an intptr_t intermediate to sign-extend.
jsint i = JSVAL_TO_INT(val);
int32_t i = JSVAL_TO_INT(val);
*result = i < 0 ? uintptr_t(intptr_t(i)) : uintptr_t(i);
return true;
}
@ -1650,7 +1650,7 @@ ConvertToJS(JSContext* cx,
case TYPE_##name: { \
type value = *static_cast<type*>(data); \
if (sizeof(type) < 4) \
*result = INT_TO_JSVAL(jsint(value)); \
*result = INT_TO_JSVAL(int32_t(value)); \
else if (!JS_NewNumberValue(cx, double(value), result)) \
return false; \
break; \
@ -2929,7 +2929,7 @@ CType::GetSafeSize(JSObject* obj, size_t* result)
jsval size = JS_GetReservedSlot(obj, SLOT_SIZE);
// The "size" property can be a jsint, a double, or JSVAL_VOID
// The "size" property can be an int, a double, or JSVAL_VOID
// (for arrays of undefined length), and must always fit in a size_t.
if (JSVAL_IS_INT(size)) {
*result = JSVAL_TO_INT(size);
@ -2953,7 +2953,7 @@ CType::GetSize(JSObject* obj)
JS_ASSERT(!JSVAL_IS_VOID(size));
// The "size" property can be a jsint, a double, or JSVAL_VOID
// The "size" property can be an int, a double, or JSVAL_VOID
// (for arrays of undefined length), and must always fit in a size_t.
// For callers who know it can never be JSVAL_VOID, return a size_t directly.
if (JSVAL_IS_INT(size))
@ -2968,7 +2968,7 @@ CType::IsSizeDefined(JSObject* obj)
jsval size = JS_GetReservedSlot(obj, SLOT_SIZE);
// The "size" property can be a jsint, a double, or JSVAL_VOID
// The "size" property can be an int, a double, or JSVAL_VOID
// (for arrays of undefined length), and must always fit in a size_t.
JS_ASSERT(JSVAL_IS_INT(size) || JSVAL_IS_DOUBLE(size) || JSVAL_IS_VOID(size));
return !JSVAL_IS_VOID(size);
@ -3599,7 +3599,7 @@ ArrayType::CreateInternal(JSContext* cx,
jsval sizeVal = JSVAL_VOID;
jsval lengthVal = JSVAL_VOID;
if (lengthDefined) {
// Check for overflow, and convert to a jsint or double as required.
// Check for overflow, and convert to an int or double as required.
size_t size = length * baseSize;
if (length > 0 && size / length != baseSize) {
JS_ReportError(cx, "size overflow");
@ -3750,7 +3750,7 @@ ArrayType::GetSafeLength(JSObject* obj, size_t* result)
jsval length = JS_GetReservedSlot(obj, SLOT_LENGTH);
// The "length" property can be a jsint, a double, or JSVAL_VOID
// The "length" property can be an int, a double, or JSVAL_VOID
// (for arrays of undefined length), and must always fit in a size_t.
if (JSVAL_IS_INT(length)) {
*result = JSVAL_TO_INT(length);
@ -3775,7 +3775,7 @@ ArrayType::GetLength(JSObject* obj)
JS_ASSERT(!JSVAL_IS_VOID(length));
// The "length" property can be a jsint, a double, or JSVAL_VOID
// The "length" property can be an int, a double, or JSVAL_VOID
// (for arrays of undefined length), and must always fit in a size_t.
// For callers who know it can never be JSVAL_VOID, return a size_t directly.
if (JSVAL_IS_INT(length))

Просмотреть файл

@ -775,7 +775,7 @@ frontend::DefineCompileTimeConstant(JSContext *cx, BytecodeEmitter *bce, JSAtom
}
StmtInfo *
frontend::LexicalLookup(TreeContext *tc, JSAtom *atom, jsint *slotp, StmtInfo *stmt)
frontend::LexicalLookup(TreeContext *tc, JSAtom *atom, int *slotp, StmtInfo *stmt)
{
if (!stmt)
stmt = tc->topScopeStmt;
@ -1007,8 +1007,8 @@ BytecodeEmitter::shouldNoteClosedName(ParseNode *pn)
*
* The function returns -1 on failures.
*/
static jsint
AdjustBlockSlot(JSContext *cx, BytecodeEmitter *bce, jsint slot)
static int
AdjustBlockSlot(JSContext *cx, BytecodeEmitter *bce, int slot)
{
JS_ASSERT((jsuint) slot < bce->maxStackDepth);
if (bce->inFunction()) {
@ -2261,7 +2261,7 @@ EmitNumberOp(JSContext *cx, double dval, BytecodeEmitter *bce)
return Emit1(cx, bce, JSOP_ZERO) >= 0;
if (ival == 1)
return Emit1(cx, bce, JSOP_ONE) >= 0;
if ((jsint)(int8_t)ival == ival)
if ((int)(int8_t)ival == ival)
return Emit2(cx, bce, JSOP_INT8, (jsbytecode)(int8_t)ival) >= 0;
u = (uint32_t)ival;
@ -2474,7 +2474,7 @@ EmitSwitch(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
continue;
}
i = pn3->pn_pval->toInt32();
if ((jsuint)(i + (jsint)JS_BIT(15)) >= (jsuint)JS_BIT(16)) {
if ((jsuint)(i + (int)JS_BIT(15)) >= (jsuint)JS_BIT(16)) {
switchOp = JSOP_LOOKUPSWITCH;
continue;
}
@ -2684,7 +2684,7 @@ EmitSwitch(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
savepc = bce->next();
bce->current->next = pc + 1;
if (switchOp == JSOP_TABLESWITCH) {
for (i = 0; i < (jsint)tableLength; i++) {
for (i = 0; i < (int)tableLength; i++) {
pn3 = table[i];
if (pn3 &&
(pn4 = pn3->pn_left) != NULL &&
@ -2764,7 +2764,7 @@ EmitSwitch(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
pc += 2 * JUMP_OFFSET_LEN;
/* Fill in the jump table, if there is one. */
for (i = 0; i < (jsint)tableLength; i++) {
for (i = 0; i < (int)tableLength; i++) {
pn3 = table[i];
off = pn3 ? pn3->pn_offset - top : 0;
SET_JUMP_OFFSET(pc, off);
@ -3334,7 +3334,7 @@ EmitGroupAssignment(JSContext *cx, BytecodeEmitter *bce, JSOp prologOp,
for (pn = lhs->pn_head; pn; pn = pn->pn_next, ++i) {
/* MaybeEmitGroupAssignment requires lhs->pn_count <= rhs->pn_count. */
JS_ASSERT(i < limit);
jsint slot = AdjustBlockSlot(cx, bce, i);
int slot = AdjustBlockSlot(cx, bce, i);
if (slot < 0)
return JS_FALSE;
EMIT_UINT16_IMM_OP(JSOP_GETLOCAL, slot);
@ -6507,7 +6507,7 @@ frontend::EmitTree(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
#endif /* JS_HAS_BLOCK_SCOPE */
#if JS_HAS_GENERATORS
case PNK_ARRAYPUSH: {
jsint slot;
int slot;
/*
* The array object's stack index is in bce->arrayCompDepth. See below

Просмотреть файл

@ -789,7 +789,7 @@ DefineCompileTimeConstant(JSContext *cx, BytecodeEmitter *bce, JSAtom *atom, Par
* found. Otherwise return null.
*/
StmtInfo *
LexicalLookup(TreeContext *tc, JSAtom *atom, jsint *slotp, StmtInfo *stmt = NULL);
LexicalLookup(TreeContext *tc, JSAtom *atom, int *slotp, StmtInfo *stmt = NULL);
/*
* Emit code into bce for the tree rooted at pn.

Просмотреть файл

@ -386,9 +386,9 @@ ScriptAnalysis::analyzeBytecode(JSContext *cx)
isInlineable = false;
unsigned defaultOffset = offset + GET_JUMP_OFFSET(pc);
jsbytecode *pc2 = pc + JUMP_OFFSET_LEN;
jsint low = GET_JUMP_OFFSET(pc2);
int32_t low = GET_JUMP_OFFSET(pc2);
pc2 += JUMP_OFFSET_LEN;
jsint high = GET_JUMP_OFFSET(pc2);
int32_t high = GET_JUMP_OFFSET(pc2);
pc2 += JUMP_OFFSET_LEN;
if (!addJump(cx, defaultOffset, &nextOffset, &forwardJump, stackDepth))
@ -396,7 +396,7 @@ ScriptAnalysis::analyzeBytecode(JSContext *cx)
getCode(defaultOffset).switchTarget = true;
getCode(defaultOffset).safePoint = true;
for (jsint i = low; i <= high; i++) {
for (int32_t i = low; i <= high; i++) {
unsigned targetOffset = offset + GET_JUMP_OFFSET(pc2);
if (targetOffset != offset) {
if (!addJump(cx, targetOffset, &nextOffset, &forwardJump, stackDepth))
@ -1520,12 +1520,12 @@ ScriptAnalysis::analyzeSSA(JSContext *cx)
case JSOP_TABLESWITCH: {
unsigned defaultOffset = offset + GET_JUMP_OFFSET(pc);
jsbytecode *pc2 = pc + JUMP_OFFSET_LEN;
jsint low = GET_JUMP_OFFSET(pc2);
int32_t low = GET_JUMP_OFFSET(pc2);
pc2 += JUMP_OFFSET_LEN;
jsint high = GET_JUMP_OFFSET(pc2);
int32_t high = GET_JUMP_OFFSET(pc2);
pc2 += JUMP_OFFSET_LEN;
for (jsint i = low; i <= high; i++) {
for (int32_t i = low; i <= high; i++) {
unsigned targetOffset = offset + GET_JUMP_OFFSET(pc2);
if (targetOffset != offset)
checkBranchTarget(cx, targetOffset, branchTargets, values, stackDepth);

Просмотреть файл

@ -547,9 +547,9 @@ JS_ValueToNumber(JSContext *cx, jsval v, double *dp)
}
JS_PUBLIC_API(JSBool)
JS_DoubleIsInt32(double d, jsint *ip)
JS_DoubleIsInt32(double d, int32_t *ip)
{
return JSDOUBLE_IS_INT32(d, (int32_t *)ip);
return JSDOUBLE_IS_INT32(d, ip);
}
JS_PUBLIC_API(int32_t)
@ -2025,7 +2025,7 @@ JS_EnumerateStandardClasses(JSContext *cx, JSObject *obj)
}
static JSIdArray *
NewIdArray(JSContext *cx, jsint length)
NewIdArray(JSContext *cx, int length)
{
JSIdArray *ida;
@ -2040,7 +2040,7 @@ NewIdArray(JSContext *cx, jsint length)
* Unlike realloc(3), this function frees ida on failure.
*/
static JSIdArray *
SetIdArrayLength(JSContext *cx, JSIdArray *ida, jsint length)
SetIdArrayLength(JSContext *cx, JSIdArray *ida, int length)
{
JSIdArray *rida;
@ -2056,12 +2056,10 @@ SetIdArrayLength(JSContext *cx, JSIdArray *ida, jsint length)
}
static JSIdArray *
AddAtomToArray(JSContext *cx, JSAtom *atom, JSIdArray *ida, jsint *ip)
AddAtomToArray(JSContext *cx, JSAtom *atom, JSIdArray *ida, int *ip)
{
jsint i, length;
i = *ip;
length = ida->length;
int i = *ip;
int length = ida->length;
if (i >= length) {
ida = SetIdArrayLength(cx, ida, JS_MAX(length * 2, 8));
if (!ida)
@ -2075,7 +2073,7 @@ AddAtomToArray(JSContext *cx, JSAtom *atom, JSIdArray *ida, jsint *ip)
static JSIdArray *
EnumerateIfResolved(JSContext *cx, JSObject *obj, JSAtom *atom, JSIdArray *ida,
jsint *ip, JSBool *foundp)
int *ip, JSBool *foundp)
{
*foundp = obj->nativeContains(cx, ATOM_TO_JSID(atom));
if (*foundp)
@ -2087,7 +2085,7 @@ JS_PUBLIC_API(JSIdArray *)
JS_EnumerateResolvedStandardClasses(JSContext *cx, JSObject *obj, JSIdArray *ida)
{
JSRuntime *rt;
jsint i, j, k;
int i, j, k;
JSAtom *atom;
JSBool found;
JSObjectOp init;
@ -3001,14 +2999,14 @@ JS_SetNativeStackQuota(JSRuntime *rt, size_t stackSize)
/************************************************************************/
JS_PUBLIC_API(jsint)
JS_PUBLIC_API(int)
JS_IdArrayLength(JSContext *cx, JSIdArray *ida)
{
return ida->length;
}
JS_PUBLIC_API(jsid)
JS_IdArrayGet(JSContext *cx, JSIdArray *ida, jsint index)
JS_IdArrayGet(JSContext *cx, JSIdArray *ida, int index)
{
JS_ASSERT(index >= 0 && index < ida->length);
return ida->vector[index];
@ -4297,7 +4295,7 @@ JS_NewPropertyIterator(JSContext *cx, JSObject *obj)
{
JSObject *iterobj;
void *pdata;
jsint index;
int index;
JSIdArray *ida;
AssertNoGC(cx);
@ -4334,7 +4332,7 @@ JS_NewPropertyIterator(JSContext *cx, JSObject *obj)
JS_PUBLIC_API(JSBool)
JS_NextProperty(JSContext *cx, JSObject *iterobj, jsid *idp)
{
jsint i;
int32_t i;
const Shape *shape;
JSIdArray *ida;
@ -4401,7 +4399,7 @@ JS_SetReservedSlot(JSObject *obj, uint32_t index, jsval v)
}
JS_PUBLIC_API(JSObject *)
JS_NewArrayObject(JSContext *cx, jsint length, jsval *vector)
JS_NewArrayObject(JSContext *cx, int length, jsval *vector)
{
JS_THREADSAFE_ASSERT(cx->compartment != cx->runtime->atomsCompartment);
AssertNoGC(cx);

Просмотреть файл

@ -65,8 +65,8 @@
/* JS::Value can store a full int32_t. */
#define JSVAL_INT_BITS 32
#define JSVAL_INT_MIN ((jsint)0x80000000)
#define JSVAL_INT_MAX ((jsint)0x7fffffff)
#define JSVAL_INT_MIN ((int32_t)0x80000000)
#define JSVAL_INT_MAX ((int32_t)0x7fffffff)
/************************************************************************/
@ -1651,7 +1651,7 @@ JSVAL_IS_INT(jsval v)
return JSVAL_IS_INT32_IMPL(JSVAL_TO_IMPL(v));
}
static JS_ALWAYS_INLINE jsint
static JS_ALWAYS_INLINE int32_t
JSVAL_TO_INT(jsval v)
{
JS_ASSERT(JSVAL_IS_INT(v));
@ -2062,7 +2062,7 @@ class AutoIdRooter : private AutoGCRooter
set of the same-named property in an
object that delegates to a prototype
containing this property */
#define JSPROP_INDEX 0x80 /* name is actually (jsint) index */
#define JSPROP_INDEX 0x80 /* name is actually (int) index */
#define JSPROP_SHORTID 0x100 /* set in JS_DefineProperty attrs
if getters/setters use a shortid */
#define JSPROP_NATIVE_ACCESSORS 0x08 /* set in JSPropertyDescriptor.flags
@ -2244,7 +2244,7 @@ extern JS_PUBLIC_API(JSBool)
JS_ValueToNumber(JSContext *cx, jsval v, double *dp);
extern JS_PUBLIC_API(JSBool)
JS_DoubleIsInt32(double d, jsint *ip);
JS_DoubleIsInt32(double d, int32_t *ip);
extern JS_PUBLIC_API(int32_t)
JS_DoubleToInt32(double d);
@ -3492,11 +3492,11 @@ struct JSClass {
#define JSCLASS_NO_INTERNAL_MEMBERS {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
#define JSCLASS_NO_OPTIONAL_MEMBERS 0,0,0,0,0,JSCLASS_NO_INTERNAL_MEMBERS
extern JS_PUBLIC_API(jsint)
extern JS_PUBLIC_API(int)
JS_IdArrayLength(JSContext *cx, JSIdArray *ida);
extern JS_PUBLIC_API(jsid)
JS_IdArrayGet(JSContext *cx, JSIdArray *ida, jsint index);
JS_IdArrayGet(JSContext *cx, JSIdArray *ida, int index);
extern JS_PUBLIC_API(void)
JS_DestroyIdArray(JSContext *cx, JSIdArray *ida);
@ -3980,7 +3980,7 @@ JS_DeleteUCProperty2(JSContext *cx, JSObject *obj,
jsval *rval);
extern JS_PUBLIC_API(JSObject *)
JS_NewArrayObject(JSContext *cx, jsint length, jsval *vector);
JS_NewArrayObject(JSContext *cx, int length, jsval *vector);
extern JS_PUBLIC_API(JSBool)
JS_IsArrayObject(JSContext *cx, JSObject *obj);

Просмотреть файл

@ -167,7 +167,7 @@ js_GetLengthProperty(JSContext *cx, JSObject *obj, jsuint *lengthp)
return false;
if (tvr.value().isInt32()) {
*lengthp = jsuint(jsint(tvr.value().toInt32())); /* jsuint cast does ToUint32_t */
*lengthp = jsuint(tvr.value().toInt32()); /* jsuint cast does ToUint32_t */
return true;
}
@ -3082,7 +3082,7 @@ array_indexOfHelper(JSContext *cx, IndexOfKind mode, CallArgs &args)
{
jsuint length, i, stop;
Value tosearch;
jsint direction;
int direction;
JSBool hole;
JSObject *obj = ToObject(cx, &args.thisv());

Просмотреть файл

@ -60,8 +60,7 @@ inline JSBool
js_IdIsIndex(jsid id, jsuint *indexp)
{
if (JSID_IS_INT(id)) {
jsint i;
i = JSID_TO_INT(id);
int32_t i = JSID_TO_INT(id);
if (i < 0)
return JS_FALSE;
*indexp = (jsuint)i;

Просмотреть файл

@ -736,13 +736,13 @@ js_CheckForStringIndex(jsid id)
if (oldIndex < -(JSID_INT_MIN / 10) ||
(oldIndex == -(JSID_INT_MIN / 10) && c <= (-JSID_INT_MIN % 10)))
{
id = INT_TO_JSID(-jsint(index));
id = INT_TO_JSID(-int32_t(index));
}
} else {
if (oldIndex < JSID_INT_MAX / 10 ||
(oldIndex == JSID_INT_MAX / 10 && c <= (JSID_INT_MAX % 10)))
{
id = INT_TO_JSID(jsint(index));
id = INT_TO_JSID(int32_t(index));
}
}

Просмотреть файл

@ -53,7 +53,7 @@
#include "js/HashTable.h"
struct JSIdArray {
jsint length;
int length;
js::HeapId vector[1]; /* actually, length jsid words */
};

Просмотреть файл

@ -214,7 +214,7 @@ class CompartmentChecker
void check(JSIdArray *ida) {
if (ida) {
for (jsint i = 0; i < ida->length; i++) {
for (int i = 0; i < ida->length; i++) {
if (JSID_IS_OBJECT(ida->vector[i]))
check(ida->vector[i]);
}

Просмотреть файл

@ -396,7 +396,7 @@ bool
JSCompartment::wrap(JSContext *cx, AutoIdVector &props)
{
jsid *vector = props.begin();
jsint length = props.length();
int length = props.length();
for (size_t n = 0; n < size_t(length); ++n) {
if (!wrapId(cx, &vector[n]))
return false;

Просмотреть файл

@ -125,17 +125,17 @@ class MathCache;
*/
class DtoaCache {
double d;
jsint base;
int base;
JSFixedString *s; // if s==NULL, d and base are not valid
public:
DtoaCache() : s(NULL) {}
void purge() { s = NULL; }
JSFixedString *lookup(jsint base, double d) {
JSFixedString *lookup(int base, double d) {
return this->s && base == this->base && d == this->d ? this->s : NULL;
}
void cache(jsint base, double d, JSFixedString *s) {
void cache(int base, double d, JSFixedString *s) {
this->base = base;
this->d = d;
this->s = s;

Просмотреть файл

@ -200,19 +200,19 @@ TimeWithinDay(double t)
}
static inline bool
IsLeapYear(jsint year)
IsLeapYear(int year)
{
return year % 4 == 0 && (year % 100 || (year % 400 == 0));
}
static inline jsint
DaysInYear(jsint year)
static inline int
DaysInYear(int year)
{
return IsLeapYear(year) ? 366 : 365;
}
static inline jsint
DaysInFebruary(jsint year)
static inline int
DaysInFebruary(int year)
{
return IsLeapYear(year) ? 29 : 28;
}
@ -224,10 +224,10 @@ DaysInFebruary(jsint year)
- floor(((y)-1901)/100.0) + floor(((y)-1601)/400.0))
#define TimeFromYear(y) (DayFromYear(y) * msPerDay)
static jsint
static int
YearFromTime(double t)
{
jsint y = (jsint) floor(t /(msPerDay*365.2425)) + 1970;
int y = (int) floor(t /(msPerDay*365.2425)) + 1970;
double t2 = (double) TimeFromYear(y);
/*
@ -258,7 +258,7 @@ static double firstDayOfMonth[2][13] = {
#define DayFromMonth(m, leap) firstDayOfMonth[leap][(int)m]
static int
DaysInMonth(jsint year, jsint month)
DaysInMonth(int year, int month)
{
JSBool leap = IsLeapYear(year);
int result = int(DayFromMonth(month, leap) - DayFromMonth(month-1, leap));
@ -269,7 +269,7 @@ static int
MonthFromTime(double t)
{
int d, step;
jsint year = YearFromTime(t);
int year = YearFromTime(t);
d = DayWithinYear(t, year);
if (d < (step = 31))
@ -301,7 +301,7 @@ static int
DateFromTime(double t)
{
int d, step, next;
jsint year = YearFromTime(t);
int year = YearFromTime(t);
d = DayWithinYear(t, year);
if (d <= (next = 30))
@ -343,8 +343,8 @@ DateFromTime(double t)
static int
WeekDay(double t)
{
jsint result;
result = (jsint) Day(t) + 4;
int result;
result = (int) Day(t) + 4;
result = result % 7;
if (result < 0)
result += 7;
@ -367,7 +367,7 @@ MakeDay(double year, double month, double date)
if (month < 0)
month += 12;
leap = IsLeapYear((jsint) year);
leap = IsLeapYear((int) year);
yearday = floor(TimeFromYear(year) / msPerDay);
monthday = DayFromMonth(month, leap);
@ -386,7 +386,7 @@ MakeDay(double year, double month, double date)
* yearStartingWith[1][i] is an example leap year where
* Jan 1 appears on Sunday (i == 0), Monday (i == 1), etc.
*/
static jsint yearStartingWith[2][7] = {
static int yearStartingWith[2][7] = {
{1978, 1973, 1974, 1975, 1981, 1971, 1977},
{1984, 1996, 1980, 1992, 1976, 1988, 1972}
};
@ -398,12 +398,12 @@ static jsint yearStartingWith[2][7] = {
* for determining DST; it hasn't been proven not to produce an
* incorrect year for times near year boundaries.
*/
static jsint
EquivalentYearForDST(jsint year)
static int
EquivalentYearForDST(int year)
{
jsint day;
int day;
day = (jsint) DayFromYear(year) + 4;
day = (int) DayFromYear(year) + 4;
day = day % 7;
if (day < 0)
day += 7;
@ -426,7 +426,7 @@ DaylightSavingTA(double t, JSContext *cx)
* many OSes, map it to an equivalent year before asking.
*/
if (t < 0.0 || t > 2145916800000.0) {
jsint year = EquivalentYearForDST(YearFromTime(t));
int year = EquivalentYearForDST(YearFromTime(t));
double day = MakeDay(year, MonthFromTime(t), DateFromTime(t));
t = MakeDate(day, TimeWithinDay(t));
}
@ -1273,11 +1273,11 @@ FillLocalTimes(JSContext *cx, JSObject *obj)
obj->setSlot(JSObject::JSSLOT_DATE_LOCAL_TIME, DoubleValue(localTime));
jsint year = (jsint) floor(localTime /(msPerDay*365.2425)) + 1970;
int year = (int) floor(localTime /(msPerDay*365.2425)) + 1970;
double yearStartTime = (double) TimeFromYear(year);
/* Adjust the year in case the approximation was wrong, as in YearFromTime. */
jsint yearDays;
int yearDays;
if (yearStartTime > localTime) {
year--;
yearStartTime -= (msPerDay * DaysInYear(year));
@ -1295,12 +1295,12 @@ FillLocalTimes(JSContext *cx, JSObject *obj)
obj->setSlot(JSObject::JSSLOT_DATE_LOCAL_YEAR, Int32Value(year));
uint64_t yearTime = uint64_t(localTime - yearStartTime);
jsint yearSeconds = uint32_t(yearTime / 1000);
int yearSeconds = uint32_t(yearTime / 1000);
jsint day = yearSeconds / jsint(SecondsPerDay);
int day = yearSeconds / int(SecondsPerDay);
jsint step = -1, next = 30;
jsint month;
int step = -1, next = 30;
int month;
do {
if (day <= next) {
@ -1365,19 +1365,19 @@ FillLocalTimes(JSContext *cx, JSObject *obj)
obj->setSlot(JSObject::JSSLOT_DATE_LOCAL_MONTH, Int32Value(month));
obj->setSlot(JSObject::JSSLOT_DATE_LOCAL_DATE, Int32Value(day - step));
jsint weekday = WeekDay(localTime);
int weekday = WeekDay(localTime);
obj->setSlot(JSObject::JSSLOT_DATE_LOCAL_DAY, Int32Value(weekday));
jsint seconds = yearSeconds % 60;
int seconds = yearSeconds % 60;
obj->setSlot(JSObject::JSSLOT_DATE_LOCAL_SECONDS, Int32Value(seconds));
jsint minutes = (yearSeconds / 60) % 60;
int minutes = (yearSeconds / 60) % 60;
obj->setSlot(JSObject::JSSLOT_DATE_LOCAL_MINUTES, Int32Value(minutes));
jsint hours = (yearSeconds / (60 * 60)) % 24;
int hours = (yearSeconds / (60 * 60)) % 24;
obj->setSlot(JSObject::JSSLOT_DATE_LOCAL_HOURS, Int32Value(hours));
@ -1441,7 +1441,7 @@ date_getYear(JSContext *cx, unsigned argc, Value *vp)
Value yearVal = obj->getSlot(JSObject::JSSLOT_DATE_LOCAL_YEAR);
if (yearVal.isInt32()) {
/* Follow ECMA-262 to the letter, contrary to IE JScript. */
jsint year = yearVal.toInt32() - 1900;
int year = yearVal.toInt32() - 1900;
args.rval().setInt32(year);
} else {
args.rval() = yearVal;
@ -2162,7 +2162,7 @@ date_toJSON(JSContext *cx, unsigned argc, Value *vp)
static void
new_explode(double timeval, PRMJTime *split, JSContext *cx)
{
jsint year = YearFromTime(timeval);
int year = YearFromTime(timeval);
split->tm_usec = int32_t(msFromTime(timeval)) * 1000;
split->tm_sec = int8_t(SecFromTime(timeval));
@ -2201,7 +2201,7 @@ date_format(JSContext *cx, double date, formatspec format, CallReceiver call)
/* offset from GMT in minutes. The offset includes daylight savings,
if it applies. */
jsint minutes = (jsint) floor(AdjustTime(date, cx) / msPerMinute);
int minutes = (int) floor(AdjustTime(date, cx) / msPerMinute);
/* map 510 minutes to 0830 hours */
int offset = (minutes / 60) * 100 + minutes % 60;

Просмотреть файл

@ -902,7 +902,7 @@ js::ValueToId(JSContext *cx, const Value &v, jsid *idp)
* of the with block with sp + stackIndex.
*/
static bool
EnterWith(JSContext *cx, jsint stackIndex)
EnterWith(JSContext *cx, int stackIndex)
{
StackFrame *fp = cx->fp();
Value *sp = cx->regs().sp;
@ -1535,7 +1535,7 @@ js::Interpret(JSContext *cx, StackFrame *entryFrame, InterpMode interpMode)
* "op" correctly in all other cases.
*/
JSOp op;
jsint len;
int32_t len;
len = 0;
/* Check for too deep of a native thread stack. */
@ -2896,7 +2896,7 @@ BEGIN_CASE(JSOP_TABLESWITCH)
/*
* ECMAv2+ forbids conversion of discriminant, so we will skip to the
* default case if the discriminant isn't already an int jsval. (This
* opcode is emitted only for dense jsint-domain switches.)
* opcode is emitted only for dense int-domain switches.)
*/
const Value &rref = *--regs.sp;
int32_t i;
@ -2910,14 +2910,14 @@ BEGIN_CASE(JSOP_TABLESWITCH)
}
pc2 += JUMP_OFFSET_LEN;
jsint low = GET_JUMP_OFFSET(pc2);
int32_t low = GET_JUMP_OFFSET(pc2);
pc2 += JUMP_OFFSET_LEN;
jsint high = GET_JUMP_OFFSET(pc2);
int32_t high = GET_JUMP_OFFSET(pc2);
i -= low;
if ((jsuint)i < (jsuint)(high - low + 1)) {
pc2 += JUMP_OFFSET_LEN + JUMP_OFFSET_LEN * i;
jsint off = (jsint) GET_JUMP_OFFSET(pc2);
int32_t off = (int32_t) GET_JUMP_OFFSET(pc2);
if (off)
len = off;
}
@ -2928,7 +2928,7 @@ END_VARLEN_CASE
{
BEGIN_CASE(JSOP_LOOKUPSWITCH)
{
jsint off;
int32_t off;
off = JUMP_OFFSET_LEN;
/*
@ -2941,12 +2941,12 @@ BEGIN_CASE(JSOP_LOOKUPSWITCH)
Value lval = regs.sp[-1];
regs.sp--;
int npairs;
if (!lval.isPrimitive())
goto end_lookup_switch;
pc2 += off;
jsint npairs;
npairs = (jsint) GET_UINT16(pc2);
npairs = GET_UINT16(pc2);
pc2 += UINT16_LEN;
JS_ASSERT(npairs); /* empty switch uses JSOP_TABLESWITCH */
@ -3354,7 +3354,7 @@ BEGIN_CASE(JSOP_SETTER)
JSOp op2 = JSOp(*++regs.pc);
jsid id;
Value rval;
jsint i;
int i;
JSObject *obj;
switch (op2) {
case JSOP_SETNAME:
@ -3583,7 +3583,7 @@ END_CASE(JSOP_INITELEM)
{
BEGIN_CASE(JSOP_GOSUB)
PUSH_BOOLEAN(false);
jsint i = (regs.pc - script->code) + JSOP_GOSUB_LENGTH;
int32_t i = (regs.pc - script->code) + JSOP_GOSUB_LENGTH;
len = GET_JUMP_OFFSET(regs.pc);
PUSH_INT32(i);
END_VARLEN_CASE

Просмотреть файл

@ -805,7 +805,7 @@ SetObjectElementOperation(JSContext *cx, JSObject *obj, jsid id, const Value &va
do {
if (obj->isDenseArray() && JSID_IS_INT(id)) {
jsuint length = obj->getDenseArrayInitializedLength();
jsint i = JSID_TO_INT(id);
int32_t i = JSID_TO_INT(id);
if ((jsuint)i < length) {
if (obj->getDenseArrayElement(i).isMagic(JS_ARRAY_HOLE)) {
if (js_PrototypeHasIndexedProperties(cx, obj))

Просмотреть файл

@ -426,9 +426,9 @@ js::VectorToIdArray(JSContext *cx, AutoIdVector &props, JSIdArray **idap)
if (!ida)
return false;
ida->length = static_cast<jsint>(len);
ida->length = static_cast<int>(len);
jsid *v = props.begin();
for (jsint i = 0; i < ida->length; i++)
for (int i = 0; i < ida->length; i++)
ida->vector[i].init(v[i]);
*idap = ida;
return true;
@ -1274,7 +1274,7 @@ js_IteratorNext(JSContext *cx, JSObject *iterobj, Value *rval)
return true;
JSString *str;
jsint i;
int i;
if (rval->isInt32() && StaticStrings::hasInt(i = rval->toInt32())) {
str = cx->runtime->staticStrings.getInt(i);
} else {

Просмотреть файл

@ -433,7 +433,7 @@ js_math_min(JSContext *cx, unsigned argc, Value *vp)
}
static double
powi(double x, jsint y)
powi(double x, int y)
{
jsuint n = (y < 0) ? -y : y;
double m = x;

Просмотреть файл

@ -575,7 +575,7 @@ js_IntToString(JSContext *cx, int32_t si)
/* Returns a non-NULL pointer to inside cbuf. */
static char *
IntToCString(ToCStringBuf *cbuf, jsint i, jsint base = 10)
IntToCString(ToCStringBuf *cbuf, int i, int base = 10)
{
jsuint u = (i < 0) ? -i : i;
@ -610,7 +610,7 @@ IntToCString(ToCStringBuf *cbuf, jsint i, jsint base = 10)
}
static JSString * JS_FASTCALL
js_NumberToStringWithBase(JSContext *cx, double d, jsint base);
js_NumberToStringWithBase(JSContext *cx, double d, int base);
static JS_ALWAYS_INLINE bool
num_toStringHelper(JSContext *cx, Native native, unsigned argc, Value *vp)
@ -788,7 +788,7 @@ js_num_valueOf(JSContext *cx, unsigned argc, Value *vp)
static JSBool
num_to(JSContext *cx, Native native, JSDToStrMode zeroArgMode, JSDToStrMode oneArgMode,
jsint precisionMin, jsint precisionMax, jsint precisionOffset,
int precisionMin, int precisionMax, int precisionOffset,
CallArgs args)
{
/* Use MAX_PRECISION+1 because precisionOffset can be 1. */
@ -809,7 +809,7 @@ num_to(JSContext *cx, Native native, JSDToStrMode zeroArgMode, JSDToStrMode oneA
return false;
if (precision < precisionMin || precision > precisionMax) {
ToCStringBuf cbuf;
numStr = IntToCString(&cbuf, jsint(precision));
numStr = IntToCString(&cbuf, int(precision));
JS_ASSERT(numStr);
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_PRECISION_RANGE, numStr);
return JS_FALSE;
@ -817,7 +817,7 @@ num_to(JSContext *cx, Native native, JSDToStrMode zeroArgMode, JSDToStrMode oneA
}
numStr = js_dtostr(cx->runtime->dtoaState, buf, sizeof buf,
oneArgMode, (jsint)precision + precisionOffset, d);
oneArgMode, (int)precision + precisionOffset, d);
if (!numStr) {
JS_ReportOutOfMemory(cx);
return JS_FALSE;
@ -1065,7 +1065,7 @@ extern char* DoubleToCString(double v, char* buffer, int buflen);
namespace js {
static char *
FracNumberToCString(JSContext *cx, ToCStringBuf *cbuf, double d, jsint base = 10)
FracNumberToCString(JSContext *cx, ToCStringBuf *cbuf, double d, int base = 10)
{
#ifdef DEBUG
{
@ -1097,7 +1097,7 @@ FracNumberToCString(JSContext *cx, ToCStringBuf *cbuf, double d, jsint base = 10
}
char *
NumberToCString(JSContext *cx, ToCStringBuf *cbuf, double d, jsint base/* = 10*/)
NumberToCString(JSContext *cx, ToCStringBuf *cbuf, double d, int base/* = 10*/)
{
int32_t i;
return (JSDOUBLE_IS_INT32(d, &i))
@ -1108,7 +1108,7 @@ NumberToCString(JSContext *cx, ToCStringBuf *cbuf, double d, jsint base/* = 10*/
}
static JSString * JS_FASTCALL
js_NumberToStringWithBase(JSContext *cx, double d, jsint base)
js_NumberToStringWithBase(JSContext *cx, double d, int base)
{
ToCStringBuf cbuf;
char *numStr;

Просмотреть файл

@ -160,7 +160,7 @@ class JSString;
class JSFixedString;
extern JSString * JS_FASTCALL
js_IntToString(JSContext *cx, jsint i);
js_IntToString(JSContext *cx, int i);
/*
* When base == 10, this function implements ToString() as specified by
@ -213,7 +213,7 @@ struct ToCStringBuf
* js_NumberToCString().
*/
extern char *
NumberToCString(JSContext *cx, ToCStringBuf *cbuf, double d, jsint base = 10);
NumberToCString(JSContext *cx, ToCStringBuf *cbuf, double d, int base = 10);
/*
* The largest positive integer such that all positive integers less than it

Просмотреть файл

@ -214,7 +214,7 @@ MarkSharpObjects(JSContext *cx, JSObject *obj, JSIdArray **idap, JSSharpInfo *va
return false;
bool ok = true;
for (jsint i = 0, length = ida->length; i < length; i++) {
for (int i = 0, length = ida->length; i < length; i++) {
jsid id = ida->vector[i];
JSObject *obj2;
JSProperty *prop;
@ -486,7 +486,7 @@ obj_toSource(JSContext *cx, unsigned argc, Value *vp)
*/
val = localroot + 2;
for (jsint i = 0; i < ida->length; i++) {
for (int i = 0; i < ida->length; i++) {
/* Get strings for id and value and GC-root them via vp. */
jsid id = ida->vector[i];
JSLinearString *idstr;

Просмотреть файл

@ -148,7 +148,7 @@ size_t
js_GetVariableBytecodeLength(jsbytecode *pc)
{
unsigned ncases;
jsint low, high;
int32_t low, high;
JSOp op = JSOp(*pc);
JS_ASSERT(js_CodeSpec[op].length == -1);
@ -586,7 +586,7 @@ js_Disassemble1(JSContext *cx, JSScript *script, jsbytecode *pc,
case JOF_TABLESWITCH:
{
jsint i, low, high;
int32_t i, low, high;
ptrdiff_t off = GET_JUMP_OFFSET(pc);
jsbytecode *pc2 = pc + JUMP_OFFSET_LEN;
@ -651,18 +651,18 @@ js_Disassemble1(JSContext *cx, JSScript *script, jsbytecode *pc,
int i;
case JOF_UINT16PAIR:
i = (jsint)GET_UINT16(pc);
i = (int)GET_UINT16(pc);
Sprint(sp, " %d", i);
pc += UINT16_LEN;
/* FALL THROUGH */
case JOF_UINT16:
i = (jsint)GET_UINT16(pc);
i = (int)GET_UINT16(pc);
goto print_int;
case JOF_UINT24:
JS_ASSERT(op == JSOP_UINT24 || op == JSOP_NEWARRAY);
i = (jsint)GET_UINT24(pc);
i = (int)GET_UINT24(pc);
goto print_int;
case JOF_UINT8:
@ -1558,7 +1558,7 @@ struct TableEntry {
jsval key;
ptrdiff_t offset;
JSAtom *label;
jsint order; /* source order for stable tableswitch sort */
int order; /* source order for stable tableswitch sort */
};
inline bool
@ -1766,7 +1766,7 @@ GetArgOrVarAtom(JSPrinter *jp, unsigned slot)
#define LOCAL_ASSERT(expr) LOCAL_ASSERT_RV(expr, "")
static const char *
GetLocalInSlot(SprintStack *ss, jsint i, jsint slot, JSObject *obj)
GetLocalInSlot(SprintStack *ss, int i, int slot, JSObject *obj)
{
for (Shape::Range r(obj->lastProperty()); !r.empty(); r.popFront()) {
const Shape &shape = r.front();
@ -1790,7 +1790,7 @@ GetLocalInSlot(SprintStack *ss, jsint i, jsint slot, JSObject *obj)
}
const char *
GetLocal(SprintStack *ss, jsint i)
GetLocal(SprintStack *ss, int i)
{
ptrdiff_t off = ss->offsets[i];
if (off >= 0)
@ -1826,7 +1826,7 @@ GetLocal(SprintStack *ss, jsint i)
uint32_t depth = obj->asBlock().stackDepth();
uint32_t count = obj->asBlock().slotCount();
if (jsuint(i - depth) < jsuint(count))
return GetLocalInSlot(ss, i, jsint(i - depth), obj);
return GetLocalInSlot(ss, i, int(i - depth), obj);
}
}
}
@ -1839,7 +1839,7 @@ GetLocal(SprintStack *ss, jsint i)
uint32_t depth = obj->asBlock().stackDepth();
uint32_t count = obj->asBlock().slotCount();
if (jsuint(i - depth) < jsuint(count))
return GetLocalInSlot(ss, i, jsint(i - depth), obj);
return GetLocalInSlot(ss, i, int(i - depth), obj);
}
}
@ -1849,7 +1849,7 @@ GetLocal(SprintStack *ss, jsint i)
#undef LOCAL_ASSERT
static JSBool
IsVarSlot(JSPrinter *jp, jsbytecode *pc, jsint *indexp)
IsVarSlot(JSPrinter *jp, jsbytecode *pc, int *indexp)
{
unsigned slot;
@ -1900,7 +1900,7 @@ DecompileDestructuringLHS(SprintStack *ss, jsbytecode *pc, jsbytecode *endpc, JS
JSOp op;
const JSCodeSpec *cs;
unsigned oplen;
jsint i;
int i;
const char *lval, *xval;
JSAtom *atom;
@ -2117,7 +2117,7 @@ DecompileDestructuring(SprintStack *ss, jsbytecode *pc, jsbytecode *endpc,
case JSOP_DOUBLE:
d = jp->script->getConst(GET_UINT32_INDEX(pc)).toDouble();
LOCAL_ASSERT(JSDOUBLE_IS_FINITE(d) && !JSDOUBLE_IS_NEGZERO(d));
i = (jsint)d;
i = (int)d;
do_getelem:
{
@ -2561,7 +2561,7 @@ Decompile(SprintStack *ss, jsbytecode *pc, int nb)
jssrcnote *sn, *sn2;
const char *lval, *rval, *xval, *fmt, *token;
unsigned nuses;
jsint i, argc;
int i, argc;
JSAtom *atom;
JSObject *obj;
JSFunction *fun = NULL; /* init to shut GCC up */
@ -4681,11 +4681,11 @@ Decompile(SprintStack *ss, jsbytecode *pc, int nb)
break;
case JSOP_UINT16:
i = (jsint) GET_UINT16(pc);
i = (int) GET_UINT16(pc);
goto do_sprint_int;
case JSOP_UINT24:
i = (jsint) GET_UINT24(pc);
i = (int) GET_UINT24(pc);
goto do_sprint_int;
case JSOP_INT8:
@ -4893,7 +4893,7 @@ Decompile(SprintStack *ss, jsbytecode *pc, int nb)
case JSOP_TABLESWITCH:
{
ptrdiff_t off, off2;
jsint j, n, low, high;
int32_t j, n, low, high;
TableEntry *table, *tmp;
sn = js_GetSrcNote(jp->script, pc);
@ -4998,7 +4998,7 @@ Decompile(SprintStack *ss, jsbytecode *pc, int nb)
case JSOP_CONDSWITCH:
{
ptrdiff_t off, off2, caseOff;
jsint ncases;
int ncases;
TableEntry *table;
sn = js_GetSrcNote(jp->script, pc);
@ -5040,7 +5040,7 @@ Decompile(SprintStack *ss, jsbytecode *pc, int nb)
pc2 += off2;
LOCAL_ASSERT(*pc2 == JSOP_CASE || *pc2 == JSOP_DEFAULT);
caseOff = pc2 - pc;
table[i].key = INT_TO_JSVAL((jsint) caseOff);
table[i].key = INT_TO_JSVAL((int32_t) caseOff);
table[i].offset = caseOff + GET_JUMP_OFFSET(pc2);
if (*pc2 == JSOP_CASE) {
sn = js_GetSrcNote(jp->script, pc2);

Просмотреть файл

@ -216,12 +216,12 @@ SET_UINT32_INDEX(jsbytecode *pc, uint32_t index)
(pc)[2] = UINT24_MID(i), \
(pc)[3] = UINT24_LO(i))
#define GET_INT8(pc) ((jsint)int8_t((pc)[1]))
#define GET_INT8(pc) (int8_t((pc)[1]))
#define GET_INT32(pc) ((jsint)((uint32_t((pc)[1]) << 24) | \
(uint32_t((pc)[2]) << 16) | \
(uint32_t((pc)[3]) << 8) | \
uint32_t((pc)[4])))
#define GET_INT32(pc) (((uint32_t((pc)[1]) << 24) | \
(uint32_t((pc)[2]) << 16) | \
(uint32_t((pc)[3]) << 8) | \
uint32_t((pc)[4])))
#define SET_INT32(pc,i) ((pc)[1] = (jsbytecode)(uint32_t(i) >> 24), \
(pc)[2] = (jsbytecode)(uint32_t(i) >> 16), \
(pc)[3] = (jsbytecode)(uint32_t(i) >> 8), \

Просмотреть файл

@ -94,7 +94,6 @@ typedef ptrdiff_t jsid;
JS_BEGIN_EXTERN_C
/* Scalar typedefs. */
typedef int32_t jsint;
typedef uint32_t jsuint;
#ifdef WIN32

Просмотреть файл

@ -424,7 +424,7 @@ str_resolve(JSContext *cx, JSObject *obj, jsid id, unsigned flags,
JSString *str = obj->asString().unbox();
jsint slot = JSID_TO_INT(id);
int32_t slot = JSID_TO_INT(id);
if ((size_t)slot < str->length()) {
JSString *str1 = cx->runtime->staticStrings.getUnitStringForElement(cx, str, size_t(slot));
if (!str1)
@ -877,9 +877,9 @@ out_of_range:
*/
static const jsuint sBMHCharSetSize = 256; /* ISO-Latin-1 */
static const jsuint sBMHPatLenMax = 255; /* skip table element is uint8_t */
static const jsint sBMHBadPattern = -2; /* return value if pat is not ISO-Latin-1 */
static const int sBMHBadPattern = -2; /* return value if pat is not ISO-Latin-1 */
jsint
int
js_BoyerMooreHorspool(const jschar *text, jsuint textlen,
const jschar *pat, jsuint patlen)
{
@ -903,7 +903,7 @@ js_BoyerMooreHorspool(const jschar *text, jsuint textlen,
if (text[i] != pat[j])
break;
if (j == 0)
return static_cast<jsint>(i); /* safe: max string size */
return static_cast<int>(i); /* safe: max string size */
}
}
return -1;
@ -934,7 +934,7 @@ struct ManualCmp {
};
template <class InnerMatch>
static jsint
static int
UnrolledMatch(const jschar *text, jsuint textlen, const jschar *pat, jsuint patlen)
{
JS_ASSERT(patlen > 0 && textlen > 0);
@ -979,7 +979,7 @@ UnrolledMatch(const jschar *text, jsuint textlen, const jschar *pat, jsuint patl
return -1;
}
static JS_ALWAYS_INLINE jsint
static JS_ALWAYS_INLINE int
StringMatch(const jschar *text, jsuint textlen,
const jschar *pat, jsuint patlen)
{
@ -1017,7 +1017,7 @@ StringMatch(const jschar *text, jsuint textlen,
* empirically. See bug 526348.
*/
if (textlen >= 512 && patlen >= 11 && patlen <= sBMHPatLenMax) {
jsint index = js_BoyerMooreHorspool(text, textlen, pat, patlen);
int index = js_BoyerMooreHorspool(text, textlen, pat, patlen);
if (index != sBMHBadPattern)
return index;
}
@ -1044,7 +1044,7 @@ static const size_t sRopeMatchThresholdRatioLog2 = 5;
* the 'match' outparam (-1 for not found).
*/
static bool
RopeMatch(JSContext *cx, JSString *textstr, const jschar *pat, jsuint patlen, jsint *match)
RopeMatch(JSContext *cx, JSString *textstr, const jschar *pat, jsuint patlen, int *match)
{
JS_ASSERT(textstr->isRope());
@ -1090,14 +1090,14 @@ RopeMatch(JSContext *cx, JSString *textstr, const jschar *pat, jsuint patlen, js
}
/* Absolute offset from the beginning of the logical string textstr. */
jsint pos = 0;
int pos = 0;
for (JSLinearString **outerp = strs.begin(); outerp != strs.end(); ++outerp) {
/* Try to find a match within 'outer'. */
JSLinearString *outer = *outerp;
const jschar *chars = outer->chars();
size_t len = outer->length();
jsint matchResult = StringMatch(chars, len, pat, patlen);
int matchResult = StringMatch(chars, len, pat, patlen);
if (matchResult != -1) {
/* Matched! */
*match = pos + matchResult;
@ -1166,7 +1166,7 @@ str_indexOf(JSContext *cx, unsigned argc, Value *vp)
jsuint start;
if (args.length() > 1) {
if (args[1].isInt32()) {
jsint i = args[1].toInt32();
int i = args[1].toInt32();
if (i <= 0) {
start = 0;
} else if (jsuint(i) > textlen) {
@ -1187,7 +1187,7 @@ str_indexOf(JSContext *cx, unsigned argc, Value *vp)
start = textlen;
textlen = 0;
} else {
start = (jsint)d;
start = (int)d;
text += start;
textlen -= start;
}
@ -1196,7 +1196,7 @@ str_indexOf(JSContext *cx, unsigned argc, Value *vp)
start = 0;
}
jsint match = StringMatch(text, textlen, pat, patlen);
int match = StringMatch(text, textlen, pat, patlen);
args.rval() = Int32Value((match == -1) ? -1 : start + match);
return true;
}
@ -1221,7 +1221,7 @@ str_lastIndexOf(JSContext *cx, unsigned argc, Value *vp)
size_t patlen = patstr->length();
const jschar *pat = patstr->chars();
jsint i = textlen - patlen; // Start searching here
int i = textlen - patlen; // Start searching here
if (i < 0) {
args.rval() = Int32Value(-1);
return true;
@ -1229,7 +1229,7 @@ str_lastIndexOf(JSContext *cx, unsigned argc, Value *vp)
if (args.length() > 1) {
if (args[1].isInt32()) {
jsint j = args[1].toInt32();
int j = args[1].toInt32();
if (j <= 0)
i = 0;
else if (j < i)
@ -1243,7 +1243,7 @@ str_lastIndexOf(JSContext *cx, unsigned argc, Value *vp)
if (d <= 0)
i = 0;
else if (d < i)
i = (jsint)d;
i = (int)d;
}
}
}
@ -1717,7 +1717,7 @@ struct ReplaceData
JSLinearString *repstr; /* replacement string */
const jschar *dollar; /* null or pointer to first $ in repstr */
const jschar *dollarEnd; /* limit pointer for js_strchr_limit */
jsint leftIndex; /* left context index in str->chars */
int leftIndex; /* left context index in str->chars */
JSSubString dollarStr; /* for "$$" InterpretDollar result */
bool calledBack; /* record whether callback has been called */
InvokeArgsGuard args; /* arguments for lambda call */
@ -2528,7 +2528,7 @@ class SplitStringMatcher
{
JS_ASSERT(index == 0 || index < str->length());
const jschar *chars = str->chars();
jsint match = StringMatch(chars + index, str->length() - index, sepChars, sepLength);
int match = StringMatch(chars + index, str->length() - index, sepChars, sepLength);
if (match == -1)
res->setFailure();
else

Просмотреть файл

@ -117,7 +117,7 @@ class StringBuffer
const jschar *begin() const { return cb.begin(); }
const jschar *end() const { return cb.end(); }
bool empty() const { return cb.empty(); }
inline jsint length() const;
inline int length() const;
/*
* Creates a string from the characters in this buffer, then (regardless
@ -216,12 +216,12 @@ StringBuffer::appendInflated(const char *cstr, size_t cstrlen)
return true;
}
inline jsint
inline int
StringBuffer::length() const
{
JS_STATIC_ASSERT(jsint(JSString::MAX_LENGTH) == JSString::MAX_LENGTH);
JS_STATIC_ASSERT(int(JSString::MAX_LENGTH) == JSString::MAX_LENGTH);
JS_ASSERT(cb.length() <= JSString::MAX_LENGTH);
return jsint(cb.length());
return int(cb.length());
}
inline bool

Просмотреть файл

@ -156,7 +156,7 @@ ArrayBuffer::prop_getByteLength(JSContext *cx, JSObject *obj, jsid id, Value *vp
vp->setInt32(0);
return true;
}
vp->setInt32(jsint(arrayBuffer->arrayBufferByteLength()));
vp->setInt32(int32_t(arrayBuffer->arrayBufferByteLength()));
return true;
}
@ -2542,7 +2542,7 @@ JS_NewArrayBuffer(JSContext *cx, jsuint nbytes)
}
static inline JSObject *
TypedArrayConstruct(JSContext *cx, jsint atype, unsigned argc, Value *argv)
TypedArrayConstruct(JSContext *cx, int atype, unsigned argc, Value *argv)
{
switch (atype) {
case TypedArray::TYPE_INT8:
@ -2579,7 +2579,7 @@ TypedArrayConstruct(JSContext *cx, jsint atype, unsigned argc, Value *argv)
}
JS_FRIEND_API(JSObject *)
js_CreateTypedArray(JSContext *cx, jsint atype, jsuint nelements)
js_CreateTypedArray(JSContext *cx, int atype, jsuint nelements)
{
JS_ASSERT(atype >= 0 && atype < TypedArray::TYPE_MAX);
@ -2588,7 +2588,7 @@ js_CreateTypedArray(JSContext *cx, jsint atype, jsuint nelements)
}
JS_FRIEND_API(JSObject *)
js_CreateTypedArrayWithArray(JSContext *cx, jsint atype, JSObject *arrayArg)
js_CreateTypedArrayWithArray(JSContext *cx, int atype, JSObject *arrayArg)
{
JS_ASSERT(atype >= 0 && atype < TypedArray::TYPE_MAX);
@ -2597,8 +2597,8 @@ js_CreateTypedArrayWithArray(JSContext *cx, jsint atype, JSObject *arrayArg)
}
JS_FRIEND_API(JSObject *)
js_CreateTypedArrayWithBuffer(JSContext *cx, jsint atype, JSObject *bufArg,
jsint byteoffset, jsint length)
js_CreateTypedArrayWithBuffer(JSContext *cx, int atype, JSObject *bufArg,
int byteoffset, int length)
{
JS_ASSERT(atype >= 0 && atype < TypedArray::TYPE_MAX);
JS_ASSERT(bufArg && js_IsArrayBuffer(bufArg));

Просмотреть файл

@ -307,7 +307,7 @@ js_CreateArrayBuffer(JSContext *cx, uint32_t nbytes);
* enumerant values above), with nelements elements.
*/
JS_FRIEND_API(JSObject *)
js_CreateTypedArray(JSContext *cx, jsint atype, uint32_t nelements);
js_CreateTypedArray(JSContext *cx, int atype, uint32_t nelements);
/*
* Create a new typed array of type atype (one of the TypedArray
@ -315,7 +315,7 @@ js_CreateTypedArray(JSContext *cx, jsint atype, uint32_t nelements);
* which must either be a typed array or an array-like object.
*/
JS_FRIEND_API(JSObject *)
js_CreateTypedArrayWithArray(JSContext *cx, jsint atype, JSObject *arrayArg);
js_CreateTypedArrayWithArray(JSContext *cx, int atype, JSObject *arrayArg);
/*
* Create a new typed array of type atype (one of the TypedArray
@ -325,8 +325,8 @@ js_CreateTypedArrayWithArray(JSContext *cx, jsint atype, JSObject *arrayArg);
* array are used as the default values.
*/
JS_FRIEND_API(JSObject *)
js_CreateTypedArrayWithBuffer(JSContext *cx, jsint atype, JSObject *bufArg,
jsint byteoffset, jsint length);
js_CreateTypedArrayWithBuffer(JSContext *cx, int atype, JSObject *bufArg,
int byteoffset, int length);
extern int32_t JS_FASTCALL
js_TypedArray_uint8_clamp_double(const double x);

Просмотреть файл

@ -4668,8 +4668,7 @@ static bool
IdValIsIndex(JSContext *cx, jsval id, jsuint *indexp, bool *isIndex)
{
if (JSVAL_IS_INT(id)) {
jsint i;
i = JSVAL_TO_INT(id);
int32_t i = JSVAL_TO_INT(id);
if (i < 0) {
*isIndex = false;
return true;
@ -5602,7 +5601,7 @@ static JSBool
ValueToId(JSContext *cx, jsval v, AutoIdRooter *idr)
{
if (JSVAL_IS_INT(v)) {
jsint i = JSVAL_TO_INT(v);
int32_t i = JSVAL_TO_INT(v);
if (INT_FITS_IN_JSID(i))
*idr->addr() = INT_TO_JSID(i);
else if (!js_ValueToStringId(cx, v, idr->addr()))

Просмотреть файл

@ -734,9 +734,9 @@ MakeJITScript(JSContext *cx, JSScript *script, bool construct)
jsbytecode *pc2 = pc;
unsigned defaultOffset = offset + GET_JUMP_OFFSET(pc);
pc2 += JUMP_OFFSET_LEN;
jsint low = GET_JUMP_OFFSET(pc2);
int32_t low = GET_JUMP_OFFSET(pc2);
pc2 += JUMP_OFFSET_LEN;
jsint high = GET_JUMP_OFFSET(pc2);
int32_t high = GET_JUMP_OFFSET(pc2);
pc2 += JUMP_OFFSET_LEN;
CrossChunkEdge edge;
@ -745,7 +745,7 @@ MakeJITScript(JSContext *cx, JSScript *script, bool construct)
if (!currentEdges.append(edge))
return NULL;
for (jsint i = low; i <= high; i++) {
for (int32_t i = low; i <= high; i++) {
unsigned targetOffset = offset + GET_JUMP_OFFSET(pc2);
if (targetOffset != offset) {
/*
@ -7347,9 +7347,9 @@ mjit::Compiler::jsop_tableswitch(jsbytecode *pc)
uint32_t defaultTarget = GET_JUMP_OFFSET(pc);
pc += JUMP_OFFSET_LEN;
jsint low = GET_JUMP_OFFSET(pc);
int32_t low = GET_JUMP_OFFSET(pc);
pc += JUMP_OFFSET_LEN;
jsint high = GET_JUMP_OFFSET(pc);
int32_t high = GET_JUMP_OFFSET(pc);
pc += JUMP_OFFSET_LEN;
int numJumps = high + 1 - low;
JS_ASSERT(numJumps >= 0);

Просмотреть файл

@ -235,7 +235,7 @@ stubs::SetElem(VMFrame &f)
do {
if (obj->isDenseArray() && JSID_IS_INT(id)) {
jsuint length = obj->getDenseArrayInitializedLength();
jsint i = JSID_TO_INT(id);
int32_t i = JSID_TO_INT(id);
if ((jsuint)i < length) {
if (obj->getDenseArrayElement(i).isMagic(JS_ARRAY_HOLE)) {
if (js_PrototypeHasIndexedProperties(cx, obj))
@ -1578,9 +1578,9 @@ stubs::TableSwitch(VMFrame &f, jsbytecode *origPc)
}
{
jsint low = GET_JUMP_OFFSET(pc);
int32_t low = GET_JUMP_OFFSET(pc);
pc += JUMP_OFFSET_LEN;
jsint high = GET_JUMP_OFFSET(pc);
int32_t high = GET_JUMP_OFFSET(pc);
pc += JUMP_OFFSET_LEN;
tableIdx -= low;
@ -1928,7 +1928,7 @@ stubs::ConvertToTypedInt(JSContext *cx, Value *vp)
#ifdef DEBUG
bool success =
#endif
StringToNumberType<jsint>(cx, vp->toString(), &i32);
StringToNumberType<int32_t>(cx, vp->toString(), &i32);
JS_ASSERT(success);
return i32;

Просмотреть файл

@ -1909,7 +1909,7 @@ UpdateSwitchTableBounds(JSContext *cx, JSScript *script, unsigned offset,
jsbytecode *pc;
JSOp op;
ptrdiff_t jmplen;
jsint low, high, n;
int32_t low, high, n;
pc = script->code + offset;
op = JSOp(*pc);

Просмотреть файл

@ -2370,19 +2370,19 @@ class FlowGraphSummary : public Vector<size_t> {
pc += step;
addEdge(lineno, defaultOffset);
jsint ncases;
int ncases;
if (op == JSOP_TABLESWITCH) {
jsint low = GET_JUMP_OFFSET(pc);
int32_t low = GET_JUMP_OFFSET(pc);
pc += JUMP_OFFSET_LEN;
ncases = GET_JUMP_OFFSET(pc) - low + 1;
pc += JUMP_OFFSET_LEN;
} else {
ncases = (jsint) GET_UINT16(pc);
ncases = GET_UINT16(pc);
pc += UINT16_LEN;
JS_ASSERT(ncases > 0);
}
for (jsint i = 0; i < ncases; i++) {
for (int i = 0; i < ncases; i++) {
if (op == JSOP_LOOKUPSWITCH)
pc += UINT32_INDEX_LEN;
size_t target = offset + GET_JUMP_OFFSET(pc);

Просмотреть файл

@ -293,7 +293,7 @@ js::StaticStrings::hasInt(int32_t i)
}
inline JSAtom *
js::StaticStrings::getInt(jsint i)
js::StaticStrings::getInt(int32_t i)
{
JS_ASSERT(hasInt(i));
return getUint(uint32_t(i));
@ -352,7 +352,7 @@ js::StaticStrings::lookup(const jschar *chars, size_t length)
if ('1' <= chars[0] && chars[0] <= '9' &&
'0' <= chars[1] && chars[1] <= '9' &&
'0' <= chars[2] && chars[2] <= '9') {
jsint i = (chars[0] - '0') * 100 +
int i = (chars[0] - '0') * 100 +
(chars[1] - '0') * 10 +
(chars[2] - '0');

Просмотреть файл

@ -529,7 +529,7 @@ StaticStrings::isStatic(JSAtom *atom)
if ('1' <= chars[0] && chars[0] <= '9' &&
'0' <= chars[1] && chars[1] <= '9' &&
'0' <= chars[2] && chars[2] <= '9') {
jsint i = (chars[0] - '0') * 100 +
int i = (chars[0] - '0') * 100 +
(chars[1] - '0') * 10 +
(chars[2] - '0');

Просмотреть файл

@ -723,7 +723,7 @@ class StaticStrings
inline JSAtom *getUint(uint32_t u);
static inline bool hasInt(int32_t i);
inline JSAtom *getInt(jsint i);
inline JSAtom *getInt(int32_t i);
static inline bool hasUnit(jschar c);
JSAtom *getUnit(jschar c);