Bug 147268

Summary: Avoid 2 times name iteration in Object.assign
Product: WebKit Reporter: Yusuke Suzuki <ysuzuki>
Component: JavaScriptCoreAssignee: Yusuke Suzuki <ysuzuki>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, darin, fpizlo, ggaren, mark.lam, oliver
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 146137    
Bug Blocks:    
Attachments:
Description Flags
Patch none

Yusuke Suzuki
Reported 2015-07-24 11:12:23 PDT
Object.assign calls Object.getOwnPropertyNames & Object.getOwnPropertySymbols to collect all the names. But exposing the private API that collects both at the same time makes the API efficient when the given Object has so many non-indexed properties. Since Object.assign is so generic API (some form of utility API), the form of the given Object is not expected. This is why I think this optimization is required.
Attachments
Patch (11.96 KB, patch)
2015-07-24 13:00 PDT, Yusuke Suzuki
no flags
Yusuke Suzuki
Comment 1 2015-07-24 13:00:44 PDT
Geoffrey Garen
Comment 2 2015-07-24 13:10:21 PDT
Comment on attachment 257471 [details] Patch r=me It seems like we might want to add caching for these property name lists. We have caching for enumerable property names, but not for these other varieties.
Yusuke Suzuki
Comment 3 2015-07-24 13:57:29 PDT
Comment on attachment 257471 [details] Patch Thank you for your review. Your thought is right. (And actually, many `// FIXME: Use the enumeration cache.` exist in ObjectConstructor.cpp) We need to extend the existing caching system to use it in these enumeration APIs.
WebKit Commit Bot
Comment 4 2015-07-24 14:46:43 PDT
Comment on attachment 257471 [details] Patch Clearing flags on attachment: 257471 Committed r187363: <http://trac.webkit.org/changeset/187363>
WebKit Commit Bot
Comment 5 2015-07-24 14:46:47 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.