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

Side by Side Diff: src/ast.cc

Issue 19539: Irregexp: Added derived knowledge of whether we are at the start of input. (Closed)
Patch Set: Fixed lint issues. Created 11 years, 10 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
« no previous file with comments | « src/ast.h ('k') | src/flags.cc » ('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-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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 return body()->CaptureRegisters(); 243 return body()->CaptureRegisters();
244 } 244 }
245 245
246 246
247 bool RegExpAssertion::IsAnchored() { 247 bool RegExpAssertion::IsAnchored() {
248 return type() == RegExpAssertion::START_OF_INPUT; 248 return type() == RegExpAssertion::START_OF_INPUT;
249 } 249 }
250 250
251 251
252 bool RegExpAlternative::IsAnchored() { 252 bool RegExpAlternative::IsAnchored() {
253 return this->nodes()->at(0)->IsAnchored(); 253 ZoneList<RegExpTree*>* nodes = this->nodes();
254 for (int i = 0; i < nodes->length(); i++) {
255 RegExpTree* node = nodes->at(i);
256 if (node->IsAnchored()) { return true; }
257 if (node->max_match() > 0) { return false; }
258 }
259 return false;
254 } 260 }
255 261
256 262
257 bool RegExpDisjunction::IsAnchored() { 263 bool RegExpDisjunction::IsAnchored() {
258 ZoneList<RegExpTree*>* alternatives = this->alternatives(); 264 ZoneList<RegExpTree*>* alternatives = this->alternatives();
259 for (int i = 0; i < alternatives->length(); i++) { 265 for (int i = 0; i < alternatives->length(); i++) {
260 if (!alternatives->at(i)->IsAnchored()) 266 if (!alternatives->at(i)->IsAnchored())
261 return false; 267 return false;
262 } 268 }
263 return true; 269 return true;
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 if (kInfinity - max_match_ < node_max_match) { 477 if (kInfinity - max_match_ < node_max_match) {
472 max_match_ = kInfinity; 478 max_match_ = kInfinity;
473 } else { 479 } else {
474 max_match_ += node->max_match(); 480 max_match_ += node->max_match();
475 } 481 }
476 } 482 }
477 } 483 }
478 484
479 485
480 } } // namespace v8::internal 486 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ast.h ('k') | src/flags.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698