author | Jeff Walden <jwalden@mit.edu> |
Wed, 20 Feb 2019 13:33:16 -0800 | |
changeset 461621 | f4101f4427821666a773c683fc893e977c81946b |
parent 461620 | 870a5571096968b606babc8eb1f7c495c18ddf1c |
child 461622 | a06864bc83520a544a3412f81b5d3ef0e930138b |
push id | 35626 |
push user | csabou@mozilla.com |
push date | Thu, 28 Feb 2019 11:31:08 +0000 |
treeherder | mozilla-central@2ea0c1db7e60 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | sfink |
bugs | 1529298 |
milestone | 67.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/js/src/vm/ArrayBufferObject.cpp +++ b/js/src/vm/ArrayBufferObject.cpp @@ -1254,42 +1254,40 @@ ArrayBufferObject* ArrayBufferObject::cr } // Some |contents| kinds need to store extra data in the ArrayBuffer beyond a // data pointer. If needed for the particular kind, add extra fixed slots to // the ArrayBuffer for use as raw storage to store such information. size_t reservedSlots = JSCLASS_RESERVED_SLOTS(&class_); size_t nslots = reservedSlots; - if (true) { - if (contents.kind() == USER_OWNED) { - // No accounting to do in this case. - } else if (contents.kind() == EXTERNAL) { - // Store the FreeInfo in the inline data slots so that we - // don't use up slots for it in non-refcounted array buffers. - size_t freeInfoSlots = JS_HOWMANY(sizeof(FreeInfo), sizeof(Value)); - MOZ_ASSERT(reservedSlots + freeInfoSlots <= NativeObject::MAX_FIXED_SLOTS, - "FreeInfo must fit in inline slots"); - nslots += freeInfoSlots; + if (contents.kind() == USER_OWNED) { + // No accounting to do in this case. + } else if (contents.kind() == EXTERNAL) { + // Store the FreeInfo in the inline data slots so that we + // don't use up slots for it in non-refcounted array buffers. + size_t freeInfoSlots = JS_HOWMANY(sizeof(FreeInfo), sizeof(Value)); + MOZ_ASSERT(reservedSlots + freeInfoSlots <= NativeObject::MAX_FIXED_SLOTS, + "FreeInfo must fit in inline slots"); + nslots += freeInfoSlots; + } else { + // The ABO is taking ownership, so account the bytes against the zone. + size_t nAllocated = nbytes; + if (contents.kind() == MAPPED) { + nAllocated = JS_ROUNDUP(nbytes, js::gc::SystemPageSize()); } else { - // The ABO is taking ownership, so account the bytes against the zone. - size_t nAllocated = nbytes; - if (contents.kind() == MAPPED) { - nAllocated = JS_ROUNDUP(nbytes, js::gc::SystemPageSize()); - } else { - MOZ_ASSERT(contents.kind() == MALLOCED, - "should have handled all possible callers' kinds"); - } + MOZ_ASSERT(contents.kind() == MALLOCED, + "should have handled all possible callers' kinds"); + } - // "mapped" bytes are fed into a "malloc" counter because (bug 1037358) - // this counter constitutes an input to the "when do we GC?" subsystem. - // Arguably it deserves renaming to something that doesn't narrowly cabin - // it to just "malloc" stuff, if we're going to use it this way. - cx->updateMallocCounter(nAllocated); - } + // "mapped" bytes are fed into a "malloc" counter because (bug 1037358) this + // counter constitutes an input to the "when do we GC?" subsystem. Arguably + // it deserves renaming to something that doesn't narrowly cabin it to just + // "malloc" stuff, if we're going to use it this way. + cx->updateMallocCounter(nAllocated); } MOZ_ASSERT(!(class_.flags & JSCLASS_HAS_PRIVATE)); gc::AllocKind allocKind = gc::GetGCObjectKind(nslots); AutoSetNewObjectMetadata metadata(cx); Rooted<ArrayBufferObject*> buffer( cx, NewObjectWithClassProto<ArrayBufferObject>(cx, nullptr, allocKind,