OLD | NEW |
---|---|
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 // This files contains runtime support implemented in JavaScript. | 5 // This files contains runtime support implemented in JavaScript. |
6 | 6 |
7 // CAUTION: Some of the functions specified in this file are called | 7 // CAUTION: Some of the functions specified in this file are called |
8 // directly from compiled code. These are the functions with names in | 8 // directly from compiled code. These are the functions with names in |
9 // ALL CAPS. The compiled code passes the first argument in 'this'. | 9 // ALL CAPS. The compiled code passes the first argument in 'this'. |
10 | 10 |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
203 /* --------------------------------- | 203 /* --------------------------------- |
204 - - - U t i l i t i e s - - - | 204 - - - U t i l i t i e s - - - |
205 --------------------------------- | 205 --------------------------------- |
206 */ | 206 */ |
207 | 207 |
208 | 208 |
209 // This function should be called rather than %AddElement in contexts where the | 209 // This function should be called rather than %AddElement in contexts where the |
210 // argument might not be less than 2**32-1. ES2015 ToLength semantics mean that | 210 // argument might not be less than 2**32-1. ES2015 ToLength semantics mean that |
211 // this is a concern at basically all callsites. | 211 // this is a concern at basically all callsites. |
212 function AddIndexedProperty(obj, index, value) { | 212 function AddIndexedProperty(obj, index, value) { |
213 if (index === TO_UINT32(index)) { | 213 if (index < kMaxUint32) { |
Jakob Kummerow
2015/10/30 09:38:05
How do you guarantee that index >= 0?
| |
214 %AddElement(obj, index, value); | 214 %AddElement(obj, index, value); |
215 } else { | 215 } else { |
216 %AddNamedProperty(obj, TO_STRING(index), value, NONE); | 216 %AddNamedProperty(obj, TO_STRING(index), value, NONE); |
217 } | 217 } |
218 } | 218 } |
219 %SetForceInlineFlag(AddIndexedProperty); | 219 %SetForceInlineFlag(AddIndexedProperty); |
220 | 220 |
221 | 221 |
222 // ES6, draft 10-14-14, section 22.1.3.1.1 | 222 // ES6, draft 10-14-14, section 22.1.3.1.1 |
223 function IsConcatSpreadable(O) { | 223 function IsConcatSpreadable(O) { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
274 "concat_iterable_to_array_builtin", CONCAT_ITERABLE_TO_ARRAY, | 274 "concat_iterable_to_array_builtin", CONCAT_ITERABLE_TO_ARRAY, |
275 "reflect_apply_prepare_builtin", REFLECT_APPLY_PREPARE, | 275 "reflect_apply_prepare_builtin", REFLECT_APPLY_PREPARE, |
276 "reflect_construct_prepare_builtin", REFLECT_CONSTRUCT_PREPARE, | 276 "reflect_construct_prepare_builtin", REFLECT_CONSTRUCT_PREPARE, |
277 ]); | 277 ]); |
278 | 278 |
279 %InstallToContext([ | 279 %InstallToContext([ |
280 "concat_iterable_to_array", ConcatIterableToArray, | 280 "concat_iterable_to_array", ConcatIterableToArray, |
281 ]); | 281 ]); |
282 | 282 |
283 }) | 283 }) |
OLD | NEW |