| Index: src/string.js
|
| diff --git a/src/string.js b/src/string.js
|
| index 7ddc467fc0de2421c21fd39e36456a438dcb30e3..0736b4b0fe1324416510f474015db2d718d6ecdb 100644
|
| --- a/src/string.js
|
| +++ b/src/string.js
|
| @@ -529,10 +529,16 @@ function ApplyReplacementFunction(replace, matchInfo, subject) {
|
| return replace.apply(null, parameters);
|
| }
|
|
|
| -
|
| // ECMA-262 section 15.5.4.12
|
| function StringSearch(re) {
|
| - var regexp = new $RegExp(re);
|
| + var regexp;
|
| + if (IS_STRING(re)) {
|
| + regexp = %_GetFromCache(STRING_TO_REGEXP_CACHE_ID, re);
|
| + } else if (IS_REGEXP(re)) {
|
| + regexp = re;
|
| + } else {
|
| + regexp = new $RegExp(re);
|
| + }
|
| var s = TO_STRING_INLINE(this);
|
| var match = DoRegExpExec(regexp, s, 0);
|
| if (match) {
|
|
|