Changeset 260711 in webkit
- Timestamp:
- Apr 25, 2020 4:56:40 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r260700 r260711 1 2020-04-25 Yusuke Suzuki <ysuzuki@apple.com> 2 3 [JSC] Add fast path for BigInt32 left-shift 4 https://bugs.webkit.org/show_bug.cgi?id=211029 5 6 Reviewed by Saam Barati. 7 8 * stress/bigint-left-shift-overflow.js: Added. 9 (shouldBe): 10 (leftShift): 11 (noInline): 12 * stress/bigint-right-shift-large.js: Added. 13 (shouldBe): 14 1 15 2020-04-25 Paulo Matos <pmatos@igalia.com> 2 16 -
trunk/Source/JavaScriptCore/ChangeLog
r260710 r260711 1 2020-04-25 Yusuke Suzuki <ysuzuki@apple.com> 2 3 [JSC] Add fast path for BigInt32 left-shift 4 https://bugs.webkit.org/show_bug.cgi?id=211029 5 6 Reviewed by Saam Barati. 7 8 Currently, the left-shift operation misses the fast path for BigInt32 <> BigInt32 case. This patch adds it. We also fixes 9 prediction-propagation for left/right shift to use existing heap prediction instead of polluting the result with SpecBigInt. 10 This offer 4.5% improvement in microbenchmarks/sunspider-sha1-big-int.js. 11 12 * dfg/DFGPredictionPropagationPhase.cpp: 13 * runtime/Operations.h: 14 (JSC::shift): 15 1 16 2020-04-25 Ross Kirsling <ross.kirsling@sony.com> 2 17 -
trunk/Source/JavaScriptCore/dfg/DFGPredictionPropagationPhase.cpp
r260331 r260711 186 186 187 187 if (left && right) { 188 if (isBigIntSpeculation(left) && isBigIntSpeculation(right)) 189 changed |= mergePrediction(SpecBigInt); 190 else if (isFullNumberOrBooleanSpeculationExpectingDefined(left) && isFullNumberOrBooleanSpeculationExpectingDefined(right)) 188 if (isFullNumberOrBooleanSpeculationExpectingDefined(left) && isFullNumberOrBooleanSpeculationExpectingDefined(right)) 191 189 changed |= mergePrediction(SpecInt32Only); 192 190 else -
trunk/Source/JavaScriptCore/runtime/Operations.h
r260683 r260711 765 765 rightInt32 = -rightInt32; 766 766 } 767 ASSERT(rightInt32 >= 0); 767 768 768 769 // This std::min is a bit hacky, but required because in C++ it is undefined behavior to do a shift where the right operand is greater or equal to the bit-width of the left operand. 769 770 if (!isLeft) 770 771 return jsBigInt32(leftInt32 >> std::min(rightInt32, 31)); 772 773 // Do some checks to detect overflow of left-shift. But this is much cheaper compared to allocating two JSBigInt and perform shift operations in JSBigInt. 774 if (!leftInt32) 775 return jsBigInt32(0); 776 if (rightInt32 < 32) { 777 int64_t result64 = static_cast<int64_t>(leftInt32) << rightInt32; 778 if (static_cast<int64_t>(static_cast<int32_t>(result64)) == result64) 779 return jsBigInt32(static_cast<int32_t>(result64)); 780 } 771 781 772 782 // In the case of a left shift we can overflow. I deal with this by allocating HeapBigInts.
Note: See TracChangeset
for help on using the changeset viewer.