Bug 19718 - Named anonymous functions are slow accessing global variables
Summary: Named anonymous functions are slow accessing global variables
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-06-22 18:58 PDT by Timothy Hatcher
Modified: 2008-07-25 20:53 PDT (History)
0 users

See Also:


Attachments
Testcase (393 bytes, text/html)
2008-06-22 18:59 PDT, Timothy Hatcher
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Timothy Hatcher 2008-06-22 18:58:55 PDT
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.
Comment 1 Timothy Hatcher 2008-06-22 18:59:28 PDT
Created attachment 21876 [details]
Testcase
Comment 2 Geoffrey Garen 2008-06-23 12:49:51 PDT
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's name. 

We can / should improve this situation, but that's how things are implemented today (and how they've always been implemented).
Comment 3 Timothy Hatcher 2008-06-23 13:16:54 PDT
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't exist in Safari 3.1.
Comment 4 Oliver Hunt 2008-07-25 20:53:50 PDT
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