mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
If we expect a concrete value but see an undefined come into the trace, convert undefined to the concerete value.
This commit is contained in:
parent
a7b0f45c3f
commit
fcd8670fec
@ -850,27 +850,32 @@ TraceRecorder::trackNativeStackUse(unsigned slots)
|
|||||||
/* Unbox a jsval into a slot. Slots are wide enough to hold double values
|
/* Unbox a jsval into a slot. Slots are wide enough to hold double values
|
||||||
directly (instead of storing a pointer to them). */
|
directly (instead of storing a pointer to them). */
|
||||||
static bool
|
static bool
|
||||||
ValueToNative(jsval v, uint8 type, double* slot)
|
ValueToNative(JSContext* cx, jsval v, uint8 type, double* slot)
|
||||||
{
|
{
|
||||||
if (type == JSVAL_INT) {
|
unsigned tag = JSVAL_TAG(v);
|
||||||
|
switch (type) {
|
||||||
|
case JSVAL_INT:
|
||||||
jsint i;
|
jsint i;
|
||||||
if (JSVAL_IS_INT(v))
|
if (JSVAL_IS_INT(v))
|
||||||
*(jsint*)slot = JSVAL_TO_INT(v);
|
*(jsint*)slot = JSVAL_TO_INT(v);
|
||||||
else if (JSVAL_IS_DOUBLE(v) && JSDOUBLE_IS_INT(*JSVAL_TO_DOUBLE(v), i))
|
else if ((tag == JSVAL_DOUBLE) && JSDOUBLE_IS_INT(*JSVAL_TO_DOUBLE(v), i))
|
||||||
*(jsint*)slot = i;
|
*(jsint*)slot = i;
|
||||||
|
else if (v == JSVAL_VOID)
|
||||||
|
*(jsint*)slot = 0;
|
||||||
else {
|
else {
|
||||||
debug_only_v(printf("int != tag%lu(value=%lu) ", JSVAL_TAG(v), v);)
|
debug_only_v(printf("int != tag%lu(value=%lu) ", JSVAL_TAG(v), v);)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
debug_only_v(printf("int<%d> ", *(jsint*)slot);)
|
debug_only_v(printf("int<%d> ", *(jsint*)slot);)
|
||||||
return true;
|
return true;
|
||||||
}
|
case JSVAL_DOUBLE:
|
||||||
if (type == JSVAL_DOUBLE) {
|
|
||||||
jsdouble d;
|
jsdouble d;
|
||||||
if (JSVAL_IS_INT(v))
|
if (JSVAL_IS_INT(v))
|
||||||
d = JSVAL_TO_INT(v);
|
d = JSVAL_TO_INT(v);
|
||||||
else if (JSVAL_IS_DOUBLE(v))
|
else if (tag == JSVAL_DOUBLE)
|
||||||
d = *JSVAL_TO_DOUBLE(v);
|
d = *JSVAL_TO_DOUBLE(v);
|
||||||
|
else if (v == JSVAL_VOID)
|
||||||
|
d = js_NaN;
|
||||||
else {
|
else {
|
||||||
debug_only_v(printf("double != tag%lu ", JSVAL_TAG(v));)
|
debug_only_v(printf("double != tag%lu ", JSVAL_TAG(v));)
|
||||||
return false;
|
return false;
|
||||||
@ -878,29 +883,39 @@ ValueToNative(jsval v, uint8 type, double* slot)
|
|||||||
*(jsdouble*)slot = d;
|
*(jsdouble*)slot = d;
|
||||||
debug_only_v(printf("double<%g> ", d);)
|
debug_only_v(printf("double<%g> ", d);)
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
if (JSVAL_TAG(v) != type) {
|
|
||||||
debug_only_v(printf("%d != tag%lu ", type, JSVAL_TAG(v));)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
switch (JSVAL_TAG(v)) {
|
|
||||||
case JSVAL_BOOLEAN:
|
case JSVAL_BOOLEAN:
|
||||||
|
if (tag != JSVAL_BOOLEAN) {
|
||||||
|
debug_only_v(printf("bool != tag%u ", tag);)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
*(JSBool*)slot = JSVAL_TO_BOOLEAN(v);
|
*(JSBool*)slot = JSVAL_TO_BOOLEAN(v);
|
||||||
debug_only_v(printf("boolean<%d> ", *(bool*)slot);)
|
debug_only_v(printf("boolean<%d> ", *(bool*)slot);)
|
||||||
break;
|
return true;
|
||||||
case JSVAL_STRING:
|
case JSVAL_STRING:
|
||||||
|
if (v == JSVAL_VOID) {
|
||||||
|
*(JSString**)slot = ATOM_TO_STRING(cx->runtime->atomState.typeAtoms[JSTYPE_VOID]);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (tag != JSVAL_STRING) {
|
||||||
|
debug_only_v(printf("string != tag%u ", tag);)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
*(JSString**)slot = JSVAL_TO_STRING(v);
|
*(JSString**)slot = JSVAL_TO_STRING(v);
|
||||||
debug_only_v(printf("string<%p> ", *(JSString**)slot);)
|
debug_only_v(printf("string<%p> ", *(JSString**)slot);)
|
||||||
break;
|
return true;
|
||||||
default:
|
default:
|
||||||
JS_ASSERT(JSVAL_IS_OBJECT(v));
|
JS_ASSERT(type == JSVAL_OBJECT);
|
||||||
|
if (tag != JSVAL_OBJECT) {
|
||||||
|
debug_only_v(printf("object != tag%u ", tag);)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
*(JSObject**)slot = JSVAL_TO_OBJECT(v);
|
*(JSObject**)slot = JSVAL_TO_OBJECT(v);
|
||||||
debug_only_v(printf("object<%p:%s> ", JSVAL_TO_OBJECT(v),
|
debug_only_v(printf("object<%p:%s> ", JSVAL_TO_OBJECT(v),
|
||||||
JSVAL_IS_NULL(v)
|
JSVAL_IS_NULL(v)
|
||||||
? "null"
|
? "null"
|
||||||
: STOBJ_GET_CLASS(JSVAL_TO_OBJECT(v))->name);)
|
: STOBJ_GET_CLASS(JSVAL_TO_OBJECT(v))->name);)
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Box a value from the native stack back into the jsval format. Integers
|
/* Box a value from the native stack back into the jsval format. Integers
|
||||||
@ -958,7 +973,7 @@ BuildNativeGlobalFrame(JSContext* cx, unsigned ngslots, uint16* gslots, uint8* m
|
|||||||
{
|
{
|
||||||
debug_only_v(printf("global: ");)
|
debug_only_v(printf("global: ");)
|
||||||
FORALL_GLOBAL_SLOTS(cx, ngslots, gslots,
|
FORALL_GLOBAL_SLOTS(cx, ngslots, gslots,
|
||||||
if (!ValueToNative(*vp, *mp, np + gslots[n]))
|
if (!ValueToNative(cx, *vp, *mp, np + gslots[n]))
|
||||||
return false;
|
return false;
|
||||||
++mp;
|
++mp;
|
||||||
);
|
);
|
||||||
@ -974,7 +989,7 @@ BuildNativeStackFrame(JSContext* cx, unsigned callDepth, uint8* mp, double* np)
|
|||||||
debug_only_v(printf("stack: ");)
|
debug_only_v(printf("stack: ");)
|
||||||
FORALL_SLOTS_IN_PENDING_FRAMES(cx, callDepth,
|
FORALL_SLOTS_IN_PENDING_FRAMES(cx, callDepth,
|
||||||
debug_only_v(printf("%s%u=", vpname, vpnum);)
|
debug_only_v(printf("%s%u=", vpname, vpnum);)
|
||||||
if (!ValueToNative(*vp, *mp, np))
|
if (!ValueToNative(cx, *vp, *mp, np))
|
||||||
return false;
|
return false;
|
||||||
++mp; ++np;
|
++mp; ++np;
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user