Skip to content

Commit

Permalink
Shortcut the SAB cloning steps
Browse files Browse the repository at this point in the history
OrdinaryCreateFromConstructor matches other generic usages to create a new instance from a given constructor,
in this case, the given steps just fall short to OrdinaryObjectCreate without any observable steps.
  • Loading branch information
leobalter committed Oct 29, 2021
1 parent 01a2614 commit b82d6b2
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -236,24 +236,17 @@ <h1>GetTransferrableValue ( _receiverRealm_, _value_ )</h1>
1. If IsCallable(_value_) is *true*,
1. Return ! WrappedFunctionCreate(_receiverRealm_, _value_).
1. If _value_ has an [[ArrayBufferData]] internal slot, then
1. If IsSharedArrayBuffer(_value_) if *true*, return ? CloneSharedArrayBuffer(_value_, _receiverRealm_.[[Intrinsics]].%SharedArrayBuffer%).
1. throw a TypeError exception.
1. If IsSharedArrayBuffer(_value_) is *true*, then
1. Let _clone_ be ! OrdinaryObjectCreate(_receiverRealm_.[[Intrinsics]].%SharedArrayBuffer.prototype%, « [[ArrayBufferData]], [[ArrayBufferByteLength]] »).
1. Assert: _value_ and _clone_ are instances of SharedArrayBuffer of different Realms each.
1. Set _clone_.[[ArrayBufferData]] to _value_.[[ArrayBufferData]].
1. Set _clone_.[[ArrayBufferByteLength]] to _value_.[[ArrayBufferByteLength]].
1. Return _clone_.
1. Throw a TypeError exception.
1. Return _value_.
</emu-alg>
</emu-clause>

<emu-clause id="sec-clonesharedarraybuffer" aoid="CloneSharedArrayBuffer">
<h1>CloneSharedArrayBuffer ( _buffer_, _constructor_ )</h1>
<emu-alg>
1. Assert: _buffer_ is an Object with a [[SharedArrayBuffer]] internal.
1. Let _clone_ be ? OrdinaryCreateFromConstructor(_constructor_, "%SharedArrayBuffer.prototype%", « [[ArrayBufferData]], [[ArrayBufferByteLength]] »).
1. Assert: _value_ and _clone_ are instances of SharedArrayBuffer of different Realms each.
1. Set _clone_.[[ArrayBufferData]] to _value_.[[ArrayBufferData]].
1. Set _clone_.[[ArrayBufferByteLength]] to _value_.[[ArrayBufferByteLength]].
1. Return _clone_.
</emu-alg>>
</emu-clause>

<emu-clause id="sec-validateshadowrealmobject" aoid="ValidateShadowRealmObject">
<h1>ValidateShadowRealmObject ( _O_ )</h1>
<p>The abstract operation ValidateShadowRealmObject takes argument _O_. It performs the following steps when called:</p>
Expand Down

0 comments on commit b82d6b2

Please sign in to comment.