From 7fa79732ebc86a6cbe692ac835c9de2c30a59e20 Mon Sep 17 00:00:00 2001 From: Eric Faust Date: Sat, 10 Aug 2013 22:20:37 -0700 Subject: [PATCH] Bug 875452 - Part 8: Move GetElementIC to use common CanAttachNative. (r=shu) --- js/src/jit/IonCaches.cpp | 13 ++++++------- js/src/jit/IonCaches.h | 12 ++++++++++++ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/js/src/jit/IonCaches.cpp b/js/src/jit/IonCaches.cpp index 0650a934f2e..6a7d949d59b 100644 --- a/js/src/jit/IonCaches.cpp +++ b/js/src/jit/IonCaches.cpp @@ -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; } diff --git a/js/src/jit/IonCaches.h b/js/src/jit/IonCaches.h index 132d8bbc0d6..d738543926a 100644 --- a/js/src/jit/IonCaches.h +++ b/js/src/jit/IonCaches.h @@ -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,