Skip to content

Commit

Permalink
Bug 1875650 - Mark allocation of prototype object as OOMUnsafe r=iain
Browse files Browse the repository at this point in the history
  • Loading branch information
mgaudet committed Jan 23, 2024
1 parent 90dd7e5 commit 5dae03c
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions js/src/jit/CacheIR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "js/GCAPI.h" // JS::AutoSuppressGCAnalysis
#include "js/RegExpFlags.h" // JS::RegExpFlags
#include "js/ScalarType.h" // js::Scalar::Type
#include "js/Utility.h" // JS::AutoEnterOOMUnsafeRegion
#include "js/Wrapper.h"
#include "proxy/DOMProxy.h" // js::GetDOMProxyHandlerFamily
#include "proxy/ScriptedProxyHandler.h"
Expand Down Expand Up @@ -5695,11 +5696,13 @@ static bool IsArrayIteratorPrototypeOptimizable(
JSContext* cx, AllowIteratorReturn allowReturn,
MutableHandle<NativeObject*> arrIterProto, uint32_t* slot,
MutableHandle<JSFunction*> nextFun) {
auto* proto =
GlobalObject::getOrCreateArrayIteratorPrototype(cx, cx->global());
if (!proto) {
cx->recoverFromOutOfMemory();
return false;
NativeObject* proto = nullptr;
{
AutoEnterOOMUnsafeRegion oom;
proto = GlobalObject::getOrCreateArrayIteratorPrototype(cx, cx->global());
if (!proto) {
oom.crash("failed to allocate Array iterator prototype");
}
}
arrIterProto.set(proto);

Expand Down

0 comments on commit 5dae03c

Please sign in to comment.