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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 return two_byte_string; | 125 return two_byte_string; |
126 } | 126 } |
127 | 127 |
128 | 128 |
129 // Converts a source string to a 16 bit flat string or a SlicedString containing | 129 // Converts a source string to a 16 bit flat string or a SlicedString containing |
130 // a 16 bit flat string). | 130 // a 16 bit flat string). |
131 Handle<String> RegExpImpl::StringToTwoByte(Handle<String> pattern) { | 131 Handle<String> RegExpImpl::StringToTwoByte(Handle<String> pattern) { |
132 StringShape shape(*pattern); | 132 StringShape shape(*pattern); |
133 if (!pattern->IsFlat(shape)) { | 133 if (!pattern->IsFlat(shape)) { |
134 FlattenString(pattern); | 134 FlattenString(pattern); |
| 135 shape = StringShape(*pattern); |
135 } | 136 } |
136 Handle<String> flat_string(shape.IsCons() ? | 137 Handle<String> flat_string(shape.IsCons() ? |
137 String::cast(ConsString::cast(*pattern)->first()) : | 138 String::cast(ConsString::cast(*pattern)->first()) : |
138 *pattern); | 139 *pattern); |
139 ASSERT(flat_string->IsString()); | 140 ASSERT(flat_string->IsString()); |
140 StringShape flat_shape(*flat_string); | 141 StringShape flat_shape(*flat_string); |
141 ASSERT(!flat_shape.IsCons()); | 142 ASSERT(!flat_shape.IsCons()); |
142 ASSERT(flat_shape.IsSequential() || | 143 ASSERT(flat_shape.IsSequential() || |
143 flat_shape.IsSliced() || | 144 flat_shape.IsSliced() || |
144 flat_shape.IsExternal()); | 145 flat_shape.IsExternal()); |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 return Smi::cast(value->get(CAPTURE_INDEX))->value(); | 567 return Smi::cast(value->get(CAPTURE_INDEX))->value(); |
567 } | 568 } |
568 | 569 |
569 | 570 |
570 ByteArray* RegExpImpl::JsreInternal(Handle<JSRegExp> re) { | 571 ByteArray* RegExpImpl::JsreInternal(Handle<JSRegExp> re) { |
571 FixedArray* value = FixedArray::cast(re->DataAt(JSRegExp::kJscreDataIndex)); | 572 FixedArray* value = FixedArray::cast(re->DataAt(JSRegExp::kJscreDataIndex)); |
572 return ByteArray::cast(value->get(INTERNAL_INDEX)); | 573 return ByteArray::cast(value->get(INTERNAL_INDEX)); |
573 } | 574 } |
574 | 575 |
575 }} // namespace v8::internal | 576 }} // namespace v8::internal |
OLD | NEW |