Skip to content
Permalink
Browse files
[JSC] Implement resizable ArrayBuffer
https://bugs.webkit.org/show_bug.cgi?id=248024
rdar://problem/102453167

Reviewed by Ross Kirsling and Mark Lam.

This patch implements resizable ArrayBuffer runtime. It is not including JIT optimization, which should be done in a subsequent patch.

1. ArrayBuffer gets resizable. We implement resize, transfer etc.[1]. Resizable ArrayBuffer is implemented as virtual-address-region (VA-region)
   based approach: we change permission of reserved VA so that we can resize buffer in-place. We reuse shared WebAssembly.Memory / growable
   SharedArrayBuffer's memory management mechanism for resizable ArrayBuffer since it offers VA-based resizing.
   We are just using AutoLength etc. mechanism introduced in 256766@main.
2. Because now we implemented resizable ArrayBuffer and growable SharedArrayBuffer, we can run many tests.
   This patch imported V8 resizable ArrayBuffer tests, and we fixed misc issues found by that.
   We also ran test262 and fixed issues found by that too.
3. After running tests, we found some issues in DFG / FTL. So we fixed them too to avoid crashes.

[1]: https://tc39.es/proposal-resizablearraybuffer/

* JSTests/stress/array-buffer-resize.js: Added.
(shouldBe):
* JSTests/stress/resources/v8-typedarray-helpers.js: Added.
(MyUint8Array):
(MyFloat32Array):
(MyBigInt64Array):
(CreateResizableArrayBuffer):
(AllBigIntMatchedCtorCombinations):
(AllBigIntUnmatchedCtorCombinations):
(ReadDataFromBuffer):
(WriteToTypedArray):
(Convert):
(ToNumbers):
(TypedArrayEntriesHelper):
(ArrayEntriesHelper):
(ValuesFromTypedArrayEntries):
(ValuesFromArrayEntries):
(TypedArrayKeysHelper):
(ArrayKeysHelper):
(TypedArrayValuesHelper):
(ArrayValuesHelper):
(ValuesFromTypedArrayValues):
(ValuesFromArrayValues):
(TypedArrayAtHelper):
(ArrayAtHelper):
(TypedArrayFillHelper):
(ArrayFillHelper):
(TypedArrayFindHelper):
(ArrayFindHelper):
(TypedArrayFindIndexHelper):
(ArrayFindIndexHelper):
(TypedArrayFindLastHelper):
(ArrayFindLastHelper):
(TypedArrayFindLastIndexHelper):
(ArrayFindLastIndexHelper):
(TypedArrayIncludesHelper):
(ArrayIncludesHelper):
(TypedArrayIndexOfHelper):
(ArrayIndexOfHelper):
(TypedArrayLastIndexOfHelper):
(ArrayLastIndexOfHelper):
(SetHelper):
(testDataViewMethodsUpToSize):
(TestAtomicsOperations):
(AssertAtomicsOperationsThrow):
(const.TypedArrayCopyWithinHelper):
(const.ArrayCopyWithinHelper):
(const.TypedArrayReverseHelper):
(const.ArrayReverseHelper):
(const.TypedArraySortHelper):
(const.ArraySortHelper):
(const.TypedArraySliceHelper):
(const.ArraySliceHelper):
(const.ArrayFlatHelper):
(const.ArrayFlatMapHelper):
(const.TypedArrayJoinHelper):
(const.ArrayJoinHelper):
(const.TypedArrayToLocaleStringHelper):
(const.ArrayToLocaleStringHelper):
(const.TypedArrayForEachHelper):
(const.ArrayForEachHelper):
(const.TypedArrayReduceHelper):
(const.ArrayReduceHelper):
(const.TypedArrayReduceRightHelper):
(const.ArrayReduceRightHelper):
(const.TypedArrayFilterHelper):
(const.ArrayFilterHelper):
(const.TypedArrayMapHelper):
(const.ArrayMapHelper):
(const.TypedArrayEveryHelper):
(const.ArrayEveryHelper):
(const.TypedArraySomeHelper):
(const.ArraySomeHelper):
* JSTests/stress/v8-dataview-growablesharedarraybuffer.js: Added.
(DataViewPrototype):
(DataViewByteLength):
(ConstructInvalid):
(GetAndSet):
* JSTests/stress/v8-dataview-resizablearraybuffer.js: Added.
(DataViewPrototype):
(DataViewByteLength):
(ConstructInvalid):
(OrdinaryCreateFromConstructorShrinks.const.newTarget):
(OrdinaryCreateFromConstructorShrinks.get assertThrows):
(OrdinaryCreateFromConstructorShrinks):
(DataViewByteLengthWhenResizedOutOfBounds2):
(GetParameterConversionShrinks):
* JSTests/stress/v8-harmony-arraybuffer-transfer.js: Added.
(AssertDetached):
(WriteTestData):
(AssertBufferContainsTestData):
(TestSameLength):
(TestGrow):
(TestNonGrow):
(TestParameterConversion):
(TestCannotBeSAB):
* JSTests/stress/v8-harmony-typed-array-to-reversed.js: Added.
(CheckToReversed):
(TestBasic):
(TestNonTypedArray):
(TestGrowableSAB):
(TestDetached):
(TestNoSpecies.MyUint8Array.get Symbol):
(TestNoSpecies.MyUint8Array):
* JSTests/stress/v8-harmony-typed-array-to-sorted.js: Added.
(AssertToSortedAndSortSameResult):
(TestBasic):
(TestResizableBuffer):
(TestComparatorShrinks):
(TestComparatorGrows):
(TestComparatorDetaches):
(TestGrowableSAB):
(TestNonTypedArray):
(TestNoSpecies.MyUint8Array.get Symbol):
(TestNoSpecies.MyUint8Array):
* JSTests/stress/v8-harmony-typed-array-with.js: Added.
(NormalizeValue):
(CheckWith):
(TestSurface):
(TestBasic):
(TestOutOfBounds):
(TestParameterConversionShrinks):
(TestParameterConversionGrows):
(TestParameterConversionDetaches):
(TestParameterConversionGrowsSAB):
(TestNoSpecies.MyUint8Array):
(TestNoSpecies.MyUint8Array.get Symbol):
(TestNoSpecies):
* JSTests/stress/v8-regress-1358505.js: Added.
(Test_OOB.f):
(Test_OOB):
(Test_OOB_WithOffset.f):
(Test_OOB_WithOffset):
* JSTests/stress/v8-regress-crbug-1347721.js: Added.
* JSTests/stress/v8-regress-crbug-1377840.js: Added.
(ctor):
(assertThrows):
* JSTests/stress/v8-regress-crbug-1381064.js: Added.
(NonBigIntRegressionTest):
(BigIntRegressionTest):
* JSTests/stress/v8-resizablearraybuffer-growablesharedarraybuffer.js: Added.
(resizeHelper):
(growHelper):
(TestRABBasics):
(TestRABCtorByteLengthEqualsMax):
(TestRABCtorByteLengthZero):
(TestRABCtorByteLengthAndMaxZero):
(TestOptionsBagNotObject):
(TestOptionsBagMaxByteLengthGetterThrows.get for):
(TestOptionsBagMaxByteLengthGetterThrows):
(TestMaxByteLengthNonExisting):
(TestMaxByteLengthUndefinedOrNan):
(TestMaxByteLengthBooleanNullOrString):
(TestMaxByteLengthDouble):
(TestByteLengthThrows):
(TestAllocatingOutrageouslyMuchThrows):
(TestRABCtorOperationOrder.const.mock_length.valueOf):
(TestRABCtorOperationOrder.const.mock_max_length.valueOf):
(TestGSABCtorOperationOrder.const.mock_length.valueOf):
(TestGSABCtorOperationOrder.const.mock_max_length.valueOf):
(TestGSABCtorOperationOrder):
(TestByteLengthGetterReceiverChecks):
(TestResizeAndGrowReceiverChecks):
(TestRABResizeToSameSize):
(TestRABResizeToSmaller):
(TestRABResizeToZero):
(TestRABResizeZeroToZero):
(TestRABGrowBeyondMaxThrows):
(TestRABResizeMultipleTimes):
(TestRABResizeParameters.rab.resize):
(TestRABResizeParameters):
(TestRABResizeInvalidParameters.assertThrows.):
(TestRABResizeInvalidParameters):
(TestRABResizeDetached):
(TestRABNewMemoryAfterResizeInitializedToZero):
(TestRABMemoryInitializedToZeroAfterShrinkAndGrow):
(TestGSABBasics):
(TestGSABCtorByteLengthEqualsMax):
(TestGSABCtorByteLengthZero):
(TestGSABCtorByteLengthAndMaxZero):
(TestGSABGrowToSameSize):
(TestGSABGrowToSmallerThrows):
(TestGSABGrowToZeroThrows):
(TestGSABGrowBeyondMaxThrows):
(TestGSABGrowMultipleTimes):
(TestGSABGrowParameters.gsab.grow):
(TestGSABGrowParameters):
(TestGSABGrowInvalidParameters.assertThrows.):
(TestGSABGrowInvalidParameters):
(TestGSABMemoryInitializedToZeroAfterGrow):
(GrowGSABOnADifferentThread):
(Slice):
(SliceSpeciesConstructorReturnsResizable.MyArrayBuffer.get Symbol):
(SliceSpeciesConstructorReturnsResizable.MyArrayBuffer):
(SliceSpeciesConstructorReturnsResizable.MyResizableArrayBuffer):
(SliceSpeciesConstructorReturnsResizable.MySharedArrayBuffer.get Symbol):
(SliceSpeciesConstructorReturnsResizable.MySharedArrayBuffer):
(SliceSpeciesConstructorReturnsResizable.MyGrowableSharedArrayBuffer):
(SliceSpeciesConstructorReturnsResizable):
(SliceSpeciesConstructorResizes.MyArrayBuffer):
(SliceSpeciesConstructorResizes):
(DecommitMemory):
* JSTests/stress/v8-typedarray-growablesharedarraybuffer-array-methods.js: Added.
(ArrayConcatDefault.helper):
(ArrayConcatDefault):
(ArrayConcatConcatSpreadable.helper):
(ArrayConcatConcatSpreadable):
(ArrayConcatConcatDictionaryElementsProto.helper):
(ArrayConcatConcatDictionaryElementsProto.assertArrayContents):
(ArrayConcatConcatDictionaryElementsProto):
(ArrayPushPopShiftUnshiftSplice):
(ArrayFlatFlatMapFrom.mapper):
(ArrayFlatFlatMapFrom):
(ArrayFlatParameterConversionGrows):
(ArrayFlatMapMapperGrows.mapper):
(ArrayFlatMapMapperGrows):
(ArrayFromMapperGrows.mapper):
(ArrayFromMapperGrows):
* JSTests/stress/v8-typedarray-growablesharedarraybuffer-atomics.js: Added.
(TestAtomics):
(AtomicsFailWithNonIntegerArray):
* JSTests/stress/v8-typedarray-growablesharedarraybuffer.js: Added.
(TypedArrayPrototype):
(TypedArrayLengthAndByteLength):
(ConstructInvalid):
(ConstructFromTypedArraySpeciesConstructorNotCalled.MySharedArrayBuffer):
(ConstructFromTypedArraySpeciesConstructorNotCalled.MySharedArrayBuffer.get Symbol):
(TypedArrayLengthWhenGrown2):
(LengthTracking1):
(LengthTracking2):
(LoadWithFeedback.ReadElement2):
(LoadWithFeedback):
(LoadAndStoreWithFeedback.ReadElement):
(LoadAndStoreWithFeedback.HasElement):
(LoadAndStoreWithFeedback.WriteElement):
(LoadAndStoreWithFeedback):
(HasWithOffsetsWithFeedback.GetElements):
(HasWithOffsetsWithFeedback):
(EnumerateElements):
(IterateTypedArray.TestIteration):
(IterateTypedArray):
(CreateGsab):
(TestIterationAndGrow):
(IterateTypedArrayAndGrowMidIteration):
(IterateTypedArrayAndGrowJustBeforeIterationWouldEnd):
(Destructuring):
(TestFill):
(At):
(Slice):
(SliceParameterConversionGrows):
(SliceSpeciesCreateResizes.MyArray):
(SliceSpeciesCreateResizes):
(TestCopyWithin):
(CopyWithinParameterConversionGrows):
(EntriesKeysValues):
(CreateGsabForTest):
(EntriesKeysValuesGrowMidIteration):
(div3):
(even):
(over10):
(EverySome):
(EveryGrowMidIteration.CreateGsabForTest):
(EveryGrowMidIteration.CollectValuesAndGrow):
(EveryGrowMidIteration):
(SomeGrowMidIteration.CreateGsabForTest):
(SomeGrowMidIteration.CollectValuesAndGrow):
(SomeGrowMidIteration):
(isTwoOrFour):
(FindFindIndexFindLastFindLastIndex):
(FindGrowMidIteration.CreateGsabForTest):
(FindGrowMidIteration.CollectValuesAndGrow):
(FindGrowMidIteration):
(FindIndexGrowMidIteration.CreateGsabForTest):
(FindIndexGrowMidIteration.CollectValuesAndGrow):
(FindIndexGrowMidIteration):
(FindLastGrowMidIteration.CreateGsabForTest):
(FindLastGrowMidIteration.CollectValuesAndGrow):
(FindLastGrowMidIteration):
(FindLastIndexGrowMidIteration.CreateGsabForTest):
(FindLastIndexGrowMidIteration.CollectValuesAndGrow):
(FindLastIndexGrowMidIteration):
(Filter.isEven):
(Filter):
(FilterGrowMidIteration.CreateGsabForTest):
(FilterGrowMidIteration.CollectValuesAndGrow):
(FilterGrowMidIteration):
(Helper):
(ForEachReduceReduceRight):
(CollectValuesAndResize):
(ForEachHelper):
(ReduceHelper):
(ReduceRightHelper):
(ForEachReduceReduceRightGrowMidIteration):
(Includes):
(IncludesParameterConversionGrows):
(IncludesSpecialValues):
(IndexOfLastIndexOf):
(IndexOfParameterConversionGrows):
(LastIndexOfParameterConversionGrows):
(IndexOfLastIndexOfSpecialValues):
(JoinToLocaleString):
(JoinParameterConversionGrows):
(ToLocaleStringNumberPrototypeToLocaleStringGrows.Number.prototype.toLocaleString):
(ToLocaleStringNumberPrototypeToLocaleStringGrows.BigInt.prototype.toLocaleString):
(ToLocaleStringNumberPrototypeToLocaleStringGrows):
(TestMap.Helper):
(TestMap):
(MapGrowMidIteration.CreateGsabForTest):
(MapGrowMidIteration.CollectValuesAndResize):
(MapGrowMidIteration.Helper):
(MapGrowMidIteration):
(MapSpeciesCreateGrows.CollectValues):
(MapSpeciesCreateGrows.Helper):
(MapSpeciesCreateGrows.MyArray):
(MapSpeciesCreateGrows):
(Reverse.WriteData):
(Reverse):
(SetWithGrowableTarget):
(SetSourceLengthGetterGrowsTarget.CreateGsabForTest):
(SetSourceLengthGetterGrowsTarget.CreateSourceProxy):
(SetSourceLengthGetterGrowsTarget.get for):
(SetSourceLengthGetterGrowsTarget):
(SetGrowTargetMidIteration.CreateGsabForTest):
(SetGrowTargetMidIteration.CreateSourceProxy):
(SetGrowTargetMidIteration.get for):
(SetGrowTargetMidIteration):
(SetWithGrowableSource):
(Subarray):
(SubarrayParameterConversionGrows.CreateGsabForTest):
(SubarrayParameterConversionGrows):
(SortWithDefaultComparison.WriteUnsortedData):
(SortWithDefaultComparison):
(ArraySortWithDefaultComparison.WriteUnsortedData):
(ArraySortWithDefaultComparison):
(SortWithCustomComparison.WriteUnsortedData):
(SortWithCustomComparison.CustomComparison):
(SortWithCustomComparison):
(SortCallbackGrows.WriteUnsortedData):
(SortCallbackGrows.CustomComparison):
(SortCallbackGrows):
(ObjectDefinePropertyDefineProperties):
(ObjectFreeze):
(FunctionApply.func):
(FunctionApply):
(TypedArrayFrom):
* JSTests/stress/v8-typedarray-resizablearraybuffer-array-methods.js: Added.
(ArrayConcatDefault.helper):
(ArrayConcatDefault):
(ArrayConcatConcatSpreadable.helper):
(ArrayConcatConcatSpreadable):
(ArrayConcatConcatDictionaryElementsProto.helper):
(ArrayConcatConcatDictionaryElementsProto.assertArrayContents):
(ArrayConcatConcatDictionaryElementsProto):
(ArrayPushPopShiftUnshiftSplice.testAllFuncsThrow):
(ArrayPushPopShiftUnshiftSplice):
(ArraySlice):
(ArraySliceParameterConversionShrinks):
(ArraySliceParameterConversionDetaches):
(ArrayFlatFlatMapFrom.mapper):
(ArrayFlatFlatMapFrom):
(ArrayFlatParameterConversionGrows):
(ArrayFlatParameterConversionDetaches):
(ArrayFlatMapMapperShrinks.mapper):
(ArrayFlatMapMapperShrinks):
(ArrayFlatMapMapperGrows.mapper):
(ArrayFlatMapMapperGrows):
(ArrayFlatMapMapperDetaches.mapper):
(ArrayFlatMapMapperDetaches):
(ArrayFromMapperShrinks.mapper):
(ArrayFromMapperShrinks):
(ArrayFromMapperGrows.mapper):
(ArrayFromMapperGrows):
(ArrayFromMapperDetaches.mapper):
(ArrayFromMapperDetaches):
(ArrayForEachReduceReduceRightShrinkMidIteration.CreateRabForTest):
(ArrayForEachReduceReduceRightShrinkMidIteration.CollectValuesAndResize):
(ArrayForEachReduceReduceRightShrinkMidIteration.ForEachHelper):
(ArrayForEachReduceReduceRightShrinkMidIteration.ReduceHelper):
(ArrayForEachReduceReduceRightShrinkMidIteration.ReduceRightHelper):
(ArrayForEachReduceReduceRightShrinkMidIteration):
(ArrayForEachReduceReduceRightDetachMidIteration.CreateRabForTest):
(ArrayForEachReduceReduceRightDetachMidIteration.CollectValuesAndDetach):
(ArrayForEachReduceReduceRightDetachMidIteration.ForEachHelper):
(ArrayForEachReduceReduceRightDetachMidIteration.ReduceHelper):
(ArrayForEachReduceReduceRightDetachMidIteration.ReduceRightHelper):
(ArrayForEachReduceReduceRightDetachMidIteration):
(FilterShrinkMidIteration.CreateRabForTest):
(FilterShrinkMidIteration.CollectValuesAndResize):
(FilterShrinkMidIteration):
(FilterDetachMidIteration.CreateRabForTest):
(FilterDetachMidIteration.CollectValuesAndDetach):
(FilterDetachMidIteration):
* JSTests/stress/v8-typedarray-resizablearraybuffer-atomics.js: Added.
(AtomicsWait):
(AtomicsWaitAsync):
(AtomicsFailWithNonIntegerArray):
(const.oneParameterFuncs):
(const.twoParameterFuncs):
(const.threeParameterFuncs):
(TestAtomicsParameterConversionShrinks):
* JSTests/stress/v8-typedarray-resizablearraybuffer-detach.js: Added.
(ConstructorThrowsIfBufferDetached):
(AccessDetachedTypedArray):
(LoadFromOutOfScopeTypedArrayWithFeedback.ReadElement2):
(LoadFromOutOfScopeTypedArrayWithFeedback):
(StoreToOutOfScopeTypedArrayWithFeedback.WriteElement2):
(StoreToOutOfScopeTypedArrayWithFeedback):
(FillParameterConversionDetaches):
(CopyWithinParameterConversionDetaches):
(EntriesKeysValues):
(CreateRabForTest):
(CollectValuesAndDetach):
(EveryDetachMidIteration):
(SomeDetachMidIteration):
(FindDetachMidIteration.CreateRabForTest):
(FindDetachMidIteration.CollectValuesAndDetach):
(FindDetachMidIteration):
(FindIndexDetachMidIteration.CreateRabForTest):
(FindIndexDetachMidIteration.CollectValuesAndDetach):
(FindIndexDetachMidIteration):
(FindLastDetachMidIteration.CreateRabForTest):
(FindLastDetachMidIteration.CollectValuesAndDetach):
(FindLastDetachMidIteration):
(FindLastIndexDetachMidIteration.CreateRabForTest):
(FindLastIndexDetachMidIteration.CollectValuesAndDetach):
(FindLastIndexDetachMidIteration):
(FilterDetachMidIteration.CreateRabForTest):
(FilterDetachMidIteration.CollectValuesAndDetach):
(FilterDetachMidIteration):
(ForEachReduceReduceRightDetachMidIteration.CreateRabForTest):
(ForEachReduceReduceRightDetachMidIteration.CollectValuesAndDetach):
(ForEachReduceReduceRightDetachMidIteration.ForEachHelper):
(ForEachReduceReduceRightDetachMidIteration.ReduceHelper):
(ForEachReduceReduceRightDetachMidIteration.ReduceRightHelper):
(ForEachReduceReduceRightDetachMidIteration):
(IncludesParameterConversionDetaches):
(IndexOfParameterConversionDetaches):
(LastIndexOfParameterConversionDetaches):
(JoinToLocaleString):
(JoinParameterConversionDetaches):
(ToLocaleStringNumberPrototypeToLocaleStringDetaches.Number.prototype.toLocaleString):
(ToLocaleStringNumberPrototypeToLocaleStringDetaches.BigInt.prototype.toLocaleString):
(ToLocaleStringNumberPrototypeToLocaleStringDetaches):
(Helper):
(MapDetachMidIteration):
(MapSpeciesCreateDetaches.CollectValues):
(MapSpeciesCreateDetaches.Helper):
(MapSpeciesCreateDetaches.MyArray):
(MapSpeciesCreateDetaches):
(SetSourceLengthGetterDetachesTarget.CreateRabForTest):
(SetSourceLengthGetterDetachesTarget.CreateSourceProxy):
(SetSourceLengthGetterDetachesTarget.get for):
(SetSourceLengthGetterDetachesTarget):
(SetDetachTargetMidIteration.CreateRabForTest):
(SetDetachTargetMidIteration.CreateSourceProxy):
(SetDetachTargetMidIteration.get for):
(SetDetachTargetMidIteration):
(Subarray):
(SubarrayParameterConversionDetaches.CreateRabForTest):
(SortCallbackDetaches.WriteUnsortedData):
(SortCallbackDetaches.CustomComparison):
(SortCallbackDetaches.AssertIsDetached):
(ObjectDefineProperty):
(FunctionApply.func):
(SliceParameterConversionDetaches):
(AtParameterConversionDetaches):
(TypedArrayFrom):
* JSTests/stress/v8-typedarray-resizablearraybuffer.js: Added.
(TypedArrayPrototype):
(TypedArrayLengthAndByteLength):
(ConstructInvalid):
(TypedArrayLengthWhenResizedOutOfBounds2):
(LengthTracking1):
(LengthTracking2):
(AccessOutOfBoundsTypedArray):
(OutOfBoundsTypedArrayAndHas):
(LoadFromOutOfBoundsTypedArrayWithFeedback.ReadElement2):
(LoadFromOutOfBoundsTypedArrayWithFeedback):
(HasAndOutOfBoundsTypedArrayWithFeedback.HasElement2):
(HasAndOutOfBoundsTypedArrayWithFeedback):
(HasWithOffsetsWithFeedback.GetElements):
(HasWithOffsetsWithFeedback):
(StoreToOutOfBoundsTypedArrayWithFeedback.WriteElement2):
(StoreToOutOfBoundsTypedArrayWithFeedback):
(OOBBehavesLikeDetached.ReadElement2):
(OOBBehavesLikeDetached.HasElement2):
(OOBBehavesLikeDetached):
(OOBBehavesLikeDetachedWithFeedback.ReadElement2):
(OOBBehavesLikeDetachedWithFeedback.HasElement2):
(OOBBehavesLikeDetachedWithFeedback):
(EnumerateElements):
(IterateTypedArray.TestIteration):
(IterateTypedArray):
(CreateRab):
(TestIterationAndResize):
(IterateTypedArrayAndGrowMidIteration):
(IterateTypedArrayAndGrowJustBeforeIterationWouldEnd):
(IterateTypedArrayAndShrinkMidIteration):
(IterateTypedArrayAndShrinkToZeroMidIteration):
(TestFill):
(FillParameterConversionResizes):
(At):
(AtParameterConversionResizes):
(Slice):
(SliceParameterConversionShrinks):
(SliceParameterConversionGrows):
(SliceSpeciesCreateResizes.MyArray):
(SliceSpeciesCreateResizes):
(TestCopyWithin):
(CopyWithinParameterConversionShrinks):
(CopyWithinParameterConversionGrows):
(EntriesKeysValues):
(CreateRabForTest):
(EntriesKeysValuesGrowMidIteration):
(EntriesKeysValuesShrinkMidIteration):
(div3):
(even):
(over10):
(EverySome):
(CollectValuesAndResize):
(EveryShrinkMidIteration):
(EveryGrowMidIteration.CreateRabForTest):
(EveryGrowMidIteration.CollectValuesAndResize):
(EveryGrowMidIteration):
(SomeShrinkMidIteration):
(SomeGrowMidIteration.CreateRabForTest):
(SomeGrowMidIteration.CollectValuesAndResize):
(SomeGrowMidIteration):
(isTwoOrFour):
(FindFindIndexFindLastFindLastIndex):
(FindShrinkMidIteration.CreateRabForTest):
(FindShrinkMidIteration.CollectValuesAndResize):
(FindShrinkMidIteration):
(FindGrowMidIteration.CreateRabForTest):
(FindGrowMidIteration.CollectValuesAndResize):
(FindGrowMidIteration):
(FindIndexShrinkMidIteration.CreateRabForTest):
(FindIndexShrinkMidIteration.CollectValuesAndResize):
(FindIndexShrinkMidIteration):
(FindIndexGrowMidIteration.CreateRabForTest):
(FindIndexGrowMidIteration.CollectValuesAndResize):
(FindIndexGrowMidIteration):
(FindLastShrinkMidIteration.CreateRabForTest):
(FindLastShrinkMidIteration.CollectValuesAndResize):
(FindLastShrinkMidIteration):
(FindLastGrowMidIteration.CreateRabForTest):
(FindLastGrowMidIteration.CollectValuesAndResize):
(FindLastGrowMidIteration):
(FindLastIndexShrinkMidIteration.CreateRabForTest):
(FindLastIndexShrinkMidIteration.CollectValuesAndResize):
(FindLastIndexShrinkMidIteration):
(FindLastIndexGrowMidIteration.CreateRabForTest):
(FindLastIndexGrowMidIteration.CollectValuesAndResize):
(FindLastIndexGrowMidIteration):
(isEven):
(Filter):
(FilterShrinkMidIteration.CreateRabForTest):
(FilterShrinkMidIteration.CollectValuesAndResize):
(FilterShrinkMidIteration):
(FilterGrowMidIteration.CreateRabForTest):
(FilterGrowMidIteration.CollectValuesAndResize):
(FilterGrowMidIteration):
(Helper):
(ForEachReduceReduceRight):
(ForEachReduceReduceRightShrinkMidIteration.CreateRabForTest):
(ForEachReduceReduceRightShrinkMidIteration.CollectValuesAndResize):
(ForEachReduceReduceRightShrinkMidIteration.ForEachHelper):
(ForEachReduceReduceRightShrinkMidIteration.ReduceHelper):
(ForEachReduceReduceRightShrinkMidIteration.ReduceRightHelper):
(ForEachReduceReduceRightShrinkMidIteration):
(ForEachHelper):
(ReduceHelper):
(ReduceRightHelper):
(ForEachReduceReduceRightGrowMidIteration):
(Includes):
(IncludesParameterConversionResizes):
(IncludesSpecialValues):
(IndexOfLastIndexOf):
(IndexOfParameterConversionShrinks):
(LastIndexOfParameterConversionShrinks):
(IndexOfParameterConversionGrows):
(LastIndexOfParameterConversionGrows):
(IndexOfLastIndexOfSpecialValues):
(JoinToLocaleString):
(JoinParameterConversionShrinks):
(JoinParameterConversionGrows):
(ToLocaleStringNumberPrototypeToLocaleStringShrinks.Number.prototype.toLocaleString):
(ToLocaleStringNumberPrototypeToLocaleStringShrinks.BigInt.prototype.toLocaleString):
(ToLocaleStringNumberPrototypeToLocaleStringShrinks):
(ToLocaleStringNumberPrototypeToLocaleStringGrows.Number.prototype.toLocaleString):
(ToLocaleStringNumberPrototypeToLocaleStringGrows.BigInt.prototype.toLocaleString):
(ToLocaleStringNumberPrototypeToLocaleStringGrows):
(TestMap):
(MapShrinkMidIteration):
(MapGrowMidIteration.CreateRabForTest):
(MapGrowMidIteration.CollectValuesAndResize):
(MapGrowMidIteration.Helper):
(MapGrowMidIteration):
(MapSpeciesCreateShrinks.CollectValues):
(MapSpeciesCreateShrinks.Helper):
(MapSpeciesCreateShrinks.MyArray):
(MapSpeciesCreateShrinks):
(MapSpeciesCreateGrows.CollectValues):
(MapSpeciesCreateGrows.Helper):
(MapSpeciesCreateGrows.MyArray):
(MapSpeciesCreateGrows):
(WriteData):
(Reverse):
(SetWithResizableTarget.get SetHelper):
(SetWithResizableTarget):
(SetSourceLengthGetterShrinksTarget.CreateRabForTest):
(SetSourceLengthGetterShrinksTarget.CreateSourceProxy):
(SetSourceLengthGetterShrinksTarget.get for):
(SetSourceLengthGetterShrinksTarget):
(SetSourceLengthGetterGrowsTarget.CreateRabForTest):
(SetSourceLengthGetterGrowsTarget.CreateSourceProxy):
(SetSourceLengthGetterGrowsTarget.get for):
(SetSourceLengthGetterGrowsTarget):
(SetShrinkTargetMidIteration.CreateRabForTest):
(SetShrinkTargetMidIteration.CreateSourceProxy):
(SetShrinkTargetMidIteration.get for):
(SetShrinkTargetMidIteration):
(SetGrowTargetMidIteration.CreateRabForTest):
(SetGrowTargetMidIteration.CreateSourceProxy):
(SetGrowTargetMidIteration.get for):
(SetGrowTargetMidIteration):
(SetWithResizableSource):
(Subarray):
(SubarrayParameterConversionShrinks.CreateRabForTest):
(SubarrayParameterConversionShrinks):
(SubarrayParameterConversionGrows.CreateRabForTest):
(SortWithDefaultComparison.WriteUnsortedData):
(SortWithDefaultComparison):
(ArraySortWithDefaultComparison.WriteUnsortedData):
(ArraySortWithDefaultComparison):
(WriteUnsortedData):
(CustomComparison):
(SortWithCustomComparison):
(SortCallbackShrinks.WriteUnsortedData):
(SortCallbackShrinks.CustomComparison):
(SortCallbackShrinks):
(SortCallbackGrows.WriteUnsortedData):
(SortCallbackGrows.CustomComparison):
(SortCallbackGrows):
(ObjectDefinePropertyDefineProperties):
(ObjectDefinePropertyParameterConversionShrinks):
(ObjectFreeze):
(FunctionApply.func):
(FunctionApply):
(TypedArrayFrom):
* JSTests/test262/expectations.yaml:
* LayoutTests/js/dom/resizable-array-buffer-should-be-rejected-by-default-expected.txt: Added.
* LayoutTests/js/dom/resizable-array-buffer-should-be-rejected-by-default.html: Added.
* Source/JavaScriptCore/builtins/BuiltinNames.h:
* Source/JavaScriptCore/builtins/TypedArrayPrototype.js:
(linkTimeConstant.typedArrayMerge):
(linkTimeConstant.typedArrayMergeSort):
(toLocaleString):
* Source/JavaScriptCore/bytecode/LinkTimeConstant.h:
* Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::handleIntrinsicCall):
* Source/JavaScriptCore/dfg/DFGSSALoweringPhase.cpp:
(JSC::DFG::SSALoweringPhase::handleNode):
(JSC::DFG::SSALoweringPhase::lowerBoundsCheck):
* Source/JavaScriptCore/llint/LowLevelInterpreter.asm:
* Source/JavaScriptCore/runtime/ArrayBuffer.cpp:
(JSC::tryAllocate):
(JSC::tryAllocateResizableMemory):
(JSC::ArrayBufferContents::tryAllocate):
(JSC::ArrayBufferContents::makeShared):
(JSC::ArrayBufferContents::copyTo):
(JSC::ArrayBufferContents::shareWith):
(JSC::ArrayBuffer::tryCreate):
(JSC::ArrayBuffer::transferTo):
(JSC::ArrayBuffer::detach):
(JSC::ArrayBuffer::grow):
(JSC::ArrayBuffer::resize):
(JSC::ArrayBuffer::tryCreateShared):
(JSC::SharedArrayBufferContents::grow):
* Source/JavaScriptCore/runtime/ArrayBuffer.h:
* Source/JavaScriptCore/runtime/BufferMemoryHandle.h:
* Source/JavaScriptCore/runtime/CommonIdentifiers.h:
* Source/JavaScriptCore/runtime/GenericTypedArrayViewInlines.h:
(JSC::GenericTypedArrayView<Adaptor>::tryCreate):
* Source/JavaScriptCore/runtime/JSArrayBuffer.h:
(JSC::JSArrayBuffer::toWrapped):
(JSC::JSArrayBuffer::toWrappedAllowShared):
* Source/JavaScriptCore/runtime/JSArrayBufferConstructor.cpp:
(JSC::JSGenericArrayBufferConstructor<sharingMode>::constructImpl):
* Source/JavaScriptCore/runtime/JSArrayBufferPrototype.cpp:
(JSC::arrayBufferSlice):
(JSC::JSC_DEFINE_HOST_FUNCTION):
(JSC::JSArrayBufferPrototype::finishCreation):
* Source/JavaScriptCore/runtime/JSArrayBufferViewInlines.h:
(JSC::JSArrayBufferView::toWrapped):
(JSC::JSArrayBufferView::toWrappedAllowShared):
* Source/JavaScriptCore/runtime/JSDataView.cpp:
(JSC::JSDataView::create):
* Source/JavaScriptCore/runtime/JSGenericTypedArrayView.h:
(JSC::JSGenericTypedArrayView<Adaptor>::toWrapped):
(JSC::JSGenericTypedArrayView<Adaptor>::toWrappedAllowShared):
* Source/JavaScriptCore/runtime/JSGenericTypedArrayViewConstructorInlines.h:
(JSC::constructGenericTypedArrayViewWithArguments):
* Source/JavaScriptCore/runtime/JSGenericTypedArrayViewInlines.h:
(JSC::JSGenericTypedArrayView<Adaptor>::create):
(JSC::JSGenericTypedArrayView<Adaptor>::setFromArrayLike):
* Source/JavaScriptCore/runtime/JSGenericTypedArrayViewPrototypeFunctions.h:
(JSC::genericTypedArrayViewProtoFuncSet):
(JSC::genericTypedArrayViewProtoFuncIncludes):
(JSC::genericTypedArrayViewProtoFuncIndexOf):
(JSC::genericTypedArrayViewProtoFuncSlice):
(JSC::genericTypedArrayViewProtoFuncSubarray):
(JSC::genericTypedArrayViewProtoFuncWith):
* Source/JavaScriptCore/runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::init):
* Source/JavaScriptCore/runtime/JSTypedArrayViewPrototype.cpp:
(JSC::JSC_DEFINE_HOST_FUNCTION):
* Source/JavaScriptCore/runtime/JSTypedArrayViewPrototype.h:
* Source/JavaScriptCore/wasm/WasmMemory.cpp:
(JSC::Wasm::Memory::grow):
* Source/WebCore/testing/Internals.cpp:
(WebCore::Internals::acceptTypedArrays):
* Source/WebCore/testing/Internals.h:
* Source/WebCore/testing/Internals.idl:

Canonical link: https://commits.webkit.org/256826@main
  • Loading branch information
Constellation committed Nov 18, 2022
1 parent 3894c75 commit 973ef455ada1b7080aaff3f35aa9355bdb0780e0
Show file tree
Hide file tree
Showing 52 changed files with 19,216 additions and 726 deletions.
@@ -0,0 +1,13 @@
//@ requireOptions("--useResizableArrayBuffer=1")
function shouldBe(actual, expected) {
if (actual !== expected)
throw new Error('bad value: ' + actual);
}

var buf = new ArrayBuffer(42, { maxByteLength: 128 << 10 });
shouldBe(buf.resizable, true);
shouldBe(buf.byteLength, 42);
buf.resize(0);
shouldBe(buf.byteLength, 0);
buf.resize(32 << 10);
shouldBe(buf.byteLength, 32 << 10);

0 comments on commit 973ef45

Please sign in to comment.