Commit 64b2b1ac authored by littledan's avatar littledan Committed by Commit bot

Fix match default behavior on strings for ES2015 semantics

String.prototype.match is specified to call out to the current
value of RegExp.prototype[Symbol.match] when passed a string argument,
rather than the original value. This patch updates the RegExp code
to do that.

R=yangguo@chromium.org
BUG=v8:4602
LOG=Y

Review URL: https://codereview.chromium.org/1821773003

Cr-Commit-Position: refs/heads/master@{#35001}
parent bdcefb9d
......@@ -779,7 +779,6 @@ for (var i = 1; i < 10; ++i) {
utils.Export(function(to) {
to.RegExpExec = DoRegExpExec;
to.RegExpExecNoTests = RegExpExecNoTests;
to.RegExpLastMatchInfo = RegExpLastMatchInfo;
to.RegExpTest = RegExpTest;
to.IsRegExp = IsRegExp;
......
......@@ -21,7 +21,6 @@ var MakeTypeError;
var MaxSimple;
var MinSimple;
var matchSymbol = utils.ImportNow("match_symbol");
var RegExpExecNoTests;
var replaceSymbol = utils.ImportNow("replace_symbol");
var searchSymbol = utils.ImportNow("search_symbol");
var splitSymbol = utils.ImportNow("split_symbol");
......@@ -34,7 +33,6 @@ utils.Import(function(from) {
MakeTypeError = from.MakeTypeError;
MaxSimple = from.MaxSimple;
MinSimple = from.MinSimple;
RegExpExecNoTests = from.RegExpExecNoTests;
});
//-------------------------------------------------------------------
......@@ -163,7 +161,7 @@ function StringMatchJS(pattern) {
// Non-regexp argument.
var regexp = new GlobalRegExp(pattern);
return RegExpExecNoTests(regexp, subject, 0);
return regexp[matchSymbol](subject);
}
......
......@@ -109,7 +109,6 @@
# happens to be thrown for some other reason (e.g,
# built-ins/RegExp/prototype/Symbol.match/builtin-failure-set-lastindex-err)
'built-ins/RegExp/prototype/Symbol.match/*': [SKIP],
'built-ins/String/prototype/match/invoke-builtin-match': [FAIL],
# https://code.google.com/p/v8/issues/detail?id=4343
'built-ins/RegExp/prototype/Symbol.replace/*': [SKIP],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment