Chromium Code Reviews| 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 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 502 // We must have done EnsureCompiledIrregexp, so we can get the number of | 502 // We must have done EnsureCompiledIrregexp, so we can get the number of |
| 503 // registers. | 503 // registers. |
| 504 int* register_vector = output.start(); | 504 int* register_vector = output.start(); |
| 505 int number_of_capture_registers = | 505 int number_of_capture_registers = |
| 506 (IrregexpNumberOfCaptures(*irregexp) + 1) * 2; | 506 (IrregexpNumberOfCaptures(*irregexp) + 1) * 2; |
| 507 for (int i = number_of_capture_registers - 1; i >= 0; i--) { | 507 for (int i = number_of_capture_registers - 1; i >= 0; i--) { |
| 508 register_vector[i] = -1; | 508 register_vector[i] = -1; |
| 509 } | 509 } |
| 510 Handle<ByteArray> byte_codes(IrregexpByteCode(*irregexp, is_ascii), isolate); | 510 Handle<ByteArray> byte_codes(IrregexpByteCode(*irregexp, is_ascii), isolate); |
| 511 | 511 |
| 512 if (IrregexpInterpreter::Match(isolate, | 512 IrregexpResult result = IrregexpInterpreter::Match(isolate, |
| 513 byte_codes, | 513 byte_codes, |
| 514 subject, | 514 subject, |
| 515 register_vector, | 515 register_vector, |
| 516 index)) { | 516 index); |
| 517 return RE_SUCCESS; | 517 if (result == RE_EXCEPTION) { |
| 518 ASSERT(!isolate->has_pending_exception()); | |
| 519 isolate->StackOverflow(); | |
|
Erik Corry
2011/10/25 12:58:41
Do we do this for compiled regexps?
Lasse Reichstein
2011/10/25 13:27:10
Yes. It's handled a little further up the call-cha
| |
| 518 } | 520 } |
| 519 return RE_FAILURE; | 521 return result; |
| 520 #endif // V8_INTERPRETED_REGEXP | 522 #endif // V8_INTERPRETED_REGEXP |
| 521 } | 523 } |
| 522 | 524 |
| 523 | 525 |
| 524 Handle<Object> RegExpImpl::IrregexpExec(Handle<JSRegExp> jsregexp, | 526 Handle<Object> RegExpImpl::IrregexpExec(Handle<JSRegExp> jsregexp, |
| 525 Handle<String> subject, | 527 Handle<String> subject, |
| 526 int previous_index, | 528 int previous_index, |
| 527 Handle<JSArray> last_match_info) { | 529 Handle<JSArray> last_match_info) { |
| 528 ASSERT_EQ(jsregexp->TypeTag(), JSRegExp::IRREGEXP); | 530 ASSERT_EQ(jsregexp->TypeTag(), JSRegExp::IRREGEXP); |
| 529 | 531 |
| (...skipping 4802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5332 } | 5334 } |
| 5333 | 5335 |
| 5334 return compiler.Assemble(¯o_assembler, | 5336 return compiler.Assemble(¯o_assembler, |
| 5335 node, | 5337 node, |
| 5336 data->capture_count, | 5338 data->capture_count, |
| 5337 pattern); | 5339 pattern); |
| 5338 } | 5340 } |
| 5339 | 5341 |
| 5340 | 5342 |
| 5341 }} // namespace v8::internal | 5343 }} // namespace v8::internal |
| OLD | NEW |