Bug 875452 - Part 8: Move GetElementIC to use common CanAttachNative. (r=shu)

This commit is contained in:
Eric Faust 2013-08-10 22:20:37 -07:00
parent 7038ea516f
commit 7fa79732eb
2 changed files with 18 additions and 7 deletions

View File

@ -2340,15 +2340,14 @@ GetElementIC::attachGetProp(JSContext *cx, IonScript *ion, HandleObject obj,
RootedObject holder(cx);
RootedShape shape(cx);
if (!JSObject::lookupProperty(cx, obj, name, &holder, &shape))
GetPropertyIC::NativeGetPropCacheability canCache =
CanAttachNativeGetProp(cx, *this, obj, name, &holder, &shape);
if (canCache == GetPropertyIC::CanAttachError)
return false;
RootedScript script(cx);
jsbytecode *pc;
getScriptedLocation(&script, &pc);
if (!IsCacheableGetPropReadSlot(obj, holder, shape) &&
!IsCacheableNoProperty(obj, holder, shape, pc, output())) {
if (canCache != GetPropertyIC::CanAttachReadSlot) {
IonSpew(IonSpew_InlineCaches, "GETELEM uncacheable property");
return true;
}

View File

@ -705,6 +705,18 @@ class GetElementIC : public RepatchIonCache
hasDenseStub_ = true;
}
// Helpers for CanAttachNativeGetProp
typedef JSContext * Context;
static bool doPropertyLookup(Context cx, HandleObject obj, HandlePropertyName name,
MutableHandleObject holder, MutableHandleShape shape) {
return JSObject::lookupProperty(cx, obj, name, holder, shape);
}
bool allowGetters() const { return false; }
bool lookupNeedsIdempotentChain() const { return false; }
bool canMonitorSingletonUndefinedSlot(HandleObject holder, HandleShape shape) const {
return monitoredResult();
}
static bool canAttachGetProp(JSObject *obj, const Value &idval, jsid id);
static bool canAttachDenseElement(JSObject *obj, const Value &idval);
static bool canAttachTypedArrayElement(JSObject *obj, const Value &idval,