Backed out changeset 7ab1be136cfa - that patch for bug 498899 has a bug.

This commit is contained in:
Igor Bukanov 2009-06-18 15:00:55 +02:00
Родитель b5255ffab4
Коммит 407f774141
4 изменённых файлов: 21 добавлений и 34 удалений

Просмотреть файл

@ -433,13 +433,16 @@ js_FullTestPropertyCache(JSContext *cx, jsbytecode *pc,
}
pobj = obj;
JS_LOCK_OBJ(cx, pobj);
if (JOF_MODE(cs->format) == JOF_NAME) {
while (vcap & (PCVCAP_SCOPEMASK << PCVCAP_PROTOBITS)) {
tmp = OBJ_GET_PARENT(cx, pobj);
tmp = LOCKED_OBJ_GET_PARENT(pobj);
if (!tmp || !OBJ_IS_NATIVE(tmp))
break;
JS_UNLOCK_OBJ(cx, pobj);
pobj = tmp;
JS_LOCK_OBJ(cx, pobj);
vcap -= PCVCAP_PROTOSIZE;
}
@ -447,14 +450,16 @@ js_FullTestPropertyCache(JSContext *cx, jsbytecode *pc,
}
while (vcap & PCVCAP_PROTOMASK) {
tmp = OBJ_GET_PROTO(cx, pobj);
tmp = LOCKED_OBJ_GET_PROTO(pobj);
if (!tmp || !OBJ_IS_NATIVE(tmp))
break;
JS_UNLOCK_OBJ(cx, pobj);
pobj = tmp;
JS_LOCK_OBJ(cx, pobj);
--vcap;
}
if (JS_LOCK_OBJ_IF_SHAPE(cx, pobj, PCVCAP_SHAPE(vcap))) {
if (PCVCAP_SHAPE(vcap) == OBJ_SHAPE(pobj)) {
#ifdef DEBUG
jsid id = ATOM_TO_JSID(atom);
@ -467,6 +472,7 @@ js_FullTestPropertyCache(JSContext *cx, jsbytecode *pc,
}
PCMETER(JS_PROPERTY_CACHE(cx).vcmisses++);
JS_UNLOCK_OBJ(cx, pobj);
return atom;
}
@ -4635,13 +4641,13 @@ js_Interpret(JSContext *cx)
PCVCAP_SHAPE(entry->vcap) == rt->protoHazardShape) {
JS_ASSERT(PCVCAP_TAG(entry->vcap) == 0);
if (JS_LOCK_OBJ_IF_SHAPE(cx, obj, kshape)) {
JS_LOCK_OBJ(cx, obj);
JSScope *scope = OBJ_SCOPE(obj);
if (scope->shape == kshape) {
JS_ASSERT(PCVAL_IS_SPROP(entry->vword));
sprop = PCVAL_TO_SPROP(entry->vword);
JS_ASSERT(!(sprop->attrs & JSPROP_READONLY));
JSScope *scope = OBJ_SCOPE(obj);
JS_ASSERT(!SCOPE_IS_SEALED(scope));
JS_ASSERT(!SCOPE_IS_SEALED(OBJ_SCOPE(obj)));
/*
* Fastest path: check whether the cached sprop is
@ -4770,6 +4776,8 @@ js_Interpret(JSContext *cx)
PCMETER(cache->setpcmisses++);
atom = NULL;
}
JS_UNLOCK_OBJ(cx, obj);
}
atom = js_FullTestPropertyCache(cx, regs.pc, &obj, &obj2,

Просмотреть файл

@ -380,20 +380,23 @@ js_FillPropertyCache(JSContext *cx, JSObject *obj,
if (entry->kpc == pc && entry->kshape == kshape_) { \
JSObject *tmp_; \
pobj = obj; \
JS_LOCK_OBJ(cx, pobj); \
JS_ASSERT(PCVCAP_TAG(entry->vcap) <= 1); \
if (PCVCAP_TAG(entry->vcap) == 1 && \
(tmp_ = OBJ_GET_PROTO(cx, pobj)) != NULL && \
(tmp_ = LOCKED_OBJ_GET_PROTO(pobj)) != NULL && \
OBJ_IS_NATIVE(tmp_)) { \
JS_UNLOCK_OBJ(cx, pobj); \
pobj = tmp_; \
JS_LOCK_OBJ(cx, pobj); \
} \
\
if (JS_LOCK_OBJ_IF_SHAPE(cx, pobj, PCVCAP_SHAPE(entry->vcap))) { \
if (PCVCAP_SHAPE(entry->vcap) == OBJ_SHAPE(pobj)) { \
PCMETER(cache_->pchits++); \
PCMETER(!PCVCAP_TAG(entry->vcap) || cache_->protopchits++); \
pobj = OBJ_SCOPE(pobj)->object; \
atom = NULL; \
break; \
} \
JS_UNLOCK_OBJ(cx, pobj); \
} \
atom = js_FullTestPropertyCache(cx, pc, &obj, &pobj, &entry); \
if (atom) \

Просмотреть файл

@ -1422,17 +1422,6 @@ js_UnlockObj(JSContext *cx, JSObject *obj)
js_UnlockTitle(cx, &OBJ_SCOPE(obj)->title);
}
bool
js_LockObjIfShape(JSContext *cx, JSObject *obj, uint32 shape)
{
JS_ASSERT(OBJ_SCOPE(obj)->title.ownercx != cx);
js_LockObj(cx, obj);
if (OBJ_SHAPE(obj) == shape)
return true;
js_UnlockObj(cx, obj);
return false;
}
void
js_InitTitle(JSContext *cx, JSTitle *title)
{

Просмотреть файл

@ -160,16 +160,6 @@ struct JSTitle {
#define JS_UNLOCK_OBJ(cx,obj) ((OBJ_SCOPE(obj)->title.ownercx == (cx)) \
? (void)0 : js_UnlockObj(cx, obj))
/*
* Lock object only if its scope has the given shape.
*/
#define JS_LOCK_OBJ_IF_SHAPE(cx,obj,shape) \
(OBJ_SHAPE(obj) == (shape) \
? (OBJ_SCOPE(obj)->title.ownercx == (cx) \
? true \
: js_LockObjIfShape(cx, obj, shape)) \
: false)
#define JS_LOCK_TITLE(cx,title) \
((title)->ownercx == (cx) ? (void)0 \
: (js_LockTitle(cx, (title)), \
@ -191,7 +181,6 @@ extern void js_LockRuntime(JSRuntime *rt);
extern void js_UnlockRuntime(JSRuntime *rt);
extern void js_LockObj(JSContext *cx, JSObject *obj);
extern void js_UnlockObj(JSContext *cx, JSObject *obj);
extern bool js_LockObjIfShape(JSContext *cx, JSObject *obj, uint32 shape);
extern void js_InitTitle(JSContext *cx, JSTitle *title);
extern void js_FinishTitle(JSContext *cx, JSTitle *title);
extern void js_LockTitle(JSContext *cx, JSTitle *title);
@ -273,8 +262,6 @@ extern void js_SetScopeInfo(JSScope *scope, const char *file, int line);
#define JS_UNLOCK_RUNTIME(rt) ((void)0)
#define JS_LOCK_OBJ(cx,obj) ((void)0)
#define JS_UNLOCK_OBJ(cx,obj) ((void)0)
#define JS_LOCK_OBJ_IF_SHAPE(cx,obj,shape) (OBJ_SHAPE(obj) == (shape))
#define JS_LOCK_OBJ_VOID(cx,obj,e) (e)
#define JS_LOCK_SCOPE(cx,scope) ((void)0)
#define JS_UNLOCK_SCOPE(cx,scope) ((void)0)