Bug 464138: invalid use of regexp addr as unique key, r=gal

This commit is contained in:
David Mandelin 2008-11-11 19:20:18 -08:00
parent 377dcbc87b
commit f7418603b9

View File

@ -2155,7 +2155,9 @@ class RegExpNativeCompiler {
bool oom = false;
Fragmento* fragmento = JS_TRACE_MONITOR(cx).reFragmento;
fragment = fragmento->getAnchor(re);
fragment = fragmento->getLoop(re);
if (!fragment)
fragment = fragmento->getAnchor(re);
fragment->lirbuf = new (&gc) LirBuffer(fragmento, NULL);
/* Scary: required to have the onDestroy method delete the lirbuf. */
fragment->root = fragment;
@ -2831,6 +2833,12 @@ void
js_DestroyRegExp(JSContext *cx, JSRegExp *re)
{
if (JS_ATOMIC_DECREMENT(&re->nrefs) == 0) {
#ifdef JS_TRACER
/* Don't reuse this compiled code for some new regexp at same addr. */
Fragment* fragment = JS_TRACE_MONITOR(cx).reFragmento->getLoop(re);
if (fragment)
fragment->blacklist();
#endif
if (re->classList) {
uintN i;
for (i = 0; i < re->classCount; i++) {
@ -3643,7 +3651,7 @@ MatchRegExp(REGlobalData *gData, REMatchState *x)
/* Run with native regexp if possible. */
if (TRACING_ENABLED(gData->cx) &&
((fragment = JS_TRACE_MONITOR(gData->cx).reFragmento->getLoop(gData->regexp)) != NULL)
&& fragment->code()) {
&& fragment->code() && !fragment->isBlacklisted()) {
union { NIns *code; REMatchState* (FASTCALL *func)(void*, void*); } u;
u.code = fragment->code();
REMatchState *lr;