Changeset 267549 in webkit
- Timestamp:
- Sep 24, 2020, 3:05:31 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
-
JSTests/ChangeLog (modified) (1 diff)
-
JSTests/stress/typedarray-slice.js (modified) (1 diff)
-
JSTests/test262/expectations.yaml (modified) (2 diffs)
-
Source/JavaScriptCore/ChangeLog (modified) (1 diff)
-
Source/JavaScriptCore/builtins/TypedArrayPrototype.js (modified) (2 diffs)
-
Source/JavaScriptCore/runtime/JSGenericTypedArrayViewPrototypeFunctions.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r267522 r267549 1 2020-09-24 Ross Kirsling <ross.kirsling@sony.com> 2 3 %TypedArray%.prototype.{map, filter} should perform TypedArraySpeciesCreate correctly 4 https://bugs.webkit.org/show_bug.cgi?id=216938 5 6 Reviewed by Yusuke Suzuki. 7 8 * stress/typedarray-slice.js: 9 Fix test. 10 11 * test262/expectations.yaml: 12 Mark ten test cases as passing. 13 1 14 2020-09-24 Ross Kirsling <ross.kirsling@sony.com> 2 15 -
trunk/JSTests/stress/typedarray-slice.js
r264304 r267549 115 115 function testSpeciesWithSameBuffer(unused, constructor) { 116 116 return typedArrays.every(function(speciesConstructor) { 117 // This test is not valid for all type pairs. 118 if (constructor.BYTES_PER_ELEMENT < speciesConstructor.BYTES_PER_ELEMENT) 119 return true; 120 117 121 constructor[Symbol.species] = function() { return new speciesConstructor(buffer); }; 118 122 let array = new constructor(buffer); -
trunk/JSTests/test262/expectations.yaml
r267522 r267549 1246 1246 test/built-ins/ThrowTypeError/unique-per-realm-non-simple.js: 1247 1247 default: 'Test262Error: callee.get Expected SameValue(«function () {' 1248 test/built-ins/TypedArray/prototype/filter/speciesctor-get-ctor-returns-throws.js:1249 default: 'Test262Error: 42 Expected a TypeError to be thrown but no exception was thrown at all (Testing with Float64Array.)'1250 strict mode: 'Test262Error: 42 Expected a TypeError to be thrown but no exception was thrown at all (Testing with Float64Array.)'1251 test/built-ins/TypedArray/prototype/filter/speciesctor-get-species-custom-ctor-length-throws.js:1252 default: 'Test262Error: Expected a TypeError to be thrown but no exception was thrown at all (Testing with Float64Array.)'1253 strict mode: 'Test262Error: Expected a TypeError to be thrown but no exception was thrown at all (Testing with Float64Array.)'1254 test/built-ins/TypedArray/prototype/map/speciesctor-get-ctor-returns-throws.js:1255 default: 'Test262Error: 42 Expected a TypeError to be thrown but no exception was thrown at all (Testing with Float64Array.)'1256 strict mode: 'Test262Error: 42 Expected a TypeError to be thrown but no exception was thrown at all (Testing with Float64Array.)'1257 test/built-ins/TypedArray/prototype/map/speciesctor-get-species-custom-ctor-length-throws.js:1258 default: 'Test262Error: Expected a TypeError to be thrown but no exception was thrown at all (Testing with Float64Array.)'1259 strict mode: 'Test262Error: Expected a TypeError to be thrown but no exception was thrown at all (Testing with Float64Array.)'1260 1248 test/built-ins/TypedArray/prototype/slice/detached-buffer-zero-count-custom-ctor-other-targettype.js: 1261 1249 default: 'TypeError: Underlying ArrayBuffer has been detached from the view (Testing with Float64Array.)' … … 1264 1252 default: 'TypeError: Underlying ArrayBuffer has been detached from the view (Testing with Float64Array.)' 1265 1253 strict mode: 'TypeError: Underlying ArrayBuffer has been detached from the view (Testing with Float64Array.)' 1266 test/built-ins/TypedArray/prototype/slice/speciesctor-get-species-custom-ctor-length-throws.js:1267 default: 'Test262Error: Expected a TypeError to be thrown but no exception was thrown at all (Testing with Float64Array.)'1268 strict mode: 'Test262Error: Expected a TypeError to be thrown but no exception was thrown at all (Testing with Float64Array.)'1269 1254 test/built-ins/TypedArray/prototype/sort/comparefn-nonfunction-call-throws.js: 1270 1255 default: 'Test262Error: Expected a TypeError to be thrown but no exception was thrown at all (Testing with Float64Array.)' -
trunk/Source/JavaScriptCore/ChangeLog
r267538 r267549 1 2020-09-24 Ross Kirsling <ross.kirsling@sony.com> 2 3 %TypedArray% methods should perform TypedArraySpeciesCreate correctly 4 https://bugs.webkit.org/show_bug.cgi?id=216938 5 6 Reviewed by Yusuke Suzuki. 7 8 map, filter, and slice are obliged to throw when: 9 1. this.constructor is defined but not an object 10 2. the species constructor produces a valid typed array which is shorter than the expected length 11 12 * builtins/TypedArrayPrototype.js: 13 (map): 14 (filter): 15 * runtime/JSGenericTypedArrayViewPrototypeFunctions.h: 16 (JSC::genericTypedArrayViewProtoFuncSlice): 17 1 18 2020-09-24 Basuke Suzuki <basuke.suzuki@sony.com> 2 19 -
trunk/Source/JavaScriptCore/builtins/TypedArrayPrototype.js
r267522 r267549 312 312 var thisArg = @argument(1); 313 313 314 // Do species construction 315 var constructor = this.constructor; 316 var result; 317 if (constructor === @undefined) 318 result = new (@typedArrayGetOriginalConstructor(this))(length); 319 else { 320 var speciesConstructor = constructor.@@species; 321 if (@isUndefinedOrNull(speciesConstructor)) 322 result = new (@typedArrayGetOriginalConstructor(this))(length); 323 else { 324 result = new speciesConstructor(length); 325 // typedArrayLength throws if it doesn't get a view. 326 @typedArrayLength(result); 327 } 328 } 314 var constructor = @typedArraySpeciesConstructor(this); 315 var result = new constructor(length); 316 if (@typedArrayLength(result) < length) 317 @throwTypeError("TypedArray.prototype.map constructed typed array of insufficient length"); 329 318 330 319 for (var i = 0; i < length; i++) { … … 352 341 kept.@push(value); 353 342 } 354 355 var constructor = this.constructor; 356 var result; 357 var resultLength = kept.length; 358 if (constructor === @undefined) 359 result = new (@typedArrayGetOriginalConstructor(this))(resultLength); 360 else { 361 var speciesConstructor = constructor.@@species; 362 if (@isUndefinedOrNull(speciesConstructor)) 363 result = new (@typedArrayGetOriginalConstructor(this))(resultLength); 364 else { 365 result = new speciesConstructor(resultLength); 366 // typedArrayLength throws if it doesn't get a view. 367 @typedArrayLength(result); 368 } 369 } 370 371 for (var i = 0; i < kept.length; i++) 343 var length = kept.length; 344 345 var constructor = @typedArraySpeciesConstructor(this); 346 var result = new constructor(length); 347 if (@typedArrayLength(result) < length) 348 @throwTypeError("TypedArray.prototype.filter constructed typed array of insufficient length"); 349 350 for (var i = 0; i < length; i++) 372 351 result[i] = kept[i]; 373 352 -
trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewPrototypeFunctions.h
r263944 r267549 465 465 466 466 // The species constructor may return an array with any arbitrary length. 467 length = std::min(length, result->length()); 467 if (result->length() < length) 468 return throwVMTypeError(globalObject, scope, "TypedArray.prototype.slice constructed typed array of insufficient length"_s); 469 468 470 switch (result->classInfo(vm)->typedArrayStorageType) { 469 471 case TypeInt8:
Note:
See TracChangeset
for help on using the changeset viewer.