jsRegExpCompile & match should not add implicit non-capturing bracket Every regexp gets an implicit non-capturing bracket added to the front, and a non-capturing close added to the back of the instruction stream in jsRegExpCompile, match() is then called and expects these. Removing this trip through the switch() would be a big savings on SunSpider.
To fix this would likely require breaking out match() into match() and recursive_match() and making sure that only outer match() function is ever called by callers, and that recursive_match() is only ever called from match(). I expect this would fall into the "softball" category of JS speedups.
So I misunderstood this bug and added code so that jsRegExpCompile will omit the outer bracket entirely when it's not needed. This doesn't help the regexp-dna test in SunSpider much at all, because almost all its regular expressions have "|" characters in them, which means they *do* require the outer bracket. Hence Eric's other suggestion, of optimizing match for this, really turns into a sort of "unrolling" of the match function, which could indeed be helpful for simple regular expressions. I can't help thinking it's a little bit too specific to this particular test, though. The more I look at the profile the more I realize it's a little bit too biased toward this one particular set of regular expressions.
Created attachment 17628 [details] patch to omit the outer bracket in cases where it's not needed
Created attachment 17768 [details] patch
Comment on attachment 17768 [details] patch r=me
Committed revision 28525.