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 3368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3379 return result; | 3379 return result; |
3380 } | 3380 } |
3381 | 3381 |
3382 | 3382 |
3383 MaybeObject* Heap::AllocateStringFromUtf8Slow(Vector<const char> string, | 3383 MaybeObject* Heap::AllocateStringFromUtf8Slow(Vector<const char> string, |
3384 PretenureFlag pretenure) { | 3384 PretenureFlag pretenure) { |
3385 // V8 only supports characters in the Basic Multilingual Plane. | 3385 // V8 only supports characters in the Basic Multilingual Plane. |
3386 const uc32 kMaxSupportedChar = 0xFFFF; | 3386 const uc32 kMaxSupportedChar = 0xFFFF; |
3387 // Count the number of characters in the UTF-8 string and check if | 3387 // Count the number of characters in the UTF-8 string and check if |
3388 // it is an ASCII string. | 3388 // it is an ASCII string. |
3389 Access<ScannerConstants::Utf8Decoder> | 3389 Access<UnicodeCache::Utf8Decoder> |
3390 decoder(isolate_->scanner_constants()->utf8_decoder()); | 3390 decoder(isolate_->unicode_cache()->utf8_decoder()); |
3391 decoder->Reset(string.start(), string.length()); | 3391 decoder->Reset(string.start(), string.length()); |
3392 int chars = 0; | 3392 int chars = 0; |
3393 while (decoder->has_more()) { | 3393 while (decoder->has_more()) { |
3394 decoder->GetNext(); | 3394 decoder->GetNext(); |
3395 chars++; | 3395 chars++; |
3396 } | 3396 } |
3397 | 3397 |
3398 Object* result; | 3398 Object* result; |
3399 { MaybeObject* maybe_result = AllocateRawTwoByteString(chars, pretenure); | 3399 { MaybeObject* maybe_result = AllocateRawTwoByteString(chars, pretenure); |
3400 if (!maybe_result->ToObject(&result)) return maybe_result; | 3400 if (!maybe_result->ToObject(&result)) return maybe_result; |
(...skipping 2446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5847 } | 5847 } |
5848 | 5848 |
5849 | 5849 |
5850 void ExternalStringTable::TearDown() { | 5850 void ExternalStringTable::TearDown() { |
5851 new_space_strings_.Free(); | 5851 new_space_strings_.Free(); |
5852 old_space_strings_.Free(); | 5852 old_space_strings_.Free(); |
5853 } | 5853 } |
5854 | 5854 |
5855 | 5855 |
5856 } } // namespace v8::internal | 5856 } } // namespace v8::internal |
OLD | NEW |