Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Side by Side Diff: src/js/runtime.js

Issue 1431503002: Avoid creating indexed elements at index maxUint32 (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Use Jakob's suggestion for a more robust check Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/js/macros.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 === TO_UINT32(index) && index !== kMaxUint32) {
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
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 })
OLDNEW
« no previous file with comments | « src/js/macros.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698