Added the requirement of having an AssertNoAllocation present.
Also fixed a bug that was obvious when trying to add an AssertNoAllocation.
The
original version was also bugged, but less so (didn't handle a string
changing
encoding during GC, would fail if not all ASCII chars are in
single-element-string-cache)
Please take a look again.
http://codereview.chromium.org/7709024/diff/1/src/objects.h
File src/objects.h (right):
http://codereview.chromium.org/7709024/diff/1/src/objects.h#newcode5901
src/objects.h:5901: FlatContent GetFlatContent();
On 2011/08/23 10:28:28, Vitaly Repeshko wrote:
This needs some documentation.
Absolutely.
A couple of optional ideas:
1. Take a pointer/reference to AssertNoAllocation as a parameter
(similar to
write barrier) to enforce valid usage.
I considered that, but decided against it. It really doesn't enforce
valid usage, since the extracted vector can survive the FlatContent.
I'll have a look at it again, because it is a good idea and it at least
encourages good behavior.
2. Make this->IsFlat() a requirement, since this function doesn't
flatten and
the caller has to check whether the content is flat anyways.
That would require two inspections of the ConsString if it is flat - on
in the caller to see that it's flat, and one see that it's a Cons and
traverse it in GetFlatContent. This way we only check it once. I think
it makes the call-points clearer.
http://codereview.chromium.org/7709024/
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev