WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
157908
arrow function lexical environment should reuse the same environment as the function's lexical environment where possible
https://bugs.webkit.org/show_bug.cgi?id=157908
Summary
arrow function lexical environment should reuse the same environment as the f...
Saam Barati
Reported
2016-05-19 12:11:10 PDT
I removed this recently, but it causes a 7x regression in Sunspider/tofte which caused 5% regression in JetStream. It's probably valuable to reuse the same environment when possible for functions that use eval and have simple parameter lists.
Attachments
patch
(4.63 KB, patch)
2016-05-19 12:24 PDT
,
Saam Barati
fpizlo
: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Saam Barati
Comment 1
2016-05-19 12:24:50 PDT
Created
attachment 279409
[details]
patch
Geoffrey Garen
Comment 2
2016-05-19 12:28:08 PDT
Sunspider/tofte uses arrow functions?
Saam Barati
Comment 3
2016-05-19 13:10:47 PDT
(In reply to
comment #2
)
> Sunspider/tofte uses arrow functions?
It uses eval. For example: function foo(x, y, z // Note: simple parameter list) { ... do some stuff eval(...) // Note must be direct eval ... do more stuff } My patch made such 'foo' functions slower.
Saam Barati
Comment 4
2016-05-19 13:10:58 PDT
landed in:
http://trac.webkit.org/changeset/201176
Saam Barati
Comment 5
2016-05-19 13:13:06 PDT
(In reply to
comment #3
)
> (In reply to
comment #2
) > > Sunspider/tofte uses arrow functions? > > It uses eval. > For example: > function foo(x, y, z // Note: simple parameter list) { > ... do some stuff > eval(...) // Note must be direct eval > ... do more stuff > } > > My patch made such 'foo' functions slower.
To elaborate more, because we don't know what the eval will do, the eval may use arrow functions. So any function with a direct eval uses arrow functions. My previous patch made us always allocate a new environment for an arrow function's 'this', new.target, etc. But, this patch makes it so that we reuse the already created activation when doing so is sound. It's sound to do this when the function 'foo' has a simple parameter list. It's not sound to do this if it doesn't have a simple parameter list, i.e: function foo({a = ()=>this}) { ... eval(...) ... }
Chris Dumez
Comment 6
2016-05-20 08:44:04 PDT
(In reply to
comment #4
)
> landed in: >
http://trac.webkit.org/changeset/201176
Confirmed 5% JetStream progression from this change on iOS.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug