static bool ChangeHeap(JSContext *cx, AsmJSModule &module, CallArgs args) { HandleValue bufferArg = args.get(0); if (!IsArrayBuffer(bufferArg)) { ReportIncompatible(cx, args); return false; } Rooted<ArrayBufferObject*> newBuffer(cx, &bufferArg.toObject().as<ArrayBufferObject>()); uint32_t heapLength = newBuffer->byteLength(); if (heapLength & module.heapLengthMask() || heapLength < module.minHeapLength() || heapLength > module.maxHeapLength()) { args.rval().set(BooleanValue(false)); return true; } if (!module.hasArrayView()) { args.rval().set(BooleanValue(true)); return true; } MOZ_ASSERT(IsValidAsmJSHeapLength(heapLength)); MOZ_ASSERT(!IsDeprecatedAsmJSHeapLength(heapLength)); if (!ArrayBufferObject::prepareForAsmJS(cx, newBuffer, module.usesSignalHandlersForOOB())) return false; args.rval().set(BooleanValue(module.changeHeap(newBuffer, cx))); return true; }