| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 class Logger::NameBuffer { | 328 class Logger::NameBuffer { |
| 329 public: | 329 public: |
| 330 NameBuffer() { Reset(); } | 330 NameBuffer() { Reset(); } |
| 331 | 331 |
| 332 void Reset() { | 332 void Reset() { |
| 333 utf8_pos_ = 0; | 333 utf8_pos_ = 0; |
| 334 } | 334 } |
| 335 | 335 |
| 336 void AppendString(String* str) { | 336 void AppendString(String* str) { |
| 337 if (str == NULL) return; | 337 if (str == NULL) return; |
| 338 if (str->HasOnlyAsciiChars()) { | |
| 339 int utf8_length = Min(str->length(), kUtf8BufferSize - utf8_pos_); | |
| 340 String::WriteToFlat(str, | |
| 341 reinterpret_cast<uint8_t*>(utf8_buffer_ + utf8_pos_), | |
| 342 0, | |
| 343 utf8_length); | |
| 344 utf8_pos_ += utf8_length; | |
| 345 return; | |
| 346 } | |
| 347 int uc16_length = Min(str->length(), kUtf16BufferSize); | 338 int uc16_length = Min(str->length(), kUtf16BufferSize); |
| 348 String::WriteToFlat(str, utf16_buffer, 0, uc16_length); | 339 String::WriteToFlat(str, utf16_buffer, 0, uc16_length); |
| 349 int previous = unibrow::Utf16::kNoPreviousCharacter; | 340 int previous = unibrow::Utf16::kNoPreviousCharacter; |
| 350 for (int i = 0; i < uc16_length && utf8_pos_ < kUtf8BufferSize; ++i) { | 341 for (int i = 0; i < uc16_length && utf8_pos_ < kUtf8BufferSize; ++i) { |
| 351 uc16 c = utf16_buffer[i]; | 342 uc16 c = utf16_buffer[i]; |
| 352 if (c <= unibrow::Utf8::kMaxOneByteChar) { | 343 if (c <= unibrow::Utf8::kMaxOneByteChar) { |
| 353 utf8_buffer_[utf8_pos_++] = static_cast<char>(c); | 344 utf8_buffer_[utf8_pos_++] = static_cast<char>(c); |
| 354 } else { | 345 } else { |
| 355 int char_length = unibrow::Utf8::Length(c, previous); | 346 int char_length = unibrow::Utf8::Length(c, previous); |
| 356 if (utf8_pos_ + char_length > kUtf8BufferSize) break; | 347 if (utf8_pos_ + char_length > kUtf8BufferSize) break; |
| (...skipping 1536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1893 profiler_ = NULL; | 1884 profiler_ = NULL; |
| 1894 } | 1885 } |
| 1895 | 1886 |
| 1896 delete ticker_; | 1887 delete ticker_; |
| 1897 ticker_ = NULL; | 1888 ticker_ = NULL; |
| 1898 | 1889 |
| 1899 return log_->Close(); | 1890 return log_->Close(); |
| 1900 } | 1891 } |
| 1901 | 1892 |
| 1902 } } // namespace v8::internal | 1893 } } // namespace v8::internal |
| OLD | NEW |