Commit 4c1d670e authored by yangguo's avatar yangguo Committed by Commit bot

[regexp, intl] Intl should not cause side effects to the RegExp object.

R=jochen@chromium.org
BUG=v8:4361
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#35099}
parent 7a33bd5d
This diff is collapsed.
......@@ -1173,10 +1173,31 @@ for (var i = 1; i < 10; ++i) {
}
%ToFastProperties(GlobalRegExp);
// -------------------------------------------------------------------
// Internal
var InternalRegExpMatchInfo = new InternalPackedArray(2, "", UNDEFINED, 0, 0);
function InternalRegExpMatch(regexp, subject) {
var matchInfo = %_RegExpExec(regexp, subject, 0, InternalRegExpMatchInfo);
if (!IS_NULL(matchInfo)) {
RETURN_NEW_RESULT_FROM_MATCH_INFO(matchInfo, subject);
}
return null;
}
function InternalRegExpReplace(regexp, subject, replacement) {
return %StringReplaceGlobalRegExpWithString(
subject, regexp, replacement, InternalRegExpMatchInfo);
}
// -------------------------------------------------------------------
// Exports
utils.Export(function(to) {
to.InternalRegExpMatch = InternalRegExpMatch;
to.InternalRegExpReplace = InternalRegExpReplace;
to.IsRegExp = IsRegExp;
to.RegExpExec = DoRegExpExec;
to.RegExpInitialize = RegExpInitialize;
to.RegExpLastMatchInfo = RegExpLastMatchInfo;
......@@ -1187,7 +1208,6 @@ utils.Export(function(to) {
to.RegExpSubclassSplit = RegExpSubclassSplit;
to.RegExpSubclassTest = RegExpSubclassTest;
to.RegExpTest = RegExpTest;
to.IsRegExp = IsRegExp;
});
})
// Copyright 2016 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
assertEquals("a", RegExp.$1);
assertEquals("b", RegExp.$2);
assertEquals("c", RegExp.$3);
assertEquals("d", RegExp.$4);
assertEquals("e", RegExp.$5);
assertEquals("f", RegExp.$6);
assertEquals("g", RegExp.$7);
assertEquals("h", RegExp.$8);
assertEquals("i", RegExp.$9);
assertEquals("abcdefghij", RegExp.lastMatch);
assertEquals("j", RegExp.lastParen);
assertEquals(">>>", RegExp.leftContext);
assertEquals("<<<", RegExp.rightContext);
assertEquals(">>>abcdefghij<<<", RegExp.input);
// Copyright 2016 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/(\w)(\w)(\w)(\w)(\w)(\w)(\w)(\w)(\w)(\w)/.exec(">>>abcdefghij<<<");
......@@ -45,7 +45,8 @@ class IntlTestSuite(testsuite.TestSuite):
files.sort()
for filename in files:
if (filename.endswith(".js") and filename != "assert.js" and
filename != "utils.js"):
filename != "utils.js" and filename != "regexp-assert.js" and
filename != "regexp-prepare.js"):
fullpath = os.path.join(dirname, filename)
relpath = fullpath[len(self.root) + 1 : -3]
testname = relpath.replace(os.path.sep, "/")
......@@ -59,7 +60,9 @@ class IntlTestSuite(testsuite.TestSuite):
files = []
files.append(os.path.join(self.root, "assert.js"))
files.append(os.path.join(self.root, "utils.js"))
files.append(os.path.join(self.root, "regexp-prepare.js"))
files.append(os.path.join(self.root, testcase.path + self.suffix()))
files.append(os.path.join(self.root, "regexp-assert.js"))
flags += files
if context.isolates:
......
......@@ -124,9 +124,6 @@
'intl402/DateTimeFormat/12.1.1_1': [FAIL],
'intl402/NumberFormat/11.1.1_1': [FAIL],
# https://code.google.com/p/v8/issues/detail?id=4361
'intl402/Collator/10.1.1_a': [FAIL],
# https://code.google.com/p/v8/issues/detail?id=4476
'built-ins/String/prototype/toLocaleLowerCase/special_casing_conditional': [FAIL],
'built-ins/String/prototype/toLocaleLowerCase/supplementary_plane': [FAIL],
......@@ -206,14 +203,12 @@
'intl402/Collator/10.2.3_b': [PASS, FAIL],
'intl402/Collator/prototype/10.3_a': [FAIL],
'intl402/DateTimeFormat/12.1.1': [FAIL],
'intl402/DateTimeFormat/12.1.1_a': [FAIL],
'intl402/DateTimeFormat/12.1.2': [PASS, FAIL],
'intl402/DateTimeFormat/12.1.2.1_4': [FAIL],
'intl402/DateTimeFormat/12.2.3_b': [FAIL],
'intl402/DateTimeFormat/prototype/12.3_a': [FAIL],
'intl402/Number/prototype/toLocaleString/13.2.1_5': [PASS, FAIL],
'intl402/NumberFormat/11.1.1_20_c': [FAIL],
'intl402/NumberFormat/11.1.1_a': [FAIL],
'intl402/NumberFormat/11.1.2': [PASS, FAIL],
'intl402/NumberFormat/11.1.2.1_4': [FAIL],
'intl402/NumberFormat/11.2.3_b': [FAIL],
......
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