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

Unified Diff: src/array.js

Issue 666883009: Change SmartMove no-op behavior to match SimpleMove (and ES6 spec) (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/mjsunit/array-unshift.js » ('j') | test/mjsunit/array-unshift.js » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/array.js
diff --git a/src/array.js b/src/array.js
index 9e83d979e09b5f31c034cc457a32d62d809e0b15..585d1da8427507f0ef0ea3cb12470d3c9bc21488 100644
--- a/src/array.js
+++ b/src/array.js
@@ -234,6 +234,8 @@ function SmartSlice(array, start_i, del_count, len, deleted_elements) {
// This function implements the optimized splice implementation that can use
// special array operations to handle sparse arrays in a sensible fashion.
function SmartMove(array, start_i, del_count, len, num_additional_args) {
+ // Bail out if no moving is necessary.
+ if (num_additional_args === del_count) return;
// Move data to new array.
var new_array = new InternalArray(len - del_count + num_additional_args);
var indices = %GetArrayKeys(array, len);
« no previous file with comments | « no previous file | test/mjsunit/array-unshift.js » ('j') | test/mjsunit/array-unshift.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698