<?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>132872</bug_id>
          
          <creation_ts>2014-05-13 10:30:03 -0700</creation_ts>
          <short_desc>Getter on prototype is called even though property is also defined on instance</short_desc>
          <delta_ts>2014-10-28 14:49:34 -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>Mac (Intel)</rep_platform>
          <op_sys>OS X 10.9</op_sys>
          <bug_status>NEW</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="Sebastian Noack">sebastian</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>barraclough</cc>
    
    <cc>fpizlo</cc>
    
    <cc>kildyt</cc>
    
    <cc>mhahnenberg</cc>
    
    <cc>oliver</cc>
    
    <cc>trev</cc>
    
    <cc>zan</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1008988</commentid>
    <comment_count>0</comment_count>
    <who name="Sebastian Noack">sebastian</who>
    <bug_when>2014-05-13 10:30:03 -0700</bug_when>
    <thetext>If you define a getter on the prototype and cache its value by defining a property with the same name on the instance, sometimes the getter is called a second time, when the property is accessed. This can be reproduced on Safari 7.0.3 with the attached HTML page. A &quot;TypeError: Attempting to change value of a readonly property&quot; is thrown when the getter is called the second time and calls Object.defineProperty() again. The expected behavior would be that the getter is executed only once per instance.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1008989</commentid>
    <comment_count>1</comment_count>
      <attachid>231392</attachid>
    <who name="Sebastian Noack">sebastian</who>
    <bug_when>2014-05-13 10:31:01 -0700</bug_when>
    <thetext>Created attachment 231392
test case</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1009027</commentid>
    <comment_count>2</comment_count>
    <who name="Wladimir Palant">trev</who>
    <bug_when>2014-05-13 11:40:41 -0700</bug_when>
    <thetext>Note that the issue only happens if there are at least 9 objects created (the testcase creates 1000 of them, just in case). It seems that the issue here is a wrong optimization when the JIT compiler processes method Class.bar() - it will call the getter on the prototype directly, without checking whether the same property exists on the object instance.

The issue is only reproducible in Safari, neither Firefox nor Chrome show this behavior.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1009042</commentid>
    <comment_count>3</comment_count>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2014-05-13 12:30:30 -0700</bug_when>
    <thetext>getter cache misoptimization?</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>231392</attachid>
            <date>2014-05-13 10:31:01 -0700</date>
            <delta_ts>2014-05-13 10:31:01 -0700</delta_ts>
            <desc>test case</desc>
            <filename>url.txt</filename>
            <type>text/plain</type>
            <size>82</size>
            <attacher name="Sebastian Noack">sebastian</attacher>
            
              <data encoding="base64">aHR0cHM6Ly9pc3N1ZXMuYWRibG9ja3BsdXMub3JnL3Jhdy1hdHRhY2htZW50L3RpY2tldC80MTkv
cHJvcGVydHlfcGVyc2lzdGFuY2UuaHRtbA==
</data>

          </attachment>
      

    </bug>

</bugzilla>