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

Issue 7709024: Replace ToAsciiVector and ToUC16Vector with single function that returns a tagged value. (Closed)

Created:
9 years, 4 months ago by Lasse Reichstein
Modified:
9 years, 4 months ago
Reviewers:
Vitaly Repeshko, Yang
CC:
v8-dev
Visibility:
Public.

Description

Replace ToAsciiVector and ToUC16Vector with single function that returns a tagged value. The tag tells whether the content is ASCII or UC16, or even if the string wasn't flat. BUG: v8:1633 Committed: http://code.google.com/p/v8/source/detail?r=8999

Patch Set 1 #

Total comments: 2

Patch Set 2 : Require AssertNoAllocation. Fixed bug detected by this requirement. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+289 lines, -206 lines) Patch
M src/handles.cc View 1 1 chunk +5 lines, -3 lines 0 comments Download
M src/hydrogen-instructions.cc View 1 1 chunk +2 lines, -1 line 0 comments Download
M src/interpreter-irregexp.cc View 1 3 chunks +6 lines, -4 lines 0 comments Download
M src/jsregexp.cc View 1 2 chunks +21 lines, -27 lines 0 comments Download
M src/objects.h View 1 4 chunks +55 lines, -5 lines 0 comments Download
M src/objects.cc View 1 8 chunks +63 lines, -66 lines 0 comments Download
M src/objects-inl.h View 1 chunk +5 lines, -0 lines 0 comments Download
M src/runtime.cc View 1 14 chunks +121 lines, -100 lines 0 comments Download
M test/mjsunit/string-split.js View 1 1 chunk +11 lines, -0 lines 0 comments Download

Messages

Total messages: 4 (0 generated)
Lasse Reichstein
9 years, 4 months ago (2011-08-23 09:39:59 UTC) #1
Vitaly Repeshko
LGTM 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(); This needs some documentation. A couple ...
9 years, 4 months ago (2011-08-23 10:28:28 UTC) #2
Yang
On 2011/08/23 09:39:59, Lasse Reichstein wrote: LGTM.
9 years, 4 months ago (2011-08-23 11:05:10 UTC) #3
Lasse Reichstein
9 years, 4 months ago (2011-08-23 12:01:55 UTC) #4
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.

Powered by Google App Engine
This is Rietveld 408576698