| 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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 Handle<JSArray> last_match_info) { | 219 Handle<JSArray> last_match_info) { |
| 220 Isolate* isolate = re->GetIsolate(); | 220 Isolate* isolate = re->GetIsolate(); |
| 221 | 221 |
| 222 ASSERT(0 <= index); | 222 ASSERT(0 <= index); |
| 223 ASSERT(index <= subject->length()); | 223 ASSERT(index <= subject->length()); |
| 224 | 224 |
| 225 if (!subject->IsFlat()) FlattenString(subject); | 225 if (!subject->IsFlat()) FlattenString(subject); |
| 226 AssertNoAllocation no_heap_allocation; // ensure vectors stay valid | 226 AssertNoAllocation no_heap_allocation; // ensure vectors stay valid |
| 227 | 227 |
| 228 String* needle = String::cast(re->DataAt(JSRegExp::kAtomPatternIndex)); | 228 String* needle = String::cast(re->DataAt(JSRegExp::kAtomPatternIndex)); |
| 229 ASSERT(StringShape(needle).IsSequential()); | |
| 230 int needle_len = needle->length(); | 229 int needle_len = needle->length(); |
| 231 ASSERT(needle->IsFlat()); | 230 ASSERT(needle->IsFlat()); |
| 232 | 231 |
| 233 if (needle_len != 0) { | 232 if (needle_len != 0) { |
| 234 if (index + needle_len > subject->length()) { | 233 if (index + needle_len > subject->length()) { |
| 235 return isolate->factory()->null_value(); | 234 return isolate->factory()->null_value(); |
| 236 } | 235 } |
| 237 | 236 |
| 238 String::FlatContent needle_content = needle->GetFlatContent(); | 237 String::FlatContent needle_content = needle->GetFlatContent(); |
| 239 String::FlatContent subject_content = subject->GetFlatContent(); | 238 String::FlatContent subject_content = subject->GetFlatContent(); |
| (...skipping 5092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5332 } | 5331 } |
| 5333 | 5332 |
| 5334 return compiler.Assemble(¯o_assembler, | 5333 return compiler.Assemble(¯o_assembler, |
| 5335 node, | 5334 node, |
| 5336 data->capture_count, | 5335 data->capture_count, |
| 5337 pattern); | 5336 pattern); |
| 5338 } | 5337 } |
| 5339 | 5338 |
| 5340 | 5339 |
| 5341 }} // namespace v8::internal | 5340 }} // namespace v8::internal |
| OLD | NEW |