Bug 1108382 - Part 9: Do not use non-standard flag argument of String.prototype.replace in js/src/. r=jandem
authorTooru Fujisawa <arai_a@mac.com>
Sun, 01 Mar 2015 09:51:33 +0900
changeset 246743 523e280701e8ab1f270085d7eb380e8ce023729d
parent 246742 f2b7475227148fe8a1f6aa0d0ca3e7262ee12c1a
child 246744 3115299a072a98991f965ece5745ddfb7e7c331b
push id879
push usercliu@mozilla.com
push dateTue, 03 Mar 2015 03:02:53 +0000
reviewersjandem
bugs1108382
milestone39.0a1
Bug 1108382 - Part 9: Do not use non-standard flag argument of String.prototype.replace in js/src/. r=jandem
js/src/jit-test/tests/ion/stack-alignment.js
js/src/jit-test/tests/sunspider/check-regexp-dna.js
--- a/js/src/jit-test/tests/ion/stack-alignment.js
+++ b/js/src/jit-test/tests/ion/stack-alignment.js
@@ -26,17 +26,17 @@ function rectifierFrame_4(i) {
 }
 
 // Check that an ion frame size is always aligned properly.
 function gen_ionFrameSize(x, y, name) {
   var locals = (new Array(x)).fill(0).map((v, i) => i);
   var args = (new Array(y)).fill(0).map((v, i) => i);
 
   return new Function("i",
-    locals.map(i => "var l% = i + %;\n".replace("%", i, "g")).join("")
+    locals.map(i => "var l% = i + %;\n".replace(/%/g, i)).join("")
   + name + "(" + args.map(i => "l%".replace("%", i)).join(", ") + ");\n"
   + "return " + locals.map(i => "l%".replace("%", i)).join(" + ") + ";\n"
   );
 }
 
 var ionFrameSize_0 = gen_ionFrameSize(30, 0, "assertJitStackInvariants");
 var ionFrameSize_1 = gen_ionFrameSize(31, 0, "assertJitStackInvariants");
 var ionFrameSize_2 = gen_ionFrameSize(32, 0, "assertJitStackInvariants");
--- a/js/src/jit-test/tests/sunspider/check-regexp-dna.js
+++ b/js/src/jit-test/tests/sunspider/check-regexp-dna.js
@@ -1703,12 +1703,12 @@ clen = dnaInput.length
 
 var dnaOutputString = '';
 
 for(i in seqs)
     dnaOutputString += seqs[i].source + " " + (dnaInput.match(seqs[i]) || []).length + "\n";
  // match returns null if no matches, so replace with empty
 
 for(k in subs)
- dnaInput = dnaInput.replace(k, subs[k], "g")
+ dnaInput = dnaInput.replace(k, subs[k]) // FIXME: Would like this to be a global substitution in a future version of SunSpider.
  // search string, replacement string, flags
 
 assertEq(dnaOutputString, "agggtaaa|tttaccct 0\n[cgt]gggtaaa|tttaccc[acg] 9\na[act]ggtaaa|tttacc[agt]t 27\nag[act]gtaaa|tttac[agt]ct 24\nagg[act]taaa|ttta[agt]cct 30\naggg[acg]aaa|ttt[cgt]ccct 9\nagggt[cgt]aa|tt[acg]accct 12\nagggta[cgt]a|t[acg]taccct 9\nagggtaa[cgt]|[acg]ttaccct 15\n")