Bug 406271: add quantifier support for regexp->native compiler, r=dmandelin

This commit is contained in:
Luke Wagner 2009-07-16 17:17:35 -07:00
parent 0a6a7cef0c
commit 0c16520e8b
5 changed files with 853 additions and 184 deletions

File diff suppressed because it is too large Load Diff

View File

@ -4798,6 +4798,27 @@ const jschar js_uriUnescaped_ucstr[] =
'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
'-', '_', '.', '!', '~', '*', '\'', '(', ')', 0};
/*
* This table allows efficient testing for the regular expression \w which is
* defined by ECMA-262 15.10.2.6 to be [0-9A-Z_a-z].
*/
const bool js_alnum[] = {
/* 0 1 2 3 4 5 5 7 8 9 */
/* 0 */ false, false, false, false, false, false, false, false, false, false,
/* 1 */ false, false, false, false, false, false, false, false, false, false,
/* 2 */ false, false, false, false, false, false, false, false, false, false,
/* 3 */ false, false, false, false, false, false, false, false, false, false,
/* 4 */ false, false, false, false, false, false, false, false, true, true,
/* 5 */ true, true, true, true, true, true, true, true, false, false,
/* 6 */ false, false, false, false, false, true, true, true, true, true,
/* 7 */ true, true, true, true, true, true, true, true, true, true,
/* 8 */ true, true, true, true, true, true, true, true, true, true,
/* 9 */ true, false, false, false, false, true, false, true, true, true,
/* 10 */ true, true, true, true, true, true, true, true, true, true,
/* 11 */ true, true, true, true, true, true, true, true, true, true,
/* 12 */ true, true, true, false, false, false, false, false
};
#define URI_CHUNK 64U
/* Concatenate jschars onto the buffer */

View File

@ -469,11 +469,18 @@ typedef enum JSCharType {
#define JS_ISFORMAT(c) (((1 << JSCT_FORMAT) >> JS_CTYPE(c)) & 1)
/*
* Per ECMA-262 15.10.2.6, these characters are the only ones that make up a
* "word", as far as a RegExp is concerned. If we want a Unicode-friendlier
* definition of "word", we should rename this macro to something regexp-y.
* This table is used in JS_ISWORD. The definition has external linkage to
* allow the raw table data to be used in the regular expression compiler.
*/
#define JS_ISWORD(c) ((c) < 128 && (isalnum(c) || (c) == '_'))
extern const bool js_alnum[];
/*
* This macro performs testing for the regular expression word class \w, which
* is defined by ECMA-262 15.10.2.6 to be [0-9A-Z_a-z]. If we want a
* Unicode-friendlier definition of "word", we should rename this macro to
* something regexp-y.
*/
#define JS_ISWORD(c) ((c) < 128 && js_alnum[(c)])
#define JS_ISIDSTART(c) (JS_ISLETTER(c) || (c) == '_' || (c) == '$')
#define JS_ISIDENT(c) (JS_ISIDPART(c) || (c) == '_' || (c) == '$')

View File

@ -203,12 +203,12 @@ class JSTempVector
size_t capacity() const { return mCapacity - mBegin; }
bool empty() const { return mBegin == mEnd; }
T &operator[](int i) {
T &operator[](size_t i) {
JS_ASSERT(!mInProgress && i < size());
return mBegin[i];
}
const T &operator[](int i) const {
const T &operator[](size_t i) const {
JS_ASSERT(!mInProgress && i < size());
return mBegin[i];
}

View File

@ -1590,6 +1590,12 @@ namespace nanojit
for (int i=0, n=pending_lives.size(); i < n; i++) {
findMemFor(pending_lives[i]);
}
/*
* TODO: I'm not positive, but I think the following line needs to be
* added, otherwise the pending_lives will build up and never get
* cleared.
*/
pending_lives.clear();
}
void Assembler::arFree(uint32_t idx)