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

Unified Diff: src/string.js

Issue 17391016: Avoid relying on monkey-patchable things in String.prototype.split. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebased Created 7 years, 6 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/regress/string-split-monkey-patching.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/string.js
diff --git a/src/string.js b/src/string.js
index a04b23f7dbb0e54e1b9df385d275a27465e2220d..5db937bc77ca446b935cca394ef8366528006076 100644
--- a/src/string.js
+++ b/src/string.js
@@ -657,7 +657,7 @@ function StringSplitOnRegExp(subject, separator, limit, length) {
var currentIndex = 0;
var startIndex = 0;
var startMatch = 0;
- var result = [];
+ var result = new InternalArray();
outer_loop:
while (true) {
@@ -698,7 +698,7 @@ function StringSplitOnRegExp(subject, separator, limit, length) {
startIndex = currentIndex = endIndex;
}
- return result;
+ return %MoveArrayContents(result, []);
}
« no previous file with comments | « no previous file | test/mjsunit/regress/string-split-monkey-patching.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698