<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>202005</bug_id>
          
          <creation_ts>2019-09-19 14:11:56 -0700</creation_ts>
          <short_desc>Consider a 14-bit JSValue tag scheme with always materializing one of the 3 needed masks.</short_desc>
          <delta_ts>2019-09-19 14:12:02 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>JavaScriptCore</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>ASSIGNED</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Mark Lam">mark.lam</reporter>
          <assigned_to name="Mark Lam">mark.lam</assigned_to>
          
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1572477</commentid>
    <comment_count>0</comment_count>
    <who name="Mark Lam">mark.lam</who>
    <bug_when>2019-09-19 14:11:56 -0700</bug_when>
    <thetext>If we&apos;re willing to use 3 tag registers or always materialize one of them, we can also adopt a 14-bit tag as follows:

    Pointer {  0000:PPPP:PPPP:PPPP
             / 0002:****:****:****
    Double  {         ...
             \ FFFC:****:****:****
    Integer {  FFFF:0000:IIII:IIII

where we need to use 3 different masks to differentiate between cells, ints, and doubles:
    NumberMask is 0xfffc: any bits set in the top 14 bits is a number.
    IntMask is 0xffff: value is int if value &amp; IntMask == IntMask.
    NotCellMask is NumberMask | OtherTag.

Since the highest double is &quot;negative&quot; pureNaN i.e. starts with 0xfff8, adding a DoubleEncodeOffset of 1&lt;&lt;50 (starts with 0x0004) produces 0xfffc which is still less than 0xffff (the IntMask).

The downside of this scheme is that materializing a mask or burning a 3rd register on a mask, will have performance impact.  We can measure if this impact is significant.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>