| 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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 | 228 |
| 229 String* needle = String::cast(re->DataAt(JSRegExp::kAtomPatternIndex)); | 229 String* needle = String::cast(re->DataAt(JSRegExp::kAtomPatternIndex)); |
| 230 int needle_len = needle->length(); | 230 int needle_len = needle->length(); |
| 231 ASSERT(needle->IsFlat()); | 231 ASSERT(needle->IsFlat()); |
| 232 | 232 |
| 233 if (needle_len != 0) { | 233 if (needle_len != 0) { |
| 234 if (index + needle_len > subject->length()) { | 234 if (index + needle_len > subject->length()) { |
| 235 return isolate->factory()->null_value(); | 235 return isolate->factory()->null_value(); |
| 236 } | 236 } |
| 237 | 237 |
| 238 String::FlatContent needle_content = | 238 String::FlatContent needle_content = needle->GetFlatContent(); |
| 239 needle->GetFlatContent(no_heap_allocation); | 239 String::FlatContent subject_content = subject->GetFlatContent(); |
| 240 String::FlatContent subject_content = | |
| 241 subject->GetFlatContent(no_heap_allocation); | |
| 242 ASSERT(needle_content.IsFlat()); | 240 ASSERT(needle_content.IsFlat()); |
| 243 ASSERT(subject_content.IsFlat()); | 241 ASSERT(subject_content.IsFlat()); |
| 244 // dispatch on type of strings | 242 // dispatch on type of strings |
| 245 index = (needle_content.IsAscii() | 243 index = (needle_content.IsAscii() |
| 246 ? (subject_content.IsAscii() | 244 ? (subject_content.IsAscii() |
| 247 ? SearchString(isolate, | 245 ? SearchString(isolate, |
| 248 subject_content.ToAsciiVector(), | 246 subject_content.ToAsciiVector(), |
| 249 needle_content.ToAsciiVector(), | 247 needle_content.ToAsciiVector(), |
| 250 index) | 248 index) |
| 251 : SearchString(isolate, | 249 : SearchString(isolate, |
| (...skipping 5099 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5351 } | 5349 } |
| 5352 | 5350 |
| 5353 return compiler.Assemble(¯o_assembler, | 5351 return compiler.Assemble(¯o_assembler, |
| 5354 node, | 5352 node, |
| 5355 data->capture_count, | 5353 data->capture_count, |
| 5356 pattern); | 5354 pattern); |
| 5357 } | 5355 } |
| 5358 | 5356 |
| 5359 | 5357 |
| 5360 }} // namespace v8::internal | 5358 }} // namespace v8::internal |
| OLD | NEW |