mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-08 04:27:37 +00:00
Bug 727326 - Add missing js_ReportOutOfMemory calls in methodjit code, r=bhackett
This commit is contained in:
parent
77819cbd94
commit
ff27c504b2
@ -3846,10 +3846,9 @@ mjit::stubs::NewDenseUnallocatedArray(VMFrame &f, uint32_t length)
|
|||||||
{
|
{
|
||||||
JSObject *proto = (JSObject *) f.scratch;
|
JSObject *proto = (JSObject *) f.scratch;
|
||||||
JSObject *obj = NewArray<false>(f.cx, length, proto);
|
JSObject *obj = NewArray<false>(f.cx, length, proto);
|
||||||
if (!obj) {
|
if (!obj)
|
||||||
js_ReportOutOfMemory(f.cx);
|
|
||||||
THROWV(NULL);
|
THROWV(NULL);
|
||||||
}
|
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1076,8 +1076,10 @@ JSObject::createDenseArray(JSContext *cx, js::gc::AllocKind kind,
|
|||||||
uint32_t capacity = js::gc::GetGCKindSlots(kind) - js::ObjectElements::VALUES_PER_HEADER;
|
uint32_t capacity = js::gc::GetGCKindSlots(kind) - js::ObjectElements::VALUES_PER_HEADER;
|
||||||
|
|
||||||
JSObject *obj = js_NewGCObject(cx, kind);
|
JSObject *obj = js_NewGCObject(cx, kind);
|
||||||
if (!obj)
|
if (!obj) {
|
||||||
|
js_ReportOutOfMemory(cx);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
obj->shape_.init(shape);
|
obj->shape_.init(shape);
|
||||||
obj->type_.init(type);
|
obj->type_.init(type);
|
||||||
|
@ -451,8 +451,10 @@ JSObject::toDictionaryMode(JSContext *cx)
|
|||||||
JS_ASSERT(!shape->inDictionary());
|
JS_ASSERT(!shape->inDictionary());
|
||||||
|
|
||||||
Shape *dprop = js_NewGCShape(cx);
|
Shape *dprop = js_NewGCShape(cx);
|
||||||
if (!dprop)
|
if (!dprop) {
|
||||||
|
js_ReportOutOfMemory(cx);
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
HeapPtrShape *listp = dictionaryShape
|
HeapPtrShape *listp = dictionaryShape
|
||||||
? &dictionaryShape->parent
|
? &dictionaryShape->parent
|
||||||
@ -466,8 +468,10 @@ JSObject::toDictionaryMode(JSContext *cx)
|
|||||||
shape = shape->previous();
|
shape = shape->previous();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!root->hashify(cx))
|
if (!root->hashify(cx)) {
|
||||||
|
js_ReportOutOfMemory(cx);
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
JS_ASSERT((Shape **) root->listp == root.address());
|
JS_ASSERT((Shape **) root->listp == root.address());
|
||||||
root->listp = &self->shape_;
|
root->listp = &self->shape_;
|
||||||
|
@ -408,8 +408,10 @@ mjit::Compiler::pushActiveFrame(JSScript *script, uint32_t argc)
|
|||||||
script->initCounts(cx);
|
script->initCounts(cx);
|
||||||
|
|
||||||
ActiveFrame *newa = OffTheBooks::new_<ActiveFrame>(cx);
|
ActiveFrame *newa = OffTheBooks::new_<ActiveFrame>(cx);
|
||||||
if (!newa)
|
if (!newa) {
|
||||||
|
js_ReportOutOfMemory(cx);
|
||||||
return Compile_Error;
|
return Compile_Error;
|
||||||
|
}
|
||||||
|
|
||||||
newa->parent = a;
|
newa->parent = a;
|
||||||
if (a)
|
if (a)
|
||||||
@ -624,8 +626,10 @@ mjit::Compiler::prepareInferenceTypes(JSScript *script, ActiveFrame *a)
|
|||||||
|
|
||||||
a->varTypes = (VarType *)
|
a->varTypes = (VarType *)
|
||||||
OffTheBooks::calloc_(TotalSlots(script) * sizeof(VarType));
|
OffTheBooks::calloc_(TotalSlots(script) * sizeof(VarType));
|
||||||
if (!a->varTypes)
|
if (!a->varTypes) {
|
||||||
|
js_ReportOutOfMemory(cx);
|
||||||
return Compile_Error;
|
return Compile_Error;
|
||||||
|
}
|
||||||
|
|
||||||
for (uint32_t slot = ArgSlot(0); slot < TotalSlots(script); slot++) {
|
for (uint32_t slot = ArgSlot(0); slot < TotalSlots(script); slot++) {
|
||||||
VarType &vt = a->varTypes[slot];
|
VarType &vt = a->varTypes[slot];
|
||||||
@ -6998,8 +7002,10 @@ mjit::Compiler::startLoop(jsbytecode *head, Jump entry, jsbytecode *entryTarget)
|
|||||||
}
|
}
|
||||||
|
|
||||||
LoopState *nloop = OffTheBooks::new_<LoopState>(cx, &ssa, this, &frame);
|
LoopState *nloop = OffTheBooks::new_<LoopState>(cx, &ssa, this, &frame);
|
||||||
if (!nloop || !nloop->init(head, entry, entryTarget))
|
if (!nloop || !nloop->init(head, entry, entryTarget)) {
|
||||||
|
js_ReportOutOfMemory(cx);
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
nloop->outer = loop;
|
nloop->outer = loop;
|
||||||
loop = nloop;
|
loop = nloop;
|
||||||
@ -7175,8 +7181,10 @@ mjit::Compiler::jumpAndRun(Jump j, jsbytecode *target, Jump *slow, bool *trampol
|
|||||||
RegisterAllocation *&alloc = analysis->getAllocation(target);
|
RegisterAllocation *&alloc = analysis->getAllocation(target);
|
||||||
if (!alloc) {
|
if (!alloc) {
|
||||||
alloc = cx->typeLifoAlloc().new_<RegisterAllocation>(false);
|
alloc = cx->typeLifoAlloc().new_<RegisterAllocation>(false);
|
||||||
if (!alloc)
|
if (!alloc) {
|
||||||
|
js_ReportOutOfMemory(cx);
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
lvtarget = alloc;
|
lvtarget = alloc;
|
||||||
consistent = frame.consistentRegisters(target);
|
consistent = frame.consistentRegisters(target);
|
||||||
|
@ -575,8 +575,10 @@ FrameState::computeAllocation(jsbytecode *target)
|
|||||||
{
|
{
|
||||||
JS_ASSERT(cx->typeInferenceEnabled());
|
JS_ASSERT(cx->typeInferenceEnabled());
|
||||||
RegisterAllocation *alloc = cx->typeLifoAlloc().new_<RegisterAllocation>(false);
|
RegisterAllocation *alloc = cx->typeLifoAlloc().new_<RegisterAllocation>(false);
|
||||||
if (!alloc)
|
if (!alloc) {
|
||||||
|
js_ReportOutOfMemory(cx);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* State must be synced at exception and switch targets, at traps and when
|
* State must be synced at exception and switch targets, at traps and when
|
||||||
@ -856,8 +858,10 @@ FrameState::discardForJoin(RegisterAllocation *&alloc, uint32_t stackDepth)
|
|||||||
* loop head, and for exception, switch target and trap safe points.
|
* loop head, and for exception, switch target and trap safe points.
|
||||||
*/
|
*/
|
||||||
alloc = cx->typeLifoAlloc().new_<RegisterAllocation>(false);
|
alloc = cx->typeLifoAlloc().new_<RegisterAllocation>(false);
|
||||||
if (!alloc)
|
if (!alloc) {
|
||||||
|
js_ReportOutOfMemory(cx);
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
resetInternalState();
|
resetInternalState();
|
||||||
|
@ -158,8 +158,10 @@ LoopState::init(jsbytecode *head, Jump entry, jsbytecode *entryTarget)
|
|||||||
JS_ASSERT(!alloc);
|
JS_ASSERT(!alloc);
|
||||||
|
|
||||||
alloc = cx->typeLifoAlloc().new_<RegisterAllocation>(true);
|
alloc = cx->typeLifoAlloc().new_<RegisterAllocation>(true);
|
||||||
if (!alloc)
|
if (!alloc) {
|
||||||
|
js_ReportOutOfMemory(cx);
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
this->alloc = alloc;
|
this->alloc = alloc;
|
||||||
this->loopRegs = Registers::AvailAnyRegs;
|
this->loopRegs = Registers::AvailAnyRegs;
|
||||||
|
Loading…
Reference in New Issue
Block a user