RESOLVED FIXED 160108
op_mul/ArithMul(Untyped,Untyped) should be an IC
https://bugs.webkit.org/show_bug.cgi?id=160108
Summary op_mul/ArithMul(Untyped,Untyped) should be an IC
Saam Barati
Reported 2016-07-22 16:59:02 PDT
...
Attachments
WIP (55.03 KB, patch)
2016-07-22 18:39 PDT, Saam Barati
no flags
patch (63.67 KB, patch)
2016-07-24 21:10 PDT, Saam Barati
no flags
patch (64.10 KB, patch)
2016-07-25 10:03 PDT, Saam Barati
mark.lam: review+
patch for landing (64.09 KB, patch)
2016-07-25 11:15 PDT, Saam Barati
no flags
benchmarks (5.94 KB, application/octet-stream)
2016-07-25 11:54 PDT, Saam Barati
no flags
Saam Barati
Comment 1 2016-07-22 18:39:22 PDT
Created attachment 284392 [details] WIP WIP with a bunch of data gathering code in it.
Saam Barati
Comment 2 2016-07-24 21:10:31 PDT
WebKit Commit Bot
Comment 3 2016-07-24 21:12:57 PDT
Attachment 284462 [details] did not pass style-queue: ERROR: Source/JavaScriptCore/jit/JITAddGenerator.cpp:171: Multi line control clauses should use braces. [whitespace/braces] [4] ERROR: Source/JavaScriptCore/jit/JITMathIC.h:32: Alphabetical sorting problem. [build/include_order] [4] Total errors found: 2 in 17 files If any of these errors are false positives, please file a bug against check-webkit-style.
Saam Barati
Comment 4 2016-07-25 10:03:18 PDT
Mark Lam
Comment 5 2016-07-25 10:04:08 PDT
Comment on attachment 284462 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=284462&action=review > Source/JavaScriptCore/jit/JITMulGenerator.cpp:53 > + if (lhs.isOnlyNonNumber() && rhs.isOnlyNonNumber()) Shouldn't this be ((lhs.isOnlyNonNumber() || rhs.isOnlyNonNumber())? I wonder why the op_mul.js tests didn't catch this scenario. Can you look into adding a test case or a new test file as appropriate? Oh, I think you'll end up returning JITMathICInlineResult::GenerateFullSnippet below, and that will still work though less efficiently. > Source/JavaScriptCore/jit/JITMulGenerator.cpp:200 > + if (!m_arithProfile || !shouldEmitProfiling) I think this should be (!m_arithProfile && !shouldEmitProfiling).
WebKit Commit Bot
Comment 6 2016-07-25 10:06:05 PDT
Attachment 284495 [details] did not pass style-queue: ERROR: Source/JavaScriptCore/jit/JITAddGenerator.cpp:171: Multi line control clauses should use braces. [whitespace/braces] [4] Total errors found: 1 in 17 files If any of these errors are false positives, please file a bug against check-webkit-style.
Saam Barati
Comment 7 2016-07-25 10:07:05 PDT
Comment on attachment 284462 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=284462&action=review >> Source/JavaScriptCore/jit/JITMulGenerator.cpp:53 >> + if (lhs.isOnlyNonNumber() && rhs.isOnlyNonNumber()) > > Shouldn't this be ((lhs.isOnlyNonNumber() || rhs.isOnlyNonNumber())? > > I wonder why the op_mul.js tests didn't catch this scenario. Can you look into adding a test case or a new test file as appropriate? Oh, I think you'll end up returning JITMathICInlineResult::GenerateFullSnippet below, and that will still work though less efficiently. Yes this is tricky. We only degrade generating if both have proven to not be numbers. We are more optimistic if one has been a number, that the other might also be a number. We can play around with this heuristic in the future. It might even be helpful to have counts. >> Source/JavaScriptCore/jit/JITMulGenerator.cpp:200 >> + if (!m_arithProfile || !shouldEmitProfiling) > > I think this should be (!m_arithProfile && !shouldEmitProfiling). No, that's not quite right. If we don't have an ArithProfile, we don't emit profiling. If shouldEmitProfiling is false, we don't emit profiling. Hence for ||
Mark Lam
Comment 8 2016-07-25 10:11:20 PDT
(In reply to comment #7) > Comment on attachment 284462 [details] > patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=284462&action=review > > >> Source/JavaScriptCore/jit/JITMulGenerator.cpp:53 > >> + if (lhs.isOnlyNonNumber() && rhs.isOnlyNonNumber()) > > > > Shouldn't this be ((lhs.isOnlyNonNumber() || rhs.isOnlyNonNumber())? > > > > I wonder why the op_mul.js tests didn't catch this scenario. Can you look into adding a test case or a new test file as appropriate? Oh, I think you'll end up returning JITMathICInlineResult::GenerateFullSnippet below, and that will still work though less efficiently. > > Yes this is tricky. We only degrade generating if both have proven to not be > numbers. We are more optimistic if one has been a number, that the other > might also be a number. We can play around with this heuristic in the > future. It might even be helpful to have counts. OK. Good point. > >> Source/JavaScriptCore/jit/JITMulGenerator.cpp:200 > >> + if (!m_arithProfile || !shouldEmitProfiling) > > > > I think this should be (!m_arithProfile && !shouldEmitProfiling). > > No, that's not quite right. > If we don't have an ArithProfile, we don't emit profiling. If > shouldEmitProfiling is false, we don't emit profiling. > Hence for || Oh, you're right. I had a mistake in my reasoning.
Mark Lam
Comment 9 2016-07-25 10:54:45 PDT
Comment on attachment 284495 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=284495&action=review r=me with fixes. > Source/JavaScriptCore/ChangeLog:11 > + work over arbitrary IC snippets. This will making adding Div/Sub/Pow in the typo: /will making/will make/. > Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp:1326 > + other.m_jit = nullptr; I think you should also set "other.m_fpr = InvalidFPRReg;" similar to the GPRTemporary version. > Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h:3122 > + if (LIKELY(m_jit)) Should this be "if (LIKELY(m_jit && m_fpr != InvalidFPRReg)" similar to the GPRTemporary version? Looking at the constructors, I see no way that m_fpr can be invalid unless the allocator fails. I'm thinking we should have the GPRTemporary and FPRTemporary code behaves consistently, either by adding the invalid check, or asserting that the reg is never invalid at destruction time.
Saam Barati
Comment 10 2016-07-25 11:09:41 PDT
Comment on attachment 284495 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=284495&action=review >> Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h:3122 >> + if (LIKELY(m_jit)) > > Should this be "if (LIKELY(m_jit && m_fpr != InvalidFPRReg)" similar to the GPRTemporary version? > > Looking at the constructors, I see no way that m_fpr can be invalid unless the allocator fails. I'm thinking we should have the GPRTemporary and FPRTemporary code behaves consistently, either by adding the invalid check, or asserting that the reg is never invalid at destruction time. Mark and I spoke offline, we're going to probably make GPRTemporary behave more like FPRTemporary in another bug.
Saam Barati
Comment 11 2016-07-25 11:15:44 PDT
Created attachment 284503 [details] patch for landing
WebKit Commit Bot
Comment 12 2016-07-25 11:17:48 PDT
Attachment 284503 [details] did not pass style-queue: ERROR: Source/JavaScriptCore/jit/JITAddGenerator.cpp:171: Multi line control clauses should use braces. [whitespace/braces] [4] Total errors found: 1 in 17 files If any of these errors are false positives, please file a bug against check-webkit-style.
Saam Barati
Comment 13 2016-07-25 11:54:49 PDT
Created attachment 284511 [details] benchmarks looks neutral, or maybe a slight win.
Saam Barati
Comment 14 2016-07-25 12:06:43 PDT
Note You need to log in before you can comment on or make changes to this bug.