Chromium Code Reviews
Help | Chromium Project | Sign in
(182)

Side by Side Diff: src/jsregexp.cc

Issue 141042: Fix regexp bug reported on iit.edu. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | test/mjsunit/regexp-captures.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 397
398 398
399 Handle<Object> RegExpImpl::IrregexpExec(Handle<JSRegExp> jsregexp, 399 Handle<Object> RegExpImpl::IrregexpExec(Handle<JSRegExp> jsregexp,
400 Handle<String> subject, 400 Handle<String> subject,
401 int previous_index, 401 int previous_index,
402 Handle<JSArray> last_match_info) { 402 Handle<JSArray> last_match_info) {
403 ASSERT_EQ(jsregexp->TypeTag(), JSRegExp::IRREGEXP); 403 ASSERT_EQ(jsregexp->TypeTag(), JSRegExp::IRREGEXP);
404 404
405 // Prepare space for the return values. 405 // Prepare space for the return values.
406 int number_of_capture_registers = 406 int number_of_capture_registers =
407 (IrregexpNumberOfCaptures(FixedArray::cast(jsregexp->data())) + 1) * 2; 407 UseNativeRegexp() ?
408 (IrregexpNumberOfCaptures(FixedArray::cast(jsregexp->data())) + 1) * 2 :
Lasse Reichstein 2009/06/22 12:32:49 Seems this have different meanings for the two imp
409 IrregexpNumberOfRegisters(FixedArray::cast(jsregexp->data()));
408 OffsetsVector offsets(number_of_capture_registers); 410 OffsetsVector offsets(number_of_capture_registers);
409 411
410 #ifdef DEBUG 412 #ifdef DEBUG
411 if (FLAG_trace_regexp_bytecodes) { 413 if (FLAG_trace_regexp_bytecodes) {
412 String* pattern = jsregexp->Pattern(); 414 String* pattern = jsregexp->Pattern();
413 PrintF("\n\nRegexp match: /%s/\n\n", *(pattern->ToCString())); 415 PrintF("\n\nRegexp match: /%s/\n\n", *(pattern->ToCString()));
414 PrintF("\n\nSubject string: '%s'\n\n", *(subject->ToCString())); 416 PrintF("\n\nSubject string: '%s'\n\n", *(subject->ToCString()));
415 } 417 }
416 #endif 418 #endif
417 419
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 891
890 892
891 void Trace::PerformDeferredActions(RegExpMacroAssembler* assembler, 893 void Trace::PerformDeferredActions(RegExpMacroAssembler* assembler,
892 int max_register, 894 int max_register,
893 OutSet& affected_registers, 895 OutSet& affected_registers,
894 OutSet* registers_to_pop, 896 OutSet* registers_to_pop,
895 OutSet* registers_to_clear) { 897 OutSet* registers_to_clear) {
896 // The "+1" is to avoid a push_limit of zero if stack_limit_slack() is 1. 898 // The "+1" is to avoid a push_limit of zero if stack_limit_slack() is 1.
897 const int push_limit = (assembler->stack_limit_slack() + 1) / 2; 899 const int push_limit = (assembler->stack_limit_slack() + 1) / 2;
898 900
901 // Count pushes performed to force a stack limit check occasionally.
902 int pushes = 0;
903
899 for (int reg = 0; reg <= max_register; reg++) { 904 for (int reg = 0; reg <= max_register; reg++) {
900 if (!affected_registers.Get(reg)) { 905 if (!affected_registers.Get(reg)) {
901 continue; 906 continue;
902 } 907 }
903 // Count pushes performed to force a stack limit check occasionally.
904 int pushes = 0;
905 908
906 // The chronologically first deferred action in the trace 909 // The chronologically first deferred action in the trace
907 // is used to infer the action needed to restore a register 910 // is used to infer the action needed to restore a register
908 // to its previous state (or not, if it's safe to ignore it). 911 // to its previous state (or not, if it's safe to ignore it).
909 enum DeferredActionUndoType { IGNORE, RESTORE, CLEAR }; 912 enum DeferredActionUndoType { IGNORE, RESTORE, CLEAR };
910 DeferredActionUndoType undo_action = IGNORE; 913 DeferredActionUndoType undo_action = IGNORE;
911 914
912 int value = 0; 915 int value = 0;
913 bool absolute = false; 916 bool absolute = false;
914 bool clear = false; 917 bool clear = false;
(...skipping 3566 matching lines...) Expand 10 before | Expand all | Expand 10 after
4481 EmbeddedVector<byte, 1024> codes; 4484 EmbeddedVector<byte, 1024> codes;
4482 RegExpMacroAssemblerIrregexp macro_assembler(codes); 4485 RegExpMacroAssemblerIrregexp macro_assembler(codes);
4483 return compiler.Assemble(&macro_assembler, 4486 return compiler.Assemble(&macro_assembler,
4484 node, 4487 node,
4485 data->capture_count, 4488 data->capture_count,
4486 pattern); 4489 pattern);
4487 } 4490 }
4488 4491
4489 4492
4490 }} // namespace v8::internal 4493 }} // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regexp-captures.js » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld 1275:d14800f88434