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

Unified Diff: src/array.js

Issue 6520004: Introduce new runtime function to make join with lower memory usage. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Following Anders' advice Created 9 years, 10 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.h » ('j') | no next file with comments »
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 1298434d5975cec4cc3deed9a989765938ae49b1..ef82674d789e2460e10cc2cf5fc995a7ae6bdbc2 100644
--- a/src/array.js
+++ b/src/array.js
@@ -161,15 +161,7 @@ function Join(array, length, separator, convert) {
var result = %_FastAsciiArrayJoin(elements, separator);
if (!IS_UNDEFINED(result)) return result;
- var length2 = (length << 1) - 1;
- var j = length2;
- var i = length;
- elements[--j] = elements[--i];
- while (i > 0) {
- elements[--j] = separator;
- elements[--j] = elements[--i];
- }
- return %StringBuilderConcat(elements, length2, '');
+ return %StringBuilderJoin(elements, length, separator);
} finally {
// Make sure to remove the last element of the visited array no
// matter what happens.
« no previous file with comments | « no previous file | src/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698