Bug 151586

Summary: [ES6] Propagate `this` usage from Generator's scope to GeneratorFunction's scope to avoid unnecessary `to_this` call.
Product: WebKit Reporter: Yusuke Suzuki <ysuzuki>
Component: JavaScriptCoreAssignee: Yusuke Suzuki <ysuzuki>
Status: NEW    
Severity: Normal CC: caitp, mark.lam, webkit-bug-importer, ysuzuki
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Yusuke Suzuki
Reported 2015-11-24 02:00:45 PST
...
Attachments
Patch (22.48 KB, patch)
2017-06-25 08:36 PDT, Yusuke Suzuki
no flags
Caitlin Potter (:caitp)
Comment 1 2016-10-28 09:37:05 PDT
This issue also applies to async functions (https://bugs.webkit.org/show_bug.cgi?id=163760), which are implemented using the same "body as a separate function" approach. This is also really the same issue which affects always storing the home object on async arrow function bodies, fixing this bug should solve both problems. I'll point those issues to this
Yusuke Suzuki
Comment 2 2017-06-22 09:38:31 PDT
We should follow arrow function design... Set |this| in generator function's environment and load it from the environment. Basically, using |this| inside the generator is very rare... We can avoid loading/storing it in most cases.
Yusuke Suzuki
Comment 3 2017-06-25 08:36:46 PDT
Yusuke Suzuki
Comment 4 2017-06-25 08:40:09 PDT
This is WIP patch. We still need to change async functions part. While it improves generator performance in SixSpeed, it a bit causes regression in ARES-6 Basic. This is because ARES-6 Basic's generator touches |this|. And in this case, it allocates one more JS heap environment. So, to adopt this change, we should change the current generator implementation to the more efficient one. My idea is allocating one JS environment for storing |this|, arguments and yield storing values. This fixes above regression.
Radar WebKit Bug Importer
Comment 5 2023-08-14 18:40:46 PDT
Note You need to log in before you can comment on or make changes to this bug.