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

Unified Diff: src/string.js

Issue 17101021: Removed ReplaceResultBuilder. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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 | no next file » | 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 44315bba168b20197194556986be5d2aa97f7a8a..a04b23f7dbb0e54e1b9df385d275a27465e2220d 100644
--- a/src/string.js
+++ b/src/string.js
@@ -495,8 +495,7 @@ function StringReplaceGlobalRegExpWithFunction(subject, regexp, replace) {
}
}
}
- var resultBuilder = new ReplaceResultBuilder(subject, res);
- var result = resultBuilder.generate();
+ var result = %StringBuilderConcat(res, res.length, subject);
resultArray.length = 0;
reusableReplaceArray = resultArray;
return result;
@@ -950,43 +949,6 @@ function StringSup() {
return "<sup>" + this + "</sup>";
}
-
-// ReplaceResultBuilder support.
-function ReplaceResultBuilder(str) {
- if (%_ArgumentsLength() > 1) {
- this.elements = %_Arguments(1);
- } else {
- this.elements = new InternalArray();
- }
- this.special_string = str;
-}
-
-SetUpLockedPrototype(ReplaceResultBuilder,
- $Array("elements", "special_string"), $Array(
- "add", function(str) {
- str = TO_STRING_INLINE(str);
- if (str.length > 0) this.elements.push(str);
- },
- "addSpecialSlice", function(start, end) {
- var len = end - start;
- if (start < 0 || len <= 0) return;
- if (start < 0x80000 && len < 0x800) {
- this.elements.push((start << 11) | len);
- } else {
- // 0 < len <= String::kMaxLength and Smi::kMaxValue >= String::kMaxLength,
- // so -len is a smi.
- var elements = this.elements;
- elements.push(-len);
- elements.push(start);
- }
- },
- "generate", function() {
- var elements = this.elements;
- return %StringBuilderConcat(elements, elements.length, this.special_string);
- }
-));
-
-
// -------------------------------------------------------------------
function SetUpString() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698