Bug 457130 - TM: regexp lastIndex property not traced correctly (r=danderson).

This commit is contained in:
Brendan Eich 2008-09-25 17:45:14 -07:00
parent 3808521295
commit 8030ce9609
2 changed files with 17 additions and 0 deletions

View File

@ -5317,6 +5317,8 @@ TraceRecorder::prop(JSObject* obj, LIns* obj_ins, uint32& slot, LIns*& v_ins)
if (setflags == 0 &&
sprop->getter == js_RegExpClass.getProperty &&
sprop->shortid < 0) {
if (sprop->shortid == REGEXP_LAST_INDEX)
ABORT_TRACE("can't trace regexp.lastIndex yet");
LIns* args[] = { INS_CONSTPTR(sprop), obj_ins, cx_ins };
v_ins = lir->insCall(F_CallGetter, args);
guard(false, lir->ins2(LIR_eq, v_ins, INS_CONST(JSVAL_ERROR_COOKIE)), OOM_EXIT);

View File

@ -1626,6 +1626,21 @@ function testInnerMissingArgs()
testInnerMissingArgs.expected = 1; //Expected: that we don't crash.
test(testInnerMissingArgs);
function regexpLastIndex()
{
var n = 0;
var re = /hi/g;
var ss = " hi hi hi hi hi hi hi hi hi hi";
for (var i = 0; i < 10; i++) {
// re.exec(ss);
n += (re.lastIndex > 0) ? 3 : 0;
re.lastIndex = 0;
}
return n;
}
regexpLastIndex.expected = 0; // 30;
test(regexpLastIndex);
/* Keep these at the end so that we can see the summary after the trace-debug spew. */
print("\npassed:", passes.length && passes.join(","));
print("\nFAILED:", fails.length && fails.join(","));