Changeset 286639 in webkit
- Timestamp:
- Dec 7, 2021, 7:59:13 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 6 edited
-
JSTests/ChangeLog (modified) (1 diff)
-
JSTests/microbenchmarks/typed-array-prototype-set.js (added)
-
JSTests/stress/typed-array-prototype-set-order.js (added)
-
JSTests/stress/typed-array-prototype-set.js (added)
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/js/script-tests/typedarray-set-overlapping-elements-of-same-size.js (modified) (1 diff)
-
LayoutTests/js/typedarray-set-overlapping-elements-of-same-size-expected.txt (modified) (1 diff)
-
Source/JavaScriptCore/ChangeLog (modified) (1 diff)
-
Source/JavaScriptCore/runtime/JSGenericTypedArrayViewInlines.h (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r286478 r286639 1 2021-12-07 Saam Barati <sbarati@apple.com> 2 3 TypedArray prototype set should go down the fast path when using non clamped integer types of the same byte size 4 https://bugs.webkit.org/show_bug.cgi?id=233905 5 6 Reviewed by Keith Miller. 7 8 * microbenchmarks/typed-array-prototype-set.js: Added. 9 * microbenchmarks/typed-array-prototype-set-order.js: Added. 10 * stress/typed-array-prototype-set.js: Added. 11 1 12 2021-12-02 Yusuke Suzuki <ysuzuki@apple.com> 2 13 -
trunk/LayoutTests/ChangeLog
r286628 r286639 1 2021-12-07 Saam Barati <sbarati@apple.com> 2 3 TypedArray prototype set should go down the fast path when using non clamped integer types of the same byte size 4 https://bugs.webkit.org/show_bug.cgi?id=233905 5 6 Reviewed by Keith Miller. 7 8 * js/script-tests/typedarray-set-overlapping-elements-of-same-size.js: 9 * js/typedarray-set-overlapping-elements-of-same-size-expected.txt: 10 1 11 2021-12-07 Yoshiaki Jitsukawa <yoshiaki.jitsukawa@sony.com> 2 12 -
trunk/LayoutTests/js/script-tests/typedarray-set-overlapping-elements-of-same-size.js
r154518 r286639 19 19 } 20 20 21 shouldBe("foo(10)", "[42,42,4 2,42,42,42,42,42,42,42,42]");21 shouldBe("foo(10)", "[42,42,43,44,45,46,47,48,49,50,51]"); 22 22 shouldBe("bar(10)", "[42,43,44,45,46,47,48,49,50,51,51]"); 23 23 -
trunk/LayoutTests/js/typedarray-set-overlapping-elements-of-same-size-expected.txt
r154518 r286639 4 4 5 5 6 PASS foo(10) is [42,42,4 2,42,42,42,42,42,42,42,42]6 PASS foo(10) is [42,42,43,44,45,46,47,48,49,50,51] 7 7 PASS bar(10) is [42,43,44,45,46,47,48,49,50,51,51] 8 8 PASS successfullyParsed is true -
trunk/Source/JavaScriptCore/ChangeLog
r286635 r286639 1 2021-12-07 Saam Barati <sbarati@apple.com> 2 3 TypedArray prototype set should go down the fast path when using non clamped integer types of the same byte size 4 https://bugs.webkit.org/show_bug.cgi?id=233905 5 6 Reviewed by Keith Miller. 7 8 We can use memmove in this scenario because the bitpattern of the 9 data between the signed and unsigned values will be the same. 10 11 This patch also fixes a bug where we were looking at the wrong 12 pointer when determining to do a forward or backwards loop in 13 our memmove. We were looking at the vector instead of vector+offset. 14 15 * runtime/JSGenericTypedArrayViewInlines.h: 16 (JSC::JSGenericTypedArrayView<Adaptor>::set): 17 1 18 2021-12-07 Ross Kirsling <ross.kirsling@sony.com> 2 19 -
trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewInlines.h
r285971 r286639 217 217 if (!hasArrayBuffer() || !other->hasArrayBuffer() 218 218 || existingBuffer() != other->existingBuffer() 219 || (elementSize == otherElementSize && vector() <= other->vector())219 || (elementSize == otherElementSize && (static_cast<void*>(typedVector() + offset) <= static_cast<void*>(other->typedVector() + otherOffset))) 220 220 || type == CopyType::LeftToRight) { 221 221 for (size_t i = 0; i < length; ++i) { … … 256 256 auto scope = DECLARE_THROW_SCOPE(vm); 257 257 258 auto memmoveFastPath = [&] ( auto* other) {258 auto memmoveFastPath = [&] (JSArrayBufferView* other) { 259 259 // The super fast case: we can just memmove since we're the same underlying storage type. 260 260 length = std::min(length, other->length()); 261 261 262 RELEASE_ASSERT(other->canAccessRangeQuickly(objectOffset, length));263 262 bool success = validateRange(globalObject, offset, length); 264 263 EXCEPTION_ASSERT(!scope.exception() == success); … … 266 265 return false; 267 266 268 RELEASE_ASSERT( (std::is_same_v<decltype(typedVector()), decltype(other->typedVector())>));269 memmove(typedVector() + offset, other->typedVector() + objectOffset, length * elementSize);267 RELEASE_ASSERT(JSC::elementSize(Adaptor::typeValue) == JSC::elementSize(other->classInfo(vm)->typedArrayStorageType)); 268 memmove(typedVector() + offset, bitwise_cast<typename Adaptor::Type*>(other->vector()) + objectOffset, length * elementSize); 270 269 return true; 271 270 }; … … 273 272 const ClassInfo* ci = object->classInfo(vm); 274 273 if (ci->typedArrayStorageType == Adaptor::typeValue) 275 return memmoveFastPath(jsCast<JS GenericTypedArrayView*>(object));274 return memmoveFastPath(jsCast<JSArrayBufferView*>(object)); 276 275 277 276 auto isSomeUint8 = [] (TypedArrayType type) { 278 277 return type == TypedArrayType::TypeUint8 || type == TypedArrayType::TypeUint8Clamped; 279 278 }; 280 if (isSomeUint8(ci->typedArrayStorageType) && isSomeUint8(Adaptor::typeValue)) { 281 if (ci->typedArrayStorageType == TypedArrayType::TypeUint8) 282 return memmoveFastPath(jsCast<JSGenericTypedArrayView<Uint8Adaptor>*>(object)); 283 return memmoveFastPath(jsCast<JSGenericTypedArrayView<Uint8ClampedAdaptor>*>(object)); 284 } 285 279 280 if (isSomeUint8(ci->typedArrayStorageType) && isSomeUint8(Adaptor::typeValue)) 281 return memmoveFastPath(jsCast<JSArrayBufferView*>(object)); 282 283 if (isInt(Adaptor::typeValue) && isInt(ci->typedArrayStorageType) && !isClamped(Adaptor::typeValue) && JSC::elementSize(Adaptor::typeValue) == JSC::elementSize(ci->typedArrayStorageType)) 284 return memmoveFastPath(jsCast<JSArrayBufferView*>(object)); 285 286 286 switch (ci->typedArrayStorageType) { 287 287 case TypeInt8:
Note:
See TracChangeset
for help on using the changeset viewer.