Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Issue 2398423002: [regexp] Port RegExp.prototype[@@replace] (Closed)

Created:
4 years, 2 months ago by jgruber
Modified:
4 years, 2 months ago
Reviewers:
Igor Sheludko, Yang
CC:
v8-reviews_googlegroups.com, Benedikt Meurer
Target Ref:
refs/pending/heads/master
Project:
v8
Visibility:
Public.

Description

[regexp] Port RegExp.prototype[@@replace] This moves the implementation of @@replace from regexp.js to builtins-regexp.cc (the TurboFan fast path) and runtime-regexp.cc (slow path). The fast path handles all cases in which the regexp itself is an unmodified JSRegExp instance, the given 'replace' argument is not callable and does not contain any '$' characters (i.e. we are doing a string replacement). BUG=v8:5339 Committed: https://crrev.com/33a4faa47d664328464cb11597ac36d07051d7dd Cr-Commit-Position: refs/heads/master@{#40253}

Patch Set 1 #

Patch Set 2 : Copy COW arrays #

Patch Set 3 : Tweaks in string code-stub-assembler methods #

Total comments: 10

Patch Set 4 : Address comments #

Patch Set 5 : Reload last match info after RegExpMultiple #

Total comments: 2

Patch Set 6 : Rebaseline again #

Patch Set 7 : Smi::kZero #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1224 lines, -413 lines) Patch
M src/bootstrapper.cc View 1 2 3 3 chunks +11 lines, -1 line 0 comments Download
M src/builtins/builtins.h View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M src/builtins/builtins-regexp.cc View 1 2 3 4 5 6 9 chunks +236 lines, -9 lines 0 comments Download
M src/code-stub-assembler.h View 1 2 3 3 chunks +33 lines, -3 lines 0 comments Download
M src/code-stub-assembler.cc View 1 2 3 4 5 6 7 chunks +183 lines, -4 lines 0 comments Download
M src/contexts.h View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M src/js/prologue.js View 1 chunk +0 lines, -1 line 0 comments Download
M src/js/regexp.js View 1 2 3 5 chunks +0 lines, -356 lines 0 comments Download
M src/objects.h View 1 2 3 1 chunk +19 lines, -0 lines 0 comments Download
M src/objects.cc View 1 2 3 1 chunk +95 lines, -0 lines 0 comments Download
M src/runtime/runtime.h View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M src/runtime/runtime-regexp.cc View 1 2 3 4 10 chunks +635 lines, -31 lines 0 comments Download
M src/string-builder.h View 1 chunk +0 lines, -6 lines 0 comments Download
M test/cctest/interpreter/bytecode_expectations/CallRuntime.golden View 1 2 3 5 1 chunk +1 line, -1 line 0 comments Download
M test/mjsunit/regexp.js View 1 2 3 1 chunk +8 lines, -0 lines 0 comments Download

Messages

Total messages: 36 (27 generated)
jgruber
This is the largest remaining part of the regexp port. We optimize for simple string ...
4 years, 2 months ago (2016-10-07 14:19:41 UTC) #10
Yang
lgtm https://codereview.chromium.org/2398423002/diff/30001/src/builtins/builtins-regexp.cc File src/builtins/builtins-regexp.cc (right): https://codereview.chromium.org/2398423002/diff/30001/src/builtins/builtins-regexp.cc#newcode554 src/builtins/builtins-regexp.cc:554: a->WordEqual(proto_map, initial_proto_initial_map); If we modify a property on ...
4 years, 2 months ago (2016-10-11 13:26:35 UTC) #11
jgruber
https://codereview.chromium.org/2398423002/diff/30001/src/builtins/builtins-regexp.cc File src/builtins/builtins-regexp.cc (right): https://codereview.chromium.org/2398423002/diff/30001/src/builtins/builtins-regexp.cc#newcode554 src/builtins/builtins-regexp.cc:554: a->WordEqual(proto_map, initial_proto_initial_map); On 2016/10/11 13:26:35, Yang wrote: > If ...
4 years, 2 months ago (2016-10-13 07:39:44 UTC) #14
Igor Sheludko
lgtm with nits: https://codereview.chromium.org/2398423002/diff/70001/src/code-stub-assembler.cc File src/code-stub-assembler.cc (right): https://codereview.chromium.org/2398423002/diff/70001/src/code-stub-assembler.cc#newcode2555 src/code-stub-assembler.cc:2555: Node* const smi_zero = a->SmiConstant(Smi::FromInt(0)); Smi::kZero, ...
4 years, 2 months ago (2016-10-13 10:45:17 UTC) #22
jgruber
Thanks! https://codereview.chromium.org/2398423002/diff/70001/src/code-stub-assembler.cc File src/code-stub-assembler.cc (right): https://codereview.chromium.org/2398423002/diff/70001/src/code-stub-assembler.cc#newcode2555 src/code-stub-assembler.cc:2555: Node* const smi_zero = a->SmiConstant(Smi::FromInt(0)); On 2016/10/13 10:45:16, ...
4 years, 2 months ago (2016-10-13 10:50:48 UTC) #27
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2398423002/110001
4 years, 2 months ago (2016-10-13 11:25:09 UTC) #32
commit-bot: I haz the power
Committed patchset #7 (id:110001)
4 years, 2 months ago (2016-10-13 11:27:31 UTC) #33
commit-bot: I haz the power
Patchset 7 (id:??) landed as https://crrev.com/33a4faa47d664328464cb11597ac36d07051d7dd Cr-Commit-Position: refs/heads/master@{#40253}
4 years, 2 months ago (2016-10-13 11:27:55 UTC) #35
zhengxing.li
4 years, 2 months ago (2016-10-14 15:22:11 UTC) #36
Message was sent while issue was closed.
On 2016/10/13 11:27:55, commit-bot: I haz the power wrote:
> Patchset 7 (id:??) landed as
> https://crrev.com/33a4faa47d664328464cb11597ac36d07051d7dd
> Cr-Commit-Position: refs/heads/master@{#40253}

Hi, all:

This CL caused a gcc compilation error.

For example: 
1. switch to gcc compiler
2. make ia32.optdebug snapsho=off -jn

then you got the following error message:
**********************************************************************************************************************************************************
In file included from .././src/base/base-export.h:8:0,
                 from .././src/base/logging.h:12,
                 from .././src/runtime/runtime-utils.h:8,
                 from ../src/runtime/runtime-regexp.cc:5:
.././src/vector.h: In function ‘v8::internal::Object*
v8::internal::__RT_impl_Runtime_RegExpReplace(v8::internal::Arguments,
v8::internal::Isolate*)’:
.././include/v8config.h:357:67: error: assuming signed overflow does not occur
when assuming that (X + c) < X is always false [-Werror=strict-overflow]
 # define V8_UNLIKELY(condition) (__builtin_expect(!!(condition), 0))
                                                                   ^
.././src/base/logging.h:48:9: note: in expansion of macro ‘V8_UNLIKELY’
     if (V8_UNLIKELY(!(condition))) {                                 \
         ^
.././src/base/logging.h:156:32: note: in expansion of macro ‘CHECK’
 #define DCHECK(condition)      CHECK(condition)
                                ^
.././src/vector.h:54:5: note: in expansion of macro ‘DCHECK’
     DCHECK(0 <= index && index < length_);
     ^
  CXX(target)
/home/zxli/work/google-v8/v8/out/x87.optdebug/obj.target/v8_base/src/wasm/wasm-module.o
cc1plus: all warnings being treated as errors
make[1]: ***
[/home/zxli/work/google-v8/v8/out/x87.optdebug/obj.target/v8_base/src/runtime/runtime-regexp.o]
Error 1
**********************************************************************************************************************************************************

Would you please take a look at this issue?

Thanks!

Powered by Google App Engine
This is Rietveld 408576698