| 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 #ifndef V8_STRING_BUILDER_H_ | 5 #ifndef V8_STRING_BUILDER_H_ |
| 6 #define V8_STRING_BUILDER_H_ | 6 #define V8_STRING_BUILDER_H_ |
| 7 | 7 |
| 8 #include "src/v8.h" | 8 #include "src/v8.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 } | 318 } |
| 319 cursor_ = start_; | 319 cursor_ = start_; |
| 320 } | 320 } |
| 321 | 321 |
| 322 INLINE(void Append(DestChar c)) { *(cursor_++) = c; } | 322 INLINE(void Append(DestChar c)) { *(cursor_++) = c; } |
| 323 INLINE(void AppendCString(const char* s)) { | 323 INLINE(void AppendCString(const char* s)) { |
| 324 const uint8_t* u = reinterpret_cast<const uint8_t*>(s); | 324 const uint8_t* u = reinterpret_cast<const uint8_t*>(s); |
| 325 while (*u != '\0') Append(*(u++)); | 325 while (*u != '\0') Append(*(u++)); |
| 326 } | 326 } |
| 327 | 327 |
| 328 int written() { return cursor_ - start_; } | 328 int written() { return static_cast<int>(cursor_ - start_); } |
| 329 | 329 |
| 330 private: | 330 private: |
| 331 DestChar* start_; | 331 DestChar* start_; |
| 332 DestChar* cursor_; | 332 DestChar* cursor_; |
| 333 DisallowHeapAllocation no_gc_; | 333 DisallowHeapAllocation no_gc_; |
| 334 }; | 334 }; |
| 335 | 335 |
| 336 template <typename DestChar> | 336 template <typename DestChar> |
| 337 class NoExtendString : public NoExtend<DestChar> { | 337 class NoExtendString : public NoExtend<DestChar> { |
| 338 public: | 338 public: |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 DCHECK_EQ(String::TWO_BYTE_ENCODING, encoding_); | 421 DCHECK_EQ(String::TWO_BYTE_ENCODING, encoding_); |
| 422 SeqTwoByteString::cast(*current_part_) | 422 SeqTwoByteString::cast(*current_part_) |
| 423 ->SeqTwoByteStringSet(current_index_++, c); | 423 ->SeqTwoByteStringSet(current_index_++, c); |
| 424 } | 424 } |
| 425 if (current_index_ == part_length_) Extend(); | 425 if (current_index_ == part_length_) Extend(); |
| 426 } | 426 } |
| 427 } | 427 } |
| 428 } // namespace v8::internal | 428 } // namespace v8::internal |
| 429 | 429 |
| 430 #endif // V8_STRING_BUILDER_H_ | 430 #endif // V8_STRING_BUILDER_H_ |
| OLD | NEW |