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

Side by Side Diff: src/array.js

Issue 678753002: SimpleMove now calls [[Has]] before [[Get]] when moving elements (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 2 months 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-3643.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 declarations have been made 7 // This file relies on the fact that the following declarations have been made
8 // in runtime.js: 8 // in runtime.js:
9 // var $Array = global.Array; 9 // var $Array = global.Array;
10 10
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 295
296 296
297 function SimpleMove(array, start_i, del_count, len, num_additional_args) { 297 function SimpleMove(array, start_i, del_count, len, num_additional_args) {
298 if (num_additional_args !== del_count) { 298 if (num_additional_args !== del_count) {
299 // Move the existing elements after the elements to be deleted 299 // Move the existing elements after the elements to be deleted
300 // to the right position in the resulting array. 300 // to the right position in the resulting array.
301 if (num_additional_args > del_count) { 301 if (num_additional_args > del_count) {
302 for (var i = len - del_count; i > start_i; i--) { 302 for (var i = len - del_count; i > start_i; i--) {
303 var from_index = i + del_count - 1; 303 var from_index = i + del_count - 1;
304 var to_index = i + num_additional_args - 1; 304 var to_index = i + num_additional_args - 1;
305 // The spec could also be interpreted such that 305 if (from_index in array) {
306 // %HasOwnProperty would be the appropriate test. We follow 306 array[to_index] = array[from_index];
307 // KJS in consulting the prototype.
308 var current = array[from_index];
309 if (!IS_UNDEFINED(current) || from_index in array) {
310 array[to_index] = current;
311 } else { 307 } else {
312 delete array[to_index]; 308 delete array[to_index];
313 } 309 }
314 } 310 }
315 } else { 311 } else {
316 for (var i = start_i; i < len - del_count; i++) { 312 for (var i = start_i; i < len - del_count; i++) {
317 var from_index = i + del_count; 313 var from_index = i + del_count;
318 var to_index = i + num_additional_args; 314 var to_index = i + num_additional_args;
319 // The spec could also be interpreted such that 315 if (from_index in array) {
320 // %HasOwnProperty would be the appropriate test. We follow 316 array[to_index] = array[from_index];
321 // KJS in consulting the prototype.
322 var current = array[from_index];
323 if (!IS_UNDEFINED(current) || from_index in array) {
324 array[to_index] = current;
325 } else { 317 } else {
326 delete array[to_index]; 318 delete array[to_index];
327 } 319 }
328 } 320 }
329 for (var i = len; i > len - del_count + num_additional_args; i--) { 321 for (var i = len; i > len - del_count + num_additional_args; i--) {
330 delete array[i - 1]; 322 delete array[i - 1];
331 } 323 }
332 } 324 }
333 } 325 }
334 } 326 }
(...skipping 1229 matching lines...) Expand 10 before | Expand all | Expand 10 after
1564 )); 1556 ));
1565 1557
1566 SetUpLockedPrototype(InternalPackedArray, $Array(), $Array( 1558 SetUpLockedPrototype(InternalPackedArray, $Array(), $Array(
1567 "join", getFunction("join", ArrayJoin), 1559 "join", getFunction("join", ArrayJoin),
1568 "pop", getFunction("pop", ArrayPop), 1560 "pop", getFunction("pop", ArrayPop),
1569 "push", getFunction("push", ArrayPush) 1561 "push", getFunction("push", ArrayPush)
1570 )); 1562 ));
1571 } 1563 }
1572 1564
1573 SetUpArray(); 1565 SetUpArray();
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-3643.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698