<?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>142943</bug_id>
          
          <creation_ts>2015-03-21 18:51:08 -0700</creation_ts>
          <short_desc>ES6: Computed Properties should always produce string/symbol keys never numeric indexes</short_desc>
          <delta_ts>2015-07-27 16:54:50 -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>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</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="Joseph Pecoraro">joepeck</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ggaren</cc>
    
    <cc>joepeck</cc>
    
    <cc>ysuzuki</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1079116</commentid>
    <comment_count>0</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2015-03-21 18:51:08 -0700</bug_when>
    <thetext>* SUMMARY
https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-initializer-runtime-semantics-evaluation

&gt; Runtime Semantics: Evaluation
&gt; 
&gt;     ComputedPropertyName : [ AssignmentExpression ]
&gt;         Let exprValue be the result of evaluating AssignmentExpression.
&gt;         Let propName be GetValue(exprValue).
&gt;         ReturnIfAbrupt(propName).
&gt;         Return ToPropertyKey(propName).
&gt; ---
&gt; 
&gt;     ToPropertyKey ( argument )
&gt; 
&gt;     The abstract operation ToPropertyKey converts argument to a value that can
&gt;     be used as a property key by performing the following steps:
&gt; 
&gt;         Let key be ToPrimitive(argument, hint String).
&gt;         ReturnIfAbrupt(key).
&gt;         If Type(key) is Symbol, then
&gt;             Return key.
&gt;         Return ToString(key).

* TEST (LayoutTests/js/script-tests/basic-computed-property-name.js)

  var a = 0;
  runTest(&quot;{[a]: true, get &apos;0&apos;(){ return false; }}[0])&quot;)

As written, this should actually be `false`, but currently it is `true`.

It seems we are treating the index key as an index instead of a string, and it goes down a different path.

* NOTES
- Firefox behaves correctly here
- Chrome does not currently have computed properties</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1079118</commentid>
    <comment_count>1</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2015-03-21 19:29:37 -0700</bug_when>
    <thetext>So it seems &quot;op_put_by_val_direct&quot; is used in lots of places:

  - computed properties (PropertyListNode::emitBytecode)
  - array literal with spread (ArrayNode::emitBytecode)
  - and any put by val used by built-ins

The implementation of the op code does special case integer indexes.

I&apos;m not sure we can reconcile the difference that only computed properties has with the generic put by value case.

It is worth keeping in mind that we will soon have computed getter/setter names, that will also have this same to string conversion of the property.

  - It seems wasteful to extend the existing opcode because it can be common
  - It seems wasteful to add a new op code just for this
    - but it would be easy (just call JSValue::toPropertyKey)

I don&apos;t see any existing opcodes that would do exactly what we want here without changes. The closest is op_to_index_string (assumes int property provided).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1112596</commentid>
    <comment_count>2</comment_count>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2015-07-27 16:54:50 -0700</bug_when>
    <thetext>This is now fixed by http://trac.webkit.org/changeset/187464!</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>