RESOLVED FIXED 107312
Weak GC maps should be easier to use
https://bugs.webkit.org/show_bug.cgi?id=107312
Summary Weak GC maps should be easier to use
Geoffrey Garen
Reported 2013-01-18 12:30:34 PST
Weak GC maps should be easier to use
Attachments
Patch (20.12 KB, patch)
2013-01-18 12:38 PST, Geoffrey Garen
no flags
For some reason "using" doesn't work on linuxes. Replace it with "typedef". (1.44 KB, patch)
2013-01-18 13:40 PST, Viatcheslav Ostapenko
no flags
Patch (2.46 KB, patch)
2013-01-20 16:57 PST, Geoffrey Garen
sam: review+
Geoffrey Garen
Comment 1 2013-01-18 12:38:28 PST
Geoffrey Garen
Comment 2 2013-01-18 12:38:46 PST
Comment on attachment 183530 [details] Patch Sam Weinig reviewed this.
Geoffrey Garen
Comment 3 2013-01-18 12:39:30 PST
Jer Noble
Comment 4 2013-01-18 13:30:52 PST
Viatcheslav Ostapenko
Comment 5 2013-01-18 13:40:35 PST
Created attachment 183537 [details] For some reason "using" doesn't work on linuxes. Replace it with "typedef".
Viatcheslav Ostapenko
Comment 6 2013-01-18 13:41:36 PST
Reopened because of build break.
Ryosuke Niwa
Comment 7 2013-01-18 14:33:03 PST
Comment on attachment 183537 [details] For some reason "using" doesn't work on linuxes. Replace it with "typedef". rs=me.
Ryosuke Niwa
Comment 8 2013-01-18 15:07:05 PST
Csaba Osztrogonác
Comment 9 2013-01-18 15:34:29 PST
You could have avoided 2.5 hours and 20 commit long build breakage , if you waited more than 18 seconds for the EWS bots ...
Geoffrey Garen
Comment 10 2013-01-20 16:57:56 PST
Reopening to attach new patch.
Geoffrey Garen
Comment 11 2013-01-20 16:57:59 PST
Geoffrey Garen
Comment 12 2013-01-20 17:01:04 PST
Darin Adler
Comment 13 2013-01-21 10:11:01 PST
Comment on attachment 183692 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=183692&action=review > Source/JavaScriptCore/runtime/WeakGCMap.h:73 > AddResult add(const KeyType& key, MappedPassInType value) > { > gcMapIfNeeded(); > - AddResult addResult = Base::add(key, value); > - if (!addResult.isNewEntry && !addResult.iterator->value) { // Found a zombie value. > + AddResult addResult = Base::add(key, nullptr); > + if (!addResult.iterator->value) { // New value or found a zombie value. > addResult.isNewEntry = true; > addResult.iterator->value = value; > } To me this function looks like HashMap::set. Three questions: 1) Why is it right to name the operation add rather than set? 2) Why doesn’t this call Base::set rather than Base::add? 3) Does HashMap::set have the same bug that you fixed here? If not, why not?
Geoffrey Garen
Comment 14 2013-01-30 12:11:09 PST
> 3) Does HashMap::set have the same bug that you fixed here? If not, why not? I wouldn't call this a bug in HashMap -- it's just a unique feature of weak values. The key new feature in WeakGCMap, which isn't appropriate for HashSet, is that values can magically become null, and a null value is treated "as if" there were no such entry in the table. Perhaps HashMap could be extended to support this feature naturally through an additional value trait. Then we could remove WeakGCMap entirely. I'm not sure if that would be appropriate or not. > 1) Why is it right to name the operation add rather than set? If there is a non-null value in the table, this function will not overwrite the value. > 2) Why doesn’t this call Base::set rather than Base::add? Same reason.
Note You need to log in before you can comment on or make changes to this bug.