| 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 2761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2772 string_result->SeqAsciiStringSet(i, string[i]); | 2772 string_result->SeqAsciiStringSet(i, string[i]); |
| 2773 } | 2773 } |
| 2774 return result; | 2774 return result; |
| 2775 } | 2775 } |
| 2776 | 2776 |
| 2777 | 2777 |
| 2778 Object* Heap::AllocateStringFromUtf8(Vector<const char> string, | 2778 Object* Heap::AllocateStringFromUtf8(Vector<const char> string, |
| 2779 PretenureFlag pretenure) { | 2779 PretenureFlag pretenure) { |
| 2780 // Count the number of characters in the UTF-8 string and check if | 2780 // Count the number of characters in the UTF-8 string and check if |
| 2781 // it is an ASCII string. | 2781 // it is an ASCII string. |
| 2782 Access<Scanner::Utf8Decoder> decoder(Scanner::utf8_decoder()); | 2782 Access<Scanner::Utf8Decoder> decoder(isolate_-> |
| 2783 scanner_character_classes()->utf8_decoder()); |
| 2783 decoder->Reset(string.start(), string.length()); | 2784 decoder->Reset(string.start(), string.length()); |
| 2784 int chars = 0; | 2785 int chars = 0; |
| 2785 bool is_ascii = true; | 2786 bool is_ascii = true; |
| 2786 while (decoder->has_more()) { | 2787 while (decoder->has_more()) { |
| 2787 uc32 r = decoder->GetNext(); | 2788 uc32 r = decoder->GetNext(); |
| 2788 if (r > String::kMaxAsciiCharCode) is_ascii = false; | 2789 if (r > String::kMaxAsciiCharCode) is_ascii = false; |
| 2789 chars++; | 2790 chars++; |
| 2790 } | 2791 } |
| 2791 | 2792 |
| 2792 // If the string is ascii, we do not need to convert the characters | 2793 // If the string is ascii, we do not need to convert the characters |
| (...skipping 1942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4735 void ExternalStringTable::TearDown() { | 4736 void ExternalStringTable::TearDown() { |
| 4736 new_space_strings_.Free(); | 4737 new_space_strings_.Free(); |
| 4737 old_space_strings_.Free(); | 4738 old_space_strings_.Free(); |
| 4738 } | 4739 } |
| 4739 | 4740 |
| 4740 | 4741 |
| 4741 List<Object*> ExternalStringTable::new_space_strings_; | 4742 List<Object*> ExternalStringTable::new_space_strings_; |
| 4742 List<Object*> ExternalStringTable::old_space_strings_; | 4743 List<Object*> ExternalStringTable::old_space_strings_; |
| 4743 | 4744 |
| 4744 } } // namespace v8::internal | 4745 } } // namespace v8::internal |
| OLD | NEW |