Author: [EMAIL PROTECTED]
Date: Fri Sep 19 04:31:02 2008
New Revision: 348

Modified:
    branches/bleeding_edge/src/string.js

Log:
Don't try an indexOf() when the search string is bigger than the string.   
The current code will spend a bunch of time trying to match, even though we  
should know a match is impossible.

Modified: branches/bleeding_edge/src/string.js
==============================================================================
--- branches/bleeding_edge/src/string.js        (original)
+++ branches/bleeding_edge/src/string.js        Fri Sep 19 04:31:02 2008
@@ -340,6 +340,7 @@
    }
    if (index < 0) index = 0;
    if (index > str.length) index = str.length;
+  if (searchStr.length + index > str.length) return -1;
    return %StringIndexOf(str, searchStr, index);
  }, DONT_ENUM);


--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to