Changeset 181871 in webkit
- Timestamp:
- Mar 23, 2015, 2:37:53 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 6 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/js/Object-getOwnPropertyNames-expected.txt (modified) (1 diff)
-
LayoutTests/js/array-includes-expected.txt (added)
-
LayoutTests/js/array-includes.html (added)
-
LayoutTests/js/script-tests/Object-getOwnPropertyNames.js (modified) (1 diff)
-
LayoutTests/js/script-tests/array-includes.js (added)
-
Source/JavaScriptCore/ChangeLog (modified) (1 diff)
-
Source/JavaScriptCore/builtins/Array.prototype.js (modified) (1 diff)
-
Source/JavaScriptCore/runtime/ArrayPrototype.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r181868 r181871 1 2015-03-23 Dean Jackson <dino@apple.com> 2 3 ES7: Implement Array.prototype.includes 4 https://bugs.webkit.org/show_bug.cgi?id=142707 5 6 Reviewed by Geoffrey Garen. 7 8 * js/array-includes-expected.txt: Added. 9 * js/array-includes.html: Added. 10 * js/script-tests/array-includes.js: Added. 11 * js/script-tests/Object-getOwnPropertyNames.js: Add 'includes'. 12 * js/Object-getOwnPropertyNames-expected.txt: Add 'includes'. 13 1 14 2015-03-23 Joseph Pecoraro <pecoraro@apple.com> 2 15 -
trunk/LayoutTests/js/Object-getOwnPropertyNames-expected.txt
r180370 r181871 46 46 PASS getSortedOwnPropertyNames(Function.prototype) is ['apply', 'bind', 'call', 'constructor', 'length', 'name', 'toString'] 47 47 PASS getSortedOwnPropertyNames(Array) is ['from', 'isArray', 'length', 'name', 'of', 'prototype'] 48 PASS getSortedOwnPropertyNames(Array.prototype) is ['concat', 'constructor', 'entries', 'every', 'fill', 'filter', 'find', 'findIndex', 'forEach', 'in dexOf', 'join', 'keys', 'lastIndexOf', 'length', 'map', 'pop', 'push', 'reduce', 'reduceRight', 'reverse', 'shift', 'slice', 'some', 'sort', 'splice', 'toLocaleString', 'toString', 'unshift']48 PASS getSortedOwnPropertyNames(Array.prototype) is ['concat', 'constructor', 'entries', 'every', 'fill', 'filter', 'find', 'findIndex', 'forEach', 'includes', 'indexOf', 'join', 'keys', 'lastIndexOf', 'length', 'map', 'pop', 'push', 'reduce', 'reduceRight', 'reverse', 'shift', 'slice', 'some', 'sort', 'splice', 'toLocaleString', 'toString', 'unshift'] 49 49 PASS getSortedOwnPropertyNames(String) is ['fromCharCode', 'length', 'name', 'prototype'] 50 50 PASS getSortedOwnPropertyNames(String.prototype) is ['anchor', 'big', 'blink', 'bold', 'charAt', 'charCodeAt', 'concat', 'constructor', 'endsWith', 'fixed', 'fontcolor', 'fontsize', 'includes', 'indexOf', 'italics', 'lastIndexOf', 'length', 'link', 'localeCompare', 'match', 'repeat', 'replace', 'search', 'slice', 'small', 'split', 'startsWith', 'strike', 'sub', 'substr', 'substring', 'sup', 'toLocaleLowerCase', 'toLocaleUpperCase', 'toLowerCase', 'toString', 'toUpperCase', 'trim', 'trimLeft', 'trimRight', 'valueOf'] -
trunk/LayoutTests/js/script-tests/Object-getOwnPropertyNames.js
r180370 r181871 54 54 "Function.prototype": "['apply', 'bind', 'call', 'constructor', 'length', 'name', 'toString']", 55 55 "Array": "['from', 'isArray', 'length', 'name', 'of', 'prototype']", 56 "Array.prototype": "['concat', 'constructor', 'entries', 'every', 'fill', 'filter', 'find', 'findIndex', 'forEach', 'in dexOf', 'join', 'keys', 'lastIndexOf', 'length', 'map', 'pop', 'push', 'reduce', 'reduceRight', 'reverse', 'shift', 'slice', 'some', 'sort', 'splice', 'toLocaleString', 'toString', 'unshift']",56 "Array.prototype": "['concat', 'constructor', 'entries', 'every', 'fill', 'filter', 'find', 'findIndex', 'forEach', 'includes', 'indexOf', 'join', 'keys', 'lastIndexOf', 'length', 'map', 'pop', 'push', 'reduce', 'reduceRight', 'reverse', 'shift', 'slice', 'some', 'sort', 'splice', 'toLocaleString', 'toString', 'unshift']", 57 57 "String": "['fromCharCode', 'length', 'name', 'prototype']", 58 58 "String.prototype": "['anchor', 'big', 'blink', 'bold', 'charAt', 'charCodeAt', 'concat', 'constructor', 'endsWith', 'fixed', 'fontcolor', 'fontsize', 'includes', 'indexOf', 'italics', 'lastIndexOf', 'length', 'link', 'localeCompare', 'match', 'repeat', 'replace', 'search', 'slice', 'small', 'split', 'startsWith', 'strike', 'sub', 'substr', 'substring', 'sup', 'toLocaleLowerCase', 'toLocaleUpperCase', 'toLowerCase', 'toString', 'toUpperCase', 'trim', 'trimLeft', 'trimRight', 'valueOf']", -
trunk/Source/JavaScriptCore/ChangeLog
r181868 r181871 1 2015-03-23 Dean Jackson <dino@apple.com> 2 3 ES7: Implement Array.prototype.includes 4 https://bugs.webkit.org/show_bug.cgi?id=142707 5 6 Reviewed by Geoffrey Garen. 7 8 Add support for the ES7 includes method on Arrays. 9 https://github.com/tc39/Array.prototype.includes 10 11 * builtins/Array.prototype.js: 12 (includes): Implementation in JS. 13 * runtime/ArrayPrototype.cpp: Add 'includes' to the lookup table. 14 1 15 2015-03-23 Joseph Pecoraro <pecoraro@apple.com> 2 16 -
trunk/Source/JavaScriptCore/builtins/Array.prototype.js
r169162 r181871 237 237 return -1; 238 238 } 239 240 function includes(searchElement /*, fromIndex*/) { 241 "use strict"; 242 if (this === null) 243 throw new @TypeError("Array.prototype.includes requires that |this| not be null"); 244 245 if (this === undefined) 246 throw new @TypeError("Array.prototype.includes requires that |this| not be undefined"); 247 248 var array = @Object(this); 249 var length = array.length >>> 0; 250 251 if (length === 0) 252 return false; 253 254 var fromIndex = 0; 255 if (arguments.length > 1 && arguments[1] !== undefined) 256 fromIndex = arguments[1] | 0; 257 258 var index; 259 if (fromIndex >= 0) 260 index = fromIndex; 261 else 262 index = length + fromIndex; 263 264 if (index < 0) 265 index = 0; 266 267 var currentElement; 268 for (; index < length; ++index) { 269 currentElement = array[index]; 270 // Use SameValueZero comparison, rather than just StrictEquals. 271 if (searchElement === currentElement || (searchElement !== searchElement && currentElement !== currentElement)) 272 return true; 273 } 274 return false; 275 } -
trunk/Source/JavaScriptCore/runtime/ArrayPrototype.cpp
r180506 r181871 118 118 find arrayProtoFuncFind DontEnum|Function 1 119 119 findIndex arrayProtoFuncFindIndex DontEnum|Function 1 120 includes arrayProtoFuncIncludes DontEnum|Function 1 120 121 @end 121 122 */
Note:
See TracChangeset
for help on using the changeset viewer.