Bug 891980 - IonMonkey: Allow lookupGeneric on fun_resolve hooked objects. (r=Waldo)

This commit is contained in:
Eric Faust 2013-07-23 13:32:36 -07:00
parent b900c31f5d
commit 995f07efa9
3 changed files with 11 additions and 6 deletions

View File

@ -5362,7 +5362,8 @@ CanEffectlesslyCallLookupGenericOnObject(JSContext *cx, JSObject *obj, jsid id)
return false;
if (obj->nativeLookup(cx, id))
return true;
if (obj->getClass()->resolve != JS_ResolveStub)
if (obj->getClass()->resolve != JS_ResolveStub &&
obj->getClass()->resolve != (JSResolveOp)fun_resolve)
return false;
obj = obj->getProto();
}

View File

@ -235,9 +235,9 @@ ResolveInterpretedFunctionPrototype(JSContext *cx, HandleObject obj)
return proto;
}
static JSBool
fun_resolve(JSContext *cx, HandleObject obj, HandleId id, unsigned flags,
MutableHandleObject objp)
JSBool
js::fun_resolve(JSContext *cx, HandleObject obj, HandleId id, unsigned flags,
MutableHandleObject objp)
{
if (!JSID_IS_ATOM(id))
return true;
@ -498,7 +498,7 @@ Class JSFunction::class_ = {
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
fun_enumerate,
(JSResolveOp)fun_resolve,
(JSResolveOp)js::fun_resolve,
JS_ConvertStub,
NULL, /* finalize */
NULL, /* checkAccess */
@ -1774,7 +1774,7 @@ JSObject::hasIdempotentProtoChain() const
return false;
JSResolveOp resolve = obj->getClass()->resolve;
if (resolve != JS_ResolveStub && resolve != (JSResolveOp) fun_resolve)
if (resolve != JS_ResolveStub && resolve != (JSResolveOp) js::fun_resolve)
return false;
if (obj->getOps()->lookupProperty || obj->getOps()->lookupGeneric || obj->getOps()->lookupElement)

View File

@ -409,6 +409,10 @@ DefineFunction(JSContext *cx, HandleObject obj, HandleId id, JSNative native,
gc::AllocKind allocKind = JSFunction::FinalizeKind,
NewObjectKind newKind = GenericObject);
extern JSBool
fun_resolve(JSContext *cx, js::HandleObject obj, js::HandleId id,
unsigned flags, js::MutableHandleObject objp);
// ES6 9.2.5 IsConstructor
bool IsConstructor(const Value &v);