<?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>19718</bug_id>
          
          <creation_ts>2008-06-22 18:58:55 -0700</creation_ts>
          <short_desc>Named anonymous functions are slow accessing global variables</short_desc>
          <delta_ts>2008-07-25 20:53: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>All</rep_platform>
          <op_sys>All</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="Timothy Hatcher">timothy</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>84104</commentid>
    <comment_count>0</comment_count>
    <who name="Timothy Hatcher">timothy</who>
    <bug_when>2008-06-22 18:58:55 -0700</bug_when>
    <thetext>A named anonymous function that accesses a global or closure scope variable is slower than a non-named anonymous function. See the attached test case. This is a regression since SquirrelFish.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84105</commentid>
    <comment_count>1</comment_count>
      <attachid>21876</attachid>
    <who name="Timothy Hatcher">timothy</who>
    <bug_when>2008-06-22 18:59:28 -0700</bug_when>
    <thetext>Created attachment 21876
Testcase</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84174</commentid>
    <comment_count>2</comment_count>
    <who name="Geoffrey Garen">ggaren</who>
    <bug_when>2008-06-23 12:49:51 -0700</bug_when>
    <thetext>Can you give more data on the SquirrelFish regression:

* Is access to a global from a named anonymous function slower in SF than it was before SF?

* How big (%) is the regression?

The cause of the relative slowness is that, according to the spec, a named anonymous function should have a vanilla (i.e. unoptimized) object inserted into its scope chain, with one property: the function&apos;s name. 

We can / should improve this situation, but that&apos;s how things are implemented today (and how they&apos;ve always been implemented).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84178</commentid>
    <comment_count>3</comment_count>
    <who name="Timothy Hatcher">timothy</who>
    <bug_when>2008-06-23 13:16:54 -0700</bug_when>
    <thetext>It is not a regression, since SquirrelFish is faster than Safari 3.1. But there is now a difference in speed between named anonymous functions and non-named anonymous function that didn&apos;t exist in Safari 3.1.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>86991</commentid>
    <comment_count>4</comment_count>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2008-07-25 20:53:50 -0700</bug_when>
    <thetext>Committing to http://svn.webkit.org/repository/webkit/trunk ...
	M	JavaScriptCore/ChangeLog
	M	JavaScriptCore/GNUmakefile.am
	M	JavaScriptCore/JavaScriptCore.pri
	M	JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj
	M	JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
	M	JavaScriptCore/VM/CodeGenerator.cpp
	M	JavaScriptCore/VM/CodeGenerator.h
	M	JavaScriptCore/kjs/AllInOneFile.cpp
	A	JavaScriptCore/kjs/JSStaticScopeObject.cpp
	A	JavaScriptCore/kjs/JSStaticScopeObject.h
	M	JavaScriptCore/kjs/nodes.cpp
	M	LayoutTests/ChangeLog
	M	LayoutTests/fast/js/const-expected.txt
	M	LayoutTests/fast/js/resources/const.js
Committed r35368

</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>21876</attachid>
            <date>2008-06-22 18:59:28 -0700</date>
            <delta_ts>2008-06-22 18:59:28 -0700</delta_ts>
            <desc>Testcase</desc>
            <filename>Test.html</filename>
            <type>text/html</type>
            <size>393</size>
            <attacher name="Timothy Hatcher">timothy</attacher>
            
              <data encoding="base64">PHNjcmlwdD4KCnZhciBqID0gMTsKCnZhciBnID0gZnVuY3Rpb24gaCgpIHsKCXZhciB0aW1lU3Rh
bXAgPSBuZXcgRGF0ZSgpOwoJZm9yICh2YXIgaSA9IDA7IGkgPCAxMDAwMDA7ICsraSkKCQlqKys7
CglhbGVydCgiZzogIiArIChuZXcgRGF0ZSgpIC0gdGltZVN0YW1wKSk7Cn0KCnZhciBnMSA9IGZ1
bmN0aW9uKCkgewoJdmFyIHRpbWVTdGFtcCA9IG5ldyBEYXRlKCk7Cglmb3IgKHZhciBpID0gMDsg
aSA8IDEwMDAwMDsgKytpKQoJCWorKzsKCWFsZXJ0KCJnMTogIiArIChuZXcgRGF0ZSgpIC0gdGlt
ZVN0YW1wKSk7Cn0KCmcoKTsKZzEoKTsKCjwvc2NyaXB0PgoKZygpIHNob3VsZCBiZSBhcyBmYXN0
IGFzIGcxKCkuIEJ1dCBnKCkgdXNlcyBhIG5hbWVkIGFub255bW91cyBmdW5jdGlvbi4K
</data>

          </attachment>
      

    </bug>

</bugzilla>