For example, we should be able to run jsc as follows: $ jsc --reportCompileTimes myscript.js ... instead of having to say: $ jsc --reportCompileTimes=true myscript.js The "=true" part seems redundant. This is not a big deal, but it's been irking me for a few years now. Since it's easily remedied, I thought I'd roll a patch for it.
Created attachment 267907 [details] proposed patch.
Comment on attachment 267907 [details] proposed patch. View in context: https://bugs.webkit.org/attachment.cgi?id=267907&action=review > Source/JavaScriptCore/jsc.cpp:1890 > + const char* equalStr = strchr(arg, '='); This variable is used exactly once and I do not feel that its name improves the readability of this code. I suggest that we inline the value of this variable into the if condition expression on line 1892. > Source/JavaScriptCore/jsc.cpp:1893 > + impliedOption = String(arg) + "=true"; This will malloc() twice: once for a buffer of size strlen(arg) and once for a buffer whose size is strlen(arg) + strlen("=true"). Making use of the convenience function makeString() and ASCIILiteral() I would write this line as: impliedOption = makeString(arg, ASCIILiteral("=true")); The benefit of this approach is that it will malloc() once for a buffer the size of the result of the string concatenation. Note, I am assuming JSC::Options::setOption() makes a copy of the string if it stores it. On another note, it's unfortunate that we do not have a more direct way to set a boolean option in JSC other than concatentating "=true". The proposed approach is sufficient.