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

Side by Side Diff: src/array.js

Issue 6073: Fixed use of undefined in ArraySort.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 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/array-sort.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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 725 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 736
737 %RemoveArrayHoles(this); 737 %RemoveArrayHoles(this);
738 738
739 var length = ToUint32(this.length); 739 var length = ToUint32(this.length);
740 740
741 // Move undefined elements to the end of the array. 741 // Move undefined elements to the end of the array.
742 for (var i = 0; i < length; ) { 742 for (var i = 0; i < length; ) {
743 if (IS_UNDEFINED(this[i])) { 743 if (IS_UNDEFINED(this[i])) {
744 length--; 744 length--;
745 this[i] = this[length]; 745 this[i] = this[length];
746 this[length] = undefined; 746 this[length] = void 0;
747 } else { 747 } else {
748 i++; 748 i++;
749 } 749 }
750 } 750 }
751 751
752 QuickSort(this, 0, length); 752 QuickSort(this, 0, length);
753 753
754 // We only changed the length of the this object (in 754 // We only changed the length of the this object (in
755 // RemoveArrayHoles) if it was an array. We are not allowed to set 755 // RemoveArrayHoles) if it was an array. We are not allowed to set
756 // the length of the this object if it is not an array because this 756 // the length of the this object if it is not an array because this
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
953 ArrayEvery: 1, 953 ArrayEvery: 1,
954 ArrayMap: 1, 954 ArrayMap: 1,
955 ArrayIndexOf: 1, 955 ArrayIndexOf: 1,
956 ArrayLastIndexOf: 1, 956 ArrayLastIndexOf: 1,
957 ArrayPush: 1 957 ArrayPush: 1
958 }); 958 });
959 }; 959 };
960 960
961 961
962 SetupArray(); 962 SetupArray();
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/array-sort.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698