Bug 875452 - Part 7: Move GetPropertyParIC to common CanAttachNative. (r=shu)

This commit is contained in:
Eric Faust 2013-08-10 22:20:37 -07:00
parent 8a27992333
commit 62b1972275
2 changed files with 22 additions and 8 deletions

View File

@ -1855,19 +1855,23 @@ GetPropertyParIC::update(ForkJoinSlice *slice, size_t cacheIndex,
{
RootedShape shape(cx);
RootedObject holder(cx);
if (canAttachReadSlot(cx, cache, cache.output(), obj, cache.name(),
&holder, &shape))
{
RootedPropertyName name(cx, cache.name());
GetPropertyIC::NativeGetPropCacheability canCache =
CanAttachNativeGetProp(cx, cache, obj, name, &holder, &shape);
JS_ASSERT(canCache != GetPropertyIC::CanAttachError);
if (canCache == GetPropertyIC::CanAttachReadSlot) {
if (!cache.attachReadSlot(cx, ion, obj, holder, shape))
return TP_FATAL;
attachedStub = true;
}
}
if (!attachedStub && obj->is<ArrayObject>() && slice->names().length == cache.name()) {
if (!cache.attachArrayLength(cx, ion, obj))
return TP_FATAL;
attachedStub = true;
if (!attachedStub && canCache == GetPropertyIC::CanAttachArrayLength) {
if (!cache.attachArrayLength(cx, ion, obj))
return TP_FATAL;
attachedStub = true;
}
}
if (!attachedStub && !cache.hasTypedArrayLengthStub() &&

View File

@ -976,6 +976,16 @@ class GetPropertyParIC : public ParallelIonCache
return hasTypedArrayLengthStub_;
}
// CanAttachNativeGetProp Helpers
typedef LockedJSContext & Context;
static bool doPropertyLookup(Context cx, HandleObject obj, HandlePropertyName name,
MutableHandleObject holder, MutableHandleShape shape) {
return LookupPropertyPure(obj, NameToId(name), holder.address(), shape.address());
}
bool lookupNeedsIdempotentChain() const { return true; }
bool canMonitorSingletonUndefinedSlot(HandleObject, HandleShape) const { return true; }
bool allowGetters() const { return false; }
static bool canAttachReadSlot(LockedJSContext &cx, IonCache &cache,
TypedOrValueRegister output, JSObject *obj,
PropertyName *name, MutableHandleObject holder,