This commit is contained in:
Andreas Gal 2008-12-17 22:54:02 -08:00
Родитель 5834ddd545 f742293204
Коммит 227d3cd479
2 изменённых файлов: 11 добавлений и 2 удалений

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

@ -242,6 +242,8 @@ js_FillPropertyCache(JSContext *cx, JSObject *obj, jsuword kshape,
/* If getting a value via a stub getter, we can cache the slot. */ /* If getting a value via a stub getter, we can cache the slot. */
if (!(cs->format & JOF_SET) && if (!(cs->format & JOF_SET) &&
!((cs->format & (JOF_INCDEC | JOF_FOR)) &&
(sprop->attrs & JSPROP_READONLY)) &&
SPROP_HAS_STUB_GETTER(sprop) && SPROP_HAS_STUB_GETTER(sprop) &&
SPROP_HAS_VALID_SLOT(sprop, scope)) { SPROP_HAS_VALID_SLOT(sprop, scope)) {
/* Great, let's cache sprop's slot and use it on cache hit. */ /* Great, let's cache sprop's slot and use it on cache hit. */

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

@ -5090,13 +5090,15 @@ TraceRecorder::test_property_cache_direct_slot(JSObject* obj, LIns* obj_ins, uin
if (PCVAL_IS_SPROP(pcval)) { if (PCVAL_IS_SPROP(pcval)) {
JSScopeProperty* sprop = PCVAL_TO_SPROP(pcval); JSScopeProperty* sprop = PCVAL_TO_SPROP(pcval);
uint32 setflags = (js_CodeSpec[*cx->fp->regs->pc].format & (JOF_SET | JOF_INCDEC)); uint32 setflags = (js_CodeSpec[*cx->fp->regs->pc].format & (JOF_SET | JOF_INCDEC | JOF_FOR));
if (setflags && !SPROP_HAS_STUB_SETTER(sprop)) if (setflags && !SPROP_HAS_STUB_SETTER(sprop))
ABORT_TRACE("non-stub setter"); ABORT_TRACE("non-stub setter");
if (setflags != JOF_SET && !SPROP_HAS_STUB_GETTER(sprop)) if (setflags != JOF_SET && !SPROP_HAS_STUB_GETTER(sprop))
ABORT_TRACE("non-stub getter"); ABORT_TRACE("non-stub getter");
if (!SPROP_HAS_VALID_SLOT(sprop, OBJ_SCOPE(obj))) if (!SPROP_HAS_VALID_SLOT(sprop, OBJ_SCOPE(obj)))
ABORT_TRACE("no valid slot"); ABORT_TRACE("no valid slot");
if (setflags && (sprop->attrs & JSPROP_READONLY))
ABORT_TRACE("writing to a readonly property");
slot = sprop->slot; slot = sprop->slot;
} else { } else {
if (!PCVAL_IS_SLOT(pcval)) if (!PCVAL_IS_SLOT(pcval))
@ -6260,6 +6262,9 @@ TraceRecorder::record_SetPropHit(JSPropCacheEntry* entry, JSScopeProperty* sprop
JSObject* obj = JSVAL_TO_OBJECT(l); JSObject* obj = JSVAL_TO_OBJECT(l);
LIns* obj_ins = get(&l); LIns* obj_ins = get(&l);
if (sprop->attrs & JSPROP_READONLY)
ABORT_TRACE("SetPropHit on readonly prop");
if (obj == globalObj) { if (obj == globalObj) {
JS_ASSERT(SPROP_HAS_VALID_SLOT(sprop, OBJ_SCOPE(obj))); JS_ASSERT(SPROP_HAS_VALID_SLOT(sprop, OBJ_SCOPE(obj)));
uint32 slot = sprop->slot; uint32 slot = sprop->slot;
@ -6797,7 +6802,7 @@ TraceRecorder::prop(JSObject* obj, LIns* obj_ins, uint32& slot, LIns*& v_ins)
} }
/* Insist if setting on obj being the directly addressed object. */ /* Insist if setting on obj being the directly addressed object. */
uint32 setflags = (cs.format & (JOF_SET | JOF_INCDEC)); uint32 setflags = (cs.format & (JOF_SET | JOF_INCDEC | JOF_FOR));
LIns* dslots_ins = NULL; LIns* dslots_ins = NULL;
if (obj2 != obj) { if (obj2 != obj) {
if (setflags) if (setflags)
@ -6820,6 +6825,8 @@ TraceRecorder::prop(JSObject* obj, LIns* obj_ins, uint32& slot, LIns*& v_ins)
if (setflags && !SPROP_HAS_STUB_SETTER(sprop)) if (setflags && !SPROP_HAS_STUB_SETTER(sprop))
ABORT_TRACE("non-stub setter"); ABORT_TRACE("non-stub setter");
if (setflags && (sprop->attrs & JSPROP_READONLY))
ABORT_TRACE("writing to a readonly property");
if (setflags != JOF_SET && !SPROP_HAS_STUB_GETTER(sprop)) { if (setflags != JOF_SET && !SPROP_HAS_STUB_GETTER(sprop)) {
// FIXME 450335: generalize this away from regexp built-in getters. // FIXME 450335: generalize this away from regexp built-in getters.
if (setflags == 0 && if (setflags == 0 &&