OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/regexp.h" | 5 #include "vm/regexp.h" |
6 | 6 |
7 #include "vm/dart_entry.h" | 7 #include "vm/dart_entry.h" |
8 #include "vm/regexp_assembler.h" | 8 #include "vm/regexp_assembler.h" |
9 #include "vm/regexp_assembler_bytecode.h" | 9 #include "vm/regexp_assembler_bytecode.h" |
10 #include "vm/regexp_assembler_ir.h" | 10 #include "vm/regexp_assembler_ir.h" |
(...skipping 4986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4997 | 4997 |
4998 // Bytecode regexp implementation. | 4998 // Bytecode regexp implementation. |
4999 | 4999 |
5000 ZoneGrowableArray<uint8_t> buffer(zone, 1024); | 5000 ZoneGrowableArray<uint8_t> buffer(zone, 1024); |
5001 BytecodeRegExpMacroAssembler* macro_assembler = | 5001 BytecodeRegExpMacroAssembler* macro_assembler = |
5002 new (zone) BytecodeRegExpMacroAssembler(&buffer, zone); | 5002 new (zone) BytecodeRegExpMacroAssembler(&buffer, zone); |
5003 | 5003 |
5004 // Inserted here, instead of in Assembler, because it depends on information | 5004 // Inserted here, instead of in Assembler, because it depends on information |
5005 // in the AST that isn't replicated in the Node structure. | 5005 // in the AST that isn't replicated in the Node structure. |
5006 static const intptr_t kMaxBacksearchLimit = 1024; | 5006 static const intptr_t kMaxBacksearchLimit = 1024; |
5007 if (is_end_anchored && !is_start_anchored && | 5007 if (is_end_anchored && !is_start_anchored && !is_sticky && |
5008 max_length < kMaxBacksearchLimit) { | 5008 max_length < kMaxBacksearchLimit) { |
5009 macro_assembler->SetCurrentPositionFromEnd(max_length); | 5009 macro_assembler->SetCurrentPositionFromEnd(max_length); |
5010 } | 5010 } |
5011 | 5011 |
5012 if (is_global) { | 5012 if (is_global) { |
5013 macro_assembler->set_global_mode( | 5013 macro_assembler->set_global_mode( |
5014 (data->tree->min_match() > 0) | 5014 (data->tree->min_match() > 0) |
5015 ? RegExpMacroAssembler::GLOBAL_NO_ZERO_LENGTH_CHECK | 5015 ? RegExpMacroAssembler::GLOBAL_NO_ZERO_LENGTH_CHECK |
5016 : RegExpMacroAssembler::GLOBAL); | 5016 : RegExpMacroAssembler::GLOBAL); |
5017 } | 5017 } |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5108 CreateSpecializedFunction(thread, zone, regexp, cid, /*sticky=*/true, | 5108 CreateSpecializedFunction(thread, zone, regexp, cid, /*sticky=*/true, |
5109 owner); | 5109 owner); |
5110 } | 5110 } |
5111 } | 5111 } |
5112 | 5112 |
5113 return regexp.raw(); | 5113 return regexp.raw(); |
5114 } | 5114 } |
5115 | 5115 |
5116 | 5116 |
5117 } // namespace dart | 5117 } // namespace dart |
OLD | NEW |