<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 - Accesses that are polymorphic on base but all share the same slot base in some shared prototype should use a hash set of structures for resolution"
   href="https://bugs.webkit.org/show_bug.cgi?id=156391">156391</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Accesses that are polymorphic on base but all share the same slot base in some shared prototype should use a hash set of structures for resolution
          </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>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </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>JavaScriptCore
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>fpizlo&#64;apple.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>If we want to cache accesses to some prototype that doesn't need repatching when new base structures come along, then we would emit this code:

- Materialize a pointer to the prototype's hashtable for this property.
- Mask or shift the structure ID to produce a hash code (on 64 bit: mask since it's a densely allocated integer ID; on 32-bit: downshift since it's a pointer)
- Load a structure ID from the hashtable.
- Check if it's the one we wanted.  (Common case is that we stop here.)
- Bail if it's the deleted value sentinel.
- Increment and loop if it's not the empty value sentinel.
- If we find the structure ID in the hashtable, we produce the result value (either produce the constant or load from the prototype).

The fast path will thus involve one load-and-branch, plus some minor integer computation.

The way this will work is that it will be backed by a hashtable hanging off the prototype's property.  Anytime we try to cache an access to that property by way of a prototype chain, we check if the prototype chain is watchable.  If it is, we watch it and put the base structure into the hashtable.

Note that the code we generate inlines a pointer to the hashtable and the mask amount.  Thus, if we rehash, we trigger watchpoints on those StructureStubInfo's so that they can be regenerated.  Alternatively, we would let them regenerate if they ended up taking slow path.</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>