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

Side by Side Diff: src/array.js

Issue 649063003: Array.prototype.{slice,splice} should use [[DefineOwnProperty]] to generate return value (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-423633.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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 // This is part of the old simple-minded splice. We are using it either 278 // This is part of the old simple-minded splice. We are using it either
279 // because the receiver is not an array (so we have no choice) or because we 279 // because the receiver is not an array (so we have no choice) or because we
280 // know we are not deleting or moving a lot of elements. 280 // know we are not deleting or moving a lot of elements.
281 function SimpleSlice(array, start_i, del_count, len, deleted_elements) { 281 function SimpleSlice(array, start_i, del_count, len, deleted_elements) {
282 for (var i = 0; i < del_count; i++) { 282 for (var i = 0; i < del_count; i++) {
283 var index = start_i + i; 283 var index = start_i + i;
284 // The spec could also be interpreted such that %HasOwnProperty 284 // The spec could also be interpreted such that %HasOwnProperty
285 // would be the appropriate test. We follow KJS in consulting the 285 // would be the appropriate test. We follow KJS in consulting the
286 // prototype. 286 // prototype.
287 var current = array[index]; 287 var current = array[index];
288 if (!IS_UNDEFINED(current) || index in array) { 288 if (!IS_UNDEFINED(current) || index in array) {
Michael Starzinger 2014/10/21 08:07:48 I know this is not part of your change, but the or
289 deleted_elements[i] = current; 289 // The spec requires [[DefineOwnProperty]] here, %AddElement is close
290 // enough (in that it ignores the prototype).
291 %AddElement(deleted_elements, i, current, NONE);
290 } 292 }
291 } 293 }
292 } 294 }
293 295
294 296
295 function SimpleMove(array, start_i, del_count, len, num_additional_args) { 297 function SimpleMove(array, start_i, del_count, len, num_additional_args) {
296 if (num_additional_args !== del_count) { 298 if (num_additional_args !== del_count) {
297 // Move the existing elements after the elements to be deleted 299 // Move the existing elements after the elements to be deleted
298 // to the right position in the resulting array. 300 // to the right position in the resulting array.
299 if (num_additional_args > del_count) { 301 if (num_additional_args > del_count) {
(...skipping 1265 matching lines...) Expand 10 before | Expand all | Expand 10 after
1565 )); 1567 ));
1566 1568
1567 SetUpLockedPrototype(InternalPackedArray, $Array(), $Array( 1569 SetUpLockedPrototype(InternalPackedArray, $Array(), $Array(
1568 "join", getFunction("join", ArrayJoin), 1570 "join", getFunction("join", ArrayJoin),
1569 "pop", getFunction("pop", ArrayPop), 1571 "pop", getFunction("pop", ArrayPop),
1570 "push", getFunction("push", ArrayPush) 1572 "push", getFunction("push", ArrayPush)
1571 )); 1573 ));
1572 } 1574 }
1573 1575
1574 SetUpArray(); 1576 SetUpArray();
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-423633.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698