Project: v8 Issues People Development process History Sign in
New issue
Advanced search Search tips
Starred by 4 users
Status: Fixed
Owner:
Closed: Apr 21
Cc:
HW: ----
OS: ----
Priority: 2
Type: FeatureRequest

Blocked on: View detail
issue 6913
issue 6914
issue 6912



Sign in to add a comment
RegExp named capture groups
Project Member Reported by math...@qiwi.be, Sep 27 2016 Back to list
This is a tracking issue for named capture groups in regular expressions.

Proposal: https://github.com/littledan/es-regexp-named-groups

Experimental support was added in https://codereview.chromium.org/2050343002.

Spec draft here: https://github.com/tc39/proposal-regexp-named-groups

 
Cc: jgruber@chromium.org
Project Member Comment 2 by bugdroid1@chromium.org, Jan 20 2017
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/70000946eb2a9155679528702a766219a1fcf154

commit 70000946eb2a9155679528702a766219a1fcf154
Author: jgruber <jgruber@chromium.org>
Date: Fri Jan 20 08:04:07 2017

[regexp] Store named captures on the regexp result

This implements storing named captures on the regexp result object.
For instance, /(?<a>.)/u.exec("b") will return a result such that:

result.group.a  // "b"

The spec proposal is not yet final, so this may still change in the future.

BUG= v8:5437 

Review-Url: https://codereview.chromium.org/2630233003
Cr-Commit-Position: refs/heads/master@{#42532}

[modify] https://crrev.com/70000946eb2a9155679528702a766219a1fcf154/src/builtins/builtins-regexp.cc
[modify] https://crrev.com/70000946eb2a9155679528702a766219a1fcf154/src/heap-symbols.h
[modify] https://crrev.com/70000946eb2a9155679528702a766219a1fcf154/src/regexp/regexp-parser.cc
[modify] https://crrev.com/70000946eb2a9155679528702a766219a1fcf154/test/mjsunit/harmony/regexp-named-captures.js

Project Member Comment 3 by bugdroid1@chromium.org, Jan 20 2017
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/9c68654c397b8783469b99d668dd54ed3f61ebfc

commit 9c68654c397b8783469b99d668dd54ed3f61ebfc
Author: jgruber <jgruber@chromium.org>
Date: Fri Jan 20 08:42:03 2017

Revert of [regexp] Create property on result for each named capture (patchset #5 id:80001 of https://codereview.chromium.org/2630233003/ )

Reason for revert:
Breaks no18n build: https://build.chromium.org/p/client.v8/builders/V8%20Linux%20-%20noi18n%20-%20debug/builds/11604

Original issue's description:
> [regexp] Store named captures on the regexp result
>
> This implements storing named captures on the regexp result object.
> For instance, /(?<a>.)/u.exec("b") will return a result such that:
>
> result.group.a  // "b"
>
> The spec proposal is not yet final, so this may still change in the future.
>
> BUG= v8:5437 
>
> Review-Url: https://codereview.chromium.org/2630233003
> Cr-Commit-Position: refs/heads/master@{#42532}
> Committed: https://chromium.googlesource.com/v8/v8/+/70000946eb2a9155679528702a766219a1fcf154

TBR=yangguo@chromium.org,littledan@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG= v8:5437 

Review-Url: https://codereview.chromium.org/2643213002
Cr-Commit-Position: refs/heads/master@{#42534}

[modify] https://crrev.com/9c68654c397b8783469b99d668dd54ed3f61ebfc/src/builtins/builtins-regexp.cc
[modify] https://crrev.com/9c68654c397b8783469b99d668dd54ed3f61ebfc/src/heap-symbols.h
[modify] https://crrev.com/9c68654c397b8783469b99d668dd54ed3f61ebfc/src/regexp/regexp-parser.cc
[modify] https://crrev.com/9c68654c397b8783469b99d668dd54ed3f61ebfc/test/mjsunit/harmony/regexp-named-captures.js

Project Member Comment 4 by bugdroid1@chromium.org, Jan 20 2017
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/ee94fa11ed63477393c6534c352ebac6e502396c

commit ee94fa11ed63477393c6534c352ebac6e502396c
Author: jgruber <jgruber@chromium.org>
Date: Fri Jan 20 16:11:13 2017

[regexp] Store named captures on the regexp result

This implements storing named captures on the regexp result object.
For instance, /(?<a>.)/u.exec("b") will return a result such that:

result.group.a  // "b"

The spec proposal is not yet final, so this may still change in the future.

BUG= v8:5437 

Review-Url: https://codereview.chromium.org/2630233003
Cr-Original-Commit-Position: refs/heads/master@{#42532}
Committed: https://chromium.googlesource.com/v8/v8/+/70000946eb2a9155679528702a766219a1fcf154
Review-Url: https://codereview.chromium.org/2630233003
Cr-Commit-Position: refs/heads/master@{#42570}

[modify] https://crrev.com/ee94fa11ed63477393c6534c352ebac6e502396c/src/builtins/builtins-regexp.cc
[modify] https://crrev.com/ee94fa11ed63477393c6534c352ebac6e502396c/src/heap-symbols.h
[modify] https://crrev.com/ee94fa11ed63477393c6534c352ebac6e502396c/src/regexp/regexp-parser.cc
[modify] https://crrev.com/ee94fa11ed63477393c6534c352ebac6e502396c/test/mjsunit/harmony/regexp-named-captures.js
[modify] https://crrev.com/ee94fa11ed63477393c6534c352ebac6e502396c/test/mjsunit/mjsunit.status

Project Member Comment 5 by bugdroid1@chromium.org, Jan 20 2017
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/50e0fe29bb4facb6b94cbfb51637daef6cc578b9

commit 50e0fe29bb4facb6b94cbfb51637daef6cc578b9
Author: jgruber <jgruber@chromium.org>
Date: Fri Jan 20 19:03:14 2017

Revert of [regexp] Create property on result for each named capture (patchset #7 id:120001 of https://codereview.chromium.org/2630233003/ )

Reason for revert:
Breaks arm64.

Original issue's description:
> [regexp] Store named captures on the regexp result
>
> This implements storing named captures on the regexp result object.
> For instance, /(?<a>.)/u.exec("b") will return a result such that:
>
> result.group.a  // "b"
>
> The spec proposal is not yet final, so this may still change in the future.
>
> BUG= v8:5437 
>
> Review-Url: https://codereview.chromium.org/2630233003
> Cr-Original-Commit-Position: refs/heads/master@{#42532}
> Committed: https://chromium.googlesource.com/v8/v8/+/70000946eb2a9155679528702a766219a1fcf154
> Review-Url: https://codereview.chromium.org/2630233003
> Cr-Commit-Position: refs/heads/master@{#42570}
> Committed: https://chromium.googlesource.com/v8/v8/+/ee94fa11ed63477393c6534c352ebac6e502396c

TBR=yangguo@chromium.org,littledan@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG= v8:5437 

Review-Url: https://codereview.chromium.org/2639403008
Cr-Commit-Position: refs/heads/master@{#42577}

[modify] https://crrev.com/50e0fe29bb4facb6b94cbfb51637daef6cc578b9/src/builtins/builtins-regexp.cc
[modify] https://crrev.com/50e0fe29bb4facb6b94cbfb51637daef6cc578b9/src/heap-symbols.h
[modify] https://crrev.com/50e0fe29bb4facb6b94cbfb51637daef6cc578b9/src/regexp/regexp-parser.cc
[modify] https://crrev.com/50e0fe29bb4facb6b94cbfb51637daef6cc578b9/test/mjsunit/harmony/regexp-named-captures.js
[modify] https://crrev.com/50e0fe29bb4facb6b94cbfb51637daef6cc578b9/test/mjsunit/mjsunit.status

Project Member Comment 6 by bugdroid1@chromium.org, Jan 26 2017
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/8bf52534f6bf86821a1589dcbcb7335052c1f94f

commit 8bf52534f6bf86821a1589dcbcb7335052c1f94f
Author: jgruber <jgruber@chromium.org>
Date: Thu Jan 26 07:59:21 2017

[regexp] Store named captures on the regexp result

This implements storing named captures on the regexp result object.
For instance, /(?<a>.)/u.exec("b") will return a result such that:

result.group.a  // "b"

https://tc39.github.io/proposal-regexp-named-groups/

BUG= v8:5437 

Review-Url: https://codereview.chromium.org/2630233003
Cr-Original-Original-Commit-Position: refs/heads/master@{#42532}
Committed: https://chromium.googlesource.com/v8/v8/+/70000946eb2a9155679528702a766219a1fcf154
Review-Url: https://codereview.chromium.org/2630233003
Cr-Original-Commit-Position: refs/heads/master@{#42570}
Committed: https://chromium.googlesource.com/v8/v8/+/ee94fa11ed63477393c6534c352ebac6e502396c
Review-Url: https://codereview.chromium.org/2630233003
Cr-Commit-Position: refs/heads/master@{#42676}

[modify] https://crrev.com/8bf52534f6bf86821a1589dcbcb7335052c1f94f/src/builtins/builtins-regexp.cc
[modify] https://crrev.com/8bf52534f6bf86821a1589dcbcb7335052c1f94f/src/heap-symbols.h
[modify] https://crrev.com/8bf52534f6bf86821a1589dcbcb7335052c1f94f/test/mjsunit/harmony/regexp-named-captures.js
[modify] https://crrev.com/8bf52534f6bf86821a1589dcbcb7335052c1f94f/test/mjsunit/mjsunit.status

Project Member Comment 7 by bugdroid1@chromium.org, Jan 26 2017
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/25bfdf1b46f21435343cd94b31add664395db146

commit 25bfdf1b46f21435343cd94b31add664395db146
Author: jgruber <jgruber@chromium.org>
Date: Thu Jan 26 09:31:08 2017

Revert of [regexp] Create property on result for each named capture (patchset #9 id:160001 of https://codereview.chromium.org/2630233003/ )

Reason for revert:
Some heap tests are broken leading to failures on nosnap builds:

https://build.chromium.org/p/client.v8.ports/builders/V8%20Linux%20-%20arm64%20-%20sim%20-%20nosnap%20-%20debug/builds/3677

Reverting again until tests are fixed to keep bots green.

Original issue's description:
> [regexp] Store named captures on the regexp result
>
> This implements storing named captures on the regexp result object.
> For instance, /(?<a>.)/u.exec("b") will return a result such that:
>
> result.group.a  // "b"
>
> https://tc39.github.io/proposal-regexp-named-groups/
>
> BUG= v8:5437 
>
> Review-Url: https://codereview.chromium.org/2630233003
> Cr-Original-Original-Commit-Position: refs/heads/master@{#42532}
> Committed: https://chromium.googlesource.com/v8/v8/+/70000946eb2a9155679528702a766219a1fcf154
> Review-Url: https://codereview.chromium.org/2630233003
> Cr-Original-Commit-Position: refs/heads/master@{#42570}
> Committed: https://chromium.googlesource.com/v8/v8/+/ee94fa11ed63477393c6534c352ebac6e502396c
> Review-Url: https://codereview.chromium.org/2630233003
> Cr-Commit-Position: refs/heads/master@{#42676}
> Committed: https://chromium.googlesource.com/v8/v8/+/8bf52534f6bf86821a1589dcbcb7335052c1f94f

TBR=yangguo@chromium.org,littledan@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG= v8:5437 

Review-Url: https://codereview.chromium.org/2654233002
Cr-Commit-Position: refs/heads/master@{#42681}

[modify] https://crrev.com/25bfdf1b46f21435343cd94b31add664395db146/src/builtins/builtins-regexp.cc
[modify] https://crrev.com/25bfdf1b46f21435343cd94b31add664395db146/src/heap-symbols.h
[modify] https://crrev.com/25bfdf1b46f21435343cd94b31add664395db146/test/mjsunit/harmony/regexp-named-captures.js
[modify] https://crrev.com/25bfdf1b46f21435343cd94b31add664395db146/test/mjsunit/mjsunit.status

Labels: Priority-2
Project Member Comment 11 by bugdroid1@chromium.org, Mar 23 2017
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/6dcf074bb232eced60ff47fe225d3d32d4bf583e

commit 6dcf074bb232eced60ff47fe225d3d32d4bf583e
Author: jgruber <jgruber@chromium.org>
Date: Thu Mar 23 15:45:00 2017

[regexp] Inline StringReplaceNonGlobalRegExpWithFunction

BUG= v8:5437 

Review-Url: https://codereview.chromium.org/2766423004
Cr-Commit-Position: refs/heads/master@{#44069}

[modify] https://crrev.com/6dcf074bb232eced60ff47fe225d3d32d4bf583e/src/runtime/runtime-regexp.cc

Project Member Comment 12 by bugdroid1@chromium.org, Mar 27 2017
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/80879b8c26818913f03cb5ec413e764fc39b498e

commit 80879b8c26818913f03cb5ec413e764fc39b498e
Author: jgruber <jgruber@chromium.org>
Date: Mon Mar 27 11:18:31 2017

[regexp] Named capture support for callable replacements

This implements support for named captures in
RegExp.prototype[@@replace] for when the replaceValue is callable.

In that case, the result.groups object is passed to the replacer
function as the last argument.

BUG= v8:5437 

Review-Url: https://codereview.chromium.org/2764343004
Cr-Commit-Position: refs/heads/master@{#44142}

[modify] https://crrev.com/80879b8c26818913f03cb5ec413e764fc39b498e/src/objects-inl.h
[modify] https://crrev.com/80879b8c26818913f03cb5ec413e764fc39b498e/src/objects.h
[modify] https://crrev.com/80879b8c26818913f03cb5ec413e764fc39b498e/src/runtime/runtime-regexp.cc
[modify] https://crrev.com/80879b8c26818913f03cb5ec413e764fc39b498e/test/mjsunit/harmony/regexp-named-captures.js

Project Member Comment 13 by bugdroid1@chromium.org, Mar 27 2017
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/fc44d57bcbd8c851e7be6c9513edb6e42cb8c245

commit fc44d57bcbd8c851e7be6c9513edb6e42cb8c245
Author: jgruber <jgruber@chromium.org>
Date: Mon Mar 27 13:19:22 2017

[string] Refactor String::GetSubstitution

Remove deep nesting and repeated code by using a switch-based structure
(instead of if-based), use clearer variable names, and separate cleanly between
immutable and mutable variables.

BUG= v8:5437 

Review-Url: https://codereview.chromium.org/2776123002
Cr-Commit-Position: refs/heads/master@{#44147}

[modify] https://crrev.com/fc44d57bcbd8c851e7be6c9513edb6e42cb8c245/src/objects.cc

Project Member Comment 14 by bugdroid1@chromium.org, Mar 28 2017
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/17f13863b64b25eccf565e0aa9c4c441f0562b84

commit 17f13863b64b25eccf565e0aa9c4c441f0562b84
Author: jgruber <jgruber@chromium.org>
Date: Tue Mar 28 08:02:03 2017

[regexp] Named capture support for string replacements

This implements support for named captures in
RegExp.prototype[@@replace] for when the replaceValue is not callable.

Named captures can be referenced from replacement strings by using the
"$<name>" syntax. A couple of examples:

let re = /(?<fst>.)(?<snd>.)/u;
"abcd".replace(re, "$<snd>$<fst>")  // "bacd"
"abcd".replace(re, "$2$1")     // "bacd" (numbered refs work as always)
"abcd".replace(re, "$<snd")    // SyntaxError (unterminated named ref)
"abcd".replace(re, "$<42$1>")  // "cd" (invalid name)
"abcd".replace(re, "$<thd>")   // "cd" (non-existent name)
"abcd".replace(/(?<fst>.)|(?<snd>.)/u, "$<snd>")  // "cd" (non-matched capture)

Support is currently behind the --harmony-regexp-named-captures flag.

BUG= v8:5437 

Review-Url: https://codereview.chromium.org/2775303002
Cr-Commit-Position: refs/heads/master@{#44171}

[modify] https://crrev.com/17f13863b64b25eccf565e0aa9c4c441f0562b84/src/messages.h
[modify] https://crrev.com/17f13863b64b25eccf565e0aa9c4c441f0562b84/src/objects.cc
[modify] https://crrev.com/17f13863b64b25eccf565e0aa9c4c441f0562b84/src/objects.h
[modify] https://crrev.com/17f13863b64b25eccf565e0aa9c4c441f0562b84/src/runtime/runtime-regexp.cc
[modify] https://crrev.com/17f13863b64b25eccf565e0aa9c4c441f0562b84/src/runtime/runtime-strings.cc
[modify] https://crrev.com/17f13863b64b25eccf565e0aa9c4c441f0562b84/test/cctest/interpreter/bytecode_expectations/ForAwaitOf.golden
[modify] https://crrev.com/17f13863b64b25eccf565e0aa9c4c441f0562b84/test/cctest/interpreter/bytecode_expectations/ForOf.golden
[modify] https://crrev.com/17f13863b64b25eccf565e0aa9c4c441f0562b84/test/cctest/interpreter/bytecode_expectations/Generators.golden
[modify] https://crrev.com/17f13863b64b25eccf565e0aa9c4c441f0562b84/test/mjsunit/harmony/regexp-named-captures.js

Project Member Comment 15 by bugdroid1@chromium.org, Mar 28 2017
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/34ffdd6238fb2aa3beb7a9397521e56b48b04523

commit 34ffdd6238fb2aa3beb7a9397521e56b48b04523
Author: jgruber <jgruber@chromium.org>
Date: Tue Mar 28 09:02:14 2017

Revert of [regexp] Named capture support for string replacements (patchset #5 id:80001 of https://codereview.chromium.org/2775303002/ )

Reason for revert:
Invalid DCHECKs for non-matched groups.

Original issue's description:
> [regexp] Named capture support for string replacements
>
> This implements support for named captures in
> RegExp.prototype[@@replace] for when the replaceValue is not callable.
>
> Named captures can be referenced from replacement strings by using the
> "$<name>" syntax. A couple of examples:
>
> let re = /(?<fst>.)(?<snd>.)/u;
> "abcd".replace(re, "$<snd>$<fst>")  // "bacd"
> "abcd".replace(re, "$2$1")     // "bacd" (numbered refs work as always)
> "abcd".replace(re, "$<snd")    // SyntaxError (unterminated named ref)
> "abcd".replace(re, "$<42$1>")  // "cd" (invalid name)
> "abcd".replace(re, "$<thd>")   // "cd" (non-existent name)
> "abcd".replace(/(?<fst>.)|(?<snd>.)/u, "$<snd>")  // "cd" (non-matched capture)
>
> Support is currently behind the --harmony-regexp-named-captures flag.
>
> BUG= v8:5437 
>
> Review-Url: https://codereview.chromium.org/2775303002
> Cr-Commit-Position: refs/heads/master@{#44171}
> Committed: https://chromium.googlesource.com/v8/v8/+/17f13863b64b25eccf565e0aa9c4c441f0562b84

TBR=yangguo@chromium.org,littledan@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG= v8:5437 

Review-Url: https://codereview.chromium.org/2776293003
Cr-Commit-Position: refs/heads/master@{#44180}

[modify] https://crrev.com/34ffdd6238fb2aa3beb7a9397521e56b48b04523/src/messages.h
[modify] https://crrev.com/34ffdd6238fb2aa3beb7a9397521e56b48b04523/src/objects.cc
[modify] https://crrev.com/34ffdd6238fb2aa3beb7a9397521e56b48b04523/src/objects.h
[modify] https://crrev.com/34ffdd6238fb2aa3beb7a9397521e56b48b04523/src/runtime/runtime-regexp.cc
[modify] https://crrev.com/34ffdd6238fb2aa3beb7a9397521e56b48b04523/src/runtime/runtime-strings.cc
[modify] https://crrev.com/34ffdd6238fb2aa3beb7a9397521e56b48b04523/test/cctest/interpreter/bytecode_expectations/ForAwaitOf.golden
[modify] https://crrev.com/34ffdd6238fb2aa3beb7a9397521e56b48b04523/test/cctest/interpreter/bytecode_expectations/ForOf.golden
[modify] https://crrev.com/34ffdd6238fb2aa3beb7a9397521e56b48b04523/test/cctest/interpreter/bytecode_expectations/Generators.golden
[modify] https://crrev.com/34ffdd6238fb2aa3beb7a9397521e56b48b04523/test/mjsunit/harmony/regexp-named-captures.js

Project Member Comment 16 by bugdroid1@chromium.org, Mar 28 2017
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/9403edfa83d0dcfdb6f110b5dc4674e4534c26e0

commit 9403edfa83d0dcfdb6f110b5dc4674e4534c26e0
Author: jgruber <jgruber@chromium.org>
Date: Tue Mar 28 09:09:42 2017

[regexp] Named capture support for string replacements

This implements support for named captures in
RegExp.prototype[@@replace] for when the replaceValue is not callable.

Named captures can be referenced from replacement strings by using the
"$<name>" syntax. A couple of examples:

let re = /(?<fst>.)(?<snd>.)/u;
"abcd".replace(re, "$<snd>$<fst>")  // "bacd"
"abcd".replace(re, "$2$1")     // "bacd" (numbered refs work as always)
"abcd".replace(re, "$<snd")    // SyntaxError (unterminated named ref)
"abcd".replace(re, "$<42$1>")  // "cd" (invalid name)
"abcd".replace(re, "$<thd>")   // "cd" (non-existent name)
"abcd".replace(/(?<fst>.)|(?<snd>.)/u, "$<snd>")  // "cd" (non-matched capture)

Support is currently behind the --harmony-regexp-named-captures flag.

BUG= v8:5437 

Review-Url: https://codereview.chromium.org/2775303002
Cr-Original-Commit-Position: refs/heads/master@{#44171}
Committed: https://chromium.googlesource.com/v8/v8/+/17f13863b64b25eccf565e0aa9c4c441f0562b84
Review-Url: https://codereview.chromium.org/2775303002
Cr-Commit-Position: refs/heads/master@{#44182}

[modify] https://crrev.com/9403edfa83d0dcfdb6f110b5dc4674e4534c26e0/src/messages.h
[modify] https://crrev.com/9403edfa83d0dcfdb6f110b5dc4674e4534c26e0/src/objects.cc
[modify] https://crrev.com/9403edfa83d0dcfdb6f110b5dc4674e4534c26e0/src/objects.h
[modify] https://crrev.com/9403edfa83d0dcfdb6f110b5dc4674e4534c26e0/src/runtime/runtime-regexp.cc
[modify] https://crrev.com/9403edfa83d0dcfdb6f110b5dc4674e4534c26e0/src/runtime/runtime-strings.cc
[modify] https://crrev.com/9403edfa83d0dcfdb6f110b5dc4674e4534c26e0/test/cctest/interpreter/bytecode_expectations/ForAwaitOf.golden
[modify] https://crrev.com/9403edfa83d0dcfdb6f110b5dc4674e4534c26e0/test/cctest/interpreter/bytecode_expectations/ForOf.golden
[modify] https://crrev.com/9403edfa83d0dcfdb6f110b5dc4674e4534c26e0/test/cctest/interpreter/bytecode_expectations/Generators.golden
[modify] https://crrev.com/9403edfa83d0dcfdb6f110b5dc4674e4534c26e0/test/mjsunit/harmony/regexp-named-captures.js

Project Member Comment 17 by bugdroid1@chromium.org, Mar 28 2017
Project Member Comment 18 by bugdroid1@chromium.org, Mar 29 2017
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/e2858f2adc4e8767576ab3adda61e37695bfd7be

commit e2858f2adc4e8767576ab3adda61e37695bfd7be
Author: jgruber <jgruber@chromium.org>
Date: Wed Mar 29 07:18:10 2017

[regexp] Properly handle failed RegExp compilations

Compilation can fail e.g. on stack overflow. This ensures that we exit
early from StringReplaceGlobalRegExpWithString in that case.

BUG= v8:5437 , chromium:705934 

Review-Url: https://codereview.chromium.org/2778953004
Cr-Commit-Position: refs/heads/master@{#44215}

[modify] https://crrev.com/e2858f2adc4e8767576ab3adda61e37695bfd7be/src/runtime/runtime-regexp.cc
[add] https://crrev.com/e2858f2adc4e8767576ab3adda61e37695bfd7be/test/mjsunit/regress/regress-705934.js

Project Member Comment 19 by bugdroid1@chromium.org, Mar 30 2017
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/1200cc2c6d715466ee762a05ae26fe4a4f82eb36

commit 1200cc2c6d715466ee762a05ae26fe4a4f82eb36
Author: jgruber <jgruber@chromium.org>
Date: Thu Mar 30 11:55:11 2017

[regexp] Only access result.groups if named captures are enabled

GetProperty(result, groups) needs to be called iff the
harmony-regexp-named-captures flag is enabled.

Also add a couple of DCHECKS.

BUG= v8:5437 ,chromium:706748

Review-Url: https://codereview.chromium.org/2786933002
Cr-Commit-Position: refs/heads/master@{#44267}

[modify] https://crrev.com/1200cc2c6d715466ee762a05ae26fe4a4f82eb36/src/runtime/runtime-regexp.cc

Project Member Comment 20 by bugdroid1@chromium.org, Mar 31 2017
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/cb812f8e5821745f906f15d22e86ecedad5212bf

commit cb812f8e5821745f906f15d22e86ecedad5212bf
Author: jgruber <jgruber@chromium.org>
Date: Fri Mar 31 07:57:15 2017

[regexp] Extend tests for named captures

Additional tests, mostly for interactions with lookbehind assertions.

BUG= v8:5437 

Review-Url: https://codereview.chromium.org/2784813002
Cr-Commit-Position: refs/heads/master@{#44290}

[modify] https://crrev.com/cb812f8e5821745f906f15d22e86ecedad5212bf/test/mjsunit/harmony/regexp-named-captures.js

Project Member Comment 21 by bugdroid1@chromium.org, Mar 31 2017
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/3f8b2aeb3587dad6a279d439db56db785197253a

commit 3f8b2aeb3587dad6a279d439db56db785197253a
Author: jgruber <jgruber@chromium.org>
Date: Fri Mar 31 10:50:05 2017

[regexp] Fix numbered reference before named capture

Numbered back-references that occur before the referenced capture
trigger an internal mini-parser that looks ahead in the pattern and
counts capturing groups.

This updates the mini-parser to correctly handle named captures.

BUG= v8:5437 

Review-Url: https://codereview.chromium.org/2792523002
Cr-Commit-Position: refs/heads/master@{#44303}

[modify] https://crrev.com/3f8b2aeb3587dad6a279d439db56db785197253a/src/regexp/regexp-parser.cc
[modify] https://crrev.com/3f8b2aeb3587dad6a279d439db56db785197253a/test/mjsunit/harmony/regexp-named-captures.js

Project Member Comment 22 by bugdroid1@chromium.org, Mar 31 2017
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/686c37839c00e1510625b6cb11a7f18a459eb2a7

commit 686c37839c00e1510625b6cb11a7f18a459eb2a7
Author: jgruber <jgruber@chromium.org>
Date: Fri Mar 31 14:38:36 2017

[regexp] Revert to ZoneList usage in @@replace

Fixes a crash found by clusterfuzz caused by a call to
std::vector::reserve with a huge capacity, and reverts to ZoneList
handling as a tentative fix for performance regressions on the slow
@@replace path.

BUG= chromium:707187 ,chromium:706748, v8:5437 

Review-Url: https://codereview.chromium.org/2787343002
Cr-Commit-Position: refs/heads/master@{#44311}

[modify] https://crrev.com/686c37839c00e1510625b6cb11a7f18a459eb2a7/src/runtime/runtime-regexp.cc
[add] https://crrev.com/686c37839c00e1510625b6cb11a7f18a459eb2a7/test/mjsunit/regress/regress-707187.js

Project Member Comment 23 by bugdroid1@chromium.org, Apr 3
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/a3be9e78c1bdb9332853cf37004697b737f1665f

commit a3be9e78c1bdb9332853cf37004697b737f1665f
Author: jgruber <jgruber@chromium.org>
Date: Mon Apr 03 08:03:09 2017

[regexp] Allow named captures and back-references in non-unicode patterns

Previously, named captures (and related functionality) were restricted to
unicode-mode regexps.

This CL extends that support to non-unicode patterns. Named groups are
supported regardless of the mode, and named back-references are supported if
the regexp is in unicode mode or if it contains a named capture (otherwise '\k'
is treated as an identity escape).

BUG= v8:5437 , v8:6192 

Review-Url: https://codereview.chromium.org/2788873002
Cr-Commit-Position: refs/heads/master@{#44324}

[modify] https://crrev.com/a3be9e78c1bdb9332853cf37004697b737f1665f/src/regexp/regexp-parser.cc
[modify] https://crrev.com/a3be9e78c1bdb9332853cf37004697b737f1665f/src/regexp/regexp-parser.h
[modify] https://crrev.com/a3be9e78c1bdb9332853cf37004697b737f1665f/test/mjsunit/harmony/regexp-named-captures.js

Project Member Comment 24 by bugdroid1@chromium.org, Apr 3
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/3b716a08044da1073240cd287f35c8517fcf392f

commit 3b716a08044da1073240cd287f35c8517fcf392f
Author: jgruber <jgruber@chromium.org>
Date: Mon Apr 03 09:37:17 2017

[regexp] Stage named captures

BUG= v8:5437 

Review-Url: https://codereview.chromium.org/2779033003
Cr-Commit-Position: refs/heads/master@{#44331}

[modify] https://crrev.com/3b716a08044da1073240cd287f35c8517fcf392f/src/flag-definitions.h

Project Member Comment 25 by bugdroid1@chromium.org, Apr 5
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/d890ec3261b09aca90e50b8a814a737602b071cf

commit d890ec3261b09aca90e50b8a814a737602b071cf
Author: jgruber <jgruber@chromium.org>
Date: Wed Apr 05 07:01:50 2017

[regexp] Disallow '\' in capture names

IdentifierStart::Is and IdentifierContinue::Is both return true for '\'.
The reason for this is lost to history.

Special-case '\' in the regexp parser to handle this.

BUG= v8:5437 , v8:5868 

Review-Url: https://codereview.chromium.org/2795093003
Cr-Commit-Position: refs/heads/master@{#44396}

[modify] https://crrev.com/d890ec3261b09aca90e50b8a814a737602b071cf/src/regexp/regexp-parser.cc
[modify] https://crrev.com/d890ec3261b09aca90e50b8a814a737602b071cf/test/mjsunit/harmony/regexp-named-captures.js

Project Member Comment 27 by bugdroid1@chromium.org, Apr 7
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/a8651c5671dd6e41595ffb438e7ea013082f2d38

commit a8651c5671dd6e41595ffb438e7ea013082f2d38
Author: jgruber <jgruber@chromium.org>
Date: Fri Apr 07 07:34:10 2017

[regexp] Support unicode capture names in non-unicode patterns

This ensures that capture names containing surrogate pairs are parsed
correctly even in non-unicode RegExp patterns by introducing a new
scanning mode which unconditionally combines surrogate pairs.

BUG= v8:5437 , v8:6192 

Review-Url: https://codereview.chromium.org/2791163003
Cr-Commit-Position: refs/heads/master@{#44466}

[modify] https://crrev.com/a8651c5671dd6e41595ffb438e7ea013082f2d38/src/regexp/regexp-parser.cc
[modify] https://crrev.com/a8651c5671dd6e41595ffb438e7ea013082f2d38/src/regexp/regexp-parser.h
[modify] https://crrev.com/a8651c5671dd6e41595ffb438e7ea013082f2d38/test/mjsunit/harmony/regexp-named-captures.js

Project Member Comment 28 by bugdroid1@chromium.org, Apr 7
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/1329d15e99096559a41ac7cb49fbd0199607a5d2

commit 1329d15e99096559a41ac7cb49fbd0199607a5d2
Author: jgruber <jgruber@chromium.org>
Date: Fri Apr 07 08:32:46 2017

[regexp] Throw on invalid capture group names in replacer string

References to invalid names (i.e. not specified as a named group in the
pattern) throw a SyntaxError. Unmatched groups are still replaced by the
empty string.

See https://github.com/tc39/proposal-regexp-named-groups/issues/14.

BUG= v8:5437 

Review-Url: https://codereview.chromium.org/2791183002
Cr-Commit-Position: refs/heads/master@{#44471}

[modify] https://crrev.com/1329d15e99096559a41ac7cb49fbd0199607a5d2/src/objects.cc
[modify] https://crrev.com/1329d15e99096559a41ac7cb49fbd0199607a5d2/src/objects.h
[modify] https://crrev.com/1329d15e99096559a41ac7cb49fbd0199607a5d2/src/runtime/runtime-regexp.cc
[modify] https://crrev.com/1329d15e99096559a41ac7cb49fbd0199607a5d2/src/runtime/runtime-strings.cc
[modify] https://crrev.com/1329d15e99096559a41ac7cb49fbd0199607a5d2/test/mjsunit/harmony/regexp-named-captures.js

Project Member Comment 29 by bugdroid1@chromium.org, Apr 7
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/f3b848fe5d1dcca6a2e490e5b5674d551f7d27db

commit f3b848fe5d1dcca6a2e490e5b5674d551f7d27db
Author: jgruber <jgruber@chromium.org>
Date: Fri Apr 07 08:57:42 2017

[regexp] Updates for unicode escapes in capture names

Update docs and tests for recent changes in the spec for unicode escapes
in capture group names.

https://github.com/tc39/proposal-regexp-named-groups/issues/23

BUG= v8:5437 

Review-Url: https://codereview.chromium.org/2788423003
Cr-Commit-Position: refs/heads/master@{#44474}

[modify] https://crrev.com/f3b848fe5d1dcca6a2e490e5b5674d551f7d27db/src/regexp/regexp-parser.cc
[modify] https://crrev.com/f3b848fe5d1dcca6a2e490e5b5674d551f7d27db/test/mjsunit/harmony/regexp-named-captures.js

Status: Fixed
Closing as the current proposal is now fully supported in V8.
Project Member Comment 32 by bugdroid1@chromium.org, Apr 25
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/9372dd95d9f9c855e8b7b17e840b6205b60ee328

commit 9372dd95d9f9c855e8b7b17e840b6205b60ee328
Author: jgruber <jgruber@chromium.org>
Date: Tue Apr 25 11:20:34 2017

[regexp] Fix unicode escapes in test strings

Some of these tests pass the pattern as a string, and in this case
there's a subtle distinction between

"/\u{0041}/"  // Unicode escape interpreted in string literal.

and

"/\\u{0041}/"  // Unicode escape interpreted by regexp parser.

Extend these tests to check both cases.

Thanks littledan@ for pointing this out.

BUG= v8:5437 

Review-Url: https://codereview.chromium.org/2839923002
Cr-Commit-Position: refs/heads/master@{#44840}

[modify] https://crrev.com/9372dd95d9f9c855e8b7b17e840b6205b60ee328/test/mjsunit/harmony/regexp-named-captures.js

Project Member Comment 33 by bugdroid1@chromium.org, May 4
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/f918404590b6800c5a5ef26fb358abbc28622deb

commit f918404590b6800c5a5ef26fb358abbc28622deb
Author: littledan <littledan@chromium.org>
Date: Thu May 04 12:33:38 2017

Revert of [regexp] Support unicode capture names in non-unicode patterns (patchset #3 id:40001 of https://codereview.chromium.org/2791163003/ )

Reason for revert:
The decision for the specification was to not have this syntax, and instead the syntax before this patch.

Original issue's description:
> [regexp] Support unicode capture names in non-unicode patterns
>
> This ensures that capture names containing surrogate pairs are parsed
> correctly even in non-unicode RegExp patterns by introducing a new
> scanning mode which unconditionally combines surrogate pairs.
>
> BUG= v8:5437 , v8:6192 
>
> Review-Url: https://codereview.chromium.org/2791163003
> Cr-Commit-Position: refs/heads/master@{#44466}
> Committed: https://chromium.googlesource.com/v8/v8/+/a8651c5671dd6e41595ffb438e7ea013082f2d38

R=yangguo@chromium.org,jgruber@chromium.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG= v8:5437 , v8:6192 

Review-Url: https://codereview.chromium.org/2859933003
Cr-Commit-Position: refs/heads/master@{#45088}

[modify] https://crrev.com/f918404590b6800c5a5ef26fb358abbc28622deb/src/regexp/regexp-parser.cc
[modify] https://crrev.com/f918404590b6800c5a5ef26fb358abbc28622deb/src/regexp/regexp-parser.h
[modify] https://crrev.com/f918404590b6800c5a5ef26fb358abbc28622deb/test/mjsunit/harmony/regexp-named-captures.js

Description: Show this description
Blockedon: 6912
Blockedon: 6913
Blockedon: 6914
Project Member Comment 38 by bugdroid1@chromium.org, Oct 10
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/159236ec254cd48586e3b362e81ec79b995a9792

commit 159236ec254cd48586e3b362e81ec79b995a9792
Author: jgruber <jgruber@chromium.org>
Date: Tue Oct 10 11:37:29 2017

[regexp] Update semantics of GetSubstitution with named captures

The specced semantics of GetSubstitution are expected to change in the
case of malformed named references, or named references to nonexistent
named groups. The former will evaluate to the identity replacement of
'$<', while the latter will result in replacement by the empty string.

See also:
https://github.com/tc39/proposal-regexp-named-groups/issues/29

Bug:  v8:5437 ,  v8:6912 
Cq-Include-Trybots: master.tryserver.v8:v8_linux_noi18n_rel_ng
Change-Id: I879288f775774cb0ec563f9d9129a99710efb77c
Reviewed-on: https://chromium-review.googlesource.com/708654
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48426}
[modify] https://crrev.com/159236ec254cd48586e3b362e81ec79b995a9792/src/messages.h
[modify] https://crrev.com/159236ec254cd48586e3b362e81ec79b995a9792/src/objects.cc
[modify] https://crrev.com/159236ec254cd48586e3b362e81ec79b995a9792/src/runtime/runtime-regexp.cc
[modify] https://crrev.com/159236ec254cd48586e3b362e81ec79b995a9792/test/cctest/interpreter/bytecode_expectations/AsyncGenerators.golden
[modify] https://crrev.com/159236ec254cd48586e3b362e81ec79b995a9792/test/cctest/interpreter/bytecode_expectations/ForAwaitOf.golden
[modify] https://crrev.com/159236ec254cd48586e3b362e81ec79b995a9792/test/cctest/interpreter/bytecode_expectations/ForOf.golden
[modify] https://crrev.com/159236ec254cd48586e3b362e81ec79b995a9792/test/cctest/interpreter/bytecode_expectations/ForOfLoop.golden
[modify] https://crrev.com/159236ec254cd48586e3b362e81ec79b995a9792/test/cctest/interpreter/bytecode_expectations/Generators.golden
[modify] https://crrev.com/159236ec254cd48586e3b362e81ec79b995a9792/test/mjsunit/harmony/regexp-named-captures.js
[modify] https://crrev.com/159236ec254cd48586e3b362e81ec79b995a9792/test/test262/test262.status

Project Member Comment 39 by bugdroid1@chromium.org, Yesterday (26 hours ago)
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/4c5c5bc0d36cfb20a26d75c6c93275de4af3c976

commit 4c5c5bc0d36cfb20a26d75c6c93275de4af3c976
Author: Jakob Gruber <jgruber@chromium.org>
Date: Thu Oct 19 07:54:08 2017

[regexp] Ship named captures

Intent to ship: goo.gl/QZ4QZ5

Bug:  v8:5437 
Change-Id: Icdacceefa3085f2657edd7f99c7d8f4dbbb76814
Reviewed-on: https://chromium-review.googlesource.com/727200
Reviewed-by: Michael Hablich <hablich@chromium.org>
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48721}
[modify] https://crrev.com/4c5c5bc0d36cfb20a26d75c6c93275de4af3c976/src/flag-definitions.h

Sign in to add a comment