OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 int utf8_length = Min(str->length(), kUtf8BufferSize - utf8_pos_); | 462 int utf8_length = Min(str->length(), kUtf8BufferSize - utf8_pos_); |
463 String::WriteToFlat(str, utf8_buffer_ + utf8_pos_, 0, utf8_length); | 463 String::WriteToFlat(str, utf8_buffer_ + utf8_pos_, 0, utf8_length); |
464 utf8_pos_ += utf8_length; | 464 utf8_pos_ += utf8_length; |
465 return; | 465 return; |
466 } | 466 } |
467 int uc16_length = Min(str->length(), kUc16BufferSize); | 467 int uc16_length = Min(str->length(), kUc16BufferSize); |
468 String::WriteToFlat(str, uc16_buffer_, 0, uc16_length); | 468 String::WriteToFlat(str, uc16_buffer_, 0, uc16_length); |
469 for (int i = 0; i < uc16_length && utf8_pos_ < kUtf8BufferSize; ++i) { | 469 for (int i = 0; i < uc16_length && utf8_pos_ < kUtf8BufferSize; ++i) { |
470 uc16 c = uc16_buffer_[i]; | 470 uc16 c = uc16_buffer_[i]; |
471 if (c <= String::kMaxAsciiCharCodeU) { | 471 if (c <= String::kMaxAsciiCharCodeU) { |
472 utf8_buffer_[utf8_pos_++] = c; | 472 utf8_buffer_[utf8_pos_++] = static_cast<char>(c); |
473 } else { | 473 } else { |
474 int char_length = unibrow::Utf8::Length(c); | 474 int char_length = unibrow::Utf8::Length(c); |
475 if (utf8_pos_ + char_length > kUtf8BufferSize) break; | 475 if (utf8_pos_ + char_length > kUtf8BufferSize) break; |
476 unibrow::Utf8::Encode(utf8_buffer_ + utf8_pos_, c); | 476 unibrow::Utf8::Encode(utf8_buffer_ + utf8_pos_, c); |
477 utf8_pos_ += char_length; | 477 utf8_pos_ += char_length; |
478 } | 478 } |
479 } | 479 } |
480 } | 480 } |
481 | 481 |
482 void AppendBytes(const char* bytes, int size) { | 482 void AppendBytes(const char* bytes, int size) { |
(...skipping 1507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1990 void SamplerRegistry::RemoveActiveSampler(Sampler* sampler) { | 1990 void SamplerRegistry::RemoveActiveSampler(Sampler* sampler) { |
1991 ASSERT(sampler->IsActive()); | 1991 ASSERT(sampler->IsActive()); |
1992 ScopedLock lock(mutex_); | 1992 ScopedLock lock(mutex_); |
1993 ASSERT(active_samplers_ != NULL); | 1993 ASSERT(active_samplers_ != NULL); |
1994 bool removed = active_samplers_->RemoveElement(sampler); | 1994 bool removed = active_samplers_->RemoveElement(sampler); |
1995 ASSERT(removed); | 1995 ASSERT(removed); |
1996 USE(removed); | 1996 USE(removed); |
1997 } | 1997 } |
1998 | 1998 |
1999 } } // namespace v8::internal | 1999 } } // namespace v8::internal |
OLD | NEW |