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 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 #endif | 471 #endif |
472 int required_registers = RegExpImpl::IrregexpPrepare(jsregexp, subject); | 472 int required_registers = RegExpImpl::IrregexpPrepare(jsregexp, subject); |
473 if (required_registers < 0) { | 473 if (required_registers < 0) { |
474 // Compiling failed with an exception. | 474 // Compiling failed with an exception. |
475 ASSERT(Top::has_pending_exception()); | 475 ASSERT(Top::has_pending_exception()); |
476 return Handle<Object>::null(); | 476 return Handle<Object>::null(); |
477 } | 477 } |
478 | 478 |
479 OffsetsVector registers(required_registers); | 479 OffsetsVector registers(required_registers); |
480 | 480 |
481 IrregexpResult res = IrregexpExecOnce(jsregexp, | 481 IrregexpResult res = RegExpImpl::IrregexpExecOnce( |
482 subject, | 482 jsregexp, subject, previous_index, Vector<int>(registers.vector(), |
483 previous_index, | 483 registers.length())); |
484 Vector<int>(registers.vector(), | |
485 registers.length())); | |
486 if (res == RE_SUCCESS) { | 484 if (res == RE_SUCCESS) { |
487 int capture_register_count = | 485 int capture_register_count = |
488 (IrregexpNumberOfCaptures(FixedArray::cast(jsregexp->data())) + 1) * 2; | 486 (IrregexpNumberOfCaptures(FixedArray::cast(jsregexp->data())) + 1) * 2; |
489 last_match_info->EnsureSize(capture_register_count + kLastMatchOverhead); | 487 last_match_info->EnsureSize(capture_register_count + kLastMatchOverhead); |
490 AssertNoAllocation no_gc; | 488 AssertNoAllocation no_gc; |
491 int* register_vector = registers.vector(); | 489 int* register_vector = registers.vector(); |
492 FixedArray* array = FixedArray::cast(last_match_info->elements()); | 490 FixedArray* array = FixedArray::cast(last_match_info->elements()); |
493 for (int i = 0; i < capture_register_count; i += 2) { | 491 for (int i = 0; i < capture_register_count; i += 2) { |
494 SetCapture(array, i, register_vector[i]); | 492 SetCapture(array, i, register_vector[i]); |
495 SetCapture(array, i + 1, register_vector[i + 1]); | 493 SetCapture(array, i + 1, register_vector[i + 1]); |
(...skipping 4745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5241 node, | 5239 node, |
5242 data->capture_count, | 5240 data->capture_count, |
5243 pattern); | 5241 pattern); |
5244 } | 5242 } |
5245 | 5243 |
5246 | 5244 |
5247 int OffsetsVector::static_offsets_vector_[ | 5245 int OffsetsVector::static_offsets_vector_[ |
5248 OffsetsVector::kStaticOffsetsVectorSize]; | 5246 OffsetsVector::kStaticOffsetsVectorSize]; |
5249 | 5247 |
5250 }} // namespace v8::internal | 5248 }} // namespace v8::internal |
OLD | NEW |