Bug 864462 - Fix OOM in write barrier verifier (r=terrence)

This commit is contained in:
Bill McCloskey 2013-04-25 21:02:15 -07:00
parent fb19038e8b
commit d5ad35af09

View File

@ -509,12 +509,13 @@ gc::StartVerifyPreBarriers(JSRuntime *rt)
const size_t size = 64 * 1024 * 1024; const size_t size = 64 * 1024 * 1024;
trc->root = (VerifyNode *)js_malloc(size); trc->root = (VerifyNode *)js_malloc(size);
JS_ASSERT(trc->root); if (!trc->root)
goto oom;
trc->edgeptr = (char *)trc->root; trc->edgeptr = (char *)trc->root;
trc->term = trc->edgeptr + size; trc->term = trc->edgeptr + size;
if (!trc->nodemap.init()) if (!trc->nodemap.init())
return; goto oom;
/* Create the root node. */ /* Create the root node. */
trc->curnode = MakeNode(trc, NULL, JSGCTraceKind(0)); trc->curnode = MakeNode(trc, NULL, JSGCTraceKind(0));
@ -525,7 +526,8 @@ gc::StartVerifyPreBarriers(JSRuntime *rt)
/* Make all the roots be edges emanating from the root node. */ /* Make all the roots be edges emanating from the root node. */
MarkRuntime(trc); MarkRuntime(trc);
VerifyNode *node = trc->curnode; VerifyNode *node;
node = trc->curnode;
if (trc->edgeptr == trc->term) if (trc->edgeptr == trc->term)
goto oom; goto oom;