Commit 7f074acd authored by yangguo@chromium.org's avatar yangguo@chromium.org

Remove most uses of StringInputBuffer

R=yangguo@chromium.org
BUG=

Review URL: https://chromiumcodereview.appspot.com/11638037
Patch from Dan Carney <dcarney@google.com>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13275 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 6b7fe028
......@@ -4043,10 +4043,9 @@ int String::WriteUtf8(char* buffer,
}
// Slow case.
i::StringInputBuffer& write_input_buffer = *isolate->write_input_buffer();
i::StringCharacterStream stream(*str, isolate->write_iterator());
isolate->string_tracker()->RecordWrite(str);
write_input_buffer.Reset(0, *str);
int len = str->length();
// Encode the first K - 3 bytes directly into the buffer since we
// know there's room for them. If no capacity is given we copy all
......@@ -4057,7 +4056,7 @@ int String::WriteUtf8(char* buffer,
int nchars = 0;
int previous = unibrow::Utf16::kNoPreviousCharacter;
for (i = 0; i < len && (capacity == -1 || pos < fast_end); i++) {
i::uc32 c = write_input_buffer.GetNext();
i::uc32 c = stream.GetNext();
int written = unibrow::Utf8::Encode(buffer + pos, c, previous);
pos += written;
nchars++;
......@@ -4069,7 +4068,7 @@ int String::WriteUtf8(char* buffer,
// buffer.
char intermediate[unibrow::Utf8::kMaxEncodedSize];
for (; i < len && pos < capacity; i++) {
i::uc32 c = write_input_buffer.GetNext();
i::uc32 c = stream.GetNext();
if (unibrow::Utf16::IsTrailSurrogate(c) &&
unibrow::Utf16::IsLeadSurrogate(previous)) {
// We can't use the intermediate buffer here because the encoding
......@@ -4125,7 +4124,7 @@ int String::WriteAscii(char* buffer,
}
if (str->IsOneByteRepresentation()) {
// WriteToFlat is faster than using the StringInputBuffer.
// WriteToFlat is faster than using the StringCharacterStream.
if (length == -1) length = str->length() + 1;
int len = i::Min(length, str->length() - start);
i::String::WriteToFlat(*str, buffer, start, start + len);
......@@ -4140,16 +4139,15 @@ int String::WriteAscii(char* buffer,
return len;
}
i::StringInputBuffer& write_input_buffer = *isolate->write_input_buffer();
int end = length;
if ((length == -1) || (length > str->length() - start)) {
end = str->length() - start;
}
if (end < 0) return 0;
write_input_buffer.Reset(start, *str);
i::StringCharacterStream write_stream(*str, isolate->write_iterator(), start);
int i;
for (i = 0; i < end; i++) {
char c = static_cast<char>(write_input_buffer.GetNext());
char c = static_cast<char>(write_stream.GetNext());
if (c == '\0' && !(options & PRESERVE_ASCII_NULL)) c = ' ';
buffer[i] = c;
}
......@@ -4173,7 +4171,7 @@ int String::Write(uint16_t* buffer,
isolate->string_tracker()->RecordWrite(str);
if (options & HINT_MANY_WRITES_EXPECTED) {
// Flatten the string for efficiency. This applies whether we are
// using StringInputBuffer or Get(i) to access the characters.
// using StringCharacterStream or Get(i) to access the characters.
FlattenString(str);
}
int end = start + length;
......
......@@ -131,14 +131,16 @@ void CodeGenerator::PrintCode(Handle<Code> code, CompilationInfo* info) {
Handle<Script> script = info->script();
if (!script->IsUndefined() && !script->source()->IsUndefined()) {
PrintF("--- Raw source ---\n");
StringInputBuffer stream(String::cast(script->source()));
stream.Seek(function->start_position());
ConsStringIteratorOp op;
StringCharacterStream stream(String::cast(script->source()),
&op,
function->start_position());
// fun->end_position() points to the last character in the stream. We
// need to compensate by adding one to calculate the length.
int source_len =
function->end_position() - function->start_position() + 1;
for (int i = 0; i < source_len; i++) {
if (stream.has_more()) PrintF("%c", stream.GetNext());
if (stream.HasMore()) PrintF("%c", stream.GetNext());
}
PrintF("\n\n");
}
......
......@@ -1635,7 +1635,7 @@ Isolate::Isolate()
free_list_(0),
preallocated_storage_preallocated_(false),
inner_pointer_to_code_cache_(NULL),
write_input_buffer_(NULL),
write_iterator_(NULL),
global_handles_(NULL),
context_switcher_(NULL),
thread_manager_(NULL),
......@@ -1846,8 +1846,8 @@ Isolate::~Isolate() {
bootstrapper_ = NULL;
delete inner_pointer_to_code_cache_;
inner_pointer_to_code_cache_ = NULL;
delete write_input_buffer_;
write_input_buffer_ = NULL;
delete write_iterator_;
write_iterator_ = NULL;
delete context_switcher_;
context_switcher_ = NULL;
......@@ -1965,7 +1965,7 @@ bool Isolate::Init(Deserializer* des) {
descriptor_lookup_cache_ = new DescriptorLookupCache();
unicode_cache_ = new UnicodeCache();
inner_pointer_to_code_cache_ = new InnerPointerToCodeCache(this);
write_input_buffer_ = new StringInputBuffer();
write_iterator_ = new ConsStringIteratorOp();
global_handles_ = new GlobalHandles(this);
bootstrapper_ = new Bootstrapper();
handle_scope_implementer_ = new HandleScopeImplementer(this);
......
......@@ -75,7 +75,7 @@ class PreallocatedMemoryThread;
class RegExpStack;
class SaveContext;
class UnicodeCache;
class StringInputBuffer;
class ConsStringIteratorOp;
class StringTracker;
class StubCache;
class ThreadManager;
......@@ -881,7 +881,7 @@ class Isolate {
return inner_pointer_to_code_cache_;
}
StringInputBuffer* write_input_buffer() { return write_input_buffer_; }
ConsStringIteratorOp* write_iterator() { return write_iterator_; }
GlobalHandles* global_handles() { return global_handles_; }
......@@ -903,16 +903,16 @@ class Isolate {
return &jsregexp_canonrange_;
}
StringInputBuffer* objects_string_compare_buffer_a() {
return &objects_string_compare_buffer_a_;
ConsStringIteratorOp* objects_string_compare_iterator_a() {
return &objects_string_compare_iterator_a_;
}
StringInputBuffer* objects_string_compare_buffer_b() {
return &objects_string_compare_buffer_b_;
ConsStringIteratorOp* objects_string_compare_iterator_b() {
return &objects_string_compare_iterator_b_;
}
StaticResource<StringInputBuffer>* objects_string_input_buffer() {
return &objects_string_input_buffer_;
StaticResource<ConsStringIteratorOp>* objects_string_iterator() {
return &objects_string_iterator_;
}
RuntimeState* runtime_state() { return &runtime_state_; }
......@@ -1225,7 +1225,7 @@ class Isolate {
PreallocatedStorage free_list_;
bool preallocated_storage_preallocated_;
InnerPointerToCodeCache* inner_pointer_to_code_cache_;
StringInputBuffer* write_input_buffer_;
ConsStringIteratorOp* write_iterator_;
GlobalHandles* global_handles_;
ContextSwitcher* context_switcher_;
ThreadManager* thread_manager_;
......@@ -1236,9 +1236,9 @@ class Isolate {
StringTracker* string_tracker_;
unibrow::Mapping<unibrow::Ecma262UnCanonicalize> jsregexp_uncanonicalize_;
unibrow::Mapping<unibrow::CanonicalizationRange> jsregexp_canonrange_;
StringInputBuffer objects_string_compare_buffer_a_;
StringInputBuffer objects_string_compare_buffer_b_;
StaticResource<StringInputBuffer> objects_string_input_buffer_;
ConsStringIteratorOp objects_string_compare_iterator_a_;
ConsStringIteratorOp objects_string_compare_iterator_b_;
StaticResource<ConsStringIteratorOp> objects_string_iterator_;
unibrow::Mapping<unibrow::Ecma262Canonicalize>
regexp_macro_assembler_canonicalize_;
RegExpStack* regexp_stack_;
......
......@@ -2845,21 +2845,31 @@ String* ConsStringIteratorOp::ContinueOperation(int32_t* type_out,
uint16_t StringCharacterStream::GetNext() {
ASSERT((buffer8_ == NULL && end_ == NULL) || buffer8_ < end_);
ASSERT(buffer8_ != NULL && end_ != NULL);
// Advance cursor if needed.
// TODO(dcarney): Ensure uses of the api call HasMore first and avoid this.
if (buffer8_ == end_) HasMore();
ASSERT(buffer8_ < end_);
return is_one_byte_ ? *buffer8_++ : *buffer16_++;
}
StringCharacterStream::StringCharacterStream(
String* string, unsigned offset, ConsStringIteratorOp* op)
StringCharacterStream::StringCharacterStream(String* string,
ConsStringIteratorOp* op,
unsigned offset)
: is_one_byte_(false),
buffer8_(NULL),
end_(NULL),
op_(op) {
op->Reset();
Reset(string, offset);
}
void StringCharacterStream::Reset(String* string, unsigned offset) {
op_->Reset();
buffer8_ = NULL;
end_ = NULL;
int32_t type = string->map()->instance_type();
unsigned length = string->length();
String::Visit(string, offset, *this, *op, type, length);
String::Visit(string, offset, *this, *op_, type, length);
}
......
This diff is collapsed.
......@@ -7200,9 +7200,7 @@ class String: public HeapObject {
// Returns a hash value used for the property table
inline uint32_t Hash();
static bool ComputeArrayIndex(unibrow::CharacterStream* buffer,
uint32_t* index,
int length);
bool ComputeArrayIndex(uint32_t* index);
// Externalization.
bool MakeExternal(v8::String::ExternalStringResource* resource);
......@@ -7898,11 +7896,11 @@ class ConsStringIteratorOp {
class StringCharacterStream {
public:
inline StringCharacterStream(String* string,
unsigned offset,
ConsStringIteratorOp* op);
ConsStringIteratorOp* op,
unsigned offset = 0);
inline uint16_t GetNext();
inline bool HasMore();
inline void Reset(String* string, unsigned offset, ConsStringIteratorOp* op);
inline void Reset(String* string, unsigned offset = 0);
inline void VisitOneByteString(const uint8_t* chars, unsigned length);
inline void VisitTwoByteString(const uint16_t* chars, unsigned length);
......
......@@ -3489,17 +3489,17 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringLocaleCompare) {
str1->TryFlatten();
str2->TryFlatten();
StringInputBuffer& buf1 =
*isolate->runtime_state()->string_locale_compare_buf1();
StringInputBuffer& buf2 =
*isolate->runtime_state()->string_locale_compare_buf2();
buf1.Reset(str1);
buf2.Reset(str2);
ConsStringIteratorOp* op1 =
isolate->runtime_state()->string_locale_compare_it1();
ConsStringIteratorOp* op2 =
isolate->runtime_state()->string_locale_compare_it2();
// TODO(dcarney) Can do array compares here more efficiently.
StringCharacterStream stream1(str1, op1);
StringCharacterStream stream2(str2, op2);
for (int i = 0; i < end; i++) {
uint16_t char1 = buf1.GetNext();
uint16_t char2 = buf2.GetNext();
uint16_t char1 = stream1.GetNext();
uint16_t char2 = stream2.GetNext();
if (char1 != char2) return Smi::FromInt(char1 - char2);
}
......@@ -5143,11 +5143,11 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_URIEscape) {
int escaped_length = 0;
int length = source->length();
{
Access<StringInputBuffer> buffer(
isolate->runtime_state()->string_input_buffer());
buffer->Reset(source);
while (buffer->has_more()) {
uint16_t character = buffer->GetNext();
Access<ConsStringIteratorOp> op(
isolate->runtime_state()->string_iterator());
StringCharacterStream stream(source, op.value());
while (stream.HasMore()) {
uint16_t character = stream.GetNext();
if (character >= 256) {
escaped_length += 6;
} else if (IsNotEscaped(character)) {
......@@ -5175,11 +5175,11 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_URIEscape) {
String* destination = String::cast(o);
int dest_position = 0;
Access<StringInputBuffer> buffer(
isolate->runtime_state()->string_input_buffer());
buffer->Rewind();
while (buffer->has_more()) {
uint16_t chr = buffer->GetNext();
Access<ConsStringIteratorOp> op(
isolate->runtime_state()->string_iterator());
StringCharacterStream stream(source, op.value());
while (stream.HasMore()) {
uint16_t chr = stream.GetNext();
if (chr >= 256) {
destination->Set(dest_position, '%');
destination->Set(dest_position+1, 'u');
......@@ -5717,15 +5717,15 @@ MUST_USE_RESULT static MaybeObject* ConvertCaseHelper(
// Convert all characters to upper case, assuming that they will fit
// in the buffer
Access<StringInputBuffer> buffer(
isolate->runtime_state()->string_input_buffer());
buffer->Reset(s);
Access<ConsStringIteratorOp> op(
isolate->runtime_state()->string_iterator());
StringCharacterStream stream(s, op.value());
unibrow::uchar chars[Converter::kMaxWidth];
// We can assume that the string is not empty
uc32 current = buffer->GetNext();
uc32 current = stream.GetNext();
for (int i = 0; i < length;) {
bool has_next = buffer->has_more();
uc32 next = has_next ? buffer->GetNext() : 0;
bool has_next = stream.HasMore();
uc32 next = has_next ? stream.GetNext() : 0;
int char_length = mapping->get(current, next, chars);
if (char_length == 0) {
// The case conversion of this character is the character itself.
......@@ -5755,8 +5755,8 @@ MUST_USE_RESULT static MaybeObject* ConvertCaseHelper(
if (next_length == 0) next_length = 1;
}
int current_length = i + char_length + next_length;
while (buffer->has_more()) {
current = buffer->GetNext();
while (stream.HasMore()) {
current = stream.GetNext();
// NOTE: we use 0 as the next character here because, while
// the next character may affect what a character converts to,
// it does not in any case affect the length of what it convert
......@@ -6960,23 +6960,21 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SmiLexicographicCompare) {
}
static Object* StringInputBufferCompare(RuntimeState* state,
static Object* StringCharacterStreamCompare(RuntimeState* state,
String* x,
String* y) {
StringInputBuffer& bufx = *state->string_input_buffer_compare_bufx();
StringInputBuffer& bufy = *state->string_input_buffer_compare_bufy();
bufx.Reset(x);
bufy.Reset(y);
while (bufx.has_more() && bufy.has_more()) {
int d = bufx.GetNext() - bufy.GetNext();
StringCharacterStream stream_x(x, state->string_iterator_compare_x());
StringCharacterStream stream_y(y, state->string_iterator_compare_y());
while (stream_x.HasMore() && stream_y.HasMore()) {
int d = stream_x.GetNext() - stream_y.GetNext();
if (d < 0) return Smi::FromInt(LESS);
else if (d > 0) return Smi::FromInt(GREATER);
}
// x is (non-trivial) prefix of y:
if (bufy.has_more()) return Smi::FromInt(LESS);
if (stream_y.HasMore()) return Smi::FromInt(LESS);
// y is prefix of x:
return Smi::FromInt(bufx.has_more() ? GREATER : EQUAL);
return Smi::FromInt(stream_x.HasMore() ? GREATER : EQUAL);
}
......@@ -7020,7 +7018,7 @@ static Object* FlatStringCompare(String* x, String* y) {
result = (r < 0) ? Smi::FromInt(LESS) : Smi::FromInt(GREATER);
}
ASSERT(result ==
StringInputBufferCompare(Isolate::Current()->runtime_state(), x, y));
StringCharacterStreamCompare(Isolate::Current()->runtime_state(), x, y));
return result;
}
......@@ -7056,7 +7054,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringCompare) {
}
return (x->IsFlat() && y->IsFlat()) ? FlatStringCompare(x, y)
: StringInputBufferCompare(isolate->runtime_state(), x, y);
: StringCharacterStreamCompare(isolate->runtime_state(), x, y);
}
......@@ -9885,9 +9883,10 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GlobalPrint) {
ASSERT(args.length() == 1);
CONVERT_ARG_CHECKED(String, string, 0);
StringInputBuffer buffer(string);
while (buffer.has_more()) {
uint16_t character = buffer.GetNext();
ConsStringIteratorOp op;
StringCharacterStream stream(string, &op);
while (stream.HasMore()) {
uint16_t character = stream.GetNext();
PrintF("%c", character);
}
return string;
......
......@@ -577,8 +577,8 @@ namespace internal {
class RuntimeState {
public:
StaticResource<StringInputBuffer>* string_input_buffer() {
return &string_input_buffer_;
StaticResource<ConsStringIteratorOp>* string_iterator() {
return &string_iterator_;
}
unibrow::Mapping<unibrow::ToUppercase, 128>* to_upper_mapping() {
return &to_upper_mapping_;
......@@ -586,29 +586,29 @@ class RuntimeState {
unibrow::Mapping<unibrow::ToLowercase, 128>* to_lower_mapping() {
return &to_lower_mapping_;
}
StringInputBuffer* string_input_buffer_compare_bufx() {
return &string_input_buffer_compare_bufx_;
ConsStringIteratorOp* string_iterator_compare_x() {
return &string_iterator_compare_x_;
}
StringInputBuffer* string_input_buffer_compare_bufy() {
return &string_input_buffer_compare_bufy_;
ConsStringIteratorOp* string_iterator_compare_y() {
return &string_iterator_compare_y_;
}
StringInputBuffer* string_locale_compare_buf1() {
return &string_locale_compare_buf1_;
ConsStringIteratorOp* string_locale_compare_it1() {
return &string_locale_compare_it1_;
}
StringInputBuffer* string_locale_compare_buf2() {
return &string_locale_compare_buf2_;
ConsStringIteratorOp* string_locale_compare_it2() {
return &string_locale_compare_it2_;
}
private:
RuntimeState() {}
// Non-reentrant string buffer for efficient general use in the runtime.
StaticResource<StringInputBuffer> string_input_buffer_;
StaticResource<ConsStringIteratorOp> string_iterator_;
unibrow::Mapping<unibrow::ToUppercase, 128> to_upper_mapping_;
unibrow::Mapping<unibrow::ToLowercase, 128> to_lower_mapping_;
StringInputBuffer string_input_buffer_compare_bufx_;
StringInputBuffer string_input_buffer_compare_bufy_;
StringInputBuffer string_locale_compare_buf1_;
StringInputBuffer string_locale_compare_buf2_;
ConsStringIteratorOp string_iterator_compare_x_;
ConsStringIteratorOp string_iterator_compare_y_;
ConsStringIteratorOp string_locale_compare_it1_;
ConsStringIteratorOp string_locale_compare_it2_;
friend class Isolate;
friend class Runtime;
......
......@@ -311,10 +311,10 @@ bool StringStream::Put(String* str) {
bool StringStream::Put(String* str, int start, int end) {
StringInputBuffer name_buffer(str);
name_buffer.Seek(start);
for (int i = start; i < end && name_buffer.has_more(); i++) {
int c = name_buffer.GetNext();
ConsStringIteratorOp op;
StringCharacterStream stream(str, &op, start);
for (int i = start; i < end && stream.HasMore(); i++) {
uint16_t c = stream.GetNext();
if (c >= 127 || c < 32) {
c = '?';
}
......
......@@ -41,40 +41,40 @@ namespace internal {
namespace {
// C++-style iterator adaptor for StringInputBuffer
// C++-style iterator adaptor for StringCharacterStream
// (unlike C++ iterators the end-marker has different type).
class StringInputBufferIterator {
class StringCharacterStreamIterator {
public:
class EndMarker {};
explicit StringInputBufferIterator(StringInputBuffer* buffer);
explicit StringCharacterStreamIterator(StringCharacterStream* stream);
int operator*() const;
uint16_t operator*() const;
void operator++();
bool operator==(EndMarker const&) const { return end_; }
bool operator!=(EndMarker const& m) const { return !end_; }
private:
StringInputBuffer* const buffer_;
int current_;
StringCharacterStream* const stream_;
uint16_t current_;
bool end_;
};
StringInputBufferIterator::StringInputBufferIterator(
StringInputBuffer* buffer) : buffer_(buffer) {
StringCharacterStreamIterator::StringCharacterStreamIterator(
StringCharacterStream* stream) : stream_(stream) {
++(*this);
}
int StringInputBufferIterator::operator*() const {
uint16_t StringCharacterStreamIterator::operator*() const {
return current_;
}
void StringInputBufferIterator::operator++() {
end_ = !buffer_->has_more();
void StringCharacterStreamIterator::operator++() {
end_ = !stream_->HasMore();
if (!end_) {
current_ = buffer_->GetNext();
current_ = stream_->GetNext();
}
}
} // End anonymous namespace.
......@@ -83,6 +83,7 @@ void StringInputBufferIterator::operator++() {
double StringToDouble(UnicodeCache* unicode_cache,
String* str, int flags, double empty_string_val) {
StringShape shape(str);
// TODO(dcarney): Use a Visitor here.
if (shape.IsSequentialAscii()) {
const char* begin = SeqOneByteString::cast(str)->GetChars();
const char* end = begin + str->length();
......@@ -94,10 +95,11 @@ double StringToDouble(UnicodeCache* unicode_cache,
return InternalStringToDouble(unicode_cache, begin, end, flags,
empty_string_val);
} else {
StringInputBuffer buffer(str);
ConsStringIteratorOp op;
StringCharacterStream stream(str, &op);
return InternalStringToDouble(unicode_cache,
StringInputBufferIterator(&buffer),
StringInputBufferIterator::EndMarker(),
StringCharacterStreamIterator(&stream),
StringCharacterStreamIterator::EndMarker(),
flags,
empty_string_val);
}
......@@ -108,6 +110,7 @@ double StringToInt(UnicodeCache* unicode_cache,
String* str,
int radix) {
StringShape shape(str);
// TODO(dcarney): Use a Visitor here.
if (shape.IsSequentialAscii()) {
const char* begin = SeqOneByteString::cast(str)->GetChars();
const char* end = begin + str->length();
......@@ -117,10 +120,11 @@ double StringToInt(UnicodeCache* unicode_cache,
const uc16* end = begin + str->length();
return InternalStringToInt(unicode_cache, begin, end, radix);
} else {
StringInputBuffer buffer(str);
ConsStringIteratorOp op;
StringCharacterStream stream(str, &op);
return InternalStringToInt(unicode_cache,
StringInputBufferIterator(&buffer),
StringInputBufferIterator::EndMarker(),
StringCharacterStreamIterator(&stream),
StringCharacterStreamIterator::EndMarker(),
radix);
}
}
......
......@@ -369,7 +369,7 @@ void AccumulateStatsWithOperator(
void VerifyConsString(Handle<String> root, ConsStringGenerationData* data) {
// Verify basic data.
CHECK(root->IsConsString());
CHECK((unsigned)root->length() == data->stats_.chars_);
CHECK(static_cast<unsigned>(root->length()) == data->stats_.chars_);
// Recursive verify.
ConsStringStats stats;
AccumulateStats(ConsString::cast(*root), &stats);
......@@ -521,8 +521,8 @@ static ConsStringIteratorOp cons_string_iterator_op_2;
static void Traverse(Handle<String> s1, Handle<String> s2) {
int i = 0;
buffer.Reset(*s1);
StringCharacterStream character_stream_1(*s1, 0, &cons_string_iterator_op_1);
StringCharacterStream character_stream_2(*s2, 0, &cons_string_iterator_op_2);
StringCharacterStream character_stream_1(*s1, &cons_string_iterator_op_1);
StringCharacterStream character_stream_2(*s2, &cons_string_iterator_op_2);
StringInputBuffer buffer2(*s2);
while (buffer.has_more()) {
CHECK(buffer2.has_more());
......@@ -545,8 +545,8 @@ static void TraverseFirst(Handle<String> s1, Handle<String> s2, int chars) {
int i = 0;
buffer.Reset(*s1);
StringInputBuffer buffer2(*s2);
StringCharacterStream character_stream_1(*s1, 0, &cons_string_iterator_op_1);
StringCharacterStream character_stream_2(*s2, 0, &cons_string_iterator_op_2);
StringCharacterStream character_stream_1(*s1, &cons_string_iterator_op_1);
StringCharacterStream character_stream_2(*s2, &cons_string_iterator_op_2);
while (buffer.has_more() && i < chars) {
CHECK(buffer2.has_more());
CHECK(character_stream_1.HasMore());
......@@ -621,9 +621,9 @@ static void VerifyCharacterStream(
// Want to test the offset == length case.
if (offset > length) offset = length;
StringCharacterStream flat_stream(
flat_string, (unsigned) offset, &cons_string_iterator_op_1);
flat_string, &cons_string_iterator_op_1, static_cast<unsigned>(offset));
StringCharacterStream cons_stream(
cons_string, (unsigned) offset, &cons_string_iterator_op_2);
cons_string, &cons_string_iterator_op_2, static_cast<unsigned>(offset));
for (int i = offset; i < length; i++) {
uint16_t c = flat_string->Get(i);
CHECK(flat_stream.HasMore());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment