[INFER] Overhaul handling of prototypes in type inference, bug 557407.

This commit is contained in:
Brian Hackett
2010-11-24 20:41:52 -05:00
parent 5fc44cdc9b
commit 3a36969da3
26 changed files with 976 additions and 1087 deletions

View File

@@ -2559,7 +2559,7 @@ static void type_NewDate(JSContext *cx, JSTypeFunction *jsfun, JSTypeCallsite *j
#ifdef JS_TYPE_INFERENCE
TypeCallsite *site = Valueify(jssite);
if (site->isNew) {
TypeObject *object = cx->getFixedTypeObject(TYPE_OBJECT_NEW_DATE);
TypeObject *object = Valueify(jsfun)->prototypeObject->getNewObject(cx);
site->returnTypes->addType(cx, (jstype) object);
} else {
JS_TypeHandlerString(cx, jsfun, jssite);
@@ -2604,8 +2604,7 @@ js_InitDateClass(JSContext *cx, JSObject *obj)
JS_FRIEND_API(JSObject *)
js_NewDateObjectMsec(JSContext *cx, jsdouble msec_time)
{
types::TypeObject *type = cx->getFixedTypeObject(types::TYPE_OBJECT_NEW_DATE);
JSObject *obj = NewBuiltinClassInstance(cx, &js_DateClass, type);
JSObject *obj = NewBuiltinClassInstance(cx, &js_DateClass, NULL);
if (!obj || !obj->ensureSlots(cx, JSObject::DATE_CLASS_RESERVED_SLOTS))
return NULL;
if (!SetUTCTime(cx, obj, msec_time))