Back out changeset ca772ab995c9 (bug 559813, trace script setters).

--HG--
extra : rebase_source : 09944589c3f8c5acbd79ddc29878b25efcb87e14
This commit is contained in:
Jason Orendorff 2010-06-02 15:58:17 -07:00
parent b0d9c052bf
commit d364454f75
6 changed files with 19 additions and 101 deletions

View File

@ -730,15 +730,6 @@
.end
.end callprop
.igroup setprop JSOP_SETPROP,JSOP_SETNAME,JSOP_SETMETHOD
.imacro scriptsetter # obj val
.fixup +2 # val setter obj val
call 1 # val ret
pop # val
stop
.end
.end setprop
.igroup getthisprop JSOP_GETTHISPROP,JSOP_GETARGPROP,JSOP_GETLOCALPROP
.imacro scriptgetter #
.fixup +2 # getter obj

View File

@ -4515,7 +4515,7 @@ class DefaultSlotMap : public SlotMap
DefaultSlotMap(TraceRecorder& tr) : SlotMap(tr)
{
}
virtual ~DefaultSlotMap()
{
}
@ -11322,23 +11322,6 @@ TraceRecorder::lookupForSetPropertyOp(JSObject* obj, LIns* obj_ins, jsid id,
return RECORD_CONTINUE;
}
JS_REQUIRES_STACK RecordingStatus
TraceRecorder::setPropertyWithScriptSetter(JSScopeProperty* sprop)
{
if (!canCallImacro())
RETURN_STOP("cannot trace script setter, already in imacro");
// Rearrange the stack in preparation for the imacro. See the comment in
// getPropertyWithScriptGetter.
JSObject *setterObj = JSVAL_TO_OBJECT(sprop->setterValue());
cx->regs->sp += 2; // obj val --- ---
stackCopy(-2, -4); // obj val obj ---
stackCopy(-4, -3); // val val obj ---
stackCopy(-1, -3); // val val obj val
stackStoreConstObject(-3, setterObj); // val setter obj val
return callImacroInfallibly(setprop_imacros.scriptsetter);
}
static JSBool FASTCALL
MethodWriteBarrier(JSContext* cx, JSObject* obj, uint32 slot, jsval v)
{
@ -11403,7 +11386,7 @@ TraceRecorder::nativeSet(JSObject* obj, LIns* obj_ins, JSScopeProperty* sprop,
// Call the setter, if any.
if (!sprop->hasDefaultSetter()) {
if (sprop->hasSetterValue())
return setPropertyWithScriptSetter(sprop);
RETURN_STOP("can't trace JavaScript function setter yet");
emitNativePropertyOp(scope, sprop, obj_ins, true, boxed_ins);
}
@ -12064,33 +12047,6 @@ TraceRecorder::getPropertyWithNativeGetter(LIns* obj_ins, JSScopeProperty* sprop
return RECORD_CONTINUE;
}
/* Set sp[dest] = sp[src], both on the real interpreter stack and in the tracker. */
JS_REQUIRES_STACK void
TraceRecorder::stackCopy(int dest, int src)
{
jsval* sp = cx->regs->sp;
sp[dest] = sp[src];
set(&sp[dest], get(&sp[src]));
}
/* Set sp[dest] = obj, both on the real interpreter stack and in the tracker. */
JS_REQUIRES_STACK void
TraceRecorder::stackStoreConstObject(int dest, JSObject *obj)
{
jsval* sp = cx->regs->sp;
sp[dest] = OBJECT_TO_JSVAL(obj);
set(&sp[dest], INS_CONSTOBJ(obj));
}
/* Set sp[dest] = obj/obj_ins, both on the real interpreter stack and in the tracker. */
JS_REQUIRES_STACK void
TraceRecorder::stackStore(int dest, JSObject* obj, LIns* obj_ins)
{
jsval* sp = cx->regs->sp;
sp[dest] = OBJECT_TO_JSVAL(obj);
set(&sp[dest], obj_ins);
}
JS_REQUIRES_STACK RecordingStatus
TraceRecorder::getPropertyWithScriptGetter(JSObject *obj, LIns* obj_ins, JSScopeProperty* sprop)
{
@ -12105,22 +12061,28 @@ TraceRecorder::getPropertyWithScriptGetter(JSObject *obj, LIns* obj_ins, JSScope
switch (*cx->regs->pc) {
case JSOP_GETPROP:
sp++;
stackCopy(-1, -2);
stackStoreConstObject(-2, JSVAL_TO_OBJECT(getter));
sp[-1] = sp[-2];
set(&sp[-1], get(&sp[-2]));
sp[-2] = getter;
set(&sp[-2], INS_CONSTOBJ(JSVAL_TO_OBJECT(getter)));
return callImacroInfallibly(getprop_imacros.scriptgetter);
case JSOP_CALLPROP:
sp += 2;
stackStoreConstObject(-2, JSVAL_TO_OBJECT(getter));
stackCopy(-1, -3);
sp[-2] = getter;
set(&sp[-2], INS_CONSTOBJ(JSVAL_TO_OBJECT(getter)));
sp[-1] = sp[-3];
set(&sp[-1], get(&sp[-3]));
return callImacroInfallibly(callprop_imacros.scriptgetter);
case JSOP_GETTHISPROP:
case JSOP_GETARGPROP:
case JSOP_GETLOCALPROP:
sp += 2;
stackStoreConstObject(-2, JSVAL_TO_OBJECT(getter));
stackStore(-1, obj, obj_ins);
sp[-2] = getter;
set(&sp[-2], INS_CONSTOBJ(JSVAL_TO_OBJECT(getter)));
sp[-1] = OBJECT_TO_JSVAL(obj);
set(&sp[-1], obj_ins);
return callImacroInfallibly(getthisprop_imacros.scriptgetter);
default:
@ -12449,9 +12411,9 @@ TraceRecorder::setElem(int lval_spindex, int idx_spindex, int v_spindex)
LIns* priv_ins = stobj_get_const_fslot(obj_ins, JSSLOT_PRIVATE);
// The index was on the stack and is therefore a LIR float; force it to
// be an integer.
idx_ins = makeNumberInt32(idx_ins);
// be an integer.
idx_ins = makeNumberInt32(idx_ins);
// Ensure idx >= 0 && idx < length (by using uint32)
lir->insGuard(LIR_xf,
lir->ins2(LIR_ltui,
@ -12519,7 +12481,7 @@ TraceRecorder::setElem(int lval_spindex, int idx_spindex, int v_spindex)
// Do nothing, this is already a float
break;
default:
JS_NOT_REACHED("Unknown typed array type in tracer");
JS_NOT_REACHED("Unknown typed array type in tracer");
}
switch (tarray->type) {
@ -12548,7 +12510,7 @@ TraceRecorder::setElem(int lval_spindex, int idx_spindex, int v_spindex)
lir->insStore(LIR_std, typed_v_ins, addr_ins, 0, ACC_OTHER);
break;
default:
JS_NOT_REACHED("Unknown typed array type in tracer");
JS_NOT_REACHED("Unknown typed array type in tracer");
}
} else if (JSVAL_TO_INT(idx) < 0 || !obj->isDenseArray()) {
CHECK_STATUS_A(initOrSetPropertyByIndex(obj_ins, idx_ins, &v,

View File

@ -1303,9 +1303,6 @@ class TraceRecorder
JS_REQUIRES_STACK RecordingStatus getPropertyWithNativeGetter(nanojit::LIns* obj_ins,
JSScopeProperty* sprop,
jsval* outp);
JS_REQUIRES_STACK void stackCopy(int dest, int src);
JS_REQUIRES_STACK void stackStoreConstObject(int dest, JSObject *obj);
JS_REQUIRES_STACK void stackStore(int dest, JSObject* obj, nanojit::LIns* obj_ins);
JS_REQUIRES_STACK RecordingStatus getPropertyWithScriptGetter(JSObject *obj,
nanojit::LIns* obj_ins,
JSScopeProperty* sprop);
@ -1323,7 +1320,6 @@ class TraceRecorder
jsid id, bool* safep,
JSObject** pobjp,
JSScopeProperty** spropp);
JS_REQUIRES_STACK RecordingStatus setPropertyWithScriptSetter(JSScopeProperty* sprop);
JS_REQUIRES_STACK RecordingStatus nativeSet(JSObject* obj, nanojit::LIns* obj_ins,
JSScopeProperty* sprop,
jsval v, nanojit::LIns* v_ins);

View File

@ -1,16 +0,0 @@
function s(f) { this._m = f; }
function C(i) {
Object.defineProperty(this, "m", {set: s});
this.m = function () { return 17; };
}
var arr = [];
for (var i = 0; i < 9; i++)
arr[i] = new C(i);
checkStats({recorderStarted: 1, recorderAborted: 0, traceCompleted: 1, traceTriggered: 1});
//BUG - uncomment this when bug 559912 is fixed
//for (var i = 1; i < 9; i++)
// assertEq(arr[0]._m === arr[i]._m, false);

View File

@ -1,8 +0,0 @@
var n = 0;
Object.defineProperty(this, "p", {get: function () { return n; },
set: function (x) { n += x; }});
for (var i = 0; i < 9; i++)
p = i;
assertEq(n, 36);
checkStats({recorderStarted: 1, recorderAborted: 0, traceCompleted: 1, traceTriggered: 1});

View File

@ -1,7 +0,0 @@
var n = 0;
var a = {set p(x) { n += x; }};
for (var i = 0; i < 9; i++)
a.p = i;
assertEq(n, 36);
checkStats({recorderStarted: 1, recorderAborted: 0, traceCompleted: 1, traceTriggered: 1});