Bug 151453

Summary: Caching of properties on objects that have named property getters is sometimes incorrect
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: BindingsAssignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: barraclough, cgarcia, commit-queue, ggaren, keith_miller, mark.lam, msaboff, saam, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=153599
Attachments:
Description Flags
WIP (Not working yet)
none
WIP (Not working yet)
none
Patch
none
Patch none

Description Chris Dumez 2015-11-19 11:54:36 PST
Caching of properties on objects that have named property getters is sometimes incorrect.
Comment 1 Chris Dumez 2015-11-19 11:54:54 PST
rdar://problem/23049343
Comment 2 Chris Dumez 2015-11-19 11:56:11 PST
Created attachment 265878 [details]
WIP (Not working yet)
Comment 3 Chris Dumez 2015-11-19 11:58:14 PST
Created attachment 265879 [details]
WIP (Not working yet)
Comment 4 Chris Dumez 2015-11-19 13:57:20 PST
Created attachment 265898 [details]
Patch
Comment 5 Gavin Barraclough 2015-11-20 10:41:33 PST
Comment on attachment 265898 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=265898&action=review

> Source/JavaScriptCore/runtime/JSTypeInfo.h:53
> +static const unsigned GetOwnPropertySlotIsImpureForPropertyAbsence = 1 << 13;

One suggestion:

GetOwnPropertySlotIsImpure implies GetOwnPropertySlotIsImpureForPropertyAbsence, but does not cause it to be set. A programmer could in error check GetOwnPropertySlotIsImpureForPropertyAbsence and think this would tell them whether property access is impure for absence – but this is not sufficient (they also need to check GetOwnPropertySlotIsImpure).

As such a better approach might be to have discrete flags – where one is not a subset of another – GetOwnPropertySlotIsImpureForPropertyAbsence and GetOwnPropertySlotIsImpureForPropertyPresence. You could define GetOwnPropertySlotIsImpure to set both (GetOwnPropertySlotIsImpureForPropertyAbsence | GetOwnPropertySlotIsImpureForPropertyPresence).

Classes wanting to adopt both behaviors could still use the GetOwnPropertySlotIsImpure name, but code wanting to check could safely either check …ForPropertyAbsence or …ForPropertyPresence.

> LayoutTests/fast/dom/NamedNodeMap-named-getter-caching.html:16
> +        lastIterationHasRightValue = true;

This loop now only detects a bad value on the last iteration, no longer checks values on the first 999 interactions are as expected too. Please fix.
Comment 6 Chris Dumez 2015-11-20 11:59:04 PST
Created attachment 265977 [details]
Patch
Comment 7 WebKit Commit Bot 2015-11-20 12:45:18 PST
Comment on attachment 265977 [details]
Patch

Clearing flags on attachment: 265977

Committed r192693: <http://trac.webkit.org/changeset/192693>
Comment 8 WebKit Commit Bot 2015-11-20 12:45:22 PST
All reviewed patches have been landed.  Closing bug.