Bug 477758 - If we fall into the regexp getter case, we need to pass the original object in, not the prototype. r=brendan

This commit is contained in:
Blake Kaplan 2009-02-10 17:48:00 -08:00
Родитель 674c652f9d
Коммит a1bbb05c6c
2 изменённых файлов: 25 добавлений и 14 удалений

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

@ -7604,20 +7604,6 @@ TraceRecorder::prop(JSObject* obj, LIns* obj_ins, uint32& slot, LIns*& v_ins)
/* Insist if setting on obj being the directly addressed object. */
uint32 setflags = (cs.format & (JOF_SET | JOF_INCDEC | JOF_FOR));
LIns* dslots_ins = NULL;
if (obj2 != obj) {
if (setflags)
ABORT_TRACE("JOF_SET opcode hit prototype chain");
/*
* We're getting a proto-property. Walk up the prototype chain emitting
* proto slot loads, updating obj as we go, leaving obj set to obj2 with
* obj_ins the last proto-load.
*/
while (obj != obj2) {
obj_ins = stobj_get_slot(obj_ins, JSSLOT_PROTO, dslots_ins);
obj = STOBJ_GET_PROTO(obj);
}
}
/* Don't trace getter or setter calls, our caller wants a direct slot. */
if (PCVAL_IS_SPROP(pcval)) {
@ -7654,6 +7640,21 @@ TraceRecorder::prop(JSObject* obj, LIns* obj_ins, uint32& slot, LIns*& v_ins)
slot = PCVAL_TO_SLOT(pcval);
}
if (obj2 != obj) {
if (setflags)
ABORT_TRACE("JOF_SET opcode hit prototype chain");
/*
* We're getting a proto-property. Walk up the prototype chain emitting
* proto slot loads, updating obj as we go, leaving obj set to obj2 with
* obj_ins the last proto-load.
*/
while (obj != obj2) {
obj_ins = stobj_get_slot(obj_ins, JSSLOT_PROTO, dslots_ins);
obj = STOBJ_GET_PROTO(obj);
}
}
v_ins = stobj_get_slot(obj_ins, slot, dslots_ins);
unbox_jsval(STOBJ_GET_SLOT(obj, slot), v_ins);
return true;

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

@ -4340,6 +4340,16 @@ function testGeneratorDeepBail() {
testGeneratorDeepBail.expected = 3;
test(testGeneratorDeepBail);
function testRegexpGet() {
var re = /hi/;
var a = [];
for (let i = 0; i < 5; ++i)
a.push(re.source);
return a.toString();
}
testRegexpGet.expected = "hi,hi,hi,hi,hi";
test(testRegexpGet);
/*****************************************************************************
* *
* _____ _ _ _____ ______ _____ _______ *