| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 "platform/assert.h" | 5 #include "platform/assert.h" |
| 6 #include "vm/bootstrap_natives.h" | 6 #include "vm/bootstrap_natives.h" |
| 7 #include "vm/exceptions.h" | 7 #include "vm/exceptions.h" |
| 8 #include "vm/native_entry.h" | 8 #include "vm/native_entry.h" |
| 9 #include "vm/object.h" | 9 #include "vm/object.h" |
| 10 #include "vm/regexp_parser.h" | 10 #include "vm/regexp_parser.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 // Parse the pattern once in order to throw any format exceptions within | 30 // Parse the pattern once in order to throw any format exceptions within |
| 31 // the factory constructor. It is parsed again upon compilation. | 31 // the factory constructor. It is parsed again upon compilation. |
| 32 RegExpCompileData compileData; | 32 RegExpCompileData compileData; |
| 33 if (!RegExpParser::ParseRegExp(pattern, multi_line, &compileData)) { | 33 if (!RegExpParser::ParseRegExp(pattern, multi_line, &compileData)) { |
| 34 // Parsing failures throw an exception. | 34 // Parsing failures throw an exception. |
| 35 UNREACHABLE(); | 35 UNREACHABLE(); |
| 36 } | 36 } |
| 37 | 37 |
| 38 // Create a RegExp object containing only the initial parameters. | 38 // Create a RegExp object containing only the initial parameters. |
| 39 return RegExpEngine::CreateRegExp(zone, | 39 return RegExpEngine::CreateRegExp(thread, |
| 40 pattern, | 40 pattern, |
| 41 multi_line, | 41 multi_line, |
| 42 ignore_case); | 42 ignore_case); |
| 43 } | 43 } |
| 44 | 44 |
| 45 | 45 |
| 46 DEFINE_NATIVE_ENTRY(RegExp_getPattern, 1) { | 46 DEFINE_NATIVE_ENTRY(RegExp_getPattern, 1) { |
| 47 const RegExp& regexp = RegExp::CheckedHandle(arguments->NativeArgAt(0)); | 47 const RegExp& regexp = RegExp::CheckedHandle(arguments->NativeArgAt(0)); |
| 48 ASSERT(!regexp.IsNull()); | 48 ASSERT(!regexp.IsNull()); |
| 49 return regexp.pattern(); | 49 return regexp.pattern(); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 | 90 |
| 91 if (FLAG_interpret_irregexp || FLAG_precompiled_runtime) { | 91 if (FLAG_interpret_irregexp || FLAG_precompiled_runtime) { |
| 92 return BytecodeRegExpMacroAssembler::Interpret(regexp, subject, start_index, | 92 return BytecodeRegExpMacroAssembler::Interpret(regexp, subject, start_index, |
| 93 zone); | 93 zone); |
| 94 } | 94 } |
| 95 | 95 |
| 96 return IRRegExpMacroAssembler::Execute(regexp, subject, start_index, zone); | 96 return IRRegExpMacroAssembler::Execute(regexp, subject, start_index, zone); |
| 97 } | 97 } |
| 98 | 98 |
| 99 } // namespace dart | 99 } // namespace dart |
| OLD | NEW |