Bug 151680 - Snippefy bitwise operators for the baseline JIT.
Summary: Snippefy bitwise operators for the baseline JIT.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Mark Lam
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2015-11-30 15:55 PST by Mark Lam
Modified: 2015-12-04 14:29 PST (History)
8 users (show)

See Also:


Attachments
proposed patch. (51.00 KB, patch)
2015-12-03 14:28 PST, Mark Lam
ggaren: review+
Details | Formatted Diff | Diff
patch 2: fixed 32-bit regression in baseline JIT (51.56 KB, patch)
2015-12-04 13:39 PST, Mark Lam
ggaren: review+
Details | Formatted Diff | Diff
x86_64 benchmark result. (65.07 KB, text/plain)
2015-12-04 13:40 PST, Mark Lam
no flags Details
x86 benchmark result. (64.45 KB, text/plain)
2015-12-04 13:41 PST, Mark Lam
no flags Details
x86_64 benchmark result without DFG. (64.29 KB, text/plain)
2015-12-04 13:41 PST, Mark Lam
no flags Details
x86 benchmark result without DFG. (64.48 KB, text/plain)
2015-12-04 13:42 PST, Mark Lam
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Lam 2015-11-30 15:55:50 PST
Working on it.
Comment 1 Radar WebKit Bug Importer 2015-11-30 15:56:47 PST
<rdar://problem/23696526>
Comment 2 Mark Lam 2015-12-03 14:28:27 PST
Created attachment 266558 [details]
proposed patch.

Tests and benchmarks are still being run.
Comment 3 WebKit Commit Bot 2015-12-03 14:30:14 PST
Attachment 266558 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/jit/JITBitOrGenerator.h:39:  Wrong number of spaces before statement. (expected: 12)  [whitespace/indent] [4]
ERROR: Source/JavaScriptCore/jit/JITBitXorGenerator.h:39:  Wrong number of spaces before statement. (expected: 12)  [whitespace/indent] [4]
ERROR: Source/JavaScriptCore/jit/JITBitwiseBinaryOpGenerator.h:40:  Wrong number of spaces before statement. (expected: 12)  [whitespace/indent] [4]
ERROR: Source/JavaScriptCore/jit/JITBitwiseBinaryOpGenerator.h:41:  Wrong number of spaces before statement. (expected: 12)  [whitespace/indent] [4]
ERROR: Source/JavaScriptCore/jit/JITBitwiseBinaryOpGenerator.h:42:  Wrong number of spaces before statement. (expected: 12)  [whitespace/indent] [4]
ERROR: Source/JavaScriptCore/jit/JITBitwiseBinaryOpGenerator.h:43:  Wrong number of spaces before statement. (expected: 12)  [whitespace/indent] [4]
ERROR: Source/JavaScriptCore/jit/JITBitwiseBinaryOpGenerator.h:44:  Wrong number of spaces before statement. (expected: 12)  [whitespace/indent] [4]
ERROR: Source/JavaScriptCore/jit/JITBitwiseBinaryOpGenerator.h:45:  Wrong number of spaces before statement. (expected: 12)  [whitespace/indent] [4]
ERROR: Source/JavaScriptCore/jit/JITBitAndGenerator.h:39:  Wrong number of spaces before statement. (expected: 12)  [whitespace/indent] [4]
Total errors found: 9 in 19 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 4 Geoffrey Garen 2015-12-03 14:50:04 PST
Comment on attachment 266558 [details]
proposed patch.

r=me
Comment 5 Mark Lam 2015-12-03 16:31:15 PST
This patch has passed the JSC tests on x86 and x86_64.  It has passed the layout tests on x86_64.

Benchmarks with the DFG and FTL enable shows perf to be neutral for both x86 and x86_64.  Still waiting for benchmark results with no DFG.
Comment 6 Mark Lam 2015-12-04 13:39:34 PST
Created attachment 266651 [details]
patch 2: fixed 32-bit regression in baseline JIT

The only difference in this patch is the addition of this conditional in emitBitwiseBinaryOpFastPath():

#if USE(JSVALUE32_64)
        emitStoreInt32(result, resultRegs.payloadGPR(), op1 == result || op2 == result);
#else
        emitPutVirtualRegister(result, resultRegs);
#endif

On x86, the emitStoreInt32() results in setting the result IntTag value using an immediate instead of getting it from another register which is already known to have the IntTag value.  The 32-bit bitwise code was previous setting the result this way.  This change basically restores the setting of the result to the way it was done before.

This difference accounted for some noticeable perf difference on x86 when running without the DFG.
Comment 7 Mark Lam 2015-12-04 13:40:35 PST
Created attachment 266652 [details]
x86_64 benchmark result.
Comment 8 WebKit Commit Bot 2015-12-04 13:40:52 PST
Attachment 266651 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/jit/JITBitOrGenerator.h:39:  Wrong number of spaces before statement. (expected: 12)  [whitespace/indent] [4]
ERROR: Source/JavaScriptCore/jit/JITBitXorGenerator.h:39:  Wrong number of spaces before statement. (expected: 12)  [whitespace/indent] [4]
ERROR: Source/JavaScriptCore/jit/JITBitwiseBinaryOpGenerator.h:40:  Wrong number of spaces before statement. (expected: 12)  [whitespace/indent] [4]
ERROR: Source/JavaScriptCore/jit/JITBitwiseBinaryOpGenerator.h:41:  Wrong number of spaces before statement. (expected: 12)  [whitespace/indent] [4]
ERROR: Source/JavaScriptCore/jit/JITBitwiseBinaryOpGenerator.h:42:  Wrong number of spaces before statement. (expected: 12)  [whitespace/indent] [4]
ERROR: Source/JavaScriptCore/jit/JITBitwiseBinaryOpGenerator.h:43:  Wrong number of spaces before statement. (expected: 12)  [whitespace/indent] [4]
ERROR: Source/JavaScriptCore/jit/JITBitwiseBinaryOpGenerator.h:44:  Wrong number of spaces before statement. (expected: 12)  [whitespace/indent] [4]
ERROR: Source/JavaScriptCore/jit/JITBitwiseBinaryOpGenerator.h:45:  Wrong number of spaces before statement. (expected: 12)  [whitespace/indent] [4]
ERROR: Source/JavaScriptCore/jit/JITBitAndGenerator.h:39:  Wrong number of spaces before statement. (expected: 12)  [whitespace/indent] [4]
Total errors found: 9 in 19 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 9 Mark Lam 2015-12-04 13:41:01 PST
Created attachment 266653 [details]
x86 benchmark result.
Comment 10 Mark Lam 2015-12-04 13:41:33 PST
Created attachment 266654 [details]
x86_64 benchmark result without DFG.
Comment 11 Mark Lam 2015-12-04 13:42:11 PST
Created attachment 266655 [details]
x86 benchmark result without DFG.
Comment 12 Mark Lam 2015-12-04 13:49:32 PST
Perf is neutral with the DFG on.  Perf is also mostly neutral with just the baseline JIT.  

On x86_64 baseline only, AsmBench tests shows some progression possibly because the snippet forms of bitor and bitxor has added support for constant operands (inherited from the 32-bit version).

On x86 baseline only, JSRegress' is-function-fold does appear to have a regression.  However, inspection of the test code shows that it doesn't even use bitand, bitor, or bitxor operators.  A dump of the disassemble JIT code also shows no use of the operators.  I'll count this one as being due to cache line effects, and ignore it.
Comment 13 Geoffrey Garen 2015-12-04 14:12:49 PST
Comment on attachment 266651 [details]
patch 2: fixed 32-bit regression in baseline JIT

r=me
Comment 14 Mark Lam 2015-12-04 14:29:16 PST
Thanks for the review.  Landed in r193471: <http://trac.webkit.org/r193471>.