| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |