<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [Binding] Use unchekcedArgument if argumentCount is already checked"
   href="https://bugs.webkit.org/show_bug.cgi?id=162502">162502</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[Binding] Use unchekcedArgument if argumentCount is already checked
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>WebKit
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>WebKit Nightly Build
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Unspecified
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Unspecified
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>Normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P2
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Bindings
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>webkit-unassigned&#64;lists.webkit.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>utatane.tea&#64;gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>cdumez&#64;apple.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Looking the current binding code, we can find that argument(n) is used even after we checked the argument count and throw an error.

3794 EncodedJSValue JSC_HOST_CALL jsWebGLRenderingContextBasePrototypeFunctionUniform1f(ExecState* state)
3795 {
3796     VM&amp; vm = state-&gt;vm();
3797     auto throwScope = DECLARE_THROW_SCOPE(vm);
3798     UNUSED_PARAM(throwScope);
3799     JSValue thisValue = state-&gt;thisValue();
3800     auto castedThis = jsDynamicCast&lt;JSWebGLRenderingContextBase*&gt;(thisValue);
3801     if (UNLIKELY(!castedThis))
3802         return throwThisTypeError(*state, throwScope, &quot;WebGLRenderingContextBase&quot;, &quot;uniform1f&quot;);
3803     ASSERT_GC_OBJECT_INHERITS(castedThis, JSWebGLRenderingContextBase::info());
3804     auto&amp; impl = castedThis-&gt;wrapped();
3805     if (UNLIKELY(state-&gt;argumentCount() &lt; 2))
3806         return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
3807     ExceptionCode ec = 0;
3808     WebGLUniformLocation* location = nullptr;
3809     if (!state-&gt;argument(0).isUndefinedOrNull()) {
3810         location = JSWebGLUniformLocation::toWrapped(state-&gt;uncheckedArgument(0));
3811         if (UNLIKELY(!location))
3812             return throwArgumentTypeError(*state, throwScope, 0, &quot;location&quot;, &quot;WebGLRenderingContextBase&quot;, &quot;uniform1f&quot;, &quot;WebGLUniformLocation&quot;);
3813     }
3814     auto x = convert&lt;float&gt;(*state, state-&gt;argument(1), ShouldAllowNonFinite::Yes);
3815     if (UNLIKELY(throwScope.exception()))
3816         return JSValue::encode(jsUndefined());
3817     impl.uniform1f(WTFMove(location), WTFMove(x), ec);
3818     setDOMException(state, ec);
3819     return JSValue::encode(jsUndefined());
3820 }

In L3805, we emit the guard against less arguments case.
So after this check, we should access to arguments by using `uncheckedArgument` instead of `argument`. However, L3809 and L3814 use argument().
It introduces unnecessary extra branches.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>