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 // This file relies on the fact that the following declaration has been made | 7 // This file relies on the fact that the following declaration has been made |
8 // in runtime.js: | 8 // in runtime.js: |
9 // var $Array = global.Array; | 9 // var $Array = global.Array; |
10 | 10 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 var array = IS_SPEC_FUNCTION(constructor) ? new constructor(length) : []; | 135 var array = IS_SPEC_FUNCTION(constructor) ? new constructor(length) : []; |
136 for (var i = 0; i < length; i++) { | 136 for (var i = 0; i < length; i++) { |
137 %AddElement(array, i, %_Arguments(i), NONE); | 137 %AddElement(array, i, %_Arguments(i), NONE); |
138 } | 138 } |
139 array.length = length; | 139 array.length = length; |
140 return array; | 140 return array; |
141 } | 141 } |
142 | 142 |
143 // ------------------------------------------------------------------- | 143 // ------------------------------------------------------------------- |
144 | 144 |
| 145 function HarmonyArrayExtendSymbolPrototype() { |
| 146 %CheckIsBootstrapping(); |
| 147 |
| 148 InstallConstants($Symbol, $Array( |
| 149 // TODO(dslomov, caitp): Move to symbol.js when shipping |
| 150 "isConcatSpreadable", symbolIsConcatSpreadable |
| 151 )); |
| 152 } |
| 153 |
| 154 HarmonyArrayExtendSymbolPrototype(); |
| 155 |
145 function HarmonyArrayExtendArrayPrototype() { | 156 function HarmonyArrayExtendArrayPrototype() { |
146 %CheckIsBootstrapping(); | 157 %CheckIsBootstrapping(); |
147 | 158 |
148 // Set up non-enumerable functions on the Array object. | 159 // Set up non-enumerable functions on the Array object. |
149 InstallFunctions($Array, DONT_ENUM, $Array( | 160 InstallFunctions($Array, DONT_ENUM, $Array( |
150 "of", ArrayOf | 161 "of", ArrayOf |
151 )); | 162 )); |
152 | 163 |
153 // Set up the non-enumerable functions on the Array prototype object. | 164 // Set up the non-enumerable functions on the Array prototype object. |
154 InstallFunctions($Array.prototype, DONT_ENUM, $Array( | 165 InstallFunctions($Array.prototype, DONT_ENUM, $Array( |
155 "find", ArrayFind, | 166 "find", ArrayFind, |
156 "findIndex", ArrayFindIndex, | 167 "findIndex", ArrayFindIndex, |
157 "fill", ArrayFill | 168 "fill", ArrayFill |
158 )); | 169 )); |
159 } | 170 } |
160 | 171 |
161 HarmonyArrayExtendArrayPrototype(); | 172 HarmonyArrayExtendArrayPrototype(); |
OLD | NEW |