blob: c5b128eec3cd584273f796d5252509c5a61d104a [file] [edit]
// Hot-path microbenchmark for String.prototype.search with a short literal
// string regexp source. This exercises the DFG StringSearch fast path for the
// common case where the regexp arg is a string and gets coerced via
// RegExp construction.
function search(string, regexp)
{
return string.search(regexp);
}
noInline(search);
var string = "abc1def2ghi3jkl4mno5";
for (var i = 0; i < 1e7; ++i)
search(string, "[0-9]");