diff --git a/js/src/jit/IonCaches.cpp b/js/src/jit/IonCaches.cpp index 6a7d949d59bf..64ce52e3de43 100644 --- a/js/src/jit/IonCaches.cpp +++ b/js/src/jit/IonCaches.cpp @@ -1761,28 +1761,6 @@ GetPropertyParIC::reset() hasTypedArrayLengthStub_ = false; } -/* static */ bool -GetPropertyParIC::canAttachReadSlot(LockedJSContext &cx, IonCache &cache, - TypedOrValueRegister output, JSObject *obj, - PropertyName *name, MutableHandleObject holder, - MutableHandleShape shape) -{ - // Bail if we have hooks or are not native. - if (!obj->hasIdempotentProtoChain()) - return false; - - if (!js::LookupPropertyPure(obj, NameToId(name), holder.address(), shape.address())) - return false; - - // In parallel execution we can't cache getters due to possible - // side-effects, so only check if we can cache slot reads. - RootedScript script(cx); - jsbytecode *pc; - cache.getScriptedLocation(&script, &pc); - return (IsCacheableGetPropReadSlot(obj, holder, shape) || - IsCacheableNoProperty(obj, holder, shape, pc, output)); -} - bool GetPropertyParIC::attachReadSlot(LockedJSContext &cx, IonScript *ion, JSObject *obj, JSObject *holder, Shape *shape) @@ -2991,9 +2969,13 @@ GetElementParIC::update(ForkJoinSlice *slice, size_t cacheIndex, HandleObject ob { RootedShape shape(cx); RootedObject holder(cx); - PropertyName *name = JSID_TO_ATOM(id)->asPropertyName(); - if (GetPropertyParIC::canAttachReadSlot(cx, cache, cache.output(), obj, - name, &holder, &shape)) + RootedPropertyName name(cx, JSID_TO_ATOM(id)->asPropertyName()); + + 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, idval, name, holder, shape)) return TP_FATAL; diff --git a/js/src/jit/IonCaches.h b/js/src/jit/IonCaches.h index d738543926a4..c055f9c7397e 100644 --- a/js/src/jit/IonCaches.h +++ b/js/src/jit/IonCaches.h @@ -998,11 +998,6 @@ class GetPropertyParIC : public ParallelIonCache 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, - MutableHandleShape shape); - bool attachReadSlot(LockedJSContext &cx, IonScript *ion, JSObject *obj, JSObject *holder, Shape *shape); bool attachArrayLength(LockedJSContext &cx, IonScript *ion, JSObject *obj); @@ -1052,6 +1047,16 @@ class GetElementParIC : public ParallelIonCache return monitoredResult_; } + // 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; } + bool attachReadSlot(LockedJSContext &cx, IonScript *ion, JSObject *obj, const Value &idval, PropertyName *name, JSObject *holder, Shape *shape); bool attachDenseElement(LockedJSContext &cx, IonScript *ion, JSObject *obj, const Value &idval);