Chromium Code Reviews| Index: src/js/regexp.js |
| diff --git a/src/js/regexp.js b/src/js/regexp.js |
| index ef6a4aed053b3d15f23056a64c4540112be08337..6031deb0d261feb8e62fdffe699c6bbaf50c0673 100644 |
| --- a/src/js/regexp.js |
| +++ b/src/js/regexp.js |
| @@ -24,6 +24,7 @@ var MinSimple; |
| var matchSymbol = utils.ImportNow("match_symbol"); |
| var replaceSymbol = utils.ImportNow("replace_symbol"); |
| var searchSymbol = utils.ImportNow("search_symbol"); |
| +var speciesSymbol = utils.ImportNow("species_symbol"); |
| var splitSymbol = utils.ImportNow("split_symbol"); |
| var SpeciesConstructor; |
| @@ -1134,6 +1135,27 @@ function RegExpGetSticky() { |
| } |
| %SetForceInlineFlag(RegExpGetSticky); |
| + |
| +// ES6 21.2.5.15. |
| +function RegExpGetUnicode() { |
| + if (!IS_REGEXP(this)) { |
| + // TODO(littledan): Remove this RegExp compat workaround |
| + if (this === GlobalRegExpPrototype) { |
| + %IncrementUseCounter(kRegExpPrototypeUnicodeGetter); |
| + return UNDEFINED; |
| + } |
| + throw MakeTypeError(kRegExpNonRegExp, "RegExp.prototype.unicode"); |
| + } |
| + return TO_BOOLEAN(REGEXP_UNICODE(this)); |
| +} |
| +%SetForceInlineFlag(RegExpGetUnicode); |
| + |
| + |
| +function RegExpSpecies() { |
| + return this; |
| +} |
| + |
| + |
| // ------------------------------------------------------------------- |
| %FunctionSetInstanceClassName(GlobalRegExp, 'RegExp'); |
| @@ -1143,15 +1165,17 @@ GlobalRegExpPrototype = new GlobalObject(); |
| GlobalRegExp.prototype, 'constructor', GlobalRegExp, DONT_ENUM); |
| %SetCode(GlobalRegExp, RegExpConstructor); |
| +utils.InstallGetter(GlobalRegExp, speciesSymbol, RegExpSpecies); |
| + |
| utils.InstallFunctions(GlobalRegExp.prototype, DONT_ENUM, [ |
| - "exec", RegExpExecJS, |
| - "test", RegExpTest, |
| + "exec", RegExpSubclassExecJS, |
| + "test", RegExpSubclassTest, |
| "toString", RegExpToString, |
| "compile", RegExpCompileJS, |
| - matchSymbol, RegExpMatch, |
| - replaceSymbol, RegExpReplace, |
| - searchSymbol, RegExpSearch, |
|
Dan Ehrenberg
2016/06/23 23:53:52
RegExpMatch and RegExpSearch are now dead code.
adamk
2016/06/24 00:08:27
Oops, meant to clean those up but failed. Removed.
|
| - splitSymbol, RegExpSplit, |
| + matchSymbol, RegExpSubclassMatch, |
| + replaceSymbol, RegExpSubclassReplace, |
| + searchSymbol, RegExpSubclassSearch, |
| + splitSymbol, RegExpSubclassSplit, |
| ]); |
| utils.InstallGetter(GlobalRegExp.prototype, 'flags', RegExpGetFlags); |
| @@ -1160,6 +1184,7 @@ utils.InstallGetter(GlobalRegExp.prototype, 'ignoreCase', RegExpGetIgnoreCase); |
| utils.InstallGetter(GlobalRegExp.prototype, 'multiline', RegExpGetMultiline); |
| utils.InstallGetter(GlobalRegExp.prototype, 'source', RegExpGetSource); |
| utils.InstallGetter(GlobalRegExp.prototype, 'sticky', RegExpGetSticky); |
| +utils.InstallGetter(GlobalRegExp.prototype, 'unicode', RegExpGetUnicode); |
| // The properties `input` and `$_` are aliases for each other. When this |
| // value is set the value it is set to is coerced to a string. |
| @@ -1234,12 +1259,6 @@ utils.Export(function(to) { |
| to.RegExpExec = DoRegExpExec; |
| to.RegExpInitialize = RegExpInitialize; |
| to.RegExpLastMatchInfo = RegExpLastMatchInfo; |
| - to.RegExpSubclassExecJS = RegExpSubclassExecJS; |
| - to.RegExpSubclassMatch = RegExpSubclassMatch; |
| - to.RegExpSubclassReplace = RegExpSubclassReplace; |
| - to.RegExpSubclassSearch = RegExpSubclassSearch; |
| - to.RegExpSubclassSplit = RegExpSubclassSplit; |
| - to.RegExpSubclassTest = RegExpSubclassTest; |
| to.RegExpTest = RegExpTest; |
| }); |