| Index: src/string.js
|
| diff --git a/src/string.js b/src/string.js
|
| index 6f68ce089096db33a4e5c3f52a9a4ead7595400c..a70eeade83b9d68b51937611b621b628fa6be286 100644
|
| --- a/src/string.js
|
| +++ b/src/string.js
|
| @@ -911,47 +911,50 @@ function ReplaceResultBuilder(str) {
|
| 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() {
|
| +ReplaceResultBuilder.prototype.__proto__ = null;
|
| +
|
| +
|
| +ReplaceResultBuilder.prototype.add = function(str) {
|
| + str = TO_STRING_INLINE(str);
|
| + if (str.length > 0) this.elements.push(str);
|
| +}
|
| +
|
| +
|
| +ReplaceResultBuilder.prototype.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;
|
| - return %StringBuilderConcat(elements, elements.length, this.special_string);
|
| + elements.push(-len);
|
| + elements.push(start);
|
| }
|
| -));
|
| +}
|
| +
|
| +
|
| +ReplaceResultBuilder.prototype.generate = function() {
|
| + var elements = this.elements;
|
| + return %StringBuilderConcat(elements, elements.length, this.special_string);
|
| +}
|
|
|
|
|
| // -------------------------------------------------------------------
|
|
|
| -function SetUpString() {
|
| - %CheckIsBootstrapping();
|
| - // Set up the constructor property on the String prototype object.
|
| +function SetupString() {
|
| + // Setup the constructor property on the String prototype object.
|
| %SetProperty($String.prototype, "constructor", $String, DONT_ENUM);
|
|
|
|
|
| - // Set up the non-enumerable functions on the String object.
|
| + // Setup the non-enumerable functions on the String object.
|
| InstallFunctions($String, DONT_ENUM, $Array(
|
| "fromCharCode", StringFromCharCode
|
| ));
|
|
|
|
|
| - // Set up the non-enumerable functions on the String prototype object.
|
| + // Setup the non-enumerable functions on the String prototype object.
|
| InstallFunctionsOnHiddenPrototype($String.prototype, DONT_ENUM, $Array(
|
| "valueOf", StringValueOf,
|
| "toString", StringToString,
|
| @@ -991,4 +994,5 @@ function SetUpString() {
|
| ));
|
| }
|
|
|
| -SetUpString();
|
| +
|
| +SetupString();
|
|
|