Bug 1239269 - as lastIndex cannot be negative change it's storage class from int32_t to uint32_t, r?Waldo draft
authorBogdan Postelnicu <bogdan.postelnicu@softvision.ro>
Mon, 08 Feb 2016 13:51:47 +0200
changeset 329526 83b728a8b5aa5822bda1373be558340710b10b98
parent 329519 a0d0344ed47a65f5c36802b61b25c0520cec421f
child 513971 8ff979a311fa5f9e39c6b8b8c5a58b48d612972a
push id10539
push userBogdan.Postelnicu@softvision.ro
push dateMon, 08 Feb 2016 12:05:19 +0000
reviewersWaldo
bugs1239269
milestone47.0a1
Bug 1239269 - as lastIndex cannot be negative change it's storage class from int32_t to uint32_t, r?Waldo
js/src/builtin/RegExp.cpp
js/src/builtin/RegExp.h
js/src/jit/CodeGenerator.cpp
--- a/js/src/builtin/RegExp.cpp
+++ b/js/src/builtin/RegExp.cpp
@@ -923,17 +923,17 @@ js::RegExpMatcher(JSContext* cx, unsigne
     return RegExpMatcherImpl(cx, regexp, string, lastIndex, sticky,
                              UpdateRegExpStatics, args.rval());
 }
 
 /* Separate interface for use by IonMonkey.
  * This code cannot re-enter Ion code. */
 bool
 js::RegExpMatcherRaw(JSContext* cx, HandleObject regexp, HandleString input,
-                     int32_t lastIndex, bool sticky,
+                     uint32_t lastIndex, bool sticky,
                      MatchPairs* maybeMatches, MutableHandleValue output)
 {
     MOZ_ASSERT(lastIndex <= INT32_MAX);
 
     // The MatchPairs will always be passed in, but RegExp execution was
     // successful only if the pairs have actually been filled in.
     if (maybeMatches && maybeMatches->pairsRaw()[0] >= 0)
         return CreateRegExpMatchResult(cx, input, *maybeMatches, output);
@@ -993,17 +993,17 @@ js::RegExpTester(JSContext* cx, unsigned
     }
     return true;
 }
 
 /* Separate interface for use by IonMonkey.
  * This code cannot re-enter Ion code. */
 bool
 js::RegExpTesterRaw(JSContext* cx, HandleObject regexp, HandleString input,
-                    int32_t lastIndex, bool sticky, int32_t* endIndex)
+                    uint32_t lastIndex, bool sticky, int32_t* endIndex)
 {
     MOZ_ASSERT(lastIndex <= INT32_MAX);
 
     size_t endIndexTmp = 0;
     RegExpRunStatus status = ExecuteRegExp(cx, regexp, input, lastIndex, sticky,
                                            nullptr, &endIndexTmp, UpdateRegExpStatics);
 
     if (status == RegExpRunStatus_Success) {
--- a/js/src/builtin/RegExp.h
+++ b/js/src/builtin/RegExp.h
@@ -43,25 +43,25 @@ bool
 CreateRegExpMatchResult(JSContext* cx, HandleString input, const MatchPairs& matches,
                         MutableHandleValue rval);
 
 extern bool
 RegExpMatcher(JSContext* cx, unsigned argc, Value* vp);
 
 extern bool
 RegExpMatcherRaw(JSContext* cx, HandleObject regexp, HandleString input,
-                 int32_t lastIndex, bool sticky,
+                 uint32_t lastIndex, bool sticky,
                  MatchPairs* maybeMatches, MutableHandleValue output);
 
 extern bool
 RegExpTester(JSContext* cx, unsigned argc, Value* vp);
 
 extern bool
 RegExpTesterRaw(JSContext* cx, HandleObject regexp, HandleString input,
-                int32_t lastIndex, bool sticky, int32_t* endIndex);
+                uint32_t lastIndex, bool sticky, int32_t* endIndex);
 
 /*
  * The following functions are for use by self-hosted code.
  */
 
 /*
  * Behaves like regexp.exec(string), but doesn't set RegExp statics.
  *
--- a/js/src/jit/CodeGenerator.cpp
+++ b/js/src/jit/CodeGenerator.cpp
@@ -1746,17 +1746,17 @@ class OutOfLineRegExpMatcher : public Ou
     }
 
     LRegExpMatcher* lir() const {
         return lir_;
     }
 };
 
 typedef bool (*RegExpMatcherRawFn)(JSContext* cx, HandleObject regexp, HandleString input,
-                                   int32_t lastIndex, bool sticky,
+                                   uint32_t lastIndex, bool sticky,
                                    MatchPairs* pairs, MutableHandleValue output);
 static const VMFunction RegExpMatcherRawInfo = FunctionInfo<RegExpMatcherRawFn>(RegExpMatcherRaw);
 
 void
 CodeGenerator::visitOutOfLineRegExpMatcher(OutOfLineRegExpMatcher* ool)
 {
     LRegExpMatcher* lir = ool->lir();
     Register sticky = ToRegister(lir->sticky());
@@ -1911,17 +1911,17 @@ class OutOfLineRegExpTester : public Out
     }
 
     LRegExpTester* lir() const {
         return lir_;
     }
 };
 
 typedef bool (*RegExpTesterRawFn)(JSContext* cx, HandleObject regexp, HandleString input,
-                                  int32_t lastIndex, bool sticky, int32_t* result);
+                                  uint32_t lastIndex, bool sticky, int32_t* result);
 static const VMFunction RegExpTesterRawInfo = FunctionInfo<RegExpTesterRawFn>(RegExpTesterRaw);
 
 void
 CodeGenerator::visitOutOfLineRegExpTester(OutOfLineRegExpTester* ool)
 {
     LRegExpTester* lir = ool->lir();
     Register sticky = ToRegister(lir->sticky());
     Register lastIndex = ToRegister(lir->lastIndex());