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

Issue 18708: Irregexp Issue 187: Captures in look-aheads are correctly cleared when backtracking. (Closed)

Created:
11 years, 11 months ago by Lasse Reichstein
Modified:
9 years, 6 months ago
Reviewers:
Erik Corry
CC:
v8-dev
Visibility:
Public.

Description

Clears captures of look-aheads on backtrack. Reduces number of pushes when flushing a trace. Some are converted to clears in the undo-code instead, and some just ignored if they have no value worth restoring.

Patch Set 1 #

Total comments: 12

Patch Set 2 : Addressed review comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+423 lines, -100 lines) Patch
M src/ast.h View 2 chunks +12 lines, -2 lines 0 comments Download
M src/jsregexp.h View 1 6 chunks +28 lines, -12 lines 0 comments Download
M src/jsregexp.cc View 1 18 chunks +146 lines, -41 lines 0 comments Download
M src/parser.cc View 1 chunk +4 lines, -1 line 0 comments Download
M src/regexp-macro-assembler.h View 1 chunk +1 line, -1 line 0 comments Download
M src/regexp-macro-assembler-ia32.h View 1 chunk +1 line, -1 line 0 comments Download
M src/regexp-macro-assembler-ia32.cc View 4 chunks +25 lines, -5 lines 0 comments Download
M src/regexp-macro-assembler-irregexp.h View 1 chunk +1 line, -1 line 0 comments Download
M src/regexp-macro-assembler-irregexp.cc View 1 chunk +5 lines, -2 lines 0 comments Download
M src/regexp-macro-assembler-tracer.h View 1 chunk +1 line, -1 line 0 comments Download
M src/regexp-macro-assembler-tracer.cc View 1 chunk +3 lines, -3 lines 0 comments Download
M test/mjsunit/bugs/bug-187.js View 1 chunk +0 lines, -30 lines 0 comments Download
A test/mjsunit/regexp-lookahead.js View 1 chunk +166 lines, -0 lines 0 comments Download
A test/mjsunit/regress/regress-187.js View 1 chunk +30 lines, -0 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
Lasse Reichstein
Largish code review.
11 years, 11 months ago (2009-01-23 12:07:09 UTC) #1
Erik Corry
LGTM http://codereview.chromium.org/18708/diff/1/3 File src/jsregexp.cc (right): http://codereview.chromium.org/18708/diff/1/3#newcode1385 Line 1385: const int push_limit = (assembler->stack_limit_slack() + 1) ...
11 years, 11 months ago (2009-01-23 13:09:21 UTC) #2
Lasse Reichstein
11 years, 11 months ago (2009-01-23 13:34:34 UTC) #3
Addressed review comments

http://codereview.chromium.org/18708/diff/1/3
File src/jsregexp.cc (right):

http://codereview.chromium.org/18708/diff/1/3#newcode1385
Line 1385: const int push_limit = (assembler->stack_limit_slack() + 1) / 2;
Ack, it lost its comment.
The +1 is to avoid doing modulo with zero if the slack is 1 (one).

http://codereview.chromium.org/18708/diff/1/3#newcode1397
Line 1397: enum DeferredActionUndoType { IGNORE, RESTORE, CLEAR } undo_action =
IGNORE;
On 2009/01/23 13:09:21, Erik Corry wrote:
> I think it's cleaner to create the enum and use it in two different
statements.

Done.

http://codereview.chromium.org/18708/diff/1/3#newcode1414
Line 1414: value = psr->value();
On 2009/01/23 13:09:21, Erik Corry wrote:
> Here you are overwriting a value with an older one!  You should just ignore
the
> value, but use the action for the undo action.

Done.

http://codereview.chromium.org/18708/diff/1/3#newcode1420
Line 1420: // counters. They have no significant previous value.
Correct. We will have to propagate the information on whether we are inside a
loop to this point. Until then, we'll have to restore the value to be safe.

http://codereview.chromium.org/18708/diff/1/3#newcode1440
Line 1440: undo_action = CLEAR;
This is also a problem if the STORE_POSITION is not a capture, but for checking
if a loop matches emptily.
If the loop is inside another loop, we need to restore.

http://codereview.chromium.org/18708/diff/1/3#newcode1467
Line 1467: (pushes % push_limit == 0) ? RegExpMacroAssembler::kCheckStackLimit
On 2009/01/23 13:09:21, Erik Corry wrote:
> I'd prefer just zeroing the pushlimit here.  That way you avoid the expensive
%
> operation and I think it would be clearer.

Done.

Powered by Google App Engine
This is Rietveld 408576698