Handle bespokes in Map constructor
commit545d927885bfd9a1877cec3e6f954eaf0ee9bacc
authorShaunak Kishore <kshaunak@fb.com>
Fri, 5 Jun 2020 02:58:16 +0000 (4 19:58 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Fri, 5 Jun 2020 03:00:36 +0000 (4 20:00 -0700)
tree0820b983be60264670e2ac608db2bd89c0b0a3fd
parentda48d5dcf890c7e121b45394cf557ebddaf72811
Handle bespokes in Map constructor

Summary:
This constructor sensibly tries to take ownership of any dicts passed to it.

Now, it needs two rounds of escalation: first from an arbitrary array layout to a vanilla array, and second from an arbitrary array type to a dict. These paths are actually orthogonal; I chose to do vanilla first because the vanilla array-to-dict functions are decently-well optimized.

Since we can now create an intermediate array, we have multiple lifetimes to manager here. I used an Array object as a smart pointer for that.

Reviewed By: ricklavoie

Differential Revision: D21875755

fbshipit-source-id: 15d089cbbbbf484f41d9e8c9a34cb145a0418a80
hphp/runtime/ext/collections/ext_collections-map.cpp