Backed out changeset f7c32e7abf72 (bug 1498458) for causing SM build bustages on oom-allocating-arraybuffer-contents.
authorCosmin Sabou <csabou@mozilla.com>
Sat, 13 Oct 2018 04:51:18 +0300
changeset 489359 3ee73bef9537d1d2f09d397150238523be4f6891
parent 489358 22f5c9171d258adadc703aca664bbca476fa441a
child 489360 2aede0d5656f05304e2a584cabd0ce9c0337723f
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
bugs1498458
milestone64.0a1
backs outf7c32e7abf7293b99c6d1941af6e15ebc3119d5c
Backed out changeset f7c32e7abf72 (bug 1498458) for causing SM build bustages on oom-allocating-arraybuffer-contents.
js/src/jit-test/tests/typedarray/oom-allocating-arraybuffer-contents.js
js/src/vm/ArrayBufferObject.cpp
deleted file mode 100644
--- a/js/src/jit-test/tests/typedarray/oom-allocating-arraybuffer-contents.js
+++ /dev/null
@@ -1,8 +0,0 @@
-// |jit-test| skip-if: !('oomTest' in this)
-
-oomTest(function test() {
-  // The original missing OOM check was after failure to allocate ArrayBuffer
-  // contents, in the ctor call -- the particular operations after that aren't
-  // important.
-  new Uint8ClampedArray(256).toLocaleString('hi');
-});
--- a/js/src/vm/ArrayBufferObject.cpp
+++ b/js/src/vm/ArrayBufferObject.cpp
@@ -458,17 +458,18 @@ ArrayBufferObject::class_constructor(JSC
     }
     args.rval().setObject(*bufobj);
     return true;
 }
 
 static ArrayBufferObject::BufferContents
 AllocateArrayBufferContents(JSContext* cx, uint32_t nbytes)
 {
-    uint8_t* p = cx->pod_callocCanGC<uint8_t>(nbytes, js::ArrayBufferContentsArena);
+    uint8_t* p = cx->pod_callocCanGC<uint8_t>(nbytes,
+                                                      js::ArrayBufferContentsArena);
     return ArrayBufferObject::BufferContents::create<ArrayBufferObject::PLAIN>(p);
 }
 
 static void
 NoteViewBufferWasDetached(ArrayBufferViewObject* view,
                           ArrayBufferObject::BufferContents newContents,
                           JSContext* cx)
 {
@@ -1244,17 +1245,16 @@ ArrayBufferObject::create(JSContext* cx,
         if (nbytes <= usableSlots * sizeof(Value)) {
             int newSlots = JS_HOWMANY(nbytes, sizeof(Value));
             MOZ_ASSERT(int(nbytes) <= newSlots * int(sizeof(Value)));
             nslots = reservedSlots + newSlots;
             contents = BufferContents::createPlain(nullptr);
         } else {
             contents = AllocateArrayBufferContents(cx, nbytes);
             if (!contents) {
-                ReportOutOfMemory(cx);
                 return nullptr;
             }
             allocated = true;
         }
     }
 
     MOZ_ASSERT(!(class_.flags & JSCLASS_HAS_PRIVATE));
     gc::AllocKind allocKind = gc::GetGCObjectKind(nslots);