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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 int utf8_length = Min(str->length(), kUtf8BufferSize - utf8_pos_); | 386 int utf8_length = Min(str->length(), kUtf8BufferSize - utf8_pos_); |
387 String::WriteToFlat(str, utf8_buffer_ + utf8_pos_, 0, utf8_length); | 387 String::WriteToFlat(str, utf8_buffer_ + utf8_pos_, 0, utf8_length); |
388 utf8_pos_ += utf8_length; | 388 utf8_pos_ += utf8_length; |
389 return; | 389 return; |
390 } | 390 } |
391 int uc16_length = Min(str->length(), kUtf16BufferSize); | 391 int uc16_length = Min(str->length(), kUtf16BufferSize); |
392 String::WriteToFlat(str, utf16_buffer, 0, uc16_length); | 392 String::WriteToFlat(str, utf16_buffer, 0, uc16_length); |
393 int previous = unibrow::Utf16::kNoPreviousCharacter; | 393 int previous = unibrow::Utf16::kNoPreviousCharacter; |
394 for (int i = 0; i < uc16_length && utf8_pos_ < kUtf8BufferSize; ++i) { | 394 for (int i = 0; i < uc16_length && utf8_pos_ < kUtf8BufferSize; ++i) { |
395 uc16 c = utf16_buffer[i]; | 395 uc16 c = utf16_buffer[i]; |
396 if (c <= String::kMaxAsciiCharCodeU) { | 396 if (c <= unibrow::Utf8::kMaxOneByteChar) { |
397 utf8_buffer_[utf8_pos_++] = static_cast<char>(c); | 397 utf8_buffer_[utf8_pos_++] = static_cast<char>(c); |
398 } else { | 398 } else { |
399 int char_length = unibrow::Utf8::Length(c, previous); | 399 int char_length = unibrow::Utf8::Length(c, previous); |
400 if (utf8_pos_ + char_length > kUtf8BufferSize) break; | 400 if (utf8_pos_ + char_length > kUtf8BufferSize) break; |
401 unibrow::Utf8::Encode(utf8_buffer_ + utf8_pos_, c, previous); | 401 unibrow::Utf8::Encode(utf8_buffer_ + utf8_pos_, c, previous); |
402 utf8_pos_ += char_length; | 402 utf8_pos_ += char_length; |
403 } | 403 } |
404 previous = c; | 404 previous = c; |
405 } | 405 } |
406 } | 406 } |
(...skipping 1422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1829 void SamplerRegistry::RemoveActiveSampler(Sampler* sampler) { | 1829 void SamplerRegistry::RemoveActiveSampler(Sampler* sampler) { |
1830 ASSERT(sampler->IsActive()); | 1830 ASSERT(sampler->IsActive()); |
1831 ScopedLock lock(active_samplers_mutex); | 1831 ScopedLock lock(active_samplers_mutex); |
1832 ASSERT(active_samplers_ != NULL); | 1832 ASSERT(active_samplers_ != NULL); |
1833 bool removed = active_samplers_->RemoveElement(sampler); | 1833 bool removed = active_samplers_->RemoveElement(sampler); |
1834 ASSERT(removed); | 1834 ASSERT(removed); |
1835 USE(removed); | 1835 USE(removed); |
1836 } | 1836 } |
1837 | 1837 |
1838 } } // namespace v8::internal | 1838 } } // namespace v8::internal |
OLD | NEW |