Not all calls to Heap::didAllocate() are done in operation Allocation state.
We need to do it in another way
Created attachment 148578 [details]
I know this is a bit ugly. Any suggestions about how to hack this neatly?
For example, can I add an argument to GCActivityCallback::didAllocate() indicating it is safe to trigger GC?
Attachment 148578 [details] did not pass style-queue:
Total errors found: 1 in 4 files
If any of these errors are false positives, please file a bug against check-webkit-style.
Created attachment 150786 [details]
Comment on attachment 150786 [details]
Why is this necessary?
(In reply to comment #4)
> (From update of attachment 150786 [details])
> Why is this necessary?
This is a follow-up of https://bugs.webkit.org/show_bug.cgi?id=89236.
The initial idea is use small heap size when system is under memory pressure. I ended up with putting platform-specific GC policy in GCActivityCallback. However I found it isn't safe to do GC in didAllocate. The only place it makes sense and is safe to collect garbage is reportExtraMemoryCost.
Any JSC folks want to review this?
This looks like a design flaw in bug 89236 more than anything else. We don't want to modify cross-platform logic to fix this, since we don't want the behavior in bug 89236 in the first place.