diff --git a/docs/index.html b/docs/index.html index f2a8f4d..a61702b 100644 --- a/docs/index.html +++ b/docs/index.html @@ -12,7 +12,7 @@

Stage 3 Draft / June 15, 2022

+

Stage 3 Draft / July 12, 2022

Resizable ArrayBuffer and growable SharedArrayBuffer

We extend the ArrayBuffer and SharedArrayBuffer constructors to take an additional maximum byte length, which would construct dynamically resizable and growable array buffers, respectively. In addition, a transfer method is added to the ArrayBuffer prototype.

@@ -133,7 +133,7 @@

1.3.5 ArrayBuffer.prototype.resize ( newLen

1.3.6 ArrayBuffer.prototype.transfer ( [ newLength ] )

The following steps are taken:

-
  1. Let O be the this value.
  2. Perform ? RequireInternalSlot(O, [[ArrayBufferData]]).
  3. If IsSharedArrayBuffer(O) is true, throw a TypeError exception.
  4. If IsDetachedBuffer(O) is true, throw a TypeError exception.
  5. If newLength is undefined, let newByteLength be O.[[ArrayBufferByteLength]].
  6. Else, let newByteLength be ? ToIntegerOrInfinity(newLength).
  7. Let new be ? Construct(%ArrayBuffer%, « 𝔽(newByteLength) »).
  8. NOTE: This method returns a fixed-length ArrayBuffer.
  9. Let copyLength be min(newByteLength, O.[[ArrayBufferByteLength]]).
  10. Let fromBlock be O.[[ArrayBufferData]].
  11. Let toBlock be new.[[ArrayBufferData]].
  12. Perform CopyDataBlockBytes(toBlock, 0, fromBlock, 0, copyLength).
  13. NOTE: Neither creation of the new Data Block nor copying from the old Data Block are observable. Implementations reserve the right to implement this method as a zero-copy move or a realloc.
  14. Perform ? DetachArrayBuffer(O).
  15. Return new.
+
  1. Let O be the this value.
  2. Perform ? RequireInternalSlot(O, [[ArrayBufferData]]).
  3. If IsSharedArrayBuffer(O) is true, throw a TypeError exception.
  4. If newLength is undefined, then
    1. If IsDetachedBuffer(O) is true, throw a TypeError exception.
    2. Let newByteLength be O.[[ArrayBufferByteLength]].
  5. Else,
    1. Let newByteLength be ? ToIndex(newLength).
    2. If IsDetachedBuffer(O) is true, throw a TypeError exception.
  6. Let new be ? Construct(%ArrayBuffer%, « 𝔽(newByteLength) »).
  7. NOTE: This method returns a fixed-length ArrayBuffer.
  8. Let copyLength be min(newByteLength, O.[[ArrayBufferByteLength]]).
  9. Let fromBlock be O.[[ArrayBufferData]].
  10. Let toBlock be new.[[ArrayBufferData]].
  11. Perform CopyDataBlockBytes(toBlock, 0, fromBlock, 0, copyLength).
  12. NOTE: Neither creation of the new Data Block nor copying from the old Data Block are observable. Implementations reserve the right to implement this method as a zero-copy move or a realloc.
  13. Perform ? DetachArrayBuffer(O).
  14. Return new.
Note

The transfer method intentionally does not honor the @@species property when creating derived objects.

diff --git a/spec.html b/spec.html index 4aae702..a2d0e91 100644 --- a/spec.html +++ b/spec.html @@ -293,9 +293,12 @@

ArrayBuffer.prototype.transfer ( [ _newLength_ ] )

1. Let _O_ be the *this* value. 1. Perform ? RequireInternalSlot(_O_, [[ArrayBufferData]]). 1. If IsSharedArrayBuffer(_O_) is *true*, throw a *TypeError* exception. - 1. If IsDetachedBuffer(_O_) is *true*, throw a *TypeError* exception. - 1. If _newLength_ is *undefined*, let _newByteLength_ be _O_.[[ArrayBufferByteLength]]. - 1. Else, let _newByteLength_ be ? ToIntegerOrInfinity(_newLength_). + 1. If _newLength_ is *undefined*, then + 1. If IsDetachedBuffer(_O_) is *true*, throw a *TypeError* exception. + 1. Let _newByteLength_ be _O_.[[ArrayBufferByteLength]]. + 1. Else, + 1. Let _newByteLength_ be ? ToIndex(_newLength_). + 1. If IsDetachedBuffer(_O_) is *true*, throw a *TypeError* exception. 1. Let _new_ be ? Construct(%ArrayBuffer%, « 𝔽(_newByteLength_) »). 1. NOTE: This method returns a fixed-length ArrayBuffer. 1. Let _copyLength_ be min(_newByteLength_, _O_.[[ArrayBufferByteLength]]).