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

Side by Side Diff: src/jsregexp.cc

Issue 11204: Assertion interest (Closed)
Patch Set: Created 12 years, 1 month 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
« no previous file with comments | « src/jsregexp.h ('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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 1434 matching lines...) Expand 10 before | Expand all | Expand 10 after
1445 return ActionNode::StoreRegister(reg_ctr, 0, center); 1445 return ActionNode::StoreRegister(reg_ctr, 0, center);
1446 } else { 1446 } else {
1447 return center; 1447 return center;
1448 } 1448 }
1449 } 1449 }
1450 1450
1451 1451
1452 RegExpNode* RegExpAssertion::ToNode(RegExpCompiler* compiler, 1452 RegExpNode* RegExpAssertion::ToNode(RegExpCompiler* compiler,
1453 RegExpNode* on_success, 1453 RegExpNode* on_success,
1454 RegExpNode* on_failure) { 1454 RegExpNode* on_failure) {
1455 // TODO(self): implement assertions. 1455 switch (type()) {
1456 case START_OF_LINE:
1457 on_success->info()->follows_newline_interest = true;
1458 break;
1459 case START_OF_INPUT:
1460 on_success->info()->follows_start_interest = true;
1461 break;
1462 case BOUNDARY: case NON_BOUNDARY:
1463 on_success->info()->follows_word_interest = true;
1464 break;
1465 case END_OF_LINE: case END_OF_INPUT:
1466 // This is wrong but has the effect of making the compiler abort.
1467 on_success->info()->follows_start_interest = true;
1468 }
1456 return on_success; 1469 return on_success;
1457 } 1470 }
1458 1471
1459 1472
1460 RegExpNode* RegExpBackreference::ToNode(RegExpCompiler* compiler, 1473 RegExpNode* RegExpBackreference::ToNode(RegExpCompiler* compiler,
1461 RegExpNode* on_success, 1474 RegExpNode* on_success,
1462 RegExpNode* on_failure) { 1475 RegExpNode* on_failure) {
1463 return new BackreferenceNode(RegExpCapture::StartRegister(index()), 1476 return new BackreferenceNode(RegExpCapture::StartRegister(index()),
1464 RegExpCapture::EndRegister(index()), 1477 RegExpCapture::EndRegister(index()),
1465 on_success, 1478 on_success,
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
1796 1809
1797 void Analysis::VisitText(TextNode* that) { 1810 void Analysis::VisitText(TextNode* that) {
1798 EnsureAnalyzed(that->on_success()); 1811 EnsureAnalyzed(that->on_success());
1799 EnsureAnalyzed(that->on_failure()); 1812 EnsureAnalyzed(that->on_failure());
1800 } 1813 }
1801 1814
1802 1815
1803 void Analysis::VisitAction(ActionNode* that) { 1816 void Analysis::VisitAction(ActionNode* that) {
1804 RegExpNode* next = that->on_success(); 1817 RegExpNode* next = that->on_success();
1805 EnsureAnalyzed(next); 1818 EnsureAnalyzed(next);
1806 that->info()->propagate_line = next->info()->propagate_line; 1819 that->info()->propagate_newline = next->info()->propagate_newline;
1807 that->info()->propagate_word = next->info()->propagate_word; 1820 that->info()->propagate_word = next->info()->propagate_word;
1821 that->info()->propagate_start = next->info()->propagate_start;
1808 } 1822 }
1809 1823
1810 1824
1811 void Analysis::VisitChoice(ChoiceNode* that) { 1825 void Analysis::VisitChoice(ChoiceNode* that) {
1812 NodeInfo* info = that->info(); 1826 NodeInfo* info = that->info();
1813 for (int i = 0; i < that->alternatives()->length(); i++) { 1827 for (int i = 0; i < that->alternatives()->length(); i++) {
1814 RegExpNode* node = that->alternatives()->at(i).node(); 1828 RegExpNode* node = that->alternatives()->at(i).node();
1815 EnsureAnalyzed(node); 1829 EnsureAnalyzed(node);
1816 info->propagate_line |= node->info()->propagate_line; 1830 info->propagate_newline |= node->info()->propagate_newline;
1817 info->propagate_word |= node->info()->propagate_word; 1831 info->propagate_word |= node->info()->propagate_word;
1832 info->propagate_start |= node->info()->propagate_start;
1818 } 1833 }
1819 if (!that->table_calculated()) { 1834 if (!that->table_calculated()) {
1820 DispatchTableConstructor cons(that->table()); 1835 DispatchTableConstructor cons(that->table());
1821 cons.BuildTable(that); 1836 cons.BuildTable(that);
1822 } 1837 }
1823 EnsureAnalyzed(that->on_failure()); 1838 EnsureAnalyzed(that->on_failure());
1824 } 1839 }
1825 1840
1826 1841
1827 void Analysis::VisitBackreference(BackreferenceNode* that) { 1842 void Analysis::VisitBackreference(BackreferenceNode* that) {
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
1978 } 1993 }
1979 1994
1980 RegExpMacroAssembler::RegExpMacroAssembler() { 1995 RegExpMacroAssembler::RegExpMacroAssembler() {
1981 } 1996 }
1982 1997
1983 RegExpMacroAssembler::~RegExpMacroAssembler() { 1998 RegExpMacroAssembler::~RegExpMacroAssembler() {
1984 } 1999 }
1985 2000
1986 2001
1987 }} // namespace v8::internal 2002 }} // namespace v8::internal
OLDNEW
« no previous file with comments | « src/jsregexp.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698