Bug 147268 - Avoid 2 times name iteration in Object.assign
Summary: Avoid 2 times name iteration in Object.assign
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Yusuke Suzuki
URL:
Keywords:
Depends on: 146137
Blocks:
  Show dependency treegraph
 
Reported: 2015-07-24 11:12 PDT by Yusuke Suzuki
Modified: 2015-07-24 14:46 PDT (History)
6 users (show)

See Also:


Attachments
Patch (11.96 KB, patch)
2015-07-24 13:00 PDT, Yusuke Suzuki
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.