Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(181)

Side by Side Diff: src/jsregexp.cc

Issue 8387027: Make the irregexp interpreter throw on stack overflow. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/interpreter-irregexp.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
5332 } 5334 }
5333 5335
5334 return compiler.Assemble(&macro_assembler, 5336 return compiler.Assemble(&macro_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
OLDNEW
« no previous file with comments | « src/interpreter-irregexp.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698