<?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>166989</bug_id>
          
          <creation_ts>2017-01-12 14:54:56 -0800</creation_ts>
          <short_desc>We could probably remove the write barrier at the end Structure::flattenDictionaryStructure</short_desc>
          <delta_ts>2018-06-19 17:43:15 -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>RESOLVED</bug_status>
          <resolution>INVALID</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>
          <dependson>166960</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Saam Barati">saam</reporter>
          <assigned_to name="Saam Barati">saam</assigned_to>
          <cc>benjamin</cc>
    
    <cc>fpizlo</cc>
    
    <cc>ggaren</cc>
    
    <cc>gskachkov</cc>
    
    <cc>jfbastien</cc>
    
    <cc>keith_miller</cc>
    
    <cc>mark.lam</cc>
    
    <cc>msaboff</cc>
    
    <cc>oliver</cc>
    
    <cc>ticaiolima</cc>
    
    <cc>ysuzuki</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1266305</commentid>
    <comment_count>0</comment_count>
    <who name="Saam Barati">saam</who>
    <bug_when>2017-01-12 14:54:56 -0800</bug_when>
    <thetext>After https://bugs.webkit.org/show_bug.cgi?id=166960, we&apos;ll have a way that rescans after races are detected.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1434657</commentid>
    <comment_count>1</comment_count>
    <who name="Saam Barati">saam</who>
    <bug_when>2018-06-19 17:39:23 -0700</bug_when>
    <thetext>I actually think this is necessary, imagine you&apos;re in the middle of flatten, and you have a butterfly that contains 3 valid properties, and a bunch of empty space, like this:
{a, ..., b, ..., c, ...}

and we want to end up with our property storage looking like this while in the middle of this loop:
```
        // Copies in our values to their compacted locations.
        for (unsigned i = 0; i &lt; propertyCount; i++)
            object-&gt;putDirect(vm, offsetForPropertyNumber(i, m_inlineCapacity), values[i]);
```
{..., a, ..., a, c}

And imagine if we scanned the property storage at that point, we&apos;d end not scanning for &quot;b&quot;. Therefore, I think this barrier is indeed needed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1434658</commentid>
    <comment_count>2</comment_count>
    <who name="Saam Barati">saam</who>
    <bug_when>2018-06-19 17:43:08 -0700</bug_when>
    <thetext>(In reply to Saam Barati from comment #1)
&gt; I actually think this is necessary, imagine you&apos;re in the middle of flatten,
&gt; and you have a butterfly that contains 3 valid properties, and a bunch of
&gt; empty space, like this:
&gt; {a, ..., b, ..., c, ...}
&gt; 
&gt; and we want to end up with our property storage looking like this while in
&gt; the middle of this loop:
&gt; ```
&gt;         // Copies in our values to their compacted locations.
&gt;         for (unsigned i = 0; i &lt; propertyCount; i++)
&gt;             object-&gt;putDirect(vm, offsetForPropertyNumber(i,
&gt; m_inlineCapacity), values[i]);
&gt; ```
&gt; {..., a, ..., a, c}
&gt; 
&gt; And imagine if we scanned the property storage at that point, we&apos;d end not
&gt; scanning for &quot;b&quot;. Therefore, I think this barrier is indeed needed.

The reason we may not detect this as a race is like so:

Imagine the collector did this:
ReadStructureEarly
ReadLastOffsetEarly
ReadButterfly
ReadStructureLate
ReadLastOffsetLate
then, the mutator does
flattenDictionaryStructure
mutator gets into the middle of the above loop
collector scans property storage

We won&apos;t detect a race here, but we need to rescan.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>