Check in rogerl's big perf patch (85721).

This commit is contained in:
brendan%mozilla.org 2003-10-22 07:01:50 +00:00
Родитель e21a5aa43b
Коммит 9410aed3d1
3 изменённых файлов: 3920 добавлений и 3027 удалений

Просмотреть файл

@ -213,7 +213,7 @@ MSG_DEF(JSMSG_BAD_PROTOTYPE, 135, 1, JSEXN_TYPEERR, "'prototype' prop
MSG_DEF(JSMSG_MISSING_EXPONENT, 136, 0, JSEXN_SYNTAXERR, "missing exponent")
MSG_DEF(JSMSG_OUT_OF_MEMORY, 137, 0, JSEXN_ERR, "out of memory")
MSG_DEF(JSMSG_UNTERMINATED_STRING, 138, 0, JSEXN_SYNTAXERR, "unterminated string literal")
MSG_DEF(JSMSG_UNUSED139, 139, 0, JSEXN_NONE, "<Error #139 is currently unused>")
MSG_DEF(JSMSG_TOO_MANY_PARENS, 139, 0, JSEXN_INTERNALERR, "Only 65535 parentheses supported in regular expressions")
MSG_DEF(JSMSG_UNTERMINATED_COMMENT, 140, 0, JSEXN_SYNTAXERR, "unterminated comment")
MSG_DEF(JSMSG_UNTERMINATED_REGEXP, 141, 0, JSEXN_SYNTAXERR, "unterminated regular expression literal")
MSG_DEF(JSMSG_BAD_REGEXP_FLAG, 142, 0, JSEXN_SYNTAXERR, "invalid flag after regular expression")

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -41,6 +41,10 @@
#include "jspubtd.h"
#include "jsstr.h"
#ifdef JS_THREADSAFE
#include "jsdhash.h"
#endif
struct JSRegExpStatics {
JSString *input; /* input string to match (perl $_, GC root) */
JSBool multiline; /* whether input contains newlines (perl $*) */
@ -54,6 +58,27 @@ struct JSRegExpStatics {
JSSubString rightContext; /* input to right of last match (perl $') */
};
/*
* This struct holds a bitmap representation of a class from a regexp.
* There's a list of these referenced by the classList field in the JSRegExp
* struct below. The initial state has startIndex set to the offset in the
* original regexp source of the beginning of the class contents. The first
* use of the class converts the source representation into a bitmap.
*
*/
typedef struct RECharSet {
JSBool converted;
JSBool sense;
uint16 length;
union {
uint8 *bits;
struct {
uint16 startIndex;
uint16 length;
} src;
} u;
} RECharSet;
/*
* This macro is safe because moreParens is guaranteed to be allocated and big
* enough to hold parenCount, or else be null when parenCount is 0.
@ -71,8 +96,10 @@ struct JSRegExp {
jsrefcount nrefs; /* reference count */
uint32 parenCount:24, /* number of parenthesized submatches */
flags:8; /* flags, see jsapi.h's JSREG_* defines */
RENode *ren; /* regular expression tree root */
uint32 classCount; /* count [...] bitmaps */
RECharSet *classList; /* list of [...] bitmaps */
JSString *source; /* locked source string, sans // */
jsbytecode program[1]; /* regular expression bytecode */
};
extern JSRegExp *
@ -121,6 +148,9 @@ extern JSObject *
js_NewRegExpObject(JSContext *cx, JSTokenStream *ts,
jschar *chars, size_t length, uintN flags);
extern JSBool
js_XDRRegExp(JSXDRState *xdr, JSObject **objp);
extern JSObject *
js_CloneRegExpObject(JSContext *cx, JSObject *obj, JSObject *parent);