Bug 1239269 - as lastIndex cannot be negative change it's storage class from int32_t to uint32_t, r?Waldo
--- 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());