| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 } | 410 } |
| 411 #endif | 411 #endif |
| 412 | 412 |
| 413 if (!subject->IsFlat()) { | 413 if (!subject->IsFlat()) { |
| 414 FlattenString(subject); | 414 FlattenString(subject); |
| 415 } | 415 } |
| 416 | 416 |
| 417 last_match_info->EnsureSize(number_of_capture_registers + kLastMatchOverhead); | 417 last_match_info->EnsureSize(number_of_capture_registers + kLastMatchOverhead); |
| 418 | 418 |
| 419 int* offsets_vector = offsets.vector(); | 419 int* offsets_vector = offsets.vector(); |
| 420 int offsets_vector_length = offsets.length(); | |
| 421 bool rc; | 420 bool rc; |
| 422 | 421 |
| 423 // Dispatch to the correct RegExp implementation. | 422 // Dispatch to the correct RegExp implementation. |
| 424 | 423 |
| 425 Handle<String> original_subject = subject; | 424 Handle<String> original_subject = subject; |
| 426 Handle<FixedArray> regexp(FixedArray::cast(jsregexp->data())); | 425 Handle<FixedArray> regexp(FixedArray::cast(jsregexp->data())); |
| 427 if (UseNativeRegexp()) { | 426 if (UseNativeRegexp()) { |
| 428 #ifdef ARM | 427 #ifdef ARM |
| 429 UNREACHABLE(); | 428 UNREACHABLE(); |
| 430 #else | 429 #else |
| 431 RegExpMacroAssemblerIA32::Result res; | 430 RegExpMacroAssemblerIA32::Result res; |
| 432 do { | 431 do { |
| 433 bool is_ascii = StringShape(*subject).IsAsciiRepresentation(); | 432 bool is_ascii = StringShape(*subject).IsAsciiRepresentation(); |
| 434 if (!EnsureCompiledIrregexp(jsregexp, is_ascii)) { | 433 if (!EnsureCompiledIrregexp(jsregexp, is_ascii)) { |
| 435 return Handle<Object>::null(); | 434 return Handle<Object>::null(); |
| 436 } | 435 } |
| 437 Handle<Code> code(RegExpImpl::IrregexpNativeCode(*regexp, is_ascii)); | 436 Handle<Code> code(RegExpImpl::IrregexpNativeCode(*regexp, is_ascii)); |
| 438 res = RegExpMacroAssemblerIA32::Match(code, | 437 res = RegExpMacroAssemblerIA32::Match(code, |
| 439 subject, | 438 subject, |
| 440 offsets_vector, | 439 offsets_vector, |
| 441 offsets_vector_length, | 440 offsets.length(), |
| 442 previous_index); | 441 previous_index); |
| 443 // If result is RETRY, the string have changed representation, and we | 442 // If result is RETRY, the string have changed representation, and we |
| 444 // must restart from scratch. | 443 // must restart from scratch. |
| 445 } while (res == RegExpMacroAssemblerIA32::RETRY); | 444 } while (res == RegExpMacroAssemblerIA32::RETRY); |
| 446 if (res == RegExpMacroAssemblerIA32::EXCEPTION) { | 445 if (res == RegExpMacroAssemblerIA32::EXCEPTION) { |
| 447 ASSERT(Top::has_pending_exception()); | 446 ASSERT(Top::has_pending_exception()); |
| 448 return Handle<Object>::null(); | 447 return Handle<Object>::null(); |
| 449 } | 448 } |
| 450 ASSERT(res == RegExpMacroAssemblerIA32::SUCCESS | 449 ASSERT(res == RegExpMacroAssemblerIA32::SUCCESS |
| 451 || res == RegExpMacroAssemblerIA32::FAILURE); | 450 || res == RegExpMacroAssemblerIA32::FAILURE); |
| (...skipping 4003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4455 EmbeddedVector<byte, 1024> codes; | 4454 EmbeddedVector<byte, 1024> codes; |
| 4456 RegExpMacroAssemblerIrregexp macro_assembler(codes); | 4455 RegExpMacroAssemblerIrregexp macro_assembler(codes); |
| 4457 return compiler.Assemble(¯o_assembler, | 4456 return compiler.Assemble(¯o_assembler, |
| 4458 node, | 4457 node, |
| 4459 data->capture_count, | 4458 data->capture_count, |
| 4460 pattern); | 4459 pattern); |
| 4461 } | 4460 } |
| 4462 | 4461 |
| 4463 | 4462 |
| 4464 }} // namespace v8::internal | 4463 }} // namespace v8::internal |
| OLD | NEW |