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

Side by Side Diff: src/array.js

Issue 194873003: ArrayUnshift() should not modify length of a frozen object. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 9 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-350890.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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 } else { 656 } else {
657 if (num_arguments == 0 && $Object.isFrozen(this)) { 657 if (num_arguments == 0 && $Object.isFrozen(this)) {
658 // In the zero argument case, values from the prototype come into the 658 // In the zero argument case, values from the prototype come into the
659 // object. This can't be allowed on frozen arrays. 659 // object. This can't be allowed on frozen arrays.
660 for (var i = 0; i < len; i++) { 660 for (var i = 0; i < len; i++) {
661 if (!this.hasOwnProperty(i) && !IS_UNDEFINED(this[i])) { 661 if (!this.hasOwnProperty(i) && !IS_UNDEFINED(this[i])) {
662 throw MakeTypeError("array_functions_on_frozen", 662 throw MakeTypeError("array_functions_on_frozen",
663 ["Array.prototype.shift"]); 663 ["Array.prototype.shift"]);
664 } 664 }
665 } 665 }
666 return this.length;
666 } 667 }
667 668
668 SimpleMove(this, 0, 0, len, num_arguments); 669 SimpleMove(this, 0, 0, len, num_arguments);
669 } 670 }
670 671
671 for (var i = 0; i < num_arguments; i++) { 672 for (var i = 0; i < num_arguments; i++) {
672 this[i] = %_Arguments(i); 673 this[i] = %_Arguments(i);
673 } 674 }
674 675
675 this.length = len + num_arguments; 676 this.length = len + num_arguments;
(...skipping 959 matching lines...) Expand 10 before | Expand all | Expand 10 after
1635 )); 1636 ));
1636 1637
1637 SetUpLockedPrototype(InternalPackedArray, $Array(), $Array( 1638 SetUpLockedPrototype(InternalPackedArray, $Array(), $Array(
1638 "join", getFunction("join", ArrayJoin), 1639 "join", getFunction("join", ArrayJoin),
1639 "pop", getFunction("pop", ArrayPop), 1640 "pop", getFunction("pop", ArrayPop),
1640 "push", getFunction("push", ArrayPush) 1641 "push", getFunction("push", ArrayPush)
1641 )); 1642 ));
1642 } 1643 }
1643 1644
1644 SetUpArray(); 1645 SetUpArray();
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-350890.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698