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

Side by Side Diff: src/array.js

Issue 197043004: Don't fast RemoveArrayHoles in case of arguments arrays. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments 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 | src/objects.cc » ('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 1097 matching lines...) Expand 10 before | Expand all | Expand 10 after
1108 // the prototype chain on non-Array objects. 1108 // the prototype chain on non-Array objects.
1109 // We do this by copying them to this object and sorting only 1109 // We do this by copying them to this object and sorting only
1110 // local elements. This is not very efficient, but sorting with 1110 // local elements. This is not very efficient, but sorting with
1111 // inherited elements happens very, very rarely, if at all. 1111 // inherited elements happens very, very rarely, if at all.
1112 // The specification allows "implementation dependent" behavior 1112 // The specification allows "implementation dependent" behavior
1113 // if an element on the prototype chain has an element that 1113 // if an element on the prototype chain has an element that
1114 // might interact with sorting. 1114 // might interact with sorting.
1115 max_prototype_element = CopyFromPrototype(this, length); 1115 max_prototype_element = CopyFromPrototype(this, length);
1116 } 1116 }
1117 1117
1118 var num_non_undefined = %IsObserved(this) ? 1118 // %RemoveArrayHoles returns -1 if fast removal is not supported.
1119 -1 : %RemoveArrayHoles(this, length); 1119 var num_non_undefined = %RemoveArrayHoles(this, length);
1120 1120
1121 if (num_non_undefined == -1) { 1121 if (num_non_undefined == -1) {
1122 // The array is observed, or there were indexed accessors in the array. 1122 // The array is observed, or there were indexed accessors in the array.
1123 // Move array holes and undefineds to the end using a Javascript function 1123 // Move array holes and undefineds to the end using a Javascript function
1124 // that is safe in the presence of accessors and is observable. 1124 // that is safe in the presence of accessors and is observable.
1125 num_non_undefined = SafeRemoveArrayHoles(this); 1125 num_non_undefined = SafeRemoveArrayHoles(this);
1126 } 1126 }
1127 1127
1128 QuickSort(this, 0, num_non_undefined); 1128 QuickSort(this, 0, num_non_undefined);
1129 1129
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
1635 )); 1635 ));
1636 1636
1637 SetUpLockedPrototype(InternalPackedArray, $Array(), $Array( 1637 SetUpLockedPrototype(InternalPackedArray, $Array(), $Array(
1638 "join", getFunction("join", ArrayJoin), 1638 "join", getFunction("join", ArrayJoin),
1639 "pop", getFunction("pop", ArrayPop), 1639 "pop", getFunction("pop", ArrayPop),
1640 "push", getFunction("push", ArrayPush) 1640 "push", getFunction("push", ArrayPush)
1641 )); 1641 ));
1642 } 1642 }
1643 1643
1644 SetUpArray(); 1644 SetUpArray();
OLDNEW
« no previous file with comments | « no previous file | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698