(I have only looked at the ia32 code)

http://codereview.chromium.org/17378/diff/1/6
File src/regexp-macro-assembler-ia32.cc (right):

http://codereview.chromium.org/17378/diff/1/6#newcode932
Line 932: __ mov(register_location(reg), esi);
The esi register does not hold the needed value (one character before
the start of the string) but instead it points to the end of the
string.
A cleared register would be seen as captured, with a position at the end
of the string.

Code that, I think, should trigger this:
  var m = /(?:(a)|b)*/.exec("ab");
  // m[1] should be null, it is "".
Otherwise a C-level test should show the difference in returned value
for the capture registers (2 instead of -1).

The correct value is computed in GetCode(), in the entry part, where we
initialize the capture registers. I suggest storing it somewhere safe
(e.g., as a "local variable" in the stack frame) until it's needed.

http://codereview.chromium.org/17378/diff/1/9
File src/regexp-macro-assembler-irregexp.h (right):

http://codereview.chromium.org/17378/diff/1/9#newcode69
Line 69: virtual void ClearRegister(int reg);
Could perhaps be called "ClearPositionRegister", because the value it
resets to is the -1 position. It does not make sense for, e.g.,
registers used as counters.

http://codereview.chromium.org/17378

--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to