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

Description Yusuke Suzuki 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.
Comment 1 Yusuke Suzuki 2015-07-24 13:00:44 PDT
Created attachment 257471 [details]
Patch
Comment 2 Geoffrey Garen 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.
Comment 3 Yusuke Suzuki 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.
Comment 4 WebKit Commit Bot 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>
Comment 5 WebKit Commit Bot 2015-07-24 14:46:47 PDT
All reviewed patches have been landed.  Closing bug.