Closed Bug 1484349 Opened 6 years ago Closed 6 years ago

Optimize HasOwnProperty/GetProperty lookup for cloning

Categories

(Core :: JavaScript Engine, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla63
Tracking Status
firefox63 --- fixed

People

(Reporter: evilpie, Assigned: evilpie)

References

Details

Attachments

(2 files)

GetOwnPropertyPure should work most of the time, unless we have wrapped object.
Attachment #9002107 - Flags: review?(jdemooij)
I've actually written a similar patch like this a few times before, but now I finally have a good reason to land it. With this patch we only take the non-GetOwnPropertyPure fallback path for wrapped objects during browser startup.
Attachment #9002112 - Flags: review?(jdemooij)
Comment on attachment 9002107 [details] [diff] [review]
Optimize HasOwnProperty/GetProperty lookup for cloning. r?

Review of attachment 9002107 [details] [diff] [review]:
-----------------------------------------------------------------

::: js/src/vm/StructuredClone.cpp
@@ +1911,5 @@
>                  if (!startWrite(key))
>                      return false;
>              } else {
> +                // This relies on the way JSStructuredCloneWriter::traverseObject
> +                // converts JSIDs to Value.

Nit: no {} below.

We have to do this Value <-> jsid dance because of Map/Set/SavedFrame entries right? I think it would be nice to split "entries" in valueEntries (Vector of Values) and idEntries (Vector of jsids), or something. Or mapSetEntries/objectEntries. Then we can just use jsids everywhere for objects.
Attachment #9002107 - Flags: review?(jdemooij) → review+
Comment on attachment 9002112 [details] [diff] [review]
Support unboxed objects in GetPropertyPure

Review of attachment 9002112 [details] [diff] [review]:
-----------------------------------------------------------------

Nice
Attachment #9002112 - Flags: review?(jdemooij) → review+
(In reply to Jan de Mooij [:jandem] from comment #3)
> Comment on attachment 9002107 [details] [diff] [review]
> We have to do this Value <-> jsid dance because of Map/Set/SavedFrame
> entries right? I think it would be nice to split "entries" in valueEntries
> (Vector of Values) and idEntries (Vector of jsids), or something. Or
> mapSetEntries/objectEntries. Then we can just use jsids everywhere for
> objects.
Great idea.
Pushed by evilpies@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/d2195ec4e254
Optimize HasOwnProperty/GetProperty lookup for cloning. r=jandem
https://hg.mozilla.org/integration/mozilla-inbound/rev/8047901cef0e
Add unboxed object support GetProperyPure. r=jandem
https://hg.mozilla.org/mozilla-central/rev/d2195ec4e254
https://hg.mozilla.org/mozilla-central/rev/8047901cef0e
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: