RESOLVED FIXED Bug 49432
Support JIT_OPTIMIZE_MOD on Thumb-2
https://bugs.webkit.org/show_bug.cgi?id=49432
Summary Support JIT_OPTIMIZE_MOD on Thumb-2
Gabor Loki
Reported 2010-11-12 01:40:10 PST
The current implementation of integer-modulo is not effective on ARM with Thumb-2. The ARM_TRADITIONAL has had JIT_OPTIMIZE_MODJIT_OPTIMIZE_MOD which dramatically increases the performance of integer-modulo. The same algorithm can be used on Thumb-2 JIT.
Attachments
Support JIT_OPTIMIZE_MOD on Thumb-2 (12.69 KB, patch)
2010-11-12 01:53 PST, Gabor Loki
no flags
Support JIT_OPTIMIZE_MOD on Thumb-2 (12.67 KB, patch)
2010-11-12 02:01 PST, Gabor Loki
barraclough: review-
barraclough: commit-queue-
Support JIT_OPTIMIZE_MOD on Thumb-2 (14.03 KB, patch)
2010-11-20 12:08 PST, Gabor Loki
no flags
Gabor Loki
Comment 1 2010-11-12 01:53:29 PST
Created attachment 73718 [details] Support JIT_OPTIMIZE_MOD on Thumb-2 SunSpider: 1.043x as fast An artificial modulo test: 6.5x as fast
Gabor Loki
Comment 2 2010-11-12 02:01:26 PST
Created attachment 73721 [details] Support JIT_OPTIMIZE_MOD on Thumb-2 remove an unused condition.
Gavin Barraclough
Comment 3 2010-11-19 20:45:16 PST
Comment on attachment 73721 [details] Support JIT_OPTIMIZE_MOD on Thumb-2 View in context: https://bugs.webkit.org/attachment.cgi?id=73721&action=review Hey Loki, Looks like a great patch, a couple of small issues. > JavaScriptCore/jit/JITOpcodes32_64.cpp:1719 > +#if CPU(ARM_THUMB2) > + RegisterID regS0 = ARMRegisters::r6; > + RegisterID regS1 = ARMRegisters::r7; > +#endif I'm not sure about defining these register names up here. Currently all registers used by the JIT are effectively documented in JSInterfaceJIT.h, if someone wants to use a register they have one place to go look to see if it is used by the JIT, needs preserving in the entry trampolines, etc. My concern is that a developer won't know to come look here to discover these registers are used. I think it would be better to add definitions for regT5 & regT6 in JSInterfaceJIT.h, for ARM & ARMv7. > JavaScriptCore/assembler/MacroAssemblerARMv7.h:226 > + void clz(RegisterID src, RegisterID dest) > + { > + m_assembler.clz(dest, src); > + } I'm not sure about this method. The first question is should this be in the MacroAssembler interface at all? - do we believe it can be usefully abstracted across a range of platforms? – x86's BSR has somewhat different semantics, so I'm not sure we'll want to generally use this call in a cross platform way - but maybe we'd abstract like this (I find BSR a little weird to use), so I'm inclined to lean towards yes, keep this here (the alternative being to just call to m_assembler.clz directly). But if we keep this, the name should change. At minimum the operation size should be encoded in the name - clz32() (the name clz is correct at the assembler layer, this is just for the MacroAssemlber layer). But coding style ask us to steer clear on acronyms & abbreviations (unless they're particularly standard and conventional), and I think we should probably change clz32 to something more explicit - like countLeadingZeros32(). What do you think? r+ with these changes, r-ing this patch. cheers, G.
Gabor Loki
Comment 4 2010-11-20 12:08:27 PST
Created attachment 74486 [details] Support JIT_OPTIMIZE_MOD on Thumb-2 List of changes: * The clz functions are renamed to countLeadingZeros32 in MacroAssembler interface. * I was able to remove the two extra temporary registers using one extra space from stack. * A possible bug was fixed related to ARMv4. * The performance numbers are not changed.
Gavin Barraclough
Comment 5 2010-11-20 12:57:39 PST
Comment on attachment 74486 [details] Support JIT_OPTIMIZE_MOD on Thumb-2 Looks awesome Loki. Just spotted that: > #error "JIT_OPTIMIZE_MOD not yet supported on this platform." should now be > #error "JIT_USE_SOFT_MODULO not yet supported on this platform." but that's my bad from an earlier change, and won't hold your patch up further for this – will fix later.
WebKit Commit Bot
Comment 6 2010-11-20 14:00:07 PST
The commit-queue encountered the following flaky tests while processing attachment 74486 [details]: http/tests/appcache/credential-url.html Please file bugs against the tests. These tests were authored by jchaffraix@webkit.org. The commit-queue is continuing to process your patch.
WebKit Commit Bot
Comment 7 2010-11-20 14:02:58 PST
Comment on attachment 74486 [details] Support JIT_OPTIMIZE_MOD on Thumb-2 Clearing flags on attachment: 74486 Committed r72481: <http://trac.webkit.org/changeset/72481>
WebKit Commit Bot
Comment 8 2010-11-20 14:03:03 PST
All reviewed patches have been landed. Closing bug.
WebKit Commit Bot
Comment 9 2010-11-20 14:34:29 PST
The commit-queue encountered the following flaky tests while processing attachment 74486 [details]: fast/profiler/throw-exception-from-eval.html fast/workers/storage/use-same-database-in-page-and-workers.html Please file bugs against the tests. These tests were authored by dumi@chromium.org, kmccullough@apple.com, oliver@apple.com, and timothy@apple.com. The commit-queue is continuing to process your patch.
Note You need to log in before you can comment on or make changes to this bug.