Bug 457130 - TM: regexp lastIndex property not traced correctly (r=danderson).
authorBrendan Eich <brendan@mozilla.org>
Thu, 25 Sep 2008 17:45:14 -0700
changeset 19986 cacf236a16630f58fef0a9f7bcad8d40e17bea51
parent 19985 766dcca2a93056376aea2206ff5b867d557776eb
child 19987 ca0b904b4b26c2ab19938d6cca3725751ce33909
push id2577
push userbrendan@mozilla.com
push dateWed, 01 Oct 2008 04:35:27 +0000
treeherdermozilla-central@a613924403d6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdanderson
bugs457130
milestone1.9.1b1pre
Bug 457130 - TM: regexp lastIndex property not traced correctly (r=danderson).
js/src/jstracer.cpp
js/src/trace-test.js
--- a/js/src/jstracer.cpp
+++ b/js/src/jstracer.cpp
@@ -5312,16 +5312,18 @@ TraceRecorder::prop(JSObject* obj, LIns*
 
         if (setflags && !SPROP_HAS_STUB_SETTER(sprop))
             ABORT_TRACE("non-stub setter");
         if (setflags != JOF_SET && !SPROP_HAS_STUB_GETTER(sprop)) {
             // FIXME 450335: generalize this away from regexp built-in getters.
             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);
                 if (!unbox_jsval((sprop->shortid == REGEXP_SOURCE) ? JSVAL_STRING : JSVAL_BOOLEAN,
                                  v_ins)) {
                     ABORT_TRACE("unboxing");
                 }
                 JS_ASSERT(cs.ndefs == 1);
--- a/js/src/trace-test.js
+++ b/js/src/trace-test.js
@@ -1621,11 +1621,26 @@ function testInnerMissingArgs()
 {
     doTestInnerMissingArgs(1);
     doTestInnerMissingArgs(0);
     return 1;
 }
 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(","));