<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[203200] trunk/Source/JavaScriptCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/203200">203200</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2016-07-13 16:54:23 -0700 (Wed, 13 Jul 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Unreviewed, rolling out <a href="http://trac.webkit.org/projects/webkit/changeset/203199">r203199</a>.

Broke the build

Reverted changeset:

&quot;Crashes with detached ArrayBuffers&quot;
https://bugs.webkit.org/show_bug.cgi?id=157088
http://trac.webkit.org/changeset/203199</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCorebuiltinsTypedArrayPrototypejs">trunk/Source/JavaScriptCore/builtins/TypedArrayPrototype.js</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSGenericTypedArrayViewh">trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayView.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSGenericTypedArrayViewInlinesh">trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewInlines.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSGenericTypedArrayViewPrototypeFunctionsh">trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewPrototypeFunctions.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSTypedArrayViewPrototypecpp">trunk/Source/JavaScriptCore/runtime/JSTypedArrayViewPrototype.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoretestsstresstypedarrayfilljs">trunk/Source/JavaScriptCore/tests/stress/typedarray-fill.js</a></li>
<li><a href="#trunkSourceJavaScriptCoretestsstresstypedarrayfunctionswithneuteredjs">trunk/Source/JavaScriptCore/tests/stress/typedarray-functions-with-neutered.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (203199 => 203200)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2016-07-13 23:38:44 UTC (rev 203199)
+++ trunk/Source/JavaScriptCore/ChangeLog        2016-07-13 23:54:23 UTC (rev 203200)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2016-07-13  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        Unreviewed, rolling out r203199.
+
+        Broke the build
+
+        Reverted changeset:
+
+        &quot;Crashes with detached ArrayBuffers&quot;
+        https://bugs.webkit.org/show_bug.cgi?id=157088
+        http://trac.webkit.org/changeset/203199
+
</ins><span class="cx"> 2016-07-13  Keith Miller  &lt;keith_miller@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Crashes with detached ArrayBuffers
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebuiltinsTypedArrayPrototypejs"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/builtins/TypedArrayPrototype.js (203199 => 203200)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/builtins/TypedArrayPrototype.js        2016-07-13 23:38:44 UTC (rev 203199)
+++ trunk/Source/JavaScriptCore/builtins/TypedArrayPrototype.js        2016-07-13 23:54:23 UTC (rev 203200)
</span><span class="lines">@@ -52,22 +52,6 @@
</span><span class="cx">     return constructor;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-@globalPrivate
-function typedArrayClampArgumentToStartOrEnd(value, length, undefinedValue)
-{
-    &quot;use strict&quot;;
-
-    if (value === @undefined)
-        return undefinedValue;
-
-    let int = @toInteger(value);
-    if (int &lt; 0) {
-        int += length;
-        return int &lt; 0 ? 0 : int;
-    }
-    return int &gt; length ? length : int;
-}
-
</del><span class="cx"> function values()
</span><span class="cx"> {
</span><span class="cx">     &quot;use strict&quot;;
</span><span class="lines">@@ -106,29 +90,6 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-function fill(value /* [, start [, end]] */)
-{
-    &quot;use strict&quot;;
-
-    let length = @typedArrayLength(this);
-    let start;
-    let end;
-
-    if (arguments.length &gt; 1) {
-        start = arguments[1];
-        if (arguments.length &gt; 2) {
-            end = arguments[2];
-        }
-    }
-
-    start = @typedArrayClampArgumentToStartOrEnd(start, length, 0);
-    end = @typedArrayClampArgumentToStartOrEnd(end, length, length);
-
-    for (let i = start; i &lt; end; i++)
-        this[i] = value;
-    return this;
-}
-
</del><span class="cx"> function find(callback /* [, thisArg] */)
</span><span class="cx"> {
</span><span class="cx">     &quot;use strict&quot;;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSGenericTypedArrayViewh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayView.h (203199 => 203200)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayView.h        2016-07-13 23:38:44 UTC (rev 203199)
+++ trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayView.h        2016-07-13 23:54:23 UTC (rev 203200)
</span><span class="lines">@@ -88,8 +88,6 @@
</span><span class="cx">     Unobservable,
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-static const char* typedArrayBufferHasBeenDetachedErrorMessage = &quot;Underlying ArrayBuffer has been detached from the view&quot;;
-
</del><span class="cx"> template&lt;typename Adaptor&gt;
</span><span class="cx"> class JSGenericTypedArrayView : public JSArrayBufferView {
</span><span class="cx"> public:
</span><span class="lines">@@ -162,7 +160,6 @@
</span><span class="cx">     
</span><span class="cx">     void setIndexQuickly(unsigned i, JSValue value)
</span><span class="cx">     {
</span><del>-        ASSERT(!value.isObject());
</del><span class="cx">         setIndexQuicklyToNativeValue(i, toNativeFromValue&lt;Adaptor&gt;(value));
</span><span class="cx">     }
</span><span class="cx">     
</span><span class="lines">@@ -172,11 +169,6 @@
</span><span class="cx">         if (exec-&gt;hadException())
</span><span class="cx">             return false;
</span><span class="cx"> 
</span><del>-        if (isNeutered()) {
-            throwTypeError(exec, typedArrayBufferHasBeenDetachedErrorMessage);
-            return false;
-        }
-
</del><span class="cx">         if (i &gt;= m_length)
</span><span class="cx">             return false;
</span><span class="cx"> 
</span><span class="lines">@@ -188,6 +180,22 @@
</span><span class="cx"> 
</span><span class="cx">     static bool toAdaptorNativeFromValue(ExecState* exec, JSValue jsValue, ElementType&amp; result) { return toNativeFromValue&lt;Adaptor&gt;(exec, jsValue, result); }
</span><span class="cx"> 
</span><ins>+    bool setRangeToValue(ExecState* exec, unsigned start, unsigned end, JSValue jsValue)
+    {
+        ASSERT(0 &lt;= start &amp;&amp; start &lt;= end &amp;&amp; end &lt;= m_length);
+
+        typename Adaptor::Type value = toNativeFromValue&lt;Adaptor&gt;(exec, jsValue);
+        if (exec-&gt;hadException())
+            return false;
+
+        // We might want to do something faster here (e.g. SIMD) if this is too slow.
+        typename Adaptor::Type* array = typedVector();
+        for (unsigned i = start; i &lt; end; ++i)
+            array[i] = value;
+
+        return true;
+    }
+
</ins><span class="cx">     void sort()
</span><span class="cx">     {
</span><span class="cx">         switch (Adaptor::typeValue) {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSGenericTypedArrayViewInlinesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewInlines.h (203199 => 203200)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewInlines.h        2016-07-13 23:38:44 UTC (rev 203199)
+++ trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewInlines.h        2016-07-13 23:54:23 UTC (rev 203200)
</span><span class="lines">@@ -37,6 +37,8 @@
</span><span class="cx"> 
</span><span class="cx"> namespace JSC {
</span><span class="cx"> 
</span><ins>+static const char* typedArrayBufferHasBeenDetachedErrorMessage = &quot;Underlying ArrayBuffer has been detached from the view&quot;;
+
</ins><span class="cx"> template&lt;typename Adaptor&gt;
</span><span class="cx"> JSGenericTypedArrayView&lt;Adaptor&gt;::JSGenericTypedArrayView(
</span><span class="cx">     VM&amp; vm, ConstructionContext&amp; context)
</span><span class="lines">@@ -323,6 +325,9 @@
</span><span class="cx"> {
</span><span class="cx">     JSGenericTypedArrayView* thisObject = jsCast&lt;JSGenericTypedArrayView*&gt;(cell);
</span><span class="cx"> 
</span><ins>+    if (thisObject-&gt;isNeutered())
+        return reject(exec, true, typedArrayBufferHasBeenDetachedErrorMessage);
+
</ins><span class="cx">     // https://tc39.github.io/ecma262/#sec-integer-indexed-exotic-objects-set-p-v-receiver
</span><span class="cx">     // Ignore the receiver even if the receiver is altered to non base value.
</span><span class="cx">     // 9.4.5.5-2-b-i Return ? IntegerIndexedElementSet(O, numericIndex, V).
</span><span class="lines">@@ -403,6 +408,9 @@
</span><span class="cx"> {
</span><span class="cx">     JSGenericTypedArrayView* thisObject = jsCast&lt;JSGenericTypedArrayView*&gt;(cell);
</span><span class="cx"> 
</span><ins>+    if (thisObject-&gt;isNeutered())
+        return reject(exec, true, typedArrayBufferHasBeenDetachedErrorMessage);
+
</ins><span class="cx">     if (propertyName &gt; MAX_ARRAY_INDEX) {
</span><span class="cx">         PutPropertySlot slot(JSValue(thisObject), shouldThrow);
</span><span class="cx">         return thisObject-&gt;methodTable()-&gt;put(thisObject, exec, Identifier::from(exec, propertyName), value, slot);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSGenericTypedArrayViewPrototypeFunctionsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewPrototypeFunctions.h (203199 => 203200)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewPrototypeFunctions.h        2016-07-13 23:38:44 UTC (rev 203199)
+++ trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewPrototypeFunctions.h        2016-07-13 23:54:23 UTC (rev 203200)
</span><span class="lines">@@ -169,6 +169,39 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> template&lt;typename ViewClass&gt;
</span><ins>+EncodedJSValue JSC_HOST_CALL genericTypedArrayViewProtoFuncFill(ExecState* exec)
+{
+    // 22.2.3.8
+    VM&amp; vm = exec-&gt;vm();
+    ViewClass* thisObject = jsCast&lt;ViewClass*&gt;(exec-&gt;thisValue());
+    if (thisObject-&gt;isNeutered())
+        return throwVMTypeError(exec, typedArrayBufferHasBeenDetachedErrorMessage);
+
+    JSValue valueToInsert = exec-&gt;argument(0);
+    if (exec-&gt;hadException())
+        return JSValue::encode(jsUndefined());
+
+    unsigned length = thisObject-&gt;length();
+    unsigned begin = argumentClampedIndexFromStartOrEnd(exec, 1, length);
+    if (vm.exception())
+        return encodedJSValue();
+    unsigned end = argumentClampedIndexFromStartOrEnd(exec, 2, length, length);
+    if (vm.exception())
+        return encodedJSValue();
+
+    if (thisObject-&gt;isNeutered())
+        return throwVMTypeError(exec, typedArrayBufferHasBeenDetachedErrorMessage);
+
+    if (end &lt; begin)
+        return JSValue::encode(exec-&gt;thisValue());
+
+    if (!thisObject-&gt;setRangeToValue(exec, begin, end, valueToInsert))
+        return JSValue::encode(jsUndefined());
+
+    return JSValue::encode(exec-&gt;thisValue());
+}
+
+template&lt;typename ViewClass&gt;
</ins><span class="cx"> EncodedJSValue JSC_HOST_CALL genericTypedArrayViewProtoFuncIncludes(ExecState* exec)
</span><span class="cx"> {
</span><span class="cx">     ViewClass* thisObject = jsCast&lt;ViewClass*&gt;(exec-&gt;thisValue());
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSTypedArrayViewPrototypecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSTypedArrayViewPrototype.cpp (203199 => 203200)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSTypedArrayViewPrototype.cpp        2016-07-13 23:38:44 UTC (rev 203199)
+++ trunk/Source/JavaScriptCore/runtime/JSTypedArrayViewPrototype.cpp        2016-07-13 23:54:23 UTC (rev 203200)
</span><span class="lines">@@ -114,6 +114,14 @@
</span><span class="cx">     CALL_GENERIC_TYPEDARRAY_PROTOTYPE_FUNCTION(genericTypedArrayViewProtoFuncCopyWithin);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static EncodedJSValue JSC_HOST_CALL typedArrayViewProtoFuncFill(ExecState* exec)
+{
+    JSValue thisValue = exec-&gt;thisValue();
+    if (!thisValue.isObject())
+        return throwVMTypeError(exec, ASCIILiteral(&quot;Receiver should be a typed array view but was not an object&quot;));
+    CALL_GENERIC_TYPEDARRAY_PROTOTYPE_FUNCTION(genericTypedArrayViewProtoFuncFill);
+}
+
</ins><span class="cx"> static EncodedJSValue JSC_HOST_CALL typedArrayViewProtoFuncIncludes(ExecState* exec)
</span><span class="cx"> {
</span><span class="cx">     JSValue thisValue = exec-&gt;thisValue();
</span><span class="lines">@@ -259,12 +267,8 @@
</span><span class="cx">     JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(&quot;filter&quot;, typedArrayPrototypeFilterCodeGenerator, DontEnum);
</span><span class="cx">     JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(&quot;sort&quot;, typedArrayPrototypeSortCodeGenerator, DontEnum);
</span><span class="cx">     JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames-&gt;builtinNames().entriesPublicName(), typedArrayPrototypeEntriesCodeGenerator, DontEnum);
</span><del>-&lt;&lt;&lt;&lt;&lt;&lt;&lt; 89717806169cc89a6e2a731666fb44bd8845272e
</del><span class="cx">     JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION(&quot;fill&quot;, typedArrayViewProtoFuncFill, DontEnum, 1);
</span><span class="cx">     JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION(&quot;includes&quot;, typedArrayViewProtoFuncIncludes, DontEnum, 1);
</span><del>-=======
-    JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(&quot;fill&quot;, typedArrayPrototypeFillCodeGenerator, DontEnum);
-&gt;&gt;&gt;&gt;&gt;&gt;&gt; Crashes with detached ArrayBuffers
</del><span class="cx">     JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(&quot;find&quot;, typedArrayPrototypeFindCodeGenerator, DontEnum);
</span><span class="cx">     JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(&quot;findIndex&quot;, typedArrayPrototypeFindIndexCodeGenerator, DontEnum);
</span><span class="cx">     JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames-&gt;forEach, typedArrayPrototypeForEachCodeGenerator, DontEnum);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstresstypedarrayfilljs"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/tests/stress/typedarray-fill.js (203199 => 203200)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/typedarray-fill.js        2016-07-13 23:38:44 UTC (rev 203199)
+++ trunk/Source/JavaScriptCore/tests/stress/typedarray-fill.js        2016-07-13 23:54:23 UTC (rev 203200)
</span><span class="lines">@@ -32,18 +32,4 @@
</span><span class="cx"> shouldBeTrue(&quot;testPrototypeFunction('fill', '(4, NaN, 5)', [14, 15, 10, 13, 44], [4, 4, 4, 4, 4])&quot;);
</span><span class="cx"> shouldBeTrue(&quot;testPrototypeFunction('fill', '(4, -3, -2)', [14, 15, 10, 13, 44], [14, 15, 4, 13, 44])&quot;);
</span><span class="cx"> shouldBeTrue(&quot;testPrototypeFunction('fill', '(4, 5, 5)', [14, 15, 10, 13, 44], [14, 15, 10, 13, 44])&quot;);
</span><del>-
-debug(&quot;4.0 Coercion Testing&quot;);
-for (constructor of typedArrays) {
-    count = 0;
-    let p = new Proxy({}, { get(target, name) {
-        count++;
-        return target[name];
-    }});
-    new constructor(10).fill(p);
-    shouldBeTrue(&quot;count === 40&quot;);
-}
-
-
-
</del><span class="cx"> finishJSTest();
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstresstypedarrayfunctionswithneuteredjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/tests/stress/typedarray-functions-with-neutered.js (203199 => 203200)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/typedarray-functions-with-neutered.js        2016-07-13 23:38:44 UTC (rev 203199)
+++ trunk/Source/JavaScriptCore/tests/stress/typedarray-functions-with-neutered.js        2016-07-13 23:54:23 UTC (rev 203200)
</span><span class="lines">@@ -77,7 +77,7 @@
</span><span class="cx"> prototypeFunctions = [
</span><span class="cx">     { func:proto.copyWithin, args:[&quot;prim&quot;, &quot;prim&quot;, &quot;prim&quot;] },
</span><span class="cx">     { func:proto.every, args:[&quot;func&quot;] },
</span><del>-    { func:proto.fill, args:[&quot;prim&quot;, &quot;prim&quot;, &quot;prim&quot;] },
</del><ins>+    { func:proto.fill, args:[&quot;ins&quot;, &quot;prim&quot;, &quot;prim&quot;] },
</ins><span class="cx">     { func:proto.filter, args:[&quot;func&quot;] },
</span><span class="cx">     { func:proto.find, args:[&quot;func&quot;] },
</span><span class="cx">     { func:proto.findIndex, args:[&quot;func&quot;] },
</span><span class="lines">@@ -95,14 +95,12 @@
</span><span class="cx">     { func:proto.subarray, args:[&quot;prim&quot;, &quot;prim&quot;] },
</span><span class="cx"> ];
</span><span class="cx"> 
</span><del>-function defaultForArg(arg, argNum)
</del><ins>+function defaultForArg(arg)
</ins><span class="cx"> {
</span><span class="cx">     if (arg === &quot;func&quot;)
</span><del>-        return () =&gt; { return argNum; }
-    if (arg === &quot;array&quot;)
-        return [1,2];
</del><ins>+        return () =&gt; { return 1; }
</ins><span class="cx"> 
</span><del>-    return argNum;
</del><ins>+    return 1;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function callWithArgs(func, array, args) {
</span><span class="lines">@@ -129,40 +127,34 @@
</span><span class="cx">         if (arg === &quot;na&quot;)
</span><span class="cx">             continue;
</span><span class="cx"> 
</span><del>-        let array = new constructor(10);
</del><ins>+        let len = 10;
</ins><span class="cx">         if (arg === &quot;func&quot;) {
</span><ins>+            let array = new constructor(len);
</ins><span class="cx">             callArgs[argNum] = () =&gt; {
</span><span class="cx">                 transferArrayBuffer(array.buffer);
</span><span class="cx">                 return func === array.every ? 1 : 0;
</span><span class="cx">             };
</span><span class="cx">             callWithArgs(func, array, callArgs);
</span><del>-        } else if (arg === &quot;prim&quot;) {
</del><ins>+        }
+
+        if (arg === &quot;prim&quot;) {
+            let array = new constructor(len)
</ins><span class="cx">             callArgs[argNum] = { [Symbol.toPrimitive]() {
</span><span class="cx">                 transferArrayBuffer(array.buffer);
</span><del>-                return argNum;
-            } };
-            callWithArgs(func, array, callArgs);
-        } else if (arg === &quot;array&quot;) {
-            callArgs[argNum] = new Array(4);
-            callArgs[argNum].fill(2);
-            let desc = { get: () =&gt; {
-                transferArrayBuffer(array.buffer);
</del><span class="cx">                 return 1;
</span><span class="cx">             } };
</span><del>-            Object.defineProperty(callArgs[argNum], 1, desc);
</del><span class="cx">             callWithArgs(func, array, callArgs);
</span><del>-        } else
-            throw new Error(arg);
</del><ins>+        }
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function checkArguments({func, args}) {
</span><span class="cx">     for (constructor of typedArrays)
</span><del>-        checkArgumentsForType(func, args, constructor);
</del><ins>+        checkArgumentsForType(func, args, constructor)
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-function test2() {
</del><ins>+function test() {
</ins><span class="cx">     prototypeFunctions.forEach(checkArguments);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-test2();
</del><ins>+test();
</ins></span></pre>
</div>
</div>

</body>
</html>