| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 3703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3714 const uint16_t* data = i::ExternalTwoByteString::cast(string)-> | 3714 const uint16_t* data = i::ExternalTwoByteString::cast(string)-> |
| 3715 ExternalTwoByteStringGetData(0); | 3715 ExternalTwoByteStringGetData(0); |
| 3716 char* current = buffer; | 3716 char* current = buffer; |
| 3717 for (int i = start; i < end; i++) { | 3717 for (int i = start; i < end; i++) { |
| 3718 uint16_t character = data[i]; | 3718 uint16_t character = data[i]; |
| 3719 current += | 3719 current += |
| 3720 unibrow::Utf8::Encode(current, character, previous_character); | 3720 unibrow::Utf8::Encode(current, character, previous_character); |
| 3721 previous_character = character; | 3721 previous_character = character; |
| 3722 } | 3722 } |
| 3723 *last_character = previous_character; | 3723 *last_character = previous_character; |
| 3724 return utf8_bytes + current - buffer; | 3724 return static_cast<int>(utf8_bytes + current - buffer); |
| 3725 } | 3725 } |
| 3726 case i::kSeqStringTag: { | 3726 case i::kSeqStringTag: { |
| 3727 const uint16_t* data = | 3727 const uint16_t* data = |
| 3728 i::SeqTwoByteString::cast(string)->SeqTwoByteStringGetData(0); | 3728 i::SeqTwoByteString::cast(string)->SeqTwoByteStringGetData(0); |
| 3729 char* current = buffer; | 3729 char* current = buffer; |
| 3730 for (int i = start; i < end; i++) { | 3730 for (int i = start; i < end; i++) { |
| 3731 uint16_t character = data[i]; | 3731 uint16_t character = data[i]; |
| 3732 current += | 3732 current += |
| 3733 unibrow::Utf8::Encode(current, character, previous_character); | 3733 unibrow::Utf8::Encode(current, character, previous_character); |
| 3734 previous_character = character; | 3734 previous_character = character; |
| 3735 } | 3735 } |
| 3736 *last_character = previous_character; | 3736 *last_character = previous_character; |
| 3737 return utf8_bytes + current - buffer; | 3737 return static_cast<int>(utf8_bytes + current - buffer); |
| 3738 } | 3738 } |
| 3739 case i::kSlicedStringTag: { | 3739 case i::kSlicedStringTag: { |
| 3740 i::SlicedString* slice = i::SlicedString::cast(string); | 3740 i::SlicedString* slice = i::SlicedString::cast(string); |
| 3741 unsigned offset = slice->offset(); | 3741 unsigned offset = slice->offset(); |
| 3742 string = slice->parent(); | 3742 string = slice->parent(); |
| 3743 start += offset; | 3743 start += offset; |
| 3744 end += offset; | 3744 end += offset; |
| 3745 continue; | 3745 continue; |
| 3746 } | 3746 } |
| 3747 case i::kConsStringTag: { | 3747 case i::kConsStringTag: { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3811 } | 3811 } |
| 3812 i::String::WriteToFlat(*str, buffer, 0, len); | 3812 i::String::WriteToFlat(*str, buffer, 0, len); |
| 3813 if (nchars_ref != NULL) *nchars_ref = len; | 3813 if (nchars_ref != NULL) *nchars_ref = len; |
| 3814 if (!(options & NO_NULL_TERMINATION) && capacity > len) { | 3814 if (!(options & NO_NULL_TERMINATION) && capacity > len) { |
| 3815 buffer[len] = '\0'; | 3815 buffer[len] = '\0'; |
| 3816 return len + 1; | 3816 return len + 1; |
| 3817 } | 3817 } |
| 3818 return len; | 3818 return len; |
| 3819 } | 3819 } |
| 3820 | 3820 |
| 3821 if (capacity == -1 || capacity >= string_length * 3) { | 3821 if (capacity == -1 || capacity / 3 >= string_length) { |
| 3822 int32_t previous = unibrow::Utf16::kNoPreviousCharacter; | 3822 int32_t previous = unibrow::Utf16::kNoPreviousCharacter; |
| 3823 const int kMaxRecursion = 100; | 3823 const int kMaxRecursion = 100; |
| 3824 int utf8_bytes = | 3824 int utf8_bytes = |
| 3825 RecursivelySerializeToUtf8(*str, | 3825 RecursivelySerializeToUtf8(*str, |
| 3826 buffer, | 3826 buffer, |
| 3827 0, | 3827 0, |
| 3828 string_length, | 3828 string_length, |
| 3829 kMaxRecursion, | 3829 kMaxRecursion, |
| 3830 previous, | 3830 previous, |
| 3831 &previous); | 3831 &previous); |
| (...skipping 2524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6356 | 6356 |
| 6357 | 6357 |
| 6358 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { | 6358 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { |
| 6359 HandleScopeImplementer* scope_implementer = | 6359 HandleScopeImplementer* scope_implementer = |
| 6360 reinterpret_cast<HandleScopeImplementer*>(storage); | 6360 reinterpret_cast<HandleScopeImplementer*>(storage); |
| 6361 scope_implementer->IterateThis(v); | 6361 scope_implementer->IterateThis(v); |
| 6362 return storage + ArchiveSpacePerThread(); | 6362 return storage + ArchiveSpacePerThread(); |
| 6363 } | 6363 } |
| 6364 | 6364 |
| 6365 } } // namespace v8::internal | 6365 } } // namespace v8::internal |
| OLD | NEW |