Modifying upvars on trace (bug 557946, r=gal).

This commit is contained in:
David Anderson 2010-04-20 22:42:00 -07:00
parent 438ca72bb6
commit 544eddfa62
2 changed files with 25 additions and 2 deletions

View File

@ -11343,6 +11343,26 @@ TraceRecorder::setProp(jsval &l, PropertyCacheEntry* entry, JSScopeProperty* spr
return nativeSet(obj, obj_ins, sprop, v, v_ins); return nativeSet(obj, obj_ins, sprop, v, v_ins);
} }
JS_REQUIRES_STACK RecordingStatus
TraceRecorder::setUpwardTrackedVar(jsval* stackVp, jsval v, LIns* v_ins)
{
TraceType stackT = determineSlotType(stackVp);
TraceType otherT = getCoercedType(v);
bool promote = true;
if (stackT != otherT) {
if (stackT == TT_DOUBLE && otherT == TT_INT32 && isPromoteInt(v_ins))
promote = false;
else
RETURN_STOP("can't trace this upvar mutation");
}
set(stackVp, v_ins, promote);
return RECORD_CONTINUE;
}
JS_REQUIRES_STACK RecordingStatus JS_REQUIRES_STACK RecordingStatus
TraceRecorder::setCallProp(JSObject *callobj, LIns *callobj_ins, JSScopeProperty *sprop, TraceRecorder::setCallProp(JSObject *callobj, LIns *callobj_ins, JSScopeProperty *sprop,
LIns *v_ins, jsval v) LIns *v_ins, jsval v)
@ -11354,14 +11374,14 @@ TraceRecorder::setCallProp(JSObject *callobj, LIns *callobj_ins, JSScopeProperty
JS_ASSERT(sprop->hasShortID()); JS_ASSERT(sprop->hasShortID());
uintN slot = uint16(sprop->shortid); uintN slot = uint16(sprop->shortid);
jsval *vp2 = &fp->argv[slot]; jsval *vp2 = &fp->argv[slot];
set(vp2, v_ins); CHECK_STATUS(setUpwardTrackedVar(vp2, v, v_ins));
return RECORD_CONTINUE; return RECORD_CONTINUE;
} }
if (sprop->setterOp() == SetCallVar) { if (sprop->setterOp() == SetCallVar) {
JS_ASSERT(sprop->hasShortID()); JS_ASSERT(sprop->hasShortID());
uintN slot = uint16(sprop->shortid); uintN slot = uint16(sprop->shortid);
jsval *vp2 = &fp->slots[slot]; jsval *vp2 = &fp->slots[slot];
set(vp2, v_ins); CHECK_STATUS(setUpwardTrackedVar(vp2, v, v_ins));
return RECORD_CONTINUE; return RECORD_CONTINUE;
} }
RETURN_STOP("can't trace special CallClass setter"); RETURN_STOP("can't trace special CallClass setter");

View File

@ -1351,6 +1351,9 @@ class TraceRecorder
JS_REQUIRES_STACK TraceType determineSlotType(jsval* vp); JS_REQUIRES_STACK TraceType determineSlotType(jsval* vp);
JS_REQUIRES_STACK RecordingStatus setUpwardTrackedVar(jsval* stackVp, jsval v,
nanojit::LIns* v_ins);
JS_REQUIRES_STACK AbortableRecordingStatus compile(); JS_REQUIRES_STACK AbortableRecordingStatus compile();
JS_REQUIRES_STACK AbortableRecordingStatus closeLoop(); JS_REQUIRES_STACK AbortableRecordingStatus closeLoop();
JS_REQUIRES_STACK AbortableRecordingStatus closeLoop(VMSideExit* exit); JS_REQUIRES_STACK AbortableRecordingStatus closeLoop(VMSideExit* exit);