Minor regexp test cleanup.
authorsandholm@chromium.org <sandholm@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 3 Nov 2010 10:30:15 +0000 (10:30 +0000)
committersandholm@chromium.org <sandholm@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 3 Nov 2010 10:30:15 +0000 (10:30 +0000)
Review URL: http://codereview.chromium.org/4371002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5759 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/regexp.js

index 6a69cf6..9e708fd 100644 (file)
@@ -237,7 +237,6 @@ function RegExpTest(string) {
   } else {
     s = ToString(string);
   }
-  var length = s.length;
 
   var lastIndex = this.lastIndex;
 
@@ -247,7 +246,7 @@ function RegExpTest(string) {
   
   var global = this.global;
   if (global) {
-    if (i < 0 || i > length) {
+    if (i < 0 || i > s.length) {
       this.lastIndex = 0;
       return false;
     }
@@ -271,13 +270,6 @@ function RegExpTest(string) {
     if (!regexp_val.test(s)) return false;
   }
 
-  var length = s.length;
-
-  if (i < 0 || i > length) {
-    this.lastIndex = 0;
-    return false;
-  }
-
   %_Log('regexp', 'regexp-exec,%0r,%1S,%2i', [this, s, lastIndex]);
   // matchIndices is either null or the lastMatchInfo array.
   var matchIndices = %_RegExpExec(this, s, i, lastMatchInfo);