Skip to content

Commit 8c4eda9

Browse files
committed
Editorial: Inline IsSameBuffer with a simplified "same backing Data Block" check
cf. tc39#3629 (comment)
1 parent 68b1a85 commit 8c4eda9

File tree

1 file changed

+3
-19
lines changed

1 file changed

+3
-19
lines changed

spec.html

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -42293,7 +42293,7 @@ <h1>
4229342293
1. Let _targetBuffer_ be _target_.[[ViewedArrayBuffer]].
4229442294
1. Let _srcBuffer_ be _source_.[[ViewedArrayBuffer]].
4229542295
1. Let _srcByteIndex_ be _source_.[[ByteOffset]].
42296-
1. If IsSameBuffer(_srcBuffer_, _targetBuffer_) is *true*, then
42296+
1. If _targetBuffer_.[[ArrayBufferData]] is _srcBuffer_.[[ArrayBufferData]], then
4229742297
1. NOTE: This operation must behave as if copying data into an overlapping range within the same Data Block is a single atomic step. But because the results of copying are not observable until it completes, implementations unable to perform such copying atomically may still avoid allocating a new ArrayBuffer by copying chunks in-place if they alter the direction of iteration as appropriate to avoid overwriting source data that has not yet been read.
4229842298
1. Let _srcByteLength_ be TypedArrayByteLength(_srcRecord_).
4229942299
1. Set _srcBuffer_ to ? CloneArrayBuffer(_srcBuffer_, _srcByteIndex_, _srcByteLength_).
@@ -44435,22 +44435,6 @@ <h1>
4443544435
</emu-alg>
4443644436
</emu-clause>
4443744437

44438-
<emu-clause id="sec-issamebuffer" type="abstract operation">
44439-
<h1>
44440-
IsSameBuffer (
44441-
_a_: an ArrayBuffer or a SharedArrayBuffer,
44442-
_b_: an ArrayBuffer or a SharedArrayBuffer,
44443-
): a Boolean
44444-
</h1>
44445-
<dl class="header">
44446-
</dl>
44447-
<emu-alg>
44448-
1. If SameValue(_a_, _b_) is *true*, return *true*.
44449-
1. If IsSharedArrayBuffer(_a_) is *true*, IsSharedArrayBuffer(_b_) is *true*, and _b_.[[ArrayBufferData]] is _a_.[[ArrayBufferData]], return *true*.
44450-
1. Return *false*.
44451-
</emu-alg>
44452-
</emu-clause>
44453-
4445444438
<emu-clause id="sec-getarraybuffermaxbytelengthoption" type="abstract operation">
4445544439
<h1>
4445644440
GetArrayBufferMaxByteLengthOption (
@@ -44942,7 +44926,7 @@ <h1>ArrayBuffer.prototype.slice ( _start_, _end_ )</h1>
4494244926
1. Perform ? RequireInternalSlot(_new_, [[ArrayBufferData]]).
4494344927
1. If IsSharedArrayBuffer(_new_) is *true*, throw a *TypeError* exception.
4494444928
1. If IsDetachedBuffer(_new_) is *true*, throw a *TypeError* exception.
44945-
1. If IsSameBuffer(_new_, _O_) is *true*, throw a *TypeError* exception.
44929+
1. If _new_.[[ArrayBufferData]] is _O_.[[ArrayBufferData]], throw a *TypeError* exception.
4494644930
1. If _new_.[[ArrayBufferByteLength]] &lt; _newLen_, throw a *TypeError* exception.
4494744931
1. NOTE: Side-effects of the above steps may have detached or resized _O_.
4494844932
1. If IsDetachedBuffer(_O_) is *true*, throw a *TypeError* exception.
@@ -45259,7 +45243,7 @@ <h1>SharedArrayBuffer.prototype.slice ( _start_, _end_ )</h1>
4525945243
1. Let _new_ be ? Construct(_ctor_, « 𝔽(_newLen_) »).
4526045244
1. Perform ? RequireInternalSlot(_new_, [[ArrayBufferData]]).
4526145245
1. If IsSharedArrayBuffer(_new_) is *false*, throw a *TypeError* exception.
45262-
1. If IsSameBuffer(_new_, _O_) is *true*, throw a *TypeError* exception.
45246+
1. If _new_.[[ArrayBufferData]] is _O_.[[ArrayBufferData]], throw a *TypeError* exception.
4526345247
1. If ArrayBufferByteLength(_new_, ~seq-cst~) &lt; _newLen_, throw a *TypeError* exception.
4526445248
1. Let _fromBuf_ be _O_.[[ArrayBufferData]].
4526545249
1. Let _toBuf_ be _new_.[[ArrayBufferData]].

0 commit comments

Comments
 (0)