Merge.
authorAndreas Gal <gal@mozilla.com>
Tue, 04 Nov 2008 20:27:32 -0800
changeset 21507 3ca599cbf05de7d323f11372955bf61a0473aa20
parent 21506 5329c0a211d31a856eac31dfff0a276ab3d8fa70 (current diff)
parent 21505 38f983892120c9d323d2389474d4dc51b24550ca (diff)
child 21508 bddd7b451f39a84680c1d20f89d4b189c984b8aa
push id3558
push userrsayre@mozilla.com
push dateSat, 08 Nov 2008 09:06:43 +0000
treeherdermozilla-central@17747605490c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone1.9.1b2pre
Merge.
--- a/js/src/jsregexp.cpp
+++ b/js/src/jsregexp.cpp
@@ -2079,16 +2079,18 @@ class RegExpNativeCompiler {
          * (a) pass around continuations so we know the right place to go
          * when we logically return, or (b) generate explicit backtracking
          * code. */
         if (node->next) return JS_FALSE;
         return compileNode(node->next, pos, fails);
     }
 
     JSBool compileNode(RENode *node, LIns *pos, LInsList &fails) {
+        if (fragment->lirbuf->outOmem()) return JS_FALSE;
+
         if (!node) {
             lir->insStorei(pos, state, (int) offsetof(REMatchState, cp));
             lir->ins1(LIR_ret, state);
             return JS_TRUE;
         }
 
         switch (node->op) {
         case REOP_EMPTY:
@@ -2152,16 +2154,17 @@ class RegExpNativeCompiler {
         Fragmento *fragmento = JS_TRACE_MONITOR(cx).reFragmento;
         fragment = fragmento->getAnchor(re);
         fragment->lirbuf = new (&gc) LirBuffer(fragmento, NULL);
         /* Scary: this is required to have the onDestroy method delete
          * the lirbuf. */
         fragment->root = fragment;
         LirBuffer *lirbuf = fragment->lirbuf;
         LirBufWriter *lirb;
+        if (lirbuf->outOmem()) goto fail2;
         /* FIXME  Use smart pointer instead. */
         lir = lirb = new (&gc) LirBufWriter(lirbuf);
 
         /* FIXME  Use smart pointer instead. */
         debug_only_v(fragment->lirbuf->names = new (&gc) LirNameMap(&gc, NULL, fragmento->labels);)
         /* FIXME  Use smart pointer instead. */
         debug_only_v(lir = new (&gc) VerboseWriter(&gc, lir, lirbuf->names);)
 
@@ -2181,23 +2184,26 @@ class RegExpNativeCompiler {
         skip = lirb->skip(sizeof(LoopGuardRecord));
         guard = (LoopGuardRecord *) skip->payload();
         memset(guard, 0, sizeof(*guard));
         guard->exit = (SideExit *) &guard->guards;
         guard->from = guard->target = fragment;
         fragment->lastIns = lir->insGuard(LIR_loop, lir->insImm(1), skip);
 
         ::compile(fragmento->assm(), fragment);
+        if (fragmento->assm()->error() != nanojit::None)
+            goto fail;
 
         delete lirb;
         debug_only_v(delete lir;)
         return JS_TRUE;
     fail:
         delete lirb;
         debug_only_v(delete lir;)
+    fail2:
         fragmento->clearFrag(re);
         return JS_FALSE;
     }
 };
 
 static inline JSBool
 js_CompileRegExpToNative(JSContext *cx, JSRegExp *re, CompilerState *cs)
 {