<?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>172005</bug_id>
          
          <creation_ts>2017-05-11 18:08:48 -0700</creation_ts>
          <short_desc>This crashes object rest parameter</short_desc>
          <delta_ts>2017-05-16 10:50:13 -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>DUPLICATE</resolution>
          <dup_id>172147</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Saam Barati">saam</reporter>
          <assigned_to name="Mark Lam">mark.lam</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>webkit-bug-importer</cc>
    
    <cc>ysuzuki</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1307652</commentid>
    <comment_count>0</comment_count>
    <who name="Saam Barati">saam</who>
    <bug_when>2017-05-11 18:08:48 -0700</bug_when>
    <thetext>&gt;&gt;&gt; let a = &quot;foo&quot;;
undefined
&gt;&gt;&gt; let {[a]:b, ...rest} = {foo:20, baz:40}
Segmentation fault: 11</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1307653</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2017-05-11 18:09:16 -0700</bug_when>
    <thetext>&lt;rdar://problem/32147443&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1307917</commentid>
    <comment_count>2</comment_count>
    <who name="Caio Lima">ticaiolima</who>
    <bug_when>2017-05-12 10:18:09 -0700</bug_when>
    <thetext>If it&apos;s ok to you, I can look this bug tonight.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1307921</commentid>
    <comment_count>3</comment_count>
    <who name="Mark Lam">mark.lam</who>
    <bug_when>2017-05-12 10:23:55 -0700</bug_when>
    <thetext>(In reply to Caio Lima from comment #2)
&gt; If it&apos;s ok to you, I can look this bug tonight.

Hi Caio, I&apos;m already looking into this.  But feel free to look and contribute if you like.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1308256</commentid>
    <comment_count>4</comment_count>
    <who name="Caio Lima">ticaiolima</who>
    <bug_when>2017-05-12 20:47:52 -0700</bug_when>
    <thetext>(In reply to Mark Lam from comment #3)
&gt; (In reply to Caio Lima from comment #2)
&gt; &gt; If it&apos;s ok to you, I can look this bug tonight.
&gt; 
&gt; Hi Caio, I&apos;m already looking into this.  But feel free to look and
&gt; contribute if you like.

I just looked at it and figured out the problem. I changed ObjectPatternNode::bindValue to add target.propertyName into excluded set and this code consider&apos;s that always we have a propertyName, which isn&apos;t true and I didn&apos;t think in this edge case.

FYI, the excludedSet in https://github.com/caiolima/webkit/blob/master/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp#L4070 is used to collect statically the identifiers that should be excluded from the rest destructuring. We then use this set to create a JSSet in constant pool at link time in https://github.com/caiolima/webkit/blob/master/Source/JavaScriptCore/bytecode/CodeBlock.cpp#L870

This approach isn&apos;t valid for this case because the property will just be evaluated in runtime and we can&apos;t populate excludedSet in compile time here. Does it make sense?

One solution I have in mind to handle this specific case is to emit code to populate the identifier/value into excludedSet dynamically, like the first patch version of https://bugs.webkit.org/show_bug.cgi?id=167962</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1309184</commentid>
    <comment_count>5</comment_count>
    <who name="Mark Lam">mark.lam</who>
    <bug_when>2017-05-16 10:50:13 -0700</bug_when>
    <thetext>The offending patch came from r213697 due to https://bugs.webkit.org/show_bug.cgi?id=167962,

... and was rolled out in r216891: &lt;http://trac.webkit.org/r216891&gt; due to https://bugs.webkit.org/show_bug.cgi?id=172147.

Hence, this specific issue is no more.  Let&apos;s fix the rest destructuring implementation in https://bugs.webkit.org/show_bug.cgi?id=167962.  Closing this one as a dupe of 172147.

*** This bug has been marked as a duplicate of bug 172147 ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>