js_obj_hasOwnProperty is supposed to return a boolean but was incorrectly generating code to return a number, resulting on a failure in the boolean comparison due to an unexpected i2f (450304).

This commit is contained in:
Andreas Gal 2008-08-12 14:28:15 -07:00
parent 64fa74acf5
commit 1819586877
2 changed files with 5 additions and 3 deletions

View File

@ -465,7 +465,7 @@ js_Object_p_hasOwnProperty(JSContext* cx, JSObject* obj, JSString *str)
{ {
jsval v; jsval v;
if (!js_HasOwnProperty(cx, obj->map->ops->lookupProperty, obj, ATOM_TO_JSID(str), &v)) if (!js_HasOwnProperty(cx, obj->map->ops->lookupProperty, obj, ATOM_TO_JSID(str), &v))
return -1; return JSVAL_TO_BOOLEAN(JSVAL_VOID);
JS_ASSERT(JSVAL_IS_BOOLEAN(v)); JS_ASSERT(JSVAL_IS_BOOLEAN(v));
return JSVAL_TO_BOOLEAN(v); return JSVAL_TO_BOOLEAN(v);
} }

View File

@ -3377,7 +3377,7 @@ TraceRecorder::record_JSOP_CALL()
if (FUN_SLOW_NATIVE(fun)) if (FUN_SLOW_NATIVE(fun))
ABORT_TRACE("slow native"); ABORT_TRACE("slow native");
enum JSTNErrType { INFALLIBLE, FAIL_NULL, FAIL_NEG }; enum JSTNErrType { INFALLIBLE, FAIL_NULL, FAIL_NEG, FAIL_VOID };
static struct JSTraceableNative { static struct JSTraceableNative {
JSFastNative native; JSFastNative native;
int builtin; int builtin;
@ -3400,7 +3400,7 @@ TraceRecorder::record_JSOP_CALL()
{ js_str_concat, F_String_p_concat_1int, "TC", "i", FAIL_NULL, NULL }, { js_str_concat, F_String_p_concat_1int, "TC", "i", FAIL_NULL, NULL },
{ js_array_join, F_Array_p_join, "TC", "s", FAIL_NULL, NULL }, { js_array_join, F_Array_p_join, "TC", "s", FAIL_NULL, NULL },
{ js_obj_hasOwnProperty, F_Object_p_hasOwnProperty, { js_obj_hasOwnProperty, F_Object_p_hasOwnProperty,
"TC", "s", FAIL_NEG, NULL }, "TC", "s", FAIL_VOID, NULL },
{ js_obj_propertyIsEnumerable, F_Object_p_propertyIsEnumerable, { js_obj_propertyIsEnumerable, F_Object_p_propertyIsEnumerable,
"TC", "s", FAIL_NEG, NULL }, "TC", "s", FAIL_NEG, NULL },
}; };
@ -3505,6 +3505,8 @@ TraceRecorder::record_JSOP_CALL()
jsdpun u; jsdpun u;
u.d = 0.0; u.d = 0.0;
guard(false, lir->ins2(LIR_flt, res_ins, lir->insImmq(u.u64)), OOM_EXIT); guard(false, lir->ins2(LIR_flt, res_ins, lir->insImmq(u.u64)), OOM_EXIT);
} else if (known->errtype == FAIL_VOID) {
guard(false, lir->ins2i(LIR_eq, res_ins, 2), OOM_EXIT);
} }
set(&fval, res_ins); set(&fval, res_ins);
return true; return true;