Changeset 28165 in webkit
- Timestamp:
- Nov 29, 2007, 3:25:55 AM (17 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r28164 r28165 16 16 17 17 Section off MatchData arguments into args struct 18 19 * pcre/pcre_exec.cpp: 20 (MatchStack::pushNewFrame): 21 (match): 22 23 2007-11-24 Eric Seidel <eric@webkit.org> 24 25 Reviewed by Sam. 26 27 Remove redundant eptrblock struct 18 28 19 29 * pcre/pcre_exec.cpp: -
trunk/JavaScriptCore/pcre/pcre_exec.cpp
r28164 r28165 60 60 #undef max 61 61 62 /* Structure for building a chain of data that actually lives on the63 stack, for holding the values of the subject pointer at the start of each64 subpattern, so as to detect when an empty string has been matched by a65 subpattern - to break infinite loops. When NO_RECURSE is set, these blocks66 are on the heap, not on the stack. */67 68 struct eptrblock {69 struct eptrblock* epb_prev;70 const UChar* epb_saved_eptr;71 };72 73 /* Structure for remembering the local variables in a private frame */74 75 76 77 62 #ifndef USE_COMPUTED_GOTO_FOR_MATCH_RECURSION 78 63 typedef int ReturnLocation; … … 90 75 const uschar* ecode; 91 76 int offset_top; 92 eptrblock* eptrb;77 const UChar* subpatternStart; 93 78 } args; 94 79 … … 117 102 int save_offset3; 118 103 119 eptrblock newptrb;104 const UChar* subpatternStart; 120 105 } locals; 121 106 }; … … 352 337 } 353 338 354 inline void pushNewFrame(const uschar* ecode, eptrblock* eptrb, ReturnLocation returnLocation)339 inline void pushNewFrame(const uschar* ecode, const UChar* subpatternStart, ReturnLocation returnLocation) 355 340 { 356 341 MatchFrame* newframe = allocateNextFrame(); … … 360 345 newframe->args.offset_top = currentFrame->args.offset_top; 361 346 newframe->args.ecode = ecode; 362 newframe->args. eptrb = eptrb;347 newframe->args.subpatternStart = subpatternStart; 363 348 newframe->returnLocation = returnLocation; 364 349 size++; … … 449 434 stack.currentFrame->args.ecode = ecode; 450 435 stack.currentFrame->args.offset_top = offset_top; 451 stack.currentFrame->args. eptrb = NULL;436 stack.currentFrame->args.subpatternStart = 0; 452 437 453 438 /* This is where control jumps back to to effect "recursion" */ … … 468 453 this stack. */ 469 454 470 if (is_group_start) { 471 stack.currentFrame->locals.newptrb.epb_prev = stack.currentFrame->args.eptrb; 472 stack.currentFrame->locals.newptrb.epb_saved_eptr = stack.currentFrame->args.eptr; 473 stack.currentFrame->args.eptrb = &stack.currentFrame->locals.newptrb; 474 } 455 if (is_group_start) 456 stack.currentFrame->locals.subpatternStart = stack.currentFrame->args.subpatternStart; 475 457 476 458 /* Now start processing the operations. */ … … 501 483 DPRINTF(("start bracket 0\n")); 502 484 do { 503 RMATCH(2, stack.currentFrame->args.ecode + 1 + LINK_SIZE, stack.currentFrame->args. eptrb, match_isgroup);485 RMATCH(2, stack.currentFrame->args.ecode + 1 + LINK_SIZE, stack.currentFrame->args.subpatternStart, match_isgroup); 504 486 if (is_match) 505 487 RRETURN; … … 572 554 573 555 do { 574 RMATCH(9, stack.currentFrame->args.ecode + 1 + LINK_SIZE, stack.currentFrame->args. eptrb, match_isgroup);556 RMATCH(9, stack.currentFrame->args.ecode + 1 + LINK_SIZE, stack.currentFrame->args.subpatternStart, match_isgroup); 575 557 if (is_match) 576 558 break; … … 608 590 609 591 if (*stack.currentFrame->args.ecode == OP_KETRMIN) { 610 RMATCH(10, stack.currentFrame->args.ecode + 1 + LINK_SIZE, stack.currentFrame->args. eptrb, 0);592 RMATCH(10, stack.currentFrame->args.ecode + 1 + LINK_SIZE, stack.currentFrame->args.subpatternStart, 0); 611 593 if (is_match) 612 594 RRETURN; 613 RMATCH(11, stack.currentFrame->locals.prev, stack.currentFrame->args. eptrb, match_isgroup);595 RMATCH(11, stack.currentFrame->locals.prev, stack.currentFrame->args.subpatternStart, match_isgroup); 614 596 if (is_match) 615 597 RRETURN; 616 598 } else { /* OP_KETRMAX */ 617 RMATCH(12, stack.currentFrame->locals.prev, stack.currentFrame->args. eptrb, match_isgroup);599 RMATCH(12, stack.currentFrame->locals.prev, stack.currentFrame->args.subpatternStart, match_isgroup); 618 600 if (is_match) 619 601 RRETURN; 620 RMATCH(13, stack.currentFrame->args.ecode + 1 + LINK_SIZE, stack.currentFrame->args. eptrb, 0);602 RMATCH(13, stack.currentFrame->args.ecode + 1 + LINK_SIZE, stack.currentFrame->args.subpatternStart, 0); 621 603 if (is_match) 622 604 RRETURN; … … 640 622 { 641 623 stack.currentFrame->locals.next = stack.currentFrame->args.ecode + 1; 642 RMATCH(14, stack.currentFrame->locals.next, stack.currentFrame->args. eptrb, match_isgroup);624 RMATCH(14, stack.currentFrame->locals.next, stack.currentFrame->args.subpatternStart, match_isgroup); 643 625 if (is_match) 644 626 RRETURN; … … 652 634 stack.currentFrame->locals.next = stack.currentFrame->args.ecode + 1; 653 635 moveOpcodePtrPastAnyAlternateBranches(stack.currentFrame->locals.next); 654 RMATCH(15, stack.currentFrame->locals.next + 1 + LINK_SIZE, stack.currentFrame->args. eptrb, match_isgroup);636 RMATCH(15, stack.currentFrame->locals.next + 1 + LINK_SIZE, stack.currentFrame->args.subpatternStart, match_isgroup); 655 637 if (is_match) 656 638 RRETURN; … … 668 650 BEGIN_OPCODE(KETRMAX): 669 651 stack.currentFrame->locals.prev = stack.currentFrame->args.ecode - getOpcodeValueAtOffset(stack.currentFrame->args.ecode, 1); 670 stack.currentFrame->locals.saved_eptr = stack.currentFrame->args.eptrb->epb_saved_eptr; 671 672 /* Back up the stack of bracket start pointers. */ 673 674 stack.currentFrame->args.eptrb = stack.currentFrame->args.eptrb->epb_prev; 675 652 stack.currentFrame->args.subpatternStart = stack.currentFrame->locals.subpatternStart; 653 stack.currentFrame->locals.subpatternStart = stack.currentFrame->previousFrame->args.subpatternStart; 654 676 655 if (*stack.currentFrame->locals.prev == OP_ASSERT || *stack.currentFrame->locals.prev == OP_ASSERT_NOT || *stack.currentFrame->locals.prev == OP_ONCE) { 677 656 md.end_match_ptr = stack.currentFrame->args.eptr; /* For ONCE */ … … 731 710 732 711 if (*stack.currentFrame->args.ecode == OP_KETRMIN) { 733 RMATCH(16, stack.currentFrame->args.ecode + 1 + LINK_SIZE, stack.currentFrame->args. eptrb, 0);712 RMATCH(16, stack.currentFrame->args.ecode + 1 + LINK_SIZE, stack.currentFrame->args.subpatternStart, 0); 734 713 if (is_match) 735 714 RRETURN; 736 RMATCH(17, stack.currentFrame->locals.prev, stack.currentFrame->args. eptrb, match_isgroup);715 RMATCH(17, stack.currentFrame->locals.prev, stack.currentFrame->args.subpatternStart, match_isgroup); 737 716 if (is_match) 738 717 RRETURN; 739 718 } else { /* OP_KETRMAX */ 740 RMATCH(18, stack.currentFrame->locals.prev, stack.currentFrame->args. eptrb, match_isgroup);719 RMATCH(18, stack.currentFrame->locals.prev, stack.currentFrame->args.subpatternStart, match_isgroup); 741 720 if (is_match) 742 721 RRETURN; 743 RMATCH(19, stack.currentFrame->args.ecode + 1 + LINK_SIZE, stack.currentFrame->args. eptrb, 0);722 RMATCH(19, stack.currentFrame->args.ecode + 1 + LINK_SIZE, stack.currentFrame->args.subpatternStart, 0); 744 723 if (is_match) 745 724 RRETURN; … … 939 918 if (minimize) { 940 919 for (stack.currentFrame->locals.fi = min;; stack.currentFrame->locals.fi++) { 941 RMATCH(20, stack.currentFrame->args.ecode, stack.currentFrame->args. eptrb, 0);920 RMATCH(20, stack.currentFrame->args.ecode, stack.currentFrame->args.subpatternStart, 0); 942 921 if (is_match) 943 922 RRETURN; … … 959 938 } 960 939 while (stack.currentFrame->args.eptr >= stack.currentFrame->locals.pp) { 961 RMATCH(21, stack.currentFrame->args.ecode, stack.currentFrame->args. eptrb, 0);940 RMATCH(21, stack.currentFrame->args.ecode, stack.currentFrame->args.subpatternStart, 0); 962 941 if (is_match) 963 942 RRETURN; … … 1039 1018 if (minimize) { 1040 1019 for (stack.currentFrame->locals.fi = min;; stack.currentFrame->locals.fi++) { 1041 RMATCH(22, stack.currentFrame->args.ecode, stack.currentFrame->args. eptrb, 0);1020 RMATCH(22, stack.currentFrame->args.ecode, stack.currentFrame->args.subpatternStart, 0); 1042 1021 if (is_match) 1043 1022 RRETURN; … … 1074 1053 } 1075 1054 for (;;) { 1076 RMATCH(24, stack.currentFrame->args.ecode, stack.currentFrame->args. eptrb, 0);1055 RMATCH(24, stack.currentFrame->args.ecode, stack.currentFrame->args.subpatternStart, 0); 1077 1056 if (is_match) 1078 1057 RRETURN; … … 1143 1122 if (minimize) { 1144 1123 for (stack.currentFrame->locals.fi = min;; stack.currentFrame->locals.fi++) { 1145 RMATCH(26, stack.currentFrame->args.ecode, stack.currentFrame->args. eptrb, 0);1124 RMATCH(26, stack.currentFrame->args.ecode, stack.currentFrame->args.subpatternStart, 0); 1146 1125 if (is_match) 1147 1126 RRETURN; … … 1169 1148 } 1170 1149 for(;;) { 1171 RMATCH(27, stack.currentFrame->args.ecode, stack.currentFrame->args. eptrb, 0);1150 RMATCH(27, stack.currentFrame->args.ecode, stack.currentFrame->args.subpatternStart, 0); 1172 1151 if (is_match) 1173 1152 RRETURN; … … 1314 1293 stack.currentFrame->locals.repeat_othercase = othercase; 1315 1294 for (stack.currentFrame->locals.fi = min;; stack.currentFrame->locals.fi++) { 1316 RMATCH(28, stack.currentFrame->args.ecode, stack.currentFrame->args. eptrb, 0);1295 RMATCH(28, stack.currentFrame->args.ecode, stack.currentFrame->args.subpatternStart, 0); 1317 1296 if (is_match) 1318 1297 RRETURN; … … 1334 1313 } 1335 1314 while (stack.currentFrame->args.eptr >= stack.currentFrame->locals.pp) { 1336 RMATCH(29, stack.currentFrame->args.ecode, stack.currentFrame->args. eptrb, 0);1315 RMATCH(29, stack.currentFrame->args.ecode, stack.currentFrame->args.subpatternStart, 0); 1337 1316 if (is_match) 1338 1317 RRETURN; … … 1359 1338 for (stack.currentFrame->locals.fi = min;; stack.currentFrame->locals.fi++) { 1360 1339 int nc; 1361 RMATCH(30, stack.currentFrame->args.ecode, stack.currentFrame->args. eptrb, 0);1340 RMATCH(30, stack.currentFrame->args.ecode, stack.currentFrame->args.subpatternStart, 0); 1362 1341 if (is_match) 1363 1342 RRETURN; … … 1382 1361 } 1383 1362 while (stack.currentFrame->args.eptr >= stack.currentFrame->locals.pp) { 1384 RMATCH(31, stack.currentFrame->args.ecode, stack.currentFrame->args. eptrb, 0);1363 RMATCH(31, stack.currentFrame->args.ecode, stack.currentFrame->args.subpatternStart, 0); 1385 1364 if (is_match) 1386 1365 RRETURN; … … 1485 1464 int d; 1486 1465 for (stack.currentFrame->locals.fi = min;; stack.currentFrame->locals.fi++) { 1487 RMATCH(38, stack.currentFrame->args.ecode, stack.currentFrame->args. eptrb, 0);1466 RMATCH(38, stack.currentFrame->args.ecode, stack.currentFrame->args.subpatternStart, 0); 1488 1467 if (is_match) 1489 1468 RRETURN; … … 1516 1495 } 1517 1496 for (;;) { 1518 RMATCH(40, stack.currentFrame->args.ecode, stack.currentFrame->args. eptrb, 0);1497 RMATCH(40, stack.currentFrame->args.ecode, stack.currentFrame->args.subpatternStart, 0); 1519 1498 if (is_match) 1520 1499 RRETURN; … … 1548 1527 int d; 1549 1528 for (stack.currentFrame->locals.fi = min;; stack.currentFrame->locals.fi++) { 1550 RMATCH(42, stack.currentFrame->args.ecode, stack.currentFrame->args. eptrb, 0);1529 RMATCH(42, stack.currentFrame->args.ecode, stack.currentFrame->args.subpatternStart, 0); 1551 1530 if (is_match) 1552 1531 RRETURN; … … 1575 1554 } 1576 1555 for (;;) { 1577 RMATCH(44, stack.currentFrame->args.ecode, stack.currentFrame->args. eptrb, 0);1556 RMATCH(44, stack.currentFrame->args.ecode, stack.currentFrame->args.subpatternStart, 0); 1578 1557 if (is_match) 1579 1558 RRETURN; … … 1715 1694 if (minimize) { 1716 1695 for (stack.currentFrame->locals.fi = min;; stack.currentFrame->locals.fi++) { 1717 RMATCH(48, stack.currentFrame->args.ecode, stack.currentFrame->args. eptrb, 0);1696 RMATCH(48, stack.currentFrame->args.ecode, stack.currentFrame->args.subpatternStart, 0); 1718 1697 if (is_match) 1719 1698 RRETURN; … … 1881 1860 1882 1861 for (;;) { 1883 RMATCH(52, stack.currentFrame->args.ecode, stack.currentFrame->args. eptrb, 0);1862 RMATCH(52, stack.currentFrame->args.ecode, stack.currentFrame->args.subpatternStart, 0); 1884 1863 if (is_match) 1885 1864 RRETURN; … … 1951 1930 1952 1931 do { 1953 RMATCH(1, stack.currentFrame->args.ecode + 1 + LINK_SIZE, stack.currentFrame->args. eptrb, match_isgroup);1932 RMATCH(1, stack.currentFrame->args.ecode + 1 + LINK_SIZE, stack.currentFrame->args.subpatternStart, match_isgroup); 1954 1933 if (is_match) 1955 1934 RRETURN;
Note:
See TracChangeset
for help on using the changeset viewer.