Skip to content

Commit 9773ff0

Browse files
committed
Editorial: Inline IsSameBuffer with a simplified "same backing Data Block" check
cf. #3629 (comment)
1 parent a46811a commit 9773ff0

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
@@ -42235,7 +42235,7 @@ <h1>
4223542235
1. Let _targetBuffer_ be _target_.[[ViewedArrayBuffer]].
4223642236
1. Let _srcBuffer_ be _source_.[[ViewedArrayBuffer]].
4223742237
1. Let _srcByteIndex_ be _source_.[[ByteOffset]].
42238-
1. If IsSameBuffer(_srcBuffer_, _targetBuffer_) is *true*, then
42238+
1. If _targetBuffer_.[[ArrayBufferData]] is _srcBuffer_.[[ArrayBufferData]], then
4223942239
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.
4224042240
1. Let _srcByteLength_ be TypedArrayByteLength(_srcRecord_).
4224142241
1. Set _srcBuffer_ to ? CloneArrayBuffer(_srcBuffer_, _srcByteIndex_, _srcByteLength_).
@@ -44379,22 +44379,6 @@ <h1>
4437944379
</emu-alg>
4438044380
</emu-clause>
4438144381

44382-
<emu-clause id="sec-issamebuffer" type="abstract operation">
44383-
<h1>
44384-
IsSameBuffer (
44385-
_a_: an ArrayBuffer or a SharedArrayBuffer,
44386-
_b_: an ArrayBuffer or a SharedArrayBuffer,
44387-
): a Boolean
44388-
</h1>
44389-
<dl class="header">
44390-
</dl>
44391-
<emu-alg>
44392-
1. If SameValue(_a_, _b_) is *true*, return *true*.
44393-
1. If IsSharedArrayBuffer(_a_) is *true*, IsSharedArrayBuffer(_b_) is *true*, and _b_.[[ArrayBufferData]] is _a_.[[ArrayBufferData]], return *true*.
44394-
1. Return *false*.
44395-
</emu-alg>
44396-
</emu-clause>
44397-
4439844382
<emu-clause id="sec-getarraybuffermaxbytelengthoption" type="abstract operation">
4439944383
<h1>
4440044384
GetArrayBufferMaxByteLengthOption (
@@ -44886,7 +44870,7 @@ <h1>ArrayBuffer.prototype.slice ( _start_, _end_ )</h1>
4488644870
1. Perform ? RequireInternalSlot(_new_, [[ArrayBufferData]]).
4488744871
1. If IsSharedArrayBuffer(_new_) is *true*, throw a *TypeError* exception.
4488844872
1. If IsDetachedBuffer(_new_) is *true*, throw a *TypeError* exception.
44889-
1. If IsSameBuffer(_new_, _O_) is *true*, throw a *TypeError* exception.
44873+
1. If _new_.[[ArrayBufferData]] is _O_.[[ArrayBufferData]], throw a *TypeError* exception.
4489044874
1. If _new_.[[ArrayBufferByteLength]] &lt; _newLen_, throw a *TypeError* exception.
4489144875
1. NOTE: Side-effects of the above steps may have detached or resized _O_.
4489244876
1. If IsDetachedBuffer(_O_) is *true*, throw a *TypeError* exception.
@@ -45203,7 +45187,7 @@ <h1>SharedArrayBuffer.prototype.slice ( _start_, _end_ )</h1>
4520345187
1. Let _new_ be ? Construct(_ctor_, « 𝔽(_newLen_) »).
4520445188
1. Perform ? RequireInternalSlot(_new_, [[ArrayBufferData]]).
4520545189
1. If IsSharedArrayBuffer(_new_) is *false*, throw a *TypeError* exception.
45206-
1. If IsSameBuffer(_new_, _O_) is *true*, throw a *TypeError* exception.
45190+
1. If _new_.[[ArrayBufferData]] is _O_.[[ArrayBufferData]], throw a *TypeError* exception.
4520745191
1. If ArrayBufferByteLength(_new_, ~seq-cst~) &lt; _newLen_, throw a *TypeError* exception.
4520845192
1. Let _fromBuf_ be _O_.[[ArrayBufferData]].
4520945193
1. Let _toBuf_ be _new_.[[ArrayBufferData]].

0 commit comments

Comments
 (0)