Bug 734976 - Call js_ReportOutOfMemory in jsgcinlines when simulating OOM. Original patch by Brian Hackett. r=luke,bhackett,jdemooij

This commit is contained in:
Christian Holler 2012-04-14 11:37:32 -07:00
Родитель e38f636fa8
Коммит 781fdef9c1
2 изменённых файлов: 13 добавлений и 2 удалений

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

@ -158,9 +158,20 @@ PrintBacktrace()
} \ } \
} while (0) } while (0)
# define JS_OOM_POSSIBLY_FAIL_REPORT(cx) \
do \
{ \
if (++OOM_counter > OOM_maxAllocations) { \
JS_OOM_EMIT_BACKTRACE();\
js_ReportOutOfMemory(cx);\
return NULL; \
} \
} while (0)
# else # else
# define JS_OOM_POSSIBLY_FAIL() do {} while(0) # define JS_OOM_POSSIBLY_FAIL() do {} while(0)
# endif # define JS_OOM_POSSIBLY_FAIL_REPORT(cx) do {} while(0)
# endif /* DEBUG */
/* /*
* SpiderMonkey code should not be calling these allocation functions directly. * SpiderMonkey code should not be calling these allocation functions directly.

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

@ -440,7 +440,7 @@ NewGCThing(JSContext *cx, js::gc::AllocKind kind, size_t thingSize)
JS_ASSERT(!cx->runtime->noGCOrAllocationCheck); JS_ASSERT(!cx->runtime->noGCOrAllocationCheck);
/* For testing out of memory conditions */ /* For testing out of memory conditions */
JS_OOM_POSSIBLY_FAIL(); JS_OOM_POSSIBLY_FAIL_REPORT(cx);
#ifdef JS_GC_ZEAL #ifdef JS_GC_ZEAL
if (cx->runtime->needZealousGC()) if (cx->runtime->needZealousGC())