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

Side by Side Diff: src/string-stream.cc

Issue 11727003: Reland r13275 and 13276 (Remove most uses of StringInputBuffer). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/runtime.cc ('k') | src/v8conversions.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 } 304 }
305 #endif 305 #endif
306 306
307 307
308 bool StringStream::Put(String* str) { 308 bool StringStream::Put(String* str) {
309 return Put(str, 0, str->length()); 309 return Put(str, 0, str->length());
310 } 310 }
311 311
312 312
313 bool StringStream::Put(String* str, int start, int end) { 313 bool StringStream::Put(String* str, int start, int end) {
314 StringInputBuffer name_buffer(str); 314 ConsStringIteratorOp op;
315 name_buffer.Seek(start); 315 StringCharacterStream stream(str, &op, start);
316 for (int i = start; i < end && name_buffer.has_more(); i++) { 316 for (int i = start; i < end && stream.HasMore(); i++) {
317 int c = name_buffer.GetNext(); 317 uint16_t c = stream.GetNext();
318 if (c >= 127 || c < 32) { 318 if (c >= 127 || c < 32) {
319 c = '?'; 319 c = '?';
320 } 320 }
321 if (!Put(c)) { 321 if (!Put(static_cast<char>(c))) {
322 return false; // Output was truncated. 322 return false; // Output was truncated.
323 } 323 }
324 } 324 }
325 return true; 325 return true;
326 } 326 }
327 327
328 328
329 void StringStream::PrintName(Object* name) { 329 void StringStream::PrintName(Object* name) {
330 if (name->IsString()) { 330 if (name->IsString()) {
331 String* str = String::cast(name); 331 String* str = String::cast(name);
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 583
584 // Only grow once to the maximum allowable size. 584 // Only grow once to the maximum allowable size.
585 char* NoAllocationStringAllocator::grow(unsigned* bytes) { 585 char* NoAllocationStringAllocator::grow(unsigned* bytes) {
586 ASSERT(size_ >= *bytes); 586 ASSERT(size_ >= *bytes);
587 *bytes = size_; 587 *bytes = size_;
588 return space_; 588 return space_;
589 } 589 }
590 590
591 591
592 } } // namespace v8::internal 592 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime.cc ('k') | src/v8conversions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698