RESOLVED FIXED 122205
FTL: Refactor compileArithDiv and compileArithMod into one function.
https://bugs.webkit.org/show_bug.cgi?id=122205
Summary FTL: Refactor compileArithDiv and compileArithMod into one function.
Nadav Rotem
Reported 2013-10-01 22:54:45 PDT
FTL: Refactor compileArithDiv and compileArithMod into one function.
Attachments
Patch (9.90 KB, patch)
2013-10-01 22:55 PDT, Nadav Rotem
no flags
Patch (9.80 KB, patch)
2013-10-02 09:33 PDT, Nadav Rotem
no flags
Patch (9.93 KB, patch)
2013-10-02 10:03 PDT, Nadav Rotem
no flags
Patch (10.16 KB, patch)
2013-10-02 10:52 PDT, Nadav Rotem
no flags
Nadav Rotem
Comment 1 2013-10-01 22:55:10 PDT
Darin Adler
Comment 2 2013-10-02 09:14:33 PDT
Comment on attachment 213153 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=213153&action=review > Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp:657 > - enum AddOrSubKind {Add, Sub}; > - void compileAddSub(AddOrSubKind opKind) > + enum ArithKind {Add, Sub, Div, Mod}; Doesn’t seem helpful to share a single enum for these four kinds of arithmetic. Why not a second enum?
Nadav Rotem
Comment 3 2013-10-02 09:30:29 PDT
Darin, I will split the enums and resubmit.
Nadav Rotem
Comment 4 2013-10-02 09:33:57 PDT
Darin Adler
Comment 5 2013-10-02 09:36:13 PDT
Comment on attachment 213169 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=213169&action=review > Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp:783 > + enum DivOrModKind {Div, Mod}; Formatting error. We use spaces inside the braces. > Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp:787 > + bool isDiv = opKind == Div; Seems like we could say "opKind == Div" at the two sites where this is used. The boolean doesn’t add significant clarity.
Nadav Rotem
Comment 6 2013-10-02 10:03:15 PDT
Filip Pizlo
Comment 7 2013-10-02 10:24:31 PDT
Comment on attachment 213172 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=213172&action=review > Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp:294 > - compileArithDiv(); > + compileArithDivMod(Div); > break; > case ArithMod: > - compileArithMod(); > + compileArithDivMod(Mod); General comment: is there a reason why we even have an enum that we pass to these? For example, compileArithMinOrMax() doesn't take any arguments; it figures out what it should do by looking at m_node->op() - either it's ArithMin or ArithMax. Hence no need for an argument or a separate enum. What do you think about that for DivOrMod() and AddOrSub()?
Nadav Rotem
Comment 8 2013-10-02 10:52:09 PDT
Nadav Rotem
Comment 9 2013-10-02 11:34:38 PDT
Filip and Darin, thanks for the code review!
WebKit Commit Bot
Comment 10 2013-10-02 11:51:02 PDT
Comment on attachment 213175 [details] Patch Clearing flags on attachment: 213175 Committed r156784: <http://trac.webkit.org/changeset/156784>
WebKit Commit Bot
Comment 11 2013-10-02 11:51:04 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.