| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 "use strict"; | 5 "use strict"; |
| 6 | 6 |
| 7 | 7 |
| 8 // This file relies on the fact that the following declaration has been made | 8 // This file relies on the fact that the following declaration has been made |
| 9 // in runtime.js: | 9 // in runtime.js: |
| 10 // var $Array = global.Array; | 10 // var $Array = global.Array; |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 return CreateArrayIterator(this, ITERATOR_KIND_KEYS); | 99 return CreateArrayIterator(this, ITERATOR_KIND_KEYS); |
| 100 } | 100 } |
| 101 | 101 |
| 102 | 102 |
| 103 function SetUpArrayIterator() { | 103 function SetUpArrayIterator() { |
| 104 %CheckIsBootstrapping(); | 104 %CheckIsBootstrapping(); |
| 105 | 105 |
| 106 %FunctionSetPrototype(ArrayIterator, new $Object()); | 106 %FunctionSetPrototype(ArrayIterator, new $Object()); |
| 107 %FunctionSetInstanceClassName(ArrayIterator, 'Array Iterator'); | 107 %FunctionSetInstanceClassName(ArrayIterator, 'Array Iterator'); |
| 108 | 108 |
| 109 InstallFunctions(ArrayIterator.prototype, DONT_ENUM, $Array( | 109 InstallFunctions(ArrayIterator.prototype, DONT_ENUM, [ |
| 110 'next', ArrayIteratorNext | 110 'next', ArrayIteratorNext |
| 111 )); | 111 ]); |
| 112 %FunctionSetName(ArrayIteratorIterator, '[Symbol.iterator]'); | 112 %FunctionSetName(ArrayIteratorIterator, '[Symbol.iterator]'); |
| 113 %AddNamedProperty(ArrayIterator.prototype, symbolIterator, | 113 %AddNamedProperty(ArrayIterator.prototype, symbolIterator, |
| 114 ArrayIteratorIterator, DONT_ENUM); | 114 ArrayIteratorIterator, DONT_ENUM); |
| 115 %AddNamedProperty(ArrayIterator.prototype, symbolToStringTag, | 115 %AddNamedProperty(ArrayIterator.prototype, symbolToStringTag, |
| 116 "Array Iterator", READ_ONLY | DONT_ENUM); | 116 "Array Iterator", READ_ONLY | DONT_ENUM); |
| 117 } | 117 } |
| 118 SetUpArrayIterator(); | 118 SetUpArrayIterator(); |
| 119 | 119 |
| 120 | 120 |
| 121 function ExtendArrayPrototype() { | 121 function ExtendArrayPrototype() { |
| 122 %CheckIsBootstrapping(); | 122 %CheckIsBootstrapping(); |
| 123 | 123 |
| 124 InstallFunctions($Array.prototype, DONT_ENUM, $Array( | 124 InstallFunctions($Array.prototype, DONT_ENUM, [ |
| 125 // No 'values' since it breaks webcompat: http://crbug.com/409858 | 125 // No 'values' since it breaks webcompat: http://crbug.com/409858 |
| 126 'entries', ArrayEntries, | 126 'entries', ArrayEntries, |
| 127 'keys', ArrayKeys | 127 'keys', ArrayKeys |
| 128 )); | 128 ]); |
| 129 | 129 |
| 130 %AddNamedProperty($Array.prototype, symbolIterator, ArrayValues, DONT_ENUM); | 130 %AddNamedProperty($Array.prototype, symbolIterator, ArrayValues, DONT_ENUM); |
| 131 } | 131 } |
| 132 ExtendArrayPrototype(); | 132 ExtendArrayPrototype(); |
| 133 | 133 |
| 134 | 134 |
| 135 function ExtendTypedArrayPrototypes() { | 135 function ExtendTypedArrayPrototypes() { |
| 136 %CheckIsBootstrapping(); | 136 %CheckIsBootstrapping(); |
| 137 | 137 |
| 138 macro TYPED_ARRAYS(FUNCTION) | 138 macro TYPED_ARRAYS(FUNCTION) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 150 macro EXTEND_TYPED_ARRAY(NAME) | 150 macro EXTEND_TYPED_ARRAY(NAME) |
| 151 %AddNamedProperty($NAME.prototype, 'entries', ArrayEntries, DONT_ENUM); | 151 %AddNamedProperty($NAME.prototype, 'entries', ArrayEntries, DONT_ENUM); |
| 152 %AddNamedProperty($NAME.prototype, 'values', ArrayValues, DONT_ENUM); | 152 %AddNamedProperty($NAME.prototype, 'values', ArrayValues, DONT_ENUM); |
| 153 %AddNamedProperty($NAME.prototype, 'keys', ArrayKeys, DONT_ENUM); | 153 %AddNamedProperty($NAME.prototype, 'keys', ArrayKeys, DONT_ENUM); |
| 154 %AddNamedProperty($NAME.prototype, symbolIterator, ArrayValues, DONT_ENUM); | 154 %AddNamedProperty($NAME.prototype, symbolIterator, ArrayValues, DONT_ENUM); |
| 155 endmacro | 155 endmacro |
| 156 | 156 |
| 157 TYPED_ARRAYS(EXTEND_TYPED_ARRAY) | 157 TYPED_ARRAYS(EXTEND_TYPED_ARRAY) |
| 158 } | 158 } |
| 159 ExtendTypedArrayPrototypes(); | 159 ExtendTypedArrayPrototypes(); |
| OLD | NEW |