| 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 int uc16_length = Min(str->length(), kUtf16BufferSize); | 113 int uc16_length = Min(str->length(), kUtf16BufferSize); |
| 114 String::WriteToFlat(str, utf16_buffer, 0, uc16_length); | 114 String::WriteToFlat(str, utf16_buffer, 0, uc16_length); |
| 115 int previous = unibrow::Utf16::kNoPreviousCharacter; | 115 int previous = unibrow::Utf16::kNoPreviousCharacter; |
| 116 for (int i = 0; i < uc16_length && utf8_pos_ < kUtf8BufferSize; ++i) { | 116 for (int i = 0; i < uc16_length && utf8_pos_ < kUtf8BufferSize; ++i) { |
| 117 uc16 c = utf16_buffer[i]; | 117 uc16 c = utf16_buffer[i]; |
| 118 if (c <= unibrow::Utf8::kMaxOneByteChar) { | 118 if (c <= unibrow::Utf8::kMaxOneByteChar) { |
| 119 utf8_buffer_[utf8_pos_++] = static_cast<char>(c); | 119 utf8_buffer_[utf8_pos_++] = static_cast<char>(c); |
| 120 } else { | 120 } else { |
| 121 int char_length = unibrow::Utf8::Length(c, previous); | 121 int char_length = unibrow::Utf8::Length(c, previous); |
| 122 if (utf8_pos_ + char_length > kUtf8BufferSize) break; | 122 if (utf8_pos_ + char_length > kUtf8BufferSize) break; |
| 123 // @TODO Fix this Utf8::Encode call site somehow. |
| 123 unibrow::Utf8::Encode(utf8_buffer_ + utf8_pos_, c, previous); | 124 unibrow::Utf8::Encode(utf8_buffer_ + utf8_pos_, c, previous); |
| 124 utf8_pos_ += char_length; | 125 utf8_pos_ += char_length; |
| 125 } | 126 } |
| 126 previous = c; | 127 previous = c; |
| 127 } | 128 } |
| 128 } | 129 } |
| 129 | 130 |
| 130 void AppendBytes(const char* bytes, int size) { | 131 void AppendBytes(const char* bytes, int size) { |
| 131 size = Min(size, kUtf8BufferSize - utf8_pos_); | 132 size = Min(size, kUtf8BufferSize - utf8_pos_); |
| 132 OS::MemCopy(utf8_buffer_ + utf8_pos_, bytes, size); | 133 OS::MemCopy(utf8_buffer_ + utf8_pos_, bytes, size); |
| (...skipping 2029 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2162 if (jit_logger_) { | 2163 if (jit_logger_) { |
| 2163 removeCodeEventListener(jit_logger_); | 2164 removeCodeEventListener(jit_logger_); |
| 2164 delete jit_logger_; | 2165 delete jit_logger_; |
| 2165 jit_logger_ = NULL; | 2166 jit_logger_ = NULL; |
| 2166 } | 2167 } |
| 2167 | 2168 |
| 2168 return log_->Close(); | 2169 return log_->Close(); |
| 2169 } | 2170 } |
| 2170 | 2171 |
| 2171 } } // namespace v8::internal | 2172 } } // namespace v8::internal |
| OLD | NEW |