Bug 784619 - Remove JS_PROPERTY_CACHE; r=evilpie

This commit is contained in:
Ms2ger 2012-09-06 09:14:49 +02:00
parent a56d5a2aa5
commit 848f0e8e1d
6 changed files with 12 additions and 12 deletions

View File

@ -1021,8 +1021,6 @@ struct JSRuntime : js::RuntimeFriendFields
}; };
/* Common macros to access thread-local caches in JSRuntime. */ /* 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_KEEP_ATOMS(rt) (rt)->gcKeepAtoms++;
#define JS_UNKEEP_ATOMS(rt) (rt)->gcKeepAtoms--; #define JS_UNKEEP_ATOMS(rt) (rt)->gcKeepAtoms--;
@ -1377,6 +1375,8 @@ struct JSContext : js::ContextFriendFields
inline js::PropertyTree &propertyTree(); inline js::PropertyTree &propertyTree();
js::PropertyCache &propertyCache() { return runtime->propertyCache; }
#ifdef JS_THREADSAFE #ifdef JS_THREADSAFE
unsigned outstandingRequests;/* number of JS_BeginRequest calls unsigned outstandingRequests;/* number of JS_BeginRequest calls
without the corresponding without the corresponding

View File

@ -951,7 +951,7 @@ js::AssertValidPropertyCacheHit(JSContext *cx, JSObject *start_,
JS_ASSERT(ok); JS_ASSERT(ok);
if (cx->runtime->gcNumber != sample) if (cx->runtime->gcNumber != sample)
JS_PROPERTY_CACHE(cx).restore(&savedEntry); cx->propertyCache().restore(&savedEntry);
JS_ASSERT(prop); JS_ASSERT(prop);
JS_ASSERT(pobj == found); JS_ASSERT(pobj == found);
JS_ASSERT(entry->prop == prop); JS_ASSERT(entry->prop == prop);

View File

@ -253,7 +253,7 @@ GetPropertyOperation(JSContext *cx, jsbytecode *pc, MutableHandleValue lval, Mut
PropertyCacheEntry *entry; PropertyCacheEntry *entry;
Rooted<JSObject*> obj2(cx); Rooted<JSObject*> obj2(cx);
PropertyName *name; 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) { if (!name) {
AssertValidPropertyCacheHit(cx, obj, obj2, entry); AssertValidPropertyCacheHit(cx, obj, obj2, entry);
if (!NativeGet(cx, obj, obj2, entry->prop, JSGET_CACHE_RESULT, vp.address())) if (!NativeGet(cx, obj, obj2, entry->prop, JSGET_CACHE_RESULT, vp.address()))
@ -296,7 +296,7 @@ SetPropertyOperation(JSContext *cx, jsbytecode *pc, HandleValue lval, HandleValu
PropertyCacheEntry *entry; PropertyCacheEntry *entry;
JSObject *obj2; JSObject *obj2;
PropertyName *name; 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 * Property cache hit, only partially confirmed by testForSet. We
* know that the entry applies to regs.pc and that obj's shape * know that the entry applies to regs.pc and that obj's shape

View File

@ -4386,7 +4386,7 @@ js_GetPropertyHelperInline(JSContext *cx, HandleObject obj, HandleObject receive
} }
if (getHow & JSGET_CACHE_RESULT) 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(). */ /* This call site is hot -- use the always-inlined variant of js_NativeGet(). */
if (!js_NativeGetInline(cx, receiver, obj, obj2, shape, getHow, vp.address())) if (!js_NativeGetInline(cx, receiver, obj, obj2, shape, getHow, vp.address()))
@ -4607,7 +4607,7 @@ baseops::SetPropertyHelper(JSContext *cx, HandleObject obj, HandleObject receive
*/ */
if (!shape->shadowable()) { if (!shape->shadowable()) {
if (defineHow & DNP_CACHE_RESULT) 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()) if (shape->hasDefaultSetter() && !shape->hasGetterValue())
return JS_TRUE; return JS_TRUE;
@ -4691,7 +4691,7 @@ baseops::SetPropertyHelper(JSContext *cx, HandleObject obj, HandleObject receive
} }
if ((defineHow & DNP_CACHE_RESULT) && !added) 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()); return js_NativeSet(cx, obj, receiver, shape, added, strict, vp.address());
} }

View File

@ -17,7 +17,7 @@ using namespace js;
PropertyCacheEntry * PropertyCacheEntry *
PropertyCache::fill(JSContext *cx, JSObject *obj, JSObject *pobj, Shape *shape) 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()); JS_ASSERT(!cx->runtime->isHeapBusy());
/* /*
@ -110,7 +110,7 @@ PropertyCache::fullTest(JSContext *cx, jsbytecode *pc, JSObject **objp, JSObject
JSObject *obj, *pobj; JSObject *obj, *pobj;
JSScript *script = cx->stack.currentScript(); 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); JS_ASSERT(uint32_t(pc - script->code) < script->length);
JSOp op = JSOp(*pc); JSOp op = JSOp(*pc);

View File

@ -33,7 +33,7 @@ js::PropertyCache::test(JSContext *cx, jsbytecode *pc, JSObject *&obj,
{ {
AssertRootingUnnecessary assert(cx); AssertRootingUnnecessary assert(cx);
JS_ASSERT(this == &JS_PROPERTY_CACHE(cx)); JS_ASSERT(this == &cx->propertyCache());
Shape *kshape = obj->lastProperty(); Shape *kshape = obj->lastProperty();
entry = &table[hash(pc, kshape)]; entry = &table[hash(pc, kshape)];
@ -64,7 +64,7 @@ JS_ALWAYS_INLINE bool
js::PropertyCache::testForSet(JSContext *cx, jsbytecode *pc, JSObject *obj, js::PropertyCache::testForSet(JSContext *cx, jsbytecode *pc, JSObject *obj,
PropertyCacheEntry **entryp, JSObject **obj2p, PropertyName **namep) PropertyCacheEntry **entryp, JSObject **obj2p, PropertyName **namep)
{ {
JS_ASSERT(this == &JS_PROPERTY_CACHE(cx)); JS_ASSERT(this == &cx->propertyCache());
Shape *kshape = obj->lastProperty(); Shape *kshape = obj->lastProperty();
PropertyCacheEntry *entry = &table[hash(pc, kshape)]; PropertyCacheEntry *entry = &table[hash(pc, kshape)];