Bug 784619 - Remove JS_PROPERTY_CACHE; r=evilpie
authorMs2ger <ms2ger@gmail.com>
Thu, 06 Sep 2012 09:14:49 +0200
changeset 104378 5cb3f0cf76355d652d3059756b02b273ff73f61a
parent 104377 b574a4e9c9db9b8d163a31b0193f7bac019d8f98
child 104379 008606bf79d74308ac6d579ad24f08b81b20ded9
push id23421
push userMs2ger@gmail.com
push dateThu, 06 Sep 2012 08:20:50 +0000
treeherdermozilla-central@47126ccdb660 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersevilpie
bugs784619
milestone18.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 784619 - Remove JS_PROPERTY_CACHE; r=evilpie
js/src/jscntxt.h
js/src/jsinterp.cpp
js/src/jsinterpinlines.h
js/src/jsobj.cpp
js/src/jspropertycache.cpp
js/src/jspropertycacheinlines.h
--- a/js/src/jscntxt.h
+++ b/js/src/jscntxt.h
@@ -1016,18 +1016,16 @@ struct JSRuntime : js::RuntimeFriendFiel
         return jitHardening;
     }
 
     void sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf, JS::RuntimeSizes *runtime);
     size_t sizeOfExplicitNonHeap();
 };
 
 /* Common macros to access thread-local caches in JSRuntime. */
-#define JS_PROPERTY_CACHE(cx)   (cx->runtime->propertyCache)
-
 #define JS_KEEP_ATOMS(rt)   (rt)->gcKeepAtoms++;
 #define JS_UNKEEP_ATOMS(rt) (rt)->gcKeepAtoms--;
 
 #ifdef JS_ARGUMENT_FORMATTER_DEFINED
 /*
  * Linked list mapping format strings for JS_{Convert,Push}Arguments{,VA} to
  * formatter functions.  Elements are sorted in non-increasing format string
  * length order.
@@ -1372,16 +1370,18 @@ struct JSContext : js::ContextFriendFiel
     bool hasAtLineOption() const { return hasRunOption(JSOPTION_ATLINE); }
 
     js::LifoAlloc &tempLifoAlloc() { return runtime->tempLifoAlloc; }
     inline js::LifoAlloc &analysisLifoAlloc();
     inline js::LifoAlloc &typeLifoAlloc();
 
     inline js::PropertyTree &propertyTree();
 
+    js::PropertyCache &propertyCache() { return runtime->propertyCache; }
+
 #ifdef JS_THREADSAFE
     unsigned            outstandingRequests;/* number of JS_BeginRequest calls
                                                without the corresponding
                                                JS_EndRequest. */
 #endif
 
     /* Stored here to avoid passing it around as a parameter. */
     unsigned               resolveFlags;
--- a/js/src/jsinterp.cpp
+++ b/js/src/jsinterp.cpp
@@ -946,17 +946,17 @@ js::AssertValidPropertyCacheHit(JSContex
     RootedPropertyName name(cx, GetNameFromBytecode(cx, script, pc, JSOp(*pc)));
     RootedObject start(cx, start_);
     RootedObject pobj(cx);
     RootedShape prop(cx);
     bool ok = baseops::LookupProperty(cx, start, name, &pobj, &prop);
     JS_ASSERT(ok);
 
     if (cx->runtime->gcNumber != sample)
-        JS_PROPERTY_CACHE(cx).restore(&savedEntry);
+        cx->propertyCache().restore(&savedEntry);
     JS_ASSERT(prop);
     JS_ASSERT(pobj == found);
     JS_ASSERT(entry->prop == prop);
 }
 #endif /* DEBUG && !JS_THREADSAFE */
 
 /*
  * Ensure that the intrepreter switch can close call-bytecode cases in the
--- a/js/src/jsinterpinlines.h
+++ b/js/src/jsinterpinlines.h
@@ -248,17 +248,17 @@ GetPropertyOperation(JSContext *cx, jsby
 
     RootedObject obj(cx, ToObjectFromStack(cx, lval));
     if (!obj)
         return false;
 
     PropertyCacheEntry *entry;
     Rooted<JSObject*> obj2(cx);
     PropertyName *name;
-    JS_PROPERTY_CACHE(cx).test(cx, pc, obj.get(), obj2.get(), entry, name);
+    cx->propertyCache().test(cx, pc, obj.get(), obj2.get(), entry, name);
     if (!name) {
         AssertValidPropertyCacheHit(cx, obj, obj2, entry);
         if (!NativeGet(cx, obj, obj2, entry->prop, JSGET_CACHE_RESULT, vp.address()))
             return false;
         return true;
     }
 
     RootedId id(cx, NameToId(name));
@@ -291,17 +291,17 @@ SetPropertyOperation(JSContext *cx, jsby
 
     RootedObject obj(cx, ToObjectFromStack(cx, lval));
     if (!obj)
         return false;
 
     PropertyCacheEntry *entry;
     JSObject *obj2;
     PropertyName *name;
-    if (JS_PROPERTY_CACHE(cx).testForSet(cx, pc, obj, &entry, &obj2, &name)) {
+    if (cx->propertyCache().testForSet(cx, pc, obj, &entry, &obj2, &name)) {
         /*
          * Property cache hit, only partially confirmed by testForSet. We
          * know that the entry applies to regs.pc and that obj's shape
          * matches.
          *
          * The entry predicts a set either an existing "own" property, or
          * on a prototype property that has a setter.
          */
--- a/js/src/jsobj.cpp
+++ b/js/src/jsobj.cpp
@@ -4381,17 +4381,17 @@ js_GetPropertyHelperInline(JSContext *cx
 
     if (!obj2->isNative()) {
         return obj2->isProxy()
                ? Proxy::get(cx, obj2, receiver, id, vp)
                : JSObject::getGeneric(cx, obj2, obj2, id, vp);
     }
 
     if (getHow & JSGET_CACHE_RESULT)
-        JS_PROPERTY_CACHE(cx).fill(cx, obj, obj2, shape);
+        cx->propertyCache().fill(cx, obj, obj2, shape);
 
     /* This call site is hot -- use the always-inlined variant of js_NativeGet(). */
     if (!js_NativeGetInline(cx, receiver, obj, obj2, shape, getHow, vp.address()))
         return JS_FALSE;
 
     return JS_TRUE;
 }
 
@@ -4602,17 +4602,17 @@ baseops::SetPropertyHelper(JSContext *cx
 
         attrs = shape->attributes();
         if (pobj != obj) {
             /*
              * We found id in a prototype object: prepare to share or shadow.
              */
             if (!shape->shadowable()) {
                 if (defineHow & DNP_CACHE_RESULT)
-                    JS_PROPERTY_CACHE(cx).fill(cx, obj, pobj, shape);
+                    cx->propertyCache().fill(cx, obj, pobj, shape);
 
                 if (shape->hasDefaultSetter() && !shape->hasGetterValue())
                     return JS_TRUE;
 
                 return shape->set(cx, obj, receiver, strict, vp);
             }
 
             /*
@@ -4686,17 +4686,17 @@ baseops::SetPropertyHelper(JSContext *cx
         if (!CallAddPropertyHook(cx, clasp, obj, shape, vp)) {
             obj->removeProperty(cx, id);
             return JS_FALSE;
         }
         added = true;
     }
 
     if ((defineHow & DNP_CACHE_RESULT) && !added)
-        JS_PROPERTY_CACHE(cx).fill(cx, obj, obj, shape);
+        cx->propertyCache().fill(cx, obj, obj, shape);
 
     return js_NativeSet(cx, obj, receiver, shape, added, strict, vp.address());
 }
 
 JSBool
 baseops::SetElementHelper(JSContext *cx, HandleObject obj, HandleObject receiver, uint32_t index,
                           unsigned defineHow, MutableHandleValue vp, JSBool strict)
 {
--- a/js/src/jspropertycache.cpp
+++ b/js/src/jspropertycache.cpp
@@ -12,17 +12,17 @@
 #include "jsopcodeinlines.h"
 #include "jspropertycacheinlines.h"
 
 using namespace js;
 
 PropertyCacheEntry *
 PropertyCache::fill(JSContext *cx, JSObject *obj, JSObject *pobj, Shape *shape)
 {
-    JS_ASSERT(this == &JS_PROPERTY_CACHE(cx));
+    JS_ASSERT(this == &cx->propertyCache());
     JS_ASSERT(!cx->runtime->isHeapBusy());
 
     /*
      * Check for overdeep scope and prototype chain. Because resolve, getter,
      * and setter hooks can change the prototype chain using JS_SetPrototype
      * after LookupPropertyWithFlags has returned, we calculate the protoIndex
      * here and not in LookupPropertyWithFlags.
      */
@@ -105,17 +105,17 @@ PropertyCache::fill(JSContext *cx, JSObj
 
 PropertyName *
 PropertyCache::fullTest(JSContext *cx, jsbytecode *pc, JSObject **objp, JSObject **pobjp,
                         PropertyCacheEntry *entry)
 {
     JSObject *obj, *pobj;
     JSScript *script = cx->stack.currentScript();
 
-    JS_ASSERT(this == &JS_PROPERTY_CACHE(cx));
+    JS_ASSERT(this == &cx->propertyCache());
     JS_ASSERT(uint32_t(pc - script->code) < script->length);
 
     JSOp op = JSOp(*pc);
 
     obj = *objp;
 
     if (entry->kpc != pc) {
         PCMETER(kpcmisses++);
--- a/js/src/jspropertycacheinlines.h
+++ b/js/src/jspropertycacheinlines.h
@@ -28,17 +28,17 @@
  * caches (on all threads) by re-generating JSObject::shape().
  */
 JS_ALWAYS_INLINE void
 js::PropertyCache::test(JSContext *cx, jsbytecode *pc, JSObject *&obj,
                         JSObject *&pobj, PropertyCacheEntry *&entry, PropertyName *&name)
 {
     AssertRootingUnnecessary assert(cx);
 
-    JS_ASSERT(this == &JS_PROPERTY_CACHE(cx));
+    JS_ASSERT(this == &cx->propertyCache());
 
     Shape *kshape = obj->lastProperty();
     entry = &table[hash(pc, kshape)];
     PCMETER(pctestentry = entry);
     PCMETER(tests++);
     JS_ASSERT(&obj != &pobj);
     if (entry->kpc == pc && entry->kshape == kshape) {
         JSObject *tmp;
@@ -59,17 +59,17 @@ js::PropertyCache::test(JSContext *cx, j
     if (name)
         PCMETER(misses++);
 }
 
 JS_ALWAYS_INLINE bool
 js::PropertyCache::testForSet(JSContext *cx, jsbytecode *pc, JSObject *obj,
                               PropertyCacheEntry **entryp, JSObject **obj2p, PropertyName **namep)
 {
-    JS_ASSERT(this == &JS_PROPERTY_CACHE(cx));
+    JS_ASSERT(this == &cx->propertyCache());
 
     Shape *kshape = obj->lastProperty();
     PropertyCacheEntry *entry = &table[hash(pc, kshape)];
     *entryp = entry;
     PCMETER(pctestentry = entry);
     PCMETER(tests++);
     PCMETER(settests++);
     if (entry->kpc == pc && entry->kshape == kshape)