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

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

Issue 663313003: Cleanup ConsStringIteratorOp. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 2 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/runtime-test.cc ('k') | test/cctest/test-strings.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/string-stream.h" 5 #include "src/string-stream.h"
6 6
7 #include "src/handles-inl.h" 7 #include "src/handles-inl.h"
8 #include "src/prototype.h" 8 #include "src/prototype.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 } 288 }
289 #endif 289 #endif
290 290
291 291
292 bool StringStream::Put(String* str) { 292 bool StringStream::Put(String* str) {
293 return Put(str, 0, str->length()); 293 return Put(str, 0, str->length());
294 } 294 }
295 295
296 296
297 bool StringStream::Put(String* str, int start, int end) { 297 bool StringStream::Put(String* str, int start, int end) {
298 ConsStringIteratorOp op; 298 StringCharacterStream stream(str, start);
299 StringCharacterStream stream(str, &op, start);
300 for (int i = start; i < end && stream.HasMore(); i++) { 299 for (int i = start; i < end && stream.HasMore(); i++) {
301 uint16_t c = stream.GetNext(); 300 uint16_t c = stream.GetNext();
302 if (c >= 127 || c < 32) { 301 if (c >= 127 || c < 32) {
303 c = '?'; 302 c = '?';
304 } 303 }
305 if (!Put(static_cast<char>(c))) { 304 if (!Put(static_cast<char>(c))) {
306 return false; // Output was truncated. 305 return false; // Output was truncated.
307 } 306 }
308 } 307 }
309 return true; 308 return true;
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 } 551 }
553 MemCopy(new_space, space_, *bytes); 552 MemCopy(new_space, space_, *bytes);
554 *bytes = new_bytes; 553 *bytes = new_bytes;
555 DeleteArray(space_); 554 DeleteArray(space_);
556 space_ = new_space; 555 space_ = new_space;
557 return new_space; 556 return new_space;
558 } 557 }
559 558
560 559
561 } } // namespace v8::internal 560 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime/runtime-test.cc ('k') | test/cctest/test-strings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698