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

Side by Side Diff: src/jsregexp.cc

Issue 40290: Experimental: Merge 1395:1441 from bleeding_edge branch to the... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/global/
Patch Set: Created 11 years, 9 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/jsregexp.h ('k') | src/list.h » ('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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 CompilationCache::PutRegExp(pattern, flags, data); 249 CompilationCache::PutRegExp(pattern, flags, data);
250 } 250 }
251 } 251 }
252 252
253 return result; 253 return result;
254 } 254 }
255 255
256 256
257 Handle<Object> RegExpImpl::Exec(Handle<JSRegExp> regexp, 257 Handle<Object> RegExpImpl::Exec(Handle<JSRegExp> regexp,
258 Handle<String> subject, 258 Handle<String> subject,
259 int index, 259 Handle<Object> index) {
260 Handle<JSArray> last_match_info) {
261 switch (regexp->TypeTag()) { 260 switch (regexp->TypeTag()) {
262 case JSRegExp::ATOM: 261 case JSRegExp::ATOM:
263 return AtomExec(regexp, subject, index, last_match_info); 262 return AtomExec(regexp, subject, index);
264 case JSRegExp::IRREGEXP: { 263 case JSRegExp::IRREGEXP: {
265 Handle<Object> result = 264 Handle<Object> result = IrregexpExec(regexp, subject, index);
266 IrregexpExec(regexp, subject, index, last_match_info);
267 ASSERT(!result.is_null() || Top::has_pending_exception()); 265 ASSERT(!result.is_null() || Top::has_pending_exception());
268 return result; 266 return result;
269 } 267 }
270 default: 268 default:
271 UNREACHABLE(); 269 UNREACHABLE();
272 return Handle<Object>::null(); 270 return Handle<Object>::null();
273 } 271 }
274 } 272 }
275 273
276 274
277 Handle<Object> RegExpImpl::ExecGlobal(Handle<JSRegExp> regexp, 275 Handle<Object> RegExpImpl::ExecGlobal(Handle<JSRegExp> regexp,
278 Handle<String> subject, 276 Handle<String> subject) {
279 Handle<JSArray> last_match_info) {
280 switch (regexp->TypeTag()) { 277 switch (regexp->TypeTag()) {
281 case JSRegExp::ATOM: 278 case JSRegExp::ATOM:
282 return AtomExecGlobal(regexp, subject, last_match_info); 279 return AtomExecGlobal(regexp, subject);
283 case JSRegExp::IRREGEXP: { 280 case JSRegExp::IRREGEXP: {
284 Handle<Object> result = 281 Handle<Object> result = IrregexpExecGlobal(regexp, subject);
285 IrregexpExecGlobal(regexp, subject, last_match_info);
286 ASSERT(!result.is_null() || Top::has_pending_exception()); 282 ASSERT(!result.is_null() || Top::has_pending_exception());
287 return result; 283 return result;
288 } 284 }
289 default: 285 default:
290 UNREACHABLE(); 286 UNREACHABLE();
291 return Handle<Object>::null(); 287 return Handle<Object>::null();
292 } 288 }
293 } 289 }
294 290
295 291
296 // RegExp Atom implementation: Simple string search using indexOf. 292 // RegExp Atom implementation: Simple string search using indexOf.
297 293
298 294
299 Handle<Object> RegExpImpl::AtomCompile(Handle<JSRegExp> re, 295 Handle<Object> RegExpImpl::AtomCompile(Handle<JSRegExp> re,
300 Handle<String> pattern, 296 Handle<String> pattern,
301 JSRegExp::Flags flags, 297 JSRegExp::Flags flags,
302 Handle<String> match_pattern) { 298 Handle<String> match_pattern) {
303 Factory::SetRegExpData(re, JSRegExp::ATOM, pattern, flags, match_pattern); 299 Factory::SetRegExpData(re, JSRegExp::ATOM, pattern, flags, match_pattern);
304 return re; 300 return re;
305 } 301 }
306 302
307 303
308 static void SetAtomLastCapture(FixedArray* array,
309 String* subject,
310 int from,
311 int to) {
312 RegExpImpl::SetLastCaptureCount(array, 2);
313 RegExpImpl::SetLastSubject(array, subject);
314 RegExpImpl::SetLastInput(array, subject);
315 RegExpImpl::SetCapture(array, 0, from);
316 RegExpImpl::SetCapture(array, 1, to);
317 }
318
319
320 Handle<Object> RegExpImpl::AtomExec(Handle<JSRegExp> re, 304 Handle<Object> RegExpImpl::AtomExec(Handle<JSRegExp> re,
321 Handle<String> subject, 305 Handle<String> subject,
322 int index, 306 Handle<Object> index) {
323 Handle<JSArray> last_match_info) {
324 Handle<String> needle(String::cast(re->DataAt(JSRegExp::kAtomPatternIndex))); 307 Handle<String> needle(String::cast(re->DataAt(JSRegExp::kAtomPatternIndex)));
325 308
326 uint32_t start_index = index; 309 uint32_t start_index;
310 if (!Array::IndexFromObject(*index, &start_index)) {
311 return Handle<Smi>(Smi::FromInt(-1));
312 }
327 313
328 int value = Runtime::StringMatch(subject, needle, start_index); 314 int value = Runtime::StringMatch(subject, needle, start_index);
329 if (value == -1) return Factory::null_value(); 315 if (value == -1) return Factory::null_value();
330 ASSERT(last_match_info->HasFastElements());
331 316
332 Handle<FixedArray> array(last_match_info->elements()); 317 Handle<FixedArray> array = Factory::NewFixedArray(2);
333 SetAtomLastCapture(*array, *subject, value, value + needle->length()); 318 array->set(0, Smi::FromInt(value));
334 return last_match_info; 319 array->set(1, Smi::FromInt(value + needle->length()));
320 return Factory::NewJSArrayWithElements(array);
335 } 321 }
336 322
337 323
338 Handle<Object> RegExpImpl::AtomExecGlobal(Handle<JSRegExp> re, 324 Handle<Object> RegExpImpl::AtomExecGlobal(Handle<JSRegExp> re,
339 Handle<String> subject, 325 Handle<String> subject) {
340 Handle<JSArray> last_match_info) {
341 Handle<String> needle(String::cast(re->DataAt(JSRegExp::kAtomPatternIndex))); 326 Handle<String> needle(String::cast(re->DataAt(JSRegExp::kAtomPatternIndex)));
342 ASSERT(last_match_info->HasFastElements());
343 Handle<JSArray> result = Factory::NewJSArray(1); 327 Handle<JSArray> result = Factory::NewJSArray(1);
344 int index = 0; 328 int index = 0;
345 int match_count = 0; 329 int match_count = 0;
346 int subject_length = subject->length(); 330 int subject_length = subject->length();
347 int needle_length = needle->length(); 331 int needle_length = needle->length();
348 int last_value = -1;
349 while (true) { 332 while (true) {
350 HandleScope scope;
351 int value = -1; 333 int value = -1;
352 if (index + needle_length <= subject_length) { 334 if (index + needle_length <= subject_length) {
353 value = Runtime::StringMatch(subject, needle, index); 335 value = Runtime::StringMatch(subject, needle, index);
354 } 336 }
355 if (value == -1) { 337 if (value == -1) break;
356 if (last_value != -1) { 338 HandleScope scope;
357 Handle<FixedArray> array(last_match_info->elements());
358 SetAtomLastCapture(*array,
359 *subject,
360 last_value,
361 last_value + needle->length());
362 }
363 break;
364 }
365
366 int end = value + needle_length; 339 int end = value + needle_length;
367 340
368 // Create an array that looks like the static last_match_info array 341 Handle<FixedArray> array = Factory::NewFixedArray(2);
369 // that is attached to the global RegExp object. We will be returning 342 array->set(0, Smi::FromInt(value));
370 // an array of these. 343 array->set(1, Smi::FromInt(end));
371 Handle<FixedArray> array = Factory::NewFixedArray(kFirstCapture + 2);
372 SetCapture(*array, 0, value);
373 SetCapture(*array, 1, end);
374 SetLastCaptureCount(*array, 2);
375 Handle<JSArray> pair = Factory::NewJSArrayWithElements(array); 344 Handle<JSArray> pair = Factory::NewJSArrayWithElements(array);
376 SetElement(result, match_count, pair); 345 SetElement(result, match_count, pair);
377 match_count++; 346 match_count++;
378 index = end; 347 index = end;
379 if (needle_length == 0) index++; 348 if (needle_length == 0) index++;
380 last_value = value;
381 } 349 }
382 return result; 350 return result;
383 } 351 }
384 352
385 353
386 // Irregexp implementation. 354 // Irregexp implementation.
387 355
388 356
389 // Retrieves a compiled version of the regexp for either ASCII or non-ASCII 357 // Retrieves a compiled version of the regexp for either ASCII or non-ASCII
390 // strings. If the compiled version doesn't already exist, it is compiled 358 // strings. If the compiled version doesn't already exist, it is compiled
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 Handle<FixedArray> alternatives = Factory::NewFixedArray(2); 438 Handle<FixedArray> alternatives = Factory::NewFixedArray(2);
471 alternatives->set_null(0); 439 alternatives->set_null(0);
472 alternatives->set_null(1); 440 alternatives->set_null(1);
473 Factory::SetRegExpData(re, JSRegExp::IRREGEXP, pattern, flags, alternatives); 441 Factory::SetRegExpData(re, JSRegExp::IRREGEXP, pattern, flags, alternatives);
474 return re; 442 return re;
475 } 443 }
476 444
477 445
478 Handle<Object> RegExpImpl::IrregexpExec(Handle<JSRegExp> regexp, 446 Handle<Object> RegExpImpl::IrregexpExec(Handle<JSRegExp> regexp,
479 Handle<String> subject, 447 Handle<String> subject,
480 int index, 448 Handle<Object> index) {
481 Handle<JSArray> last_match_info) {
482 ASSERT_EQ(regexp->TypeTag(), JSRegExp::IRREGEXP); 449 ASSERT_EQ(regexp->TypeTag(), JSRegExp::IRREGEXP);
483 ASSERT(regexp->DataAt(JSRegExp::kIrregexpDataIndex)->IsFixedArray()); 450 ASSERT(regexp->DataAt(JSRegExp::kIrregexpDataIndex)->IsFixedArray());
484 451
485 bool is_ascii = StringShape(*subject).IsAsciiRepresentation(); 452 bool is_ascii = StringShape(*subject).IsAsciiRepresentation();
486 Handle<FixedArray> irregexp = GetCompiledIrregexp(regexp, is_ascii); 453 Handle<FixedArray> irregexp = GetCompiledIrregexp(regexp, is_ascii);
487 if (irregexp.is_null()) { 454 if (irregexp.is_null()) {
488 // We can't handle the RegExp with IRRegExp. 455 // We can't handle the RegExp with IRRegExp.
489 return Handle<Object>::null(); 456 return Handle<Object>::null();
490 } 457 }
491 458
492 // Prepare space for the return values. 459 // Prepare space for the return values.
493 int number_of_capture_registers = 460 int number_of_registers = IrregexpNumberOfRegisters(irregexp);
494 (IrregexpNumberOfCaptures(irregexp) + 1) * 2; 461 OffsetsVector offsets(number_of_registers);
495 OffsetsVector offsets(number_of_capture_registers);
496 462
497 int previous_index = index; 463 int num_captures = IrregexpNumberOfCaptures(irregexp);
464
465 int previous_index = static_cast<int>(DoubleToInteger(index->Number()));
498 466
499 #ifdef DEBUG 467 #ifdef DEBUG
500 if (FLAG_trace_regexp_bytecodes) { 468 if (FLAG_trace_regexp_bytecodes) {
501 String* pattern = regexp->Pattern(); 469 String* pattern = regexp->Pattern();
502 PrintF("\n\nRegexp match: /%s/\n\n", *(pattern->ToCString())); 470 PrintF("\n\nRegexp match: /%s/\n\n", *(pattern->ToCString()));
503 PrintF("\n\nSubject string: '%s'\n\n", *(subject->ToCString())); 471 PrintF("\n\nSubject string: '%s'\n\n", *(subject->ToCString()));
504 } 472 }
505 #endif 473 #endif
506 474
507 if (!subject->IsFlat(StringShape(*subject))) { 475 if (!subject->IsFlat(StringShape(*subject))) {
508 FlattenString(subject); 476 FlattenString(subject);
509 } 477 }
510 478
511 last_match_info->EnsureSize(number_of_capture_registers + kLastMatchOverhead);
512
513 return IrregexpExecOnce(irregexp, 479 return IrregexpExecOnce(irregexp,
514 number_of_capture_registers, 480 num_captures,
515 last_match_info,
516 subject, 481 subject,
517 previous_index, 482 previous_index,
518 offsets.vector(), 483 offsets.vector(),
519 offsets.length()); 484 offsets.length());
520 } 485 }
521 486
522 487
523 Handle<Object> RegExpImpl::IrregexpExecGlobal(Handle<JSRegExp> regexp, 488 Handle<Object> RegExpImpl::IrregexpExecGlobal(Handle<JSRegExp> regexp,
524 Handle<String> subject, 489 Handle<String> subject) {
525 Handle<JSArray> last_match_info) {
526 ASSERT_EQ(regexp->TypeTag(), JSRegExp::IRREGEXP); 490 ASSERT_EQ(regexp->TypeTag(), JSRegExp::IRREGEXP);
527 491
528 bool is_ascii = StringShape(*subject).IsAsciiRepresentation(); 492 bool is_ascii = StringShape(*subject).IsAsciiRepresentation();
529 Handle<FixedArray> irregexp = GetCompiledIrregexp(regexp, is_ascii); 493 Handle<FixedArray> irregexp = GetCompiledIrregexp(regexp, is_ascii);
530 if (irregexp.is_null()) { 494 if (irregexp.is_null()) {
531 return Handle<Object>::null(); 495 return Handle<Object>::null();
532 } 496 }
533 497
534 // Prepare space for the return values. 498 // Prepare space for the return values.
535 int number_of_capture_registers = 499 int number_of_registers = IrregexpNumberOfRegisters(irregexp);
536 (IrregexpNumberOfCaptures(irregexp) + 1) * 2; 500 OffsetsVector offsets(number_of_registers);
537 OffsetsVector offsets(number_of_capture_registers);
538 501
539 int previous_index = 0; 502 int previous_index = 0;
540 503
541 Handle<JSArray> result = Factory::NewJSArray(0); 504 Handle<JSArray> result = Factory::NewJSArray(0);
542 int result_length = 0; 505 int i = 0;
543 Handle<Object> matches; 506 Handle<Object> matches;
544 507
545 if (!subject->IsFlat(StringShape(*subject))) { 508 if (!subject->IsFlat(StringShape(*subject))) {
546 FlattenString(subject); 509 FlattenString(subject);
547 } 510 }
548 511
549 last_match_info->EnsureSize(number_of_capture_registers + kLastMatchOverhead);
550
551 while (true) { 512 while (true) {
552 if (previous_index > subject->length() || previous_index < 0) { 513 if (previous_index > subject->length() || previous_index < 0) {
553 // Per ECMA-262 15.10.6.2, if the previous index is greater than the 514 // Per ECMA-262 15.10.6.2, if the previous index is greater than the
554 // string length, there is no match. 515 // string length, there is no match.
555 matches = Factory::null_value(); 516 matches = Factory::null_value();
556 return result; 517 return result;
557 } else { 518 } else {
558 #ifdef DEBUG 519 #ifdef DEBUG
559 if (FLAG_trace_regexp_bytecodes) { 520 if (FLAG_trace_regexp_bytecodes) {
560 String* pattern = regexp->Pattern(); 521 String* pattern = regexp->Pattern();
561 PrintF("\n\nRegexp match: /%s/\n\n", *(pattern->ToCString())); 522 PrintF("\n\nRegexp match: /%s/\n\n", *(pattern->ToCString()));
562 PrintF("\n\nSubject string: '%s'\n\n", *(subject->ToCString())); 523 PrintF("\n\nSubject string: '%s'\n\n", *(subject->ToCString()));
563 } 524 }
564 #endif 525 #endif
565 HandleScope scope;
566 matches = IrregexpExecOnce(irregexp, 526 matches = IrregexpExecOnce(irregexp,
567 number_of_capture_registers, 527 IrregexpNumberOfCaptures(irregexp),
568 last_match_info,
569 subject, 528 subject,
570 previous_index, 529 previous_index,
571 offsets.vector(), 530 offsets.vector(),
572 offsets.length()); 531 offsets.length());
573 532
574 if (matches.is_null()) { 533 if (matches.is_null()) {
575 ASSERT(Top::has_pending_exception()); 534 ASSERT(Top::has_pending_exception());
576 return matches; 535 return matches;
577 } 536 }
578 537
579 if (matches->IsJSArray()) { 538 if (matches->IsJSArray()) {
580 // Create an array that looks like the static last_match_info array 539 SetElement(result, i, matches);
581 // that is attached to the global RegExp object. We will be returning 540 i++;
582 // an array of these. 541 previous_index = offsets.vector()[1];
583 Handle<FixedArray> matches_array(JSArray::cast(*matches)->elements()); 542 if (offsets.vector()[0] == offsets.vector()[1]) {
584 Handle<JSArray> latest_match = 543 previous_index++;
585 Factory::NewJSArray(kFirstCapture + number_of_capture_registers);
586 Handle<FixedArray> latest_match_array(latest_match->elements());
587
588 for (int i = 0; i < number_of_capture_registers; i++) {
589 SetCapture(*latest_match_array, i, GetCapture(*matches_array, i));
590 } 544 }
591 SetLastCaptureCount(*latest_match_array, number_of_capture_registers);
592
593 SetElement(result, result_length, latest_match);
594 result_length++;
595 previous_index = GetCapture(*matches_array, 1);
596 if (GetCapture(*matches_array, 0) == previous_index)
597 previous_index++;
598
599 } else { 545 } else {
600 ASSERT(matches->IsNull()); 546 ASSERT(matches->IsNull());
601 return result; 547 return result;
602 } 548 }
603 } 549 }
604 } 550 }
605 } 551 }
606 552
607 553
608 Handle<Object> RegExpImpl::IrregexpExecOnce(Handle<FixedArray> irregexp, 554 Handle<Object> RegExpImpl::IrregexpExecOnce(Handle<FixedArray> irregexp,
609 int number_of_capture_registers, 555 int num_captures,
610 Handle<JSArray> last_match_info,
611 Handle<String> subject, 556 Handle<String> subject,
612 int previous_index, 557 int previous_index,
613 int* offsets_vector, 558 int* offsets_vector,
614 int offsets_vector_length) { 559 int offsets_vector_length) {
615 ASSERT(subject->IsFlat(StringShape(*subject))); 560 ASSERT(subject->IsFlat(StringShape(*subject)));
616 bool rc; 561 bool rc;
617 562
618 int tag = Smi::cast(irregexp->get(kIrregexpImplementationIndex))->value(); 563 int tag = Smi::cast(irregexp->get(kIrregexpImplementationIndex))->value();
619 564
620 switch (tag) { 565 switch (tag) {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 } 635 }
691 } 636 }
692 break; 637 break;
693 #else 638 #else
694 UNIMPLEMENTED(); 639 UNIMPLEMENTED();
695 rc = false; 640 rc = false;
696 break; 641 break;
697 #endif 642 #endif
698 } 643 }
699 case RegExpMacroAssembler::kBytecodeImplementation: { 644 case RegExpMacroAssembler::kBytecodeImplementation: {
700 for (int i = number_of_capture_registers - 1; i >= 0; i--) { 645 for (int i = (num_captures + 1) * 2 - 1; i >= 0; i--) {
701 offsets_vector[i] = -1; 646 offsets_vector[i] = -1;
702 } 647 }
703 Handle<ByteArray> byte_codes = IrregexpByteCode(irregexp); 648 Handle<ByteArray> byte_codes = IrregexpByteCode(irregexp);
704 649
705 rc = IrregexpInterpreter::Match(byte_codes, 650 rc = IrregexpInterpreter::Match(byte_codes,
706 subject, 651 subject,
707 offsets_vector, 652 offsets_vector,
708 previous_index); 653 previous_index);
709 break; 654 break;
710 } 655 }
711 case RegExpMacroAssembler::kARMImplementation: 656 case RegExpMacroAssembler::kARMImplementation:
712 default: 657 default:
713 UNREACHABLE(); 658 UNREACHABLE();
714 rc = false; 659 rc = false;
715 break; 660 break;
716 } 661 }
717 662
718 if (!rc) { 663 if (!rc) {
719 return Factory::null_value(); 664 return Factory::null_value();
720 } 665 }
721 666
722 Handle<FixedArray> array(last_match_info->elements()); 667 Handle<FixedArray> array = Factory::NewFixedArray(2 * (num_captures+1));
723 // The captures come in (start, end+1) pairs. 668 // The captures come in (start, end+1) pairs.
724 for (int i = 0; i < number_of_capture_registers; i += 2) { 669 for (int i = 0; i < 2 * (num_captures + 1); i += 2) {
725 SetCapture(*array, i, offsets_vector[i]); 670 array->set(i, Smi::FromInt(offsets_vector[i]));
726 SetCapture(*array, i + 1, offsets_vector[i + 1]); 671 array->set(i + 1, Smi::FromInt(offsets_vector[i + 1]));
727 } 672 }
728 SetLastCaptureCount(*array, number_of_capture_registers); 673 return Factory::NewJSArrayWithElements(array);
729 SetLastSubject(*array, *subject);
730 SetLastInput(*array, *subject);
731 return last_match_info;
732 } 674 }
733 675
734 676
735 // ------------------------------------------------------------------- 677 // -------------------------------------------------------------------
736 // Implmentation of the Irregexp regular expression engine. 678 // Implmentation of the Irregexp regular expression engine.
737 // 679 //
738 // The Irregexp regular expression engine is intended to be a complete 680 // The Irregexp regular expression engine is intended to be a complete
739 // implementation of ECMAScript regular expressions. It generates either 681 // implementation of ECMAScript regular expressions. It generates either
740 // bytecodes or native code. 682 // bytecodes or native code.
741 683
(...skipping 3032 matching lines...) Expand 10 before | Expand all | Expand 10 after
3774 // x{f, t} becomes this: 3716 // x{f, t} becomes this:
3775 // 3717 //
3776 // (r++)<-. 3718 // (r++)<-.
3777 // | ` 3719 // | `
3778 // | (x) 3720 // | (x)
3779 // v ^ 3721 // v ^
3780 // (r=0)-->(?)---/ [if r < t] 3722 // (r=0)-->(?)---/ [if r < t]
3781 // | 3723 // |
3782 // [if r >= f] \----> ... 3724 // [if r >= f] \----> ...
3783 // 3725 //
3726 //
3727 // TODO(someone): clear captures on repetition and handle empty
3728 // matches.
3784 3729
3785 // 15.10.2.5 RepeatMatcher algorithm. 3730 // 15.10.2.5 RepeatMatcher algorithm.
3786 // The parser has already eliminated the case where max is 0. In the case 3731 // The parser has already eliminated the case where max is 0. In the case
3787 // where max_match is zero the parser has removed the quantifier if min was 3732 // where max_match is zero the parser has removed the quantifier if min was
3788 // > 0 and removed the atom if min was 0. See AddQuantifierToAtom. 3733 // > 0 and removed the atom if min was 0. See AddQuantifierToAtom.
3789 3734
3790 // If we know that we cannot match zero length then things are a little 3735 // If we know that we cannot match zero length then things are a little
3791 // simpler since we don't need to make the special zero length match check 3736 // simpler since we don't need to make the special zero length match check
3792 // from step 2.1. If the min and max are small we can unroll a little in 3737 // from step 2.1. If the min and max are small we can unroll a little in
3793 // this case. 3738 // this case.
(...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after
4713 EmbeddedVector<byte, 1024> codes; 4658 EmbeddedVector<byte, 1024> codes;
4714 RegExpMacroAssemblerIrregexp macro_assembler(codes); 4659 RegExpMacroAssemblerIrregexp macro_assembler(codes);
4715 return compiler.Assemble(&macro_assembler, 4660 return compiler.Assemble(&macro_assembler,
4716 node, 4661 node,
4717 data->capture_count, 4662 data->capture_count,
4718 pattern); 4663 pattern);
4719 } 4664 }
4720 4665
4721 4666
4722 }} // namespace v8::internal 4667 }} // namespace v8::internal
OLDNEW
« no previous file with comments | « src/jsregexp.h ('k') | src/list.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698