Bug 1079844 - Adjust TypedArray.js comments to refer to detachment rather than neutering. r=mrrrgn
authorJeff Walden <jwalden@mit.edu>
Sun, 24 Jan 2016 23:41:39 -0800
changeset 281723 7fecabf69ee963d906ca11bdbbf76c84896e2116
parent 281722 320b84c9e32173d367d822505fa966d8a2ab3efc
child 281724 9be65753d24997290b5a15634ca5cba20e7ead5a
push id70898
push userjwalden@mit.edu
push dateTue, 26 Jan 2016 19:18:23 +0000
treeherdermozilla-inbound@82fa5db23a4c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmrrrgn
bugs1079844
milestone47.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1079844 - Adjust TypedArray.js comments to refer to detachment rather than neutering. r=mrrrgn
js/src/builtin/TypedArray.js
--- a/js/src/builtin/TypedArray.js
+++ b/js/src/builtin/TypedArray.js
@@ -9,25 +9,25 @@ function ViewedArrayBufferIfReified(tarr
 
     var buf = UnsafeGetReservedSlot(tarray, JS_TYPEDARRAYLAYOUT_BUFFER_SLOT);
     assert(buf === null || (IsObject(buf) && (IsArrayBuffer(buf) || IsSharedArrayBuffer(buf))),
            "unexpected value in buffer slot");
     return buf;
 }
 
 function IsDetachedBuffer(buffer) {
-    // Typed arrays whose buffers are null use inline storage and can't have
-    // been neutered.
+    // A typed array with a null buffer has never had its buffer exposed to
+    // become detached.
     if (buffer === null)
         return false;
 
     assert(IsArrayBuffer(buffer) || IsSharedArrayBuffer(buffer),
            "non-ArrayBuffer passed to IsDetachedBuffer");
 
-    // Typed arrays whose buffers map shared memory can't have been neutered.
+    // Shared array buffers are not detachable.
     //
     // This check is more expensive than desirable, but IsDetachedBuffer is
     // only hot for non-shared memory in SetFromNonTypedArray, so there is an
     // optimization in place there to avoid incurring the cost here.  An
     // alternative is to give SharedArrayBuffer the same layout as ArrayBuffer.
     if (IsSharedArrayBuffer(buffer))
 	return false;
 
@@ -95,18 +95,19 @@ function TypedArrayCopyWithin(target, st
     // [-len, len] for |count| -- and with |len| bounded by implementation
     // limits to 2**31 - 1, there can be no exceeding int32_t.
     assert(-0x7FFFFFFF - 1 <= count && count <= 0x7FFFFFFF,
            "typed array element count assumed int32_t");
 
     // Steps 15-17.
     //
     // Note that getting or setting a typed array element must throw if the
-    // typed array is neutered, so the intrinsic below checks for neutering.
-    // This happens *only* if a get/set occurs, i.e. when |count > 0|.
+    // underlying buffer is detached, so the intrinsic below checks for
+    // detachment.  This happens *only* if a get/set occurs, i.e. when
+    // |count > 0|.
     //
     // Also note that this copies elements effectively by memmove, *not* in
     // step 17's specified order.  This is unobservable, but it would be if we
     // used this method to implement shared typed arrays' copyWithin.
     if (count > 0)
         MoveTypedArrayElements(obj, to | 0, from | 0, count | 0);
 
     // Step 18.