Commit 121f3f60 authored by yangguo@chromium.org's avatar yangguo@chromium.org

Revert r13275 and 13276 (Remove most uses of StringInputBuffer).

This is due to test failures in test-mark-compact/BootUpMemoryUse.

R=ulan@chromium.org
BUG=

Review URL: https://chromiumcodereview.appspot.com/11688003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13277 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 6e614072
......@@ -4043,9 +4043,10 @@ int String::WriteUtf8(char* buffer,
}
// Slow case.
i::StringCharacterStream stream(*str, isolate->write_iterator());
i::StringInputBuffer& write_input_buffer = *isolate->write_input_buffer();
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
......@@ -4056,7 +4057,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 = stream.GetNext();
i::uc32 c = write_input_buffer.GetNext();
int written = unibrow::Utf8::Encode(buffer + pos, c, previous);
pos += written;
nchars++;
......@@ -4068,7 +4069,7 @@ int String::WriteUtf8(char* buffer,
// buffer.
char intermediate[unibrow::Utf8::kMaxEncodedSize];
for (; i < len && pos < capacity; i++) {
i::uc32 c = stream.GetNext();
i::uc32 c = write_input_buffer.GetNext();
if (unibrow::Utf16::IsTrailSurrogate(c) &&
unibrow::Utf16::IsLeadSurrogate(previous)) {
// We can't use the intermediate buffer here because the encoding
......@@ -4124,7 +4125,7 @@ int String::WriteAscii(char* buffer,
}
if (str->IsOneByteRepresentation()) {
// WriteToFlat is faster than using the StringCharacterStream.
// WriteToFlat is faster than using the StringInputBuffer.
if (length == -1) length = str->length() + 1;
int len = i::Min(length, str->length() - start);
i::String::WriteToFlat(*str, buffer, start, start + len);
......@@ -4139,15 +4140,16 @@ 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;
i::StringCharacterStream write_stream(*str, isolate->write_iterator(), start);
write_input_buffer.Reset(start, *str);
int i;
for (i = 0; i < end; i++) {
char c = static_cast<char>(write_stream.GetNext());
char c = static_cast<char>(write_input_buffer.GetNext());
if (c == '\0' && !(options & PRESERVE_ASCII_NULL)) c = ' ';
buffer[i] = c;
}
......@@ -4171,7 +4173,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 StringCharacterStream or Get(i) to access the characters.
// using StringInputBuffer or Get(i) to access the characters.
FlattenString(str);
}
int end = start + length;
......
......@@ -131,16 +131,14 @@ void CodeGenerator::PrintCode(Handle<Code> code, CompilationInfo* info) {
Handle<Script> script = info->script();
if (!script->IsUndefined() && !script->source()->IsUndefined()) {
PrintF("--- Raw source ---\n");
ConsStringIteratorOp op;
StringCharacterStream stream(String::cast(script->source()),
&op,
function->start_position());
StringInputBuffer stream(String::cast(script->source()));
stream.Seek(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.HasMore()) PrintF("%c", stream.GetNext());
if (stream.has_more()) 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_iterator_(NULL),
write_input_buffer_(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_iterator_;
write_iterator_ = NULL;
delete write_input_buffer_;
write_input_buffer_ = 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_iterator_ = new ConsStringIteratorOp();
write_input_buffer_ = new StringInputBuffer();
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 ConsStringIteratorOp;
class StringInputBuffer;
class StringTracker;
class StubCache;
class ThreadManager;
......@@ -881,7 +881,7 @@ class Isolate {
return inner_pointer_to_code_cache_;
}
ConsStringIteratorOp* write_iterator() { return write_iterator_; }
StringInputBuffer* write_input_buffer() { return write_input_buffer_; }
GlobalHandles* global_handles() { return global_handles_; }
......@@ -903,16 +903,16 @@ class Isolate {
return &jsregexp_canonrange_;
}
ConsStringIteratorOp* objects_string_compare_iterator_a() {
return &objects_string_compare_iterator_a_;
StringInputBuffer* objects_string_compare_buffer_a() {
return &objects_string_compare_buffer_a_;
}
ConsStringIteratorOp* objects_string_compare_iterator_b() {
return &objects_string_compare_iterator_b_;
StringInputBuffer* objects_string_compare_buffer_b() {
return &objects_string_compare_buffer_b_;
}
StaticResource<ConsStringIteratorOp>* objects_string_iterator() {
return &objects_string_iterator_;
StaticResource<StringInputBuffer>* objects_string_input_buffer() {
return &objects_string_input_buffer_;
}
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_;
ConsStringIteratorOp* write_iterator_;
StringInputBuffer* write_input_buffer_;
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_;
ConsStringIteratorOp objects_string_compare_iterator_a_;
ConsStringIteratorOp objects_string_compare_iterator_b_;
StaticResource<ConsStringIteratorOp> objects_string_iterator_;
StringInputBuffer objects_string_compare_buffer_a_;
StringInputBuffer objects_string_compare_buffer_b_;
StaticResource<StringInputBuffer> objects_string_input_buffer_;
unibrow::Mapping<unibrow::Ecma262Canonicalize>
regexp_macro_assembler_canonicalize_;
RegExpStack* regexp_stack_;
......
......@@ -2845,31 +2845,21 @@ String* ConsStringIteratorOp::ContinueOperation(int32_t* type_out,
uint16_t StringCharacterStream::GetNext() {
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_);
ASSERT((buffer8_ == NULL && end_ == NULL) || buffer8_ < end_);
return is_one_byte_ ? *buffer8_++ : *buffer16_++;
}
StringCharacterStream::StringCharacterStream(String* string,
ConsStringIteratorOp* op,
unsigned offset)
StringCharacterStream::StringCharacterStream(
String* string, unsigned offset, ConsStringIteratorOp* op)
: is_one_byte_(false),
buffer8_(NULL),
end_(NULL),
op_(op) {
Reset(string, offset);
}
void StringCharacterStream::Reset(String* string, unsigned offset) {
op_->Reset();
buffer8_ = NULL;
end_ = NULL;
op->Reset();
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,7 +7200,9 @@ class String: public HeapObject {
// Returns a hash value used for the property table
inline uint32_t Hash();
bool ComputeArrayIndex(uint32_t* index);
static bool ComputeArrayIndex(unibrow::CharacterStream* buffer,
uint32_t* index,
int length);
// Externalization.
bool MakeExternal(v8::String::ExternalStringResource* resource);
......@@ -7896,11 +7898,11 @@ class ConsStringIteratorOp {
class StringCharacterStream {
public:
inline StringCharacterStream(String* string,
ConsStringIteratorOp* op,
unsigned offset = 0);
unsigned offset,
ConsStringIteratorOp* op);
inline uint16_t GetNext();
inline bool HasMore();
inline void Reset(String* string, unsigned offset = 0);
inline void Reset(String* string, unsigned offset, ConsStringIteratorOp* op);
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();
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);
StringInputBuffer& buf1 =
*isolate->runtime_state()->string_locale_compare_buf1();
StringInputBuffer& buf2 =
*isolate->runtime_state()->string_locale_compare_buf2();
buf1.Reset(str1);
buf2.Reset(str2);
for (int i = 0; i < end; i++) {
uint16_t char1 = stream1.GetNext();
uint16_t char2 = stream2.GetNext();
uint16_t char1 = buf1.GetNext();
uint16_t char2 = buf2.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<ConsStringIteratorOp> op(
isolate->runtime_state()->string_iterator());
StringCharacterStream stream(source, op.value());
while (stream.HasMore()) {
uint16_t character = stream.GetNext();
Access<StringInputBuffer> buffer(
isolate->runtime_state()->string_input_buffer());
buffer->Reset(source);
while (buffer->has_more()) {
uint16_t character = buffer->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<ConsStringIteratorOp> op(
isolate->runtime_state()->string_iterator());
StringCharacterStream stream(source, op.value());
while (stream.HasMore()) {
uint16_t chr = stream.GetNext();
Access<StringInputBuffer> buffer(
isolate->runtime_state()->string_input_buffer());
buffer->Rewind();
while (buffer->has_more()) {
uint16_t chr = buffer->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<ConsStringIteratorOp> op(
isolate->runtime_state()->string_iterator());
StringCharacterStream stream(s, op.value());
Access<StringInputBuffer> buffer(
isolate->runtime_state()->string_input_buffer());
buffer->Reset(s);
unibrow::uchar chars[Converter::kMaxWidth];
// We can assume that the string is not empty
uc32 current = stream.GetNext();
uc32 current = buffer->GetNext();
for (int i = 0; i < length;) {
bool has_next = stream.HasMore();
uc32 next = has_next ? stream.GetNext() : 0;
bool has_next = buffer->has_more();
uc32 next = has_next ? buffer->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 (stream.HasMore()) {
current = stream.GetNext();
while (buffer->has_more()) {
current = buffer->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,21 +6960,23 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SmiLexicographicCompare) {
}
static Object* StringCharacterStreamCompare(RuntimeState* state,
static Object* StringInputBufferCompare(RuntimeState* state,
String* x,
String* y) {
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();
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();
if (d < 0) return Smi::FromInt(LESS);
else if (d > 0) return Smi::FromInt(GREATER);
}
// x is (non-trivial) prefix of y:
if (stream_y.HasMore()) return Smi::FromInt(LESS);
if (bufy.has_more()) return Smi::FromInt(LESS);
// y is prefix of x:
return Smi::FromInt(stream_x.HasMore() ? GREATER : EQUAL);
return Smi::FromInt(bufx.has_more() ? GREATER : EQUAL);
}
......@@ -7018,7 +7020,7 @@ static Object* FlatStringCompare(String* x, String* y) {
result = (r < 0) ? Smi::FromInt(LESS) : Smi::FromInt(GREATER);
}
ASSERT(result ==
StringCharacterStreamCompare(Isolate::Current()->runtime_state(), x, y));
StringInputBufferCompare(Isolate::Current()->runtime_state(), x, y));
return result;
}
......@@ -7054,7 +7056,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringCompare) {
}
return (x->IsFlat() && y->IsFlat()) ? FlatStringCompare(x, y)
: StringCharacterStreamCompare(isolate->runtime_state(), x, y);
: StringInputBufferCompare(isolate->runtime_state(), x, y);
}
......@@ -9883,10 +9885,9 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GlobalPrint) {
ASSERT(args.length() == 1);
CONVERT_ARG_CHECKED(String, string, 0);
ConsStringIteratorOp op;
StringCharacterStream stream(string, &op);
while (stream.HasMore()) {
uint16_t character = stream.GetNext();
StringInputBuffer buffer(string);
while (buffer.has_more()) {
uint16_t character = buffer.GetNext();
PrintF("%c", character);
}
return string;
......
......@@ -577,8 +577,8 @@ namespace internal {
class RuntimeState {
public:
StaticResource<ConsStringIteratorOp>* string_iterator() {
return &string_iterator_;
StaticResource<StringInputBuffer>* string_input_buffer() {
return &string_input_buffer_;
}
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_;
}
ConsStringIteratorOp* string_iterator_compare_x() {
return &string_iterator_compare_x_;
StringInputBuffer* string_input_buffer_compare_bufx() {
return &string_input_buffer_compare_bufx_;
}
ConsStringIteratorOp* string_iterator_compare_y() {
return &string_iterator_compare_y_;
StringInputBuffer* string_input_buffer_compare_bufy() {
return &string_input_buffer_compare_bufy_;
}
ConsStringIteratorOp* string_locale_compare_it1() {
return &string_locale_compare_it1_;
StringInputBuffer* string_locale_compare_buf1() {
return &string_locale_compare_buf1_;
}
ConsStringIteratorOp* string_locale_compare_it2() {
return &string_locale_compare_it2_;
StringInputBuffer* string_locale_compare_buf2() {
return &string_locale_compare_buf2_;
}
private:
RuntimeState() {}
// Non-reentrant string buffer for efficient general use in the runtime.
StaticResource<ConsStringIteratorOp> string_iterator_;
StaticResource<StringInputBuffer> string_input_buffer_;
unibrow::Mapping<unibrow::ToUppercase, 128> to_upper_mapping_;
unibrow::Mapping<unibrow::ToLowercase, 128> to_lower_mapping_;
ConsStringIteratorOp string_iterator_compare_x_;
ConsStringIteratorOp string_iterator_compare_y_;
ConsStringIteratorOp string_locale_compare_it1_;
ConsStringIteratorOp string_locale_compare_it2_;
StringInputBuffer string_input_buffer_compare_bufx_;
StringInputBuffer string_input_buffer_compare_bufy_;
StringInputBuffer string_locale_compare_buf1_;
StringInputBuffer string_locale_compare_buf2_;
friend class Isolate;
friend class Runtime;
......
......@@ -311,14 +311,14 @@ bool StringStream::Put(String* str) {
bool StringStream::Put(String* str, int start, int end) {
ConsStringIteratorOp op;
StringCharacterStream stream(str, &op, start);
for (int i = start; i < end && stream.HasMore(); i++) {
uint16_t c = stream.GetNext();
StringInputBuffer name_buffer(str);
name_buffer.Seek(start);
for (int i = start; i < end && name_buffer.has_more(); i++) {
int c = name_buffer.GetNext();
if (c >= 127 || c < 32) {
c = '?';
}
if (!Put(static_cast<char>(c))) {
if (!Put(c)) {
return false; // Output was truncated.
}
}
......
......@@ -41,40 +41,40 @@ namespace internal {
namespace {
// C++-style iterator adaptor for StringCharacterStream
// C++-style iterator adaptor for StringInputBuffer
// (unlike C++ iterators the end-marker has different type).
class StringCharacterStreamIterator {
class StringInputBufferIterator {
public:
class EndMarker {};
explicit StringCharacterStreamIterator(StringCharacterStream* stream);
explicit StringInputBufferIterator(StringInputBuffer* buffer);
uint16_t operator*() const;
int operator*() const;
void operator++();
bool operator==(EndMarker const&) const { return end_; }
bool operator!=(EndMarker const& m) const { return !end_; }
private:
StringCharacterStream* const stream_;
uint16_t current_;
StringInputBuffer* const buffer_;
int current_;
bool end_;
};
StringCharacterStreamIterator::StringCharacterStreamIterator(
StringCharacterStream* stream) : stream_(stream) {
StringInputBufferIterator::StringInputBufferIterator(
StringInputBuffer* buffer) : buffer_(buffer) {
++(*this);
}
uint16_t StringCharacterStreamIterator::operator*() const {
int StringInputBufferIterator::operator*() const {
return current_;
}
void StringCharacterStreamIterator::operator++() {
end_ = !stream_->HasMore();
void StringInputBufferIterator::operator++() {
end_ = !buffer_->has_more();
if (!end_) {
current_ = stream_->GetNext();
current_ = buffer_->GetNext();
}
}
} // End anonymous namespace.
......@@ -83,7 +83,6 @@ void StringCharacterStreamIterator::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();
......@@ -95,11 +94,10 @@ double StringToDouble(UnicodeCache* unicode_cache,
return InternalStringToDouble(unicode_cache, begin, end, flags,
empty_string_val);
} else {
ConsStringIteratorOp op;
StringCharacterStream stream(str, &op);
StringInputBuffer buffer(str);
return InternalStringToDouble(unicode_cache,
StringCharacterStreamIterator(&stream),
StringCharacterStreamIterator::EndMarker(),
StringInputBufferIterator(&buffer),
StringInputBufferIterator::EndMarker(),
flags,
empty_string_val);
}
......@@ -110,7 +108,6 @@ 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();
......@@ -120,11 +117,10 @@ double StringToInt(UnicodeCache* unicode_cache,
const uc16* end = begin + str->length();
return InternalStringToInt(unicode_cache, begin, end, radix);
} else {
ConsStringIteratorOp op;
StringCharacterStream stream(str, &op);
StringInputBuffer buffer(str);
return InternalStringToInt(unicode_cache,
StringCharacterStreamIterator(&stream),
StringCharacterStreamIterator::EndMarker(),
StringInputBufferIterator(&buffer),
StringInputBufferIterator::EndMarker(),
radix);
}
}
......
......@@ -369,7 +369,7 @@ void AccumulateStatsWithOperator(
void VerifyConsString(Handle<String> root, ConsStringGenerationData* data) {
// Verify basic data.
CHECK(root->IsConsString());
CHECK(static_cast<unsigned>(root->length()) == data->stats_.chars_);
CHECK((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, &cons_string_iterator_op_1);
StringCharacterStream character_stream_2(*s2, &cons_string_iterator_op_2);
StringCharacterStream character_stream_1(*s1, 0, &cons_string_iterator_op_1);
StringCharacterStream character_stream_2(*s2, 0, &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, &cons_string_iterator_op_1);
StringCharacterStream character_stream_2(*s2, &cons_string_iterator_op_2);
StringCharacterStream character_stream_1(*s1, 0, &cons_string_iterator_op_1);
StringCharacterStream character_stream_2(*s2, 0, &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, &cons_string_iterator_op_1, static_cast<unsigned>(offset));
flat_string, (unsigned) offset, &cons_string_iterator_op_1);
StringCharacterStream cons_stream(
cons_string, &cons_string_iterator_op_2, static_cast<unsigned>(offset));
cons_string, (unsigned) offset, &cons_string_iterator_op_2);
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