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; return false;
if (obj->nativeLookup(cx, id)) if (obj->nativeLookup(cx, id))
return true; return true;
if (obj->getClass()->resolve != JS_ResolveStub) if (obj->getClass()->resolve != JS_ResolveStub &&
obj->getClass()->resolve != (JSResolveOp)fun_resolve)
return false; return false;
obj = obj->getProto(); obj = obj->getProto();
} }

View File

@ -235,9 +235,9 @@ ResolveInterpretedFunctionPrototype(JSContext *cx, HandleObject obj)
return proto; return proto;
} }
static JSBool JSBool
fun_resolve(JSContext *cx, HandleObject obj, HandleId id, unsigned flags, js::fun_resolve(JSContext *cx, HandleObject obj, HandleId id, unsigned flags,
MutableHandleObject objp) MutableHandleObject objp)
{ {
if (!JSID_IS_ATOM(id)) if (!JSID_IS_ATOM(id))
return true; return true;
@ -498,7 +498,7 @@ Class JSFunction::class_ = {
JS_PropertyStub, /* getProperty */ JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */ JS_StrictPropertyStub, /* setProperty */
fun_enumerate, fun_enumerate,
(JSResolveOp)fun_resolve, (JSResolveOp)js::fun_resolve,
JS_ConvertStub, JS_ConvertStub,
NULL, /* finalize */ NULL, /* finalize */
NULL, /* checkAccess */ NULL, /* checkAccess */
@ -1774,7 +1774,7 @@ JSObject::hasIdempotentProtoChain() const
return false; return false;
JSResolveOp resolve = obj->getClass()->resolve; JSResolveOp resolve = obj->getClass()->resolve;
if (resolve != JS_ResolveStub && resolve != (JSResolveOp) fun_resolve) if (resolve != JS_ResolveStub && resolve != (JSResolveOp) js::fun_resolve)
return false; return false;
if (obj->getOps()->lookupProperty || obj->getOps()->lookupGeneric || obj->getOps()->lookupElement) 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, gc::AllocKind allocKind = JSFunction::FinalizeKind,
NewObjectKind newKind = GenericObject); 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 // ES6 9.2.5 IsConstructor
bool IsConstructor(const Value &v); bool IsConstructor(const Value &v);