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

Unified Diff: src/array.js

Issue 13465008: Fix Array.prototype.concat when exceeding array size limit. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/runtime.cc » ('j') | src/runtime.cc » ('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 7cf744bedf29fc9c138b848d8d66d9021cd8afa0..323c8cf983ca9e704a3850790d555cdff44cf235 100644
--- a/src/array.js
+++ b/src/array.js
@@ -483,7 +483,23 @@ function ArrayConcat(arg1) { // length == 1
arrays[i + 1] = %_Arguments(i);
}
- return %ArrayConcat(arrays);
+ var result = %ArrayConcat(arrays);
+ if (!%_IsSmi(result)) return result;
+
+ // The result is a smi as signal that %ArrayConcat failed because the result
+ // exceeds the array size limit. Overflowing elements turn into properties.
+ var offset = 0;
+ var result = [];
+ for (var i = 0; i < arrays.length; i++) {
+ var array = arrays[i];
+ var keys = GetSortedArrayKeys(array, %GetArrayKeys(array, array.length));
+ for (var j = 0; j < keys.length; j++) {
+ var key = keys[j];
+ result[key + offset] = array[key];
+ }
+ offset += array.length;
+ }
+ return result;
}
« no previous file with comments | « no previous file | src/runtime.cc » ('j') | src/runtime.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698