Summary: | Update JSC_functionOverrides to handle the new SourceCode strings that have params. | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Mark Lam <mark.lam> | ||||||
Component: | JavaScriptCore | Assignee: | Mark Lam <mark.lam> | ||||||
Status: | RESOLVED FIXED | ||||||||
Severity: | Normal | CC: | achristensen, ggaren, saam | ||||||
Priority: | P2 | ||||||||
Version: | WebKit Nightly Build | ||||||||
Hardware: | Unspecified | ||||||||
OS: | Unspecified | ||||||||
Attachments: |
|
Description
Mark Lam
2016-06-30 16:01:30 PDT
Created attachment 282487 [details]
proposed patch.
Created attachment 282498 [details]
proposed patch 2: fixed EWS complaint.
Comment on attachment 282498 [details] proposed patch 2: fixed EWS complaint. View in context: https://bugs.webkit.org/attachment.cgi?id=282498&action=review > Source/JavaScriptCore/tools/FunctionOverrides.cpp:153 > + String sourceString = origCode.view().toString(); > + size_t sourceBodyStart = sourceString.find('{'); > + if (sourceBodyStart == notFound) > + return false; > + String sourceBodyString = sourceString.substring(sourceBodyStart); > + > + auto it = overrides.m_entries.find(sourceBodyString); This is OK -- but I think it might be better to allow the author to override parameter declaration too. (In reply to comment #3) > Comment on attachment 282498 [details] > proposed patch 2: fixed EWS complaint. > > View in context: > https://bugs.webkit.org/attachment.cgi?id=282498&action=review > > > Source/JavaScriptCore/tools/FunctionOverrides.cpp:153 > > + String sourceString = origCode.view().toString(); > > + size_t sourceBodyStart = sourceString.find('{'); > > + if (sourceBodyStart == notFound) > > + return false; > > + String sourceBodyString = sourceString.substring(sourceBodyStart); > > + > > + auto it = overrides.m_entries.find(sourceBodyString); > > This is OK -- but I think it might be better to allow the author to override > parameter declaration too. I'll leave overriding parameters to another patch. As far as I can tell, the uses of overriding parameters are: 1. Ability to use different argument names for better readability (especially if we're replacing an obfuscated function). 2. Ability to force stack arity adjustments. I think (2) is the more meaningful reason for overriding parameters, but the need for that is probably rare. I filed https://bugs.webkit.org/show_bug.cgi?id=159355 to track this for future work. Thanks for the review. Landed in r202737: <http://trac.webkit.org/r202737>. |