| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 2705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2716 return ChoiceNode::FilterASCII(depth - 1); | 2716 return ChoiceNode::FilterASCII(depth - 1); |
| 2717 } | 2717 } |
| 2718 | 2718 |
| 2719 | 2719 |
| 2720 RegExpNode* ChoiceNode::FilterASCII(int depth) { | 2720 RegExpNode* ChoiceNode::FilterASCII(int depth) { |
| 2721 if (info()->replacement_calculated) return replacement(); | 2721 if (info()->replacement_calculated) return replacement(); |
| 2722 if (depth < 0) return this; | 2722 if (depth < 0) return this; |
| 2723 if (info()->visited) return this; | 2723 if (info()->visited) return this; |
| 2724 VisitMarker marker(info()); | 2724 VisitMarker marker(info()); |
| 2725 int choice_count = alternatives_->length(); | 2725 int choice_count = alternatives_->length(); |
| 2726 |
| 2727 for (int i = 0; i < choice_count; i++) { |
| 2728 GuardedAlternative alternative = alternatives_->at(i); |
| 2729 if (alternative.guards() != NULL && alternative.guards()->length() != 0) { |
| 2730 set_replacement(this); |
| 2731 return this; |
| 2732 } |
| 2733 } |
| 2734 |
| 2726 int surviving = 0; | 2735 int surviving = 0; |
| 2727 RegExpNode* survivor = NULL; | 2736 RegExpNode* survivor = NULL; |
| 2728 for (int i = 0; i < choice_count; i++) { | 2737 for (int i = 0; i < choice_count; i++) { |
| 2729 GuardedAlternative alternative = alternatives_->at(i); | 2738 GuardedAlternative alternative = alternatives_->at(i); |
| 2730 RegExpNode* replacement = alternative.node()->FilterASCII(depth - 1); | 2739 RegExpNode* replacement = alternative.node()->FilterASCII(depth - 1); |
| 2731 ASSERT(replacement != this); // No missing EMPTY_MATCH_CHECK. | 2740 ASSERT(replacement != this); // No missing EMPTY_MATCH_CHECK. |
| 2732 if (replacement != NULL) { | 2741 if (replacement != NULL) { |
| 2733 alternatives_->at(i).set_node(replacement); | 2742 alternatives_->at(i).set_node(replacement); |
| 2734 surviving++; | 2743 surviving++; |
| 2735 survivor = replacement; | 2744 survivor = replacement; |
| (...skipping 3174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5910 } | 5919 } |
| 5911 | 5920 |
| 5912 return compiler.Assemble(¯o_assembler, | 5921 return compiler.Assemble(¯o_assembler, |
| 5913 node, | 5922 node, |
| 5914 data->capture_count, | 5923 data->capture_count, |
| 5915 pattern); | 5924 pattern); |
| 5916 } | 5925 } |
| 5917 | 5926 |
| 5918 | 5927 |
| 5919 }} // namespace v8::internal | 5928 }} // namespace v8::internal |
| OLD | NEW |