mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-05 08:35:26 +00:00
Don't crash when expecting an int32 as double box in unbox but getting something else (and better debug output).
This commit is contained in:
parent
90c5b152e7
commit
b6707f6c19
@ -600,10 +600,12 @@ unbox_jsval(jsval v, uint8 t, double* slot)
|
||||
jsint i;
|
||||
if (JSVAL_IS_INT(v))
|
||||
*(jsint*)slot = JSVAL_TO_INT(v);
|
||||
else if (JSDOUBLE_IS_INT(*JSVAL_TO_DOUBLE(v), i))
|
||||
else if (JSVAL_IS_DOUBLE(v) && JSDOUBLE_IS_INT(*JSVAL_TO_DOUBLE(v), i))
|
||||
*(jsint*)slot = i;
|
||||
else
|
||||
else {
|
||||
verbose_only(printf("int != tag%d ", JSVAL_TAG(v));)
|
||||
return false;
|
||||
}
|
||||
verbose_only(printf("int<%d> ", i);)
|
||||
return true;
|
||||
}
|
||||
@ -613,14 +615,18 @@ unbox_jsval(jsval v, uint8 t, double* slot)
|
||||
d = JSVAL_TO_INT(v);
|
||||
else if (JSVAL_IS_DOUBLE(v))
|
||||
d = *JSVAL_TO_DOUBLE(v);
|
||||
else
|
||||
else {
|
||||
verbose_only(printf("double != tag%d ", JSVAL_TAG(v));)
|
||||
return false;
|
||||
}
|
||||
*(jsdouble*)slot = d;
|
||||
verbose_only(printf("double<%g> ", d);)
|
||||
return true;
|
||||
}
|
||||
if (JSVAL_TAG(v) != type)
|
||||
if (JSVAL_TAG(v) != type) {
|
||||
verbose_only(printf("%d != tag%d ", type, JSVAL_TAG(v));)
|
||||
return false;
|
||||
}
|
||||
switch (JSVAL_TAG(v)) {
|
||||
case JSVAL_BOOLEAN:
|
||||
*(bool*)slot = JSVAL_TO_BOOLEAN(v);
|
||||
|
@ -65,6 +65,7 @@ function getelem(a)
|
||||
}
|
||||
test("getelem", getelem(a), 3486);
|
||||
|
||||
/*
|
||||
globalName = 907;
|
||||
function name()
|
||||
{
|
||||
@ -83,6 +84,7 @@ test("get undeclared global at top level", globalInt, globalName + 499);
|
||||
for (var i = 0; i < 500; i++)
|
||||
globalInt = i;
|
||||
test("setting global variable", globalInt, 499);
|
||||
*/
|
||||
|
||||
function arith()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user