| 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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 FlatStringReader reader(pattern); | 264 FlatStringReader reader(pattern); |
| 265 if (!ParseRegExp(&reader, flags.is_multiline(), &parse_result)) { | 265 if (!ParseRegExp(&reader, flags.is_multiline(), &parse_result)) { |
| 266 // Throw an exception if we fail to parse the pattern. | 266 // Throw an exception if we fail to parse the pattern. |
| 267 ThrowRegExpException(re, | 267 ThrowRegExpException(re, |
| 268 pattern, | 268 pattern, |
| 269 parse_result.error, | 269 parse_result.error, |
| 270 "malformed_regexp"); | 270 "malformed_regexp"); |
| 271 return Handle<Object>::null(); | 271 return Handle<Object>::null(); |
| 272 } | 272 } |
| 273 RegExpAtom* atom = parse_result.tree->AsAtom(); | 273 RegExpAtom* atom = parse_result.tree->AsAtom(); |
| 274 if (atom != NULL && !flags.is_ignore_case()) { | 274 if (atom != NULL && |
| 275 if (parse_result.has_character_escapes) { | 275 !flags.is_ignore_case() && |
| 276 parse_result.capture_count == 0) { |
| 277 if (parse_result.non_simple) { |
| 276 Vector<const uc16> atom_pattern = atom->data(); | 278 Vector<const uc16> atom_pattern = atom->data(); |
| 277 Handle<String> atom_string = | 279 Handle<String> atom_string = |
| 278 Factory::NewStringFromTwoByte(atom_pattern); | 280 Factory::NewStringFromTwoByte(atom_pattern); |
| 279 result = AtomCompile(re, pattern, flags, atom_string); | 281 result = AtomCompile(re, pattern, flags, atom_string); |
| 280 } else { | 282 } else { |
| 281 result = AtomCompile(re, pattern, flags, pattern); | 283 result = AtomCompile(re, pattern, flags, pattern); |
| 282 } | 284 } |
| 283 } else { | 285 } else { |
| 284 if (FLAG_irregexp) { | 286 if (FLAG_irregexp) { |
| 285 result = IrregexpPrepare(re, pattern, flags); | 287 result = IrregexpPrepare(re, pattern, flags); |
| (...skipping 3545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3831 EmbeddedVector<byte, 1024> codes; | 3833 EmbeddedVector<byte, 1024> codes; |
| 3832 RegExpMacroAssemblerIrregexp macro_assembler(codes); | 3834 RegExpMacroAssemblerIrregexp macro_assembler(codes); |
| 3833 return compiler.Assemble(¯o_assembler, | 3835 return compiler.Assemble(¯o_assembler, |
| 3834 node, | 3836 node, |
| 3835 data->capture_count, | 3837 data->capture_count, |
| 3836 pattern); | 3838 pattern); |
| 3837 } | 3839 } |
| 3838 | 3840 |
| 3839 | 3841 |
| 3840 }} // namespace v8::internal | 3842 }} // namespace v8::internal |
| OLD | NEW |