On 2011/08/26 13:41:03, Vyacheslav Egorov wrote:
+lrn
http://codereview.chromium.org/7741041/diff/1/src/x64/regexp-macro-assembler-x64.cc
File src/x64/regexp-macro-assembler-x64.cc (right):
http://codereview.chromium.org/7741041/diff/1/src/x64/regexp-macro-assembler-x64.cc#newcode1190
src/x64/regexp-macro-assembler-x64.cc:1190: *return_address += delta;
On 2011/08/26 13:36:21, Sven wrote:
> This (old) code looks wrong: The delta is in units of Code, but we add
it
onto
a
> byte pointer. Is this really correct? I suspect that we should cast the
Code
> pointers to byte pointers before doing the subtraction. If I am wrong, a
comment
> why the code is correct should be added.
Yes. Nice catch.
For type safety we need to do code_handle->address() - re_code->address().
sizeof(Code) == 0 so I guess it somehow worked as expected.
This was a surprise to me as well, so I've just googled a bit:
http://www2.research.att.com/~bs/bs_faq2.html#sizeof-empty
http://stackoverflow.com/questions/3849334/sizeof-empty-structure-is-0-in-c-and-1-in-c-why
Somehow I would prefer a compiler warning/error in such cases like
ours... :-P
http://codereview.chromium.org/7741041/
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev