| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 2860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2871 | 2871 |
| 2872 Vector<const char> String::ToAsciiVector() { | 2872 Vector<const char> String::ToAsciiVector() { |
| 2873 ASSERT(IsAsciiRepresentation()); | 2873 ASSERT(IsAsciiRepresentation()); |
| 2874 ASSERT(IsFlat()); | 2874 ASSERT(IsFlat()); |
| 2875 | 2875 |
| 2876 int offset = 0; | 2876 int offset = 0; |
| 2877 int length = this->length(); | 2877 int length = this->length(); |
| 2878 StringRepresentationTag string_tag = representation_tag(); | 2878 StringRepresentationTag string_tag = representation_tag(); |
| 2879 String* string = this; | 2879 String* string = this; |
| 2880 if (string_tag == kSlicedStringTag) { | 2880 if (string_tag == kSlicedStringTag) { |
| 2881 SlicedString* sliced = SlicedString::cast(string); | 2881 SlicedString* sliced = SlicedString::cast(string); |
| 2882 offset += sliced->start(); | 2882 offset += sliced->start(); |
| 2883 string = String::cast(sliced->buffer()); | 2883 string = String::cast(sliced->buffer()); |
| 2884 string_tag = string->representation_tag(); | 2884 string_tag = string->representation_tag(); |
| 2885 } else if (string_tag == kConsStringTag) { | 2885 } else if (string_tag == kConsStringTag) { |
| 2886 ConsString* cons = ConsString::cast(string); | 2886 ConsString* cons = ConsString::cast(string); |
| 2887 ASSERT(String::cast(cons->second())->length() == 0); | 2887 ASSERT(String::cast(cons->second())->length() == 0); |
| 2888 string = String::cast(cons->first()); | 2888 string = String::cast(cons->first()); |
| 2889 string_tag = string->representation_tag(); | 2889 string_tag = string->representation_tag(); |
| 2890 } | 2890 } |
| 2891 if (string_tag == kSeqStringTag) { | 2891 if (string_tag == kSeqStringTag) { |
| 2892 SeqAsciiString* seq = SeqAsciiString::cast(string); | 2892 SeqAsciiString* seq = SeqAsciiString::cast(string); |
| 2893 char* start = reinterpret_cast<char*>(seq->GetCharsAddress()); | 2893 char* start = reinterpret_cast<char*>(seq->GetCharsAddress()); |
| 2894 return Vector<const char>(start + offset, length); | 2894 return Vector<const char>(start + offset, length); |
| 2895 } | 2895 } |
| 2896 ASSERT(string_tag == kExternalStringTag); | 2896 ASSERT(string_tag == kExternalStringTag); |
| 2897 ExternalAsciiString* ext = ExternalAsciiString::cast(string); | 2897 ExternalAsciiString* ext = ExternalAsciiString::cast(string); |
| 2898 const char* start = ext->resource()->data(); | 2898 const char* start = ext->resource()->data(); |
| 2899 return Vector<const char>(start + offset, length); | 2899 return Vector<const char>(start + offset, length); |
| 2900 } | 2900 } |
| 2901 | 2901 |
| 2902 | 2902 |
| 2903 Vector<const uc16> String::ToUC16Vector() { | 2903 Vector<const uc16> String::ToUC16Vector() { |
| 2904 ASSERT(IsTwoByteStringRepresentation()); | 2904 ASSERT(IsTwoByteStringRepresentation()); |
| 2905 ASSERT(IsFlat()); | 2905 ASSERT(IsFlat()); |
| 2906 | 2906 |
| 2907 int offset = 0; | 2907 int offset = 0; |
| 2908 int length = this->length(); | 2908 int length = this->length(); |
| 2909 StringRepresentationTag string_tag = representation_tag(); | 2909 StringRepresentationTag string_tag = representation_tag(); |
| 2910 String* string = this; | 2910 String* string = this; |
| 2911 if (string_tag == kSlicedStringTag) { | 2911 if (string_tag == kSlicedStringTag) { |
| 2912 SlicedString* sliced = SlicedString::cast(string); | 2912 SlicedString* sliced = SlicedString::cast(string); |
| 2913 offset += sliced->start(); | 2913 offset += sliced->start(); |
| 2914 string = String::cast(sliced->buffer()); | 2914 string = String::cast(sliced->buffer()); |
| 2915 string_tag = string->representation_tag(); | 2915 string_tag = string->representation_tag(); |
| 2916 } else if (string_tag == kConsStringTag) { | 2916 } else if (string_tag == kConsStringTag) { |
| 2917 ConsString* cons = ConsString::cast(string); | 2917 ConsString* cons = ConsString::cast(string); |
| 2918 ASSERT(String::cast(cons->second())->length() == 0); | 2918 ASSERT(String::cast(cons->second())->length() == 0); |
| 2919 string = String::cast(cons->first()); | 2919 string = String::cast(cons->first()); |
| 2920 string_tag = string->representation_tag(); | 2920 string_tag = string->representation_tag(); |
| 2921 } | 2921 } |
| 2922 if (string_tag == kSeqStringTag) { | 2922 if (string_tag == kSeqStringTag) { |
| 2923 SeqTwoByteString* seq = SeqTwoByteString::cast(string); | 2923 SeqTwoByteString* seq = SeqTwoByteString::cast(string); |
| 2924 uc16* start = reinterpret_cast<uc16*>(seq->GetCharsAddress()); | 2924 uc16* start = reinterpret_cast<uc16*>(seq->GetCharsAddress()); |
| 2925 return Vector<const uc16>(start + offset, length); | 2925 return Vector<const uc16>(start + offset, length); |
| 2926 } | 2926 } |
| 2927 ASSERT(string_tag == kExternalStringTag); | 2927 ASSERT(string_tag == kExternalStringTag); |
| 2928 ExternalTwoByteString* ext = ExternalTwoByteString::cast(string); | 2928 ExternalTwoByteString* ext = ExternalTwoByteString::cast(string); |
| 2929 const uc16* start = | 2929 const uc16* start = |
| 2930 reinterpret_cast<const uc16*>(ext->resource()->data()); | 2930 reinterpret_cast<const uc16*>(ext->resource()->data()); |
| (...skipping 3547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6478 // No break point. | 6478 // No break point. |
| 6479 if (break_point_objects()->IsUndefined()) return 0; | 6479 if (break_point_objects()->IsUndefined()) return 0; |
| 6480 // Single beak point. | 6480 // Single beak point. |
| 6481 if (!break_point_objects()->IsFixedArray()) return 1; | 6481 if (!break_point_objects()->IsFixedArray()) return 1; |
| 6482 // Multiple break points. | 6482 // Multiple break points. |
| 6483 return FixedArray::cast(break_point_objects())->length(); | 6483 return FixedArray::cast(break_point_objects())->length(); |
| 6484 } | 6484 } |
| 6485 | 6485 |
| 6486 | 6486 |
| 6487 } } // namespace v8::internal | 6487 } } // namespace v8::internal |
| OLD | NEW |