Bug 95737

Summary: Extend the coverage of the Custom Allocation Framework in WTF and in JavaScriptCore
Product: WebKit Reporter: Zoltan Horvath <zoltan>
Component: JavaScriptCoreAssignee: Zoltan Horvath <zoltan>
Status: RESOLVED FIXED    
Severity: Normal CC: benjamin, darin, eric.carlson, eric, feature-media-reviews, ossy, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
proposed patch none

Zoltan Horvath
Reported 2012-09-04 05:06:49 PDT
Add WTF_MAKE_FAST_ALLOCATED macro to some class declarations in WTF and in JavaScriptCore because these are instantiated by 'new'.
Attachments
proposed patch (7.97 KB, patch)
2012-09-04 05:25 PDT, Zoltan Horvath
no flags
Zoltan Horvath
Comment 1 2012-09-04 05:25:31 PDT
Created attachment 162020 [details] proposed patch
Eric Seidel (no email)
Comment 2 2012-09-04 08:22:38 PDT
What happens w/o this change? Are there ports whcih would end up using sytem malloc for these objects by mistake?
Zoltan Horvath
Comment 3 2012-09-04 08:25:46 PDT
(In reply to comment #2) > What happens w/o this change? Are there ports whcih would end up using sytem malloc for these objects by mistake? Ports that don't customize ::new (e.g. qt) use system malloc for these allocations. The macro makes it straightforward for every port.
Eric Seidel (no email)
Comment 4 2012-09-04 08:28:24 PDT
ok
Benjamin Poulain
Comment 5 2012-09-04 12:01:06 PDT
May I suggest to extend the style checker to cover that? Chances are people will forget it again. I know I am guilty of this.
Zoltan Horvath
Comment 6 2012-09-04 12:17:09 PDT
(In reply to comment #5) > May I suggest to extend the style checker to cover that? > > Chances are people will forget it again. I know I am guilty of this. It would be good, but we couldn't do that, since static source code analysis is required to find the places. For example some JSValue classes don't have allocation operators, but stored on the JSGC's heap with placement new, or e.g. we don't want to customize memory allocation for QObjects. I'm working on the WebCore's coverage now. I think it's not critical and it's okay if I check it sometimes.
WebKit Review Bot
Comment 7 2012-09-04 12:35:32 PDT
Comment on attachment 162020 [details] proposed patch Clearing flags on attachment: 162020 Committed r127484: <http://trac.webkit.org/changeset/127484>
WebKit Review Bot
Comment 8 2012-09-04 12:35:35 PDT
All reviewed patches have been landed. Closing bug.
Zoltan Horvath
Comment 9 2012-09-04 12:38:54 PDT
(In reply to comment #6) > For example some JSValue classes don't have allocation operators, but stored on the JSGC's heap with placement new Let me correct myself. So it can happen that you customize the operator new of a class and you should have not done it. (e.g. basically it inherits the operator new from its base class what you can't see with a grep)
Benjamin Poulain
Comment 10 2012-09-04 13:14:46 PDT
(In reply to comment #9) > Let me correct myself. So it can happen that you customize the operator new of a class and you should have not done it. (e.g. basically it inherits the operator new from its base class what you can't see with a grep) It does not have to be perfect. You'd be surprised how dumb are some test in webkitpy, and yet they work 99% of the time :)
Zoltan Horvath
Comment 11 2012-09-04 13:29:58 PDT
(In reply to comment #10) > (In reply to comment #9) > > Let me correct myself. So it can happen that you customize the operator new of a class and you should have not done it. (e.g. basically it inherits the operator new from its base class what you can't see with a grep) > > It does not have to be perfect. > You'd be surprised how dumb are some test in webkitpy, and yet they work 99% of the time :) I see your point, but the incorrect use of this macro can lead to random crashes. Of course if anyone wants to give it a try to implement a checker for this in check-webkit-style I'd gladly support him.
Note You need to log in before you can comment on or make changes to this bug.