| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |