| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 (function(global, utils) { | 5 (function(global, utils) { |
| 6 | 6 |
| 7 %CheckIsBootstrapping(); | 7 %CheckIsBootstrapping(); |
| 8 | 8 |
| 9 // ------------------------------------------------------------------- | 9 // ------------------------------------------------------------------- |
| 10 // Imports | 10 // Imports |
| 11 | 11 |
| 12 var GlobalString = global.String; | 12 var GlobalString = global.String; |
| 13 var matchSymbol = utils.ImportNow("match_symbol"); | 13 var matchSymbol = utils.ImportNow("match_symbol"); |
| 14 var searchSymbol = utils.ImportNow("search_symbol"); | 14 var searchSymbol = utils.ImportNow("search_symbol"); |
| 15 | 15 |
| 16 //------------------------------------------------------------------- | 16 //------------------------------------------------------------------- |
| 17 | 17 |
| 18 // ECMA-262, section 15.5.4.6 | |
| 19 function StringConcat(other /* and more */) { // length == 1 | |
| 20 "use strict"; | |
| 21 CHECK_OBJECT_COERCIBLE(this, "String.prototype.concat"); | |
| 22 var s = TO_STRING(this); | |
| 23 var len = arguments.length; | |
| 24 for (var i = 0; i < len; ++i) { | |
| 25 s = s + TO_STRING(arguments[i]); | |
| 26 } | |
| 27 return s; | |
| 28 } | |
| 29 | |
| 30 | |
| 31 // ES6 21.1.3.11. | 18 // ES6 21.1.3.11. |
| 32 function StringMatchJS(pattern) { | 19 function StringMatchJS(pattern) { |
| 33 CHECK_OBJECT_COERCIBLE(this, "String.prototype.match"); | 20 CHECK_OBJECT_COERCIBLE(this, "String.prototype.match"); |
| 34 | 21 |
| 35 if (!IS_NULL_OR_UNDEFINED(pattern)) { | 22 if (!IS_NULL_OR_UNDEFINED(pattern)) { |
| 36 var matcher = pattern[matchSymbol]; | 23 var matcher = pattern[matchSymbol]; |
| 37 if (!IS_UNDEFINED(matcher)) { | 24 if (!IS_UNDEFINED(matcher)) { |
| 38 return %_Call(matcher, pattern, this); | 25 return %_Call(matcher, pattern, this); |
| 39 } | 26 } |
| 40 } | 27 } |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 // ------------------------------------------------------------------- | 268 // ------------------------------------------------------------------- |
| 282 | 269 |
| 283 // Set up the non-enumerable functions on the String object. | 270 // Set up the non-enumerable functions on the String object. |
| 284 utils.InstallFunctions(GlobalString, DONT_ENUM, [ | 271 utils.InstallFunctions(GlobalString, DONT_ENUM, [ |
| 285 "raw", StringRaw | 272 "raw", StringRaw |
| 286 ]); | 273 ]); |
| 287 | 274 |
| 288 // Set up the non-enumerable functions on the String prototype object. | 275 // Set up the non-enumerable functions on the String prototype object. |
| 289 utils.InstallFunctions(GlobalString.prototype, DONT_ENUM, [ | 276 utils.InstallFunctions(GlobalString.prototype, DONT_ENUM, [ |
| 290 "codePointAt", StringCodePointAt, | 277 "codePointAt", StringCodePointAt, |
| 291 "concat", StringConcat, | |
| 292 "match", StringMatchJS, | 278 "match", StringMatchJS, |
| 293 "repeat", StringRepeat, | 279 "repeat", StringRepeat, |
| 294 "search", StringSearch, | 280 "search", StringSearch, |
| 295 "slice", StringSlice, | 281 "slice", StringSlice, |
| 296 | 282 |
| 297 "link", StringLink, | 283 "link", StringLink, |
| 298 "anchor", StringAnchor, | 284 "anchor", StringAnchor, |
| 299 "fontcolor", StringFontcolor, | 285 "fontcolor", StringFontcolor, |
| 300 "fontsize", StringFontsize, | 286 "fontsize", StringFontsize, |
| 301 "big", StringBig, | 287 "big", StringBig, |
| 302 "blink", StringBlink, | 288 "blink", StringBlink, |
| 303 "bold", StringBold, | 289 "bold", StringBold, |
| 304 "fixed", StringFixed, | 290 "fixed", StringFixed, |
| 305 "italics", StringItalics, | 291 "italics", StringItalics, |
| 306 "small", StringSmall, | 292 "small", StringSmall, |
| 307 "strike", StringStrike, | 293 "strike", StringStrike, |
| 308 "sub", StringSub, | 294 "sub", StringSub, |
| 309 "sup", StringSup | 295 "sup", StringSup |
| 310 ]); | 296 ]); |
| 311 | 297 |
| 312 }) | 298 }) |
| OLD | NEW |