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 "vm/compiler.h" | 5 #include "vm/compiler.h" |
6 | 6 |
7 #include "vm/assembler.h" | 7 #include "vm/assembler.h" |
8 | 8 |
9 #include "vm/ast_printer.h" | 9 #include "vm/ast_printer.h" |
10 #include "vm/block_scheduler.h" | 10 #include "vm/block_scheduler.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 "Trace only optimizing compiler operations."); | 100 "Trace only optimizing compiler operations."); |
101 DEFINE_FLAG(bool, trace_bailout, false, "Print bailout from ssa compiler."); | 101 DEFINE_FLAG(bool, trace_bailout, false, "Print bailout from ssa compiler."); |
102 DEFINE_FLAG(bool, use_inlining, true, "Enable call-site inlining"); | 102 DEFINE_FLAG(bool, use_inlining, true, "Enable call-site inlining"); |
103 DEFINE_FLAG(bool, | 103 DEFINE_FLAG(bool, |
104 verify_compiler, | 104 verify_compiler, |
105 false, | 105 false, |
106 "Enable compiler verification assertions"); | 106 "Enable compiler verification assertions"); |
107 | 107 |
108 DECLARE_FLAG(bool, huge_method_cutoff_in_code_size); | 108 DECLARE_FLAG(bool, huge_method_cutoff_in_code_size); |
109 DECLARE_FLAG(bool, trace_failed_optimization_attempts); | 109 DECLARE_FLAG(bool, trace_failed_optimization_attempts); |
110 DECLARE_FLAG(bool, trace_irregexp); | |
111 | 110 |
112 | 111 |
113 #ifndef DART_PRECOMPILED_RUNTIME | 112 #ifndef DART_PRECOMPILED_RUNTIME |
114 | 113 |
115 | 114 |
116 bool UseKernelFrontEndFor(ParsedFunction* parsed_function) { | 115 bool UseKernelFrontEndFor(ParsedFunction* parsed_function) { |
117 const Function& function = parsed_function->function(); | 116 const Function& function = parsed_function->function(); |
118 return (function.kernel_offset() > 0) || | 117 return (function.kernel_offset() > 0) || |
119 (function.kind() == RawFunction::kNoSuchMethodDispatcher) || | 118 (function.kind() == RawFunction::kNoSuchMethodDispatcher) || |
120 (function.kind() == RawFunction::kInvokeFieldDispatcher); | 119 (function.kind() == RawFunction::kInvokeFieldDispatcher); |
(...skipping 29 matching lines...) Expand all Loading... |
150 | 149 |
151 return builder.BuildGraph(); | 150 return builder.BuildGraph(); |
152 } | 151 } |
153 | 152 |
154 | 153 |
155 void DartCompilationPipeline::FinalizeCompilation(FlowGraph* flow_graph) {} | 154 void DartCompilationPipeline::FinalizeCompilation(FlowGraph* flow_graph) {} |
156 | 155 |
157 | 156 |
158 void IrregexpCompilationPipeline::ParseFunction( | 157 void IrregexpCompilationPipeline::ParseFunction( |
159 ParsedFunction* parsed_function) { | 158 ParsedFunction* parsed_function) { |
160 RegExpParser::ParseFunction(parsed_function); | 159 VMTagScope tagScope(parsed_function->thread(), |
| 160 VMTag::kCompileParseRegExpTagId); |
| 161 Zone* zone = parsed_function->zone(); |
| 162 RegExp& regexp = RegExp::Handle(parsed_function->function().regexp()); |
| 163 |
| 164 const String& pattern = String::Handle(regexp.pattern()); |
| 165 const bool multiline = regexp.is_multi_line(); |
| 166 |
| 167 RegExpCompileData* compile_data = new (zone) RegExpCompileData(); |
| 168 if (!RegExpParser::ParseRegExp(pattern, multiline, compile_data)) { |
| 169 // Parsing failures are handled in the RegExp factory constructor. |
| 170 UNREACHABLE(); |
| 171 } |
| 172 |
| 173 regexp.set_num_bracket_expressions(compile_data->capture_count); |
| 174 if (compile_data->simple) { |
| 175 regexp.set_is_simple(); |
| 176 } else { |
| 177 regexp.set_is_complex(); |
| 178 } |
| 179 |
| 180 parsed_function->SetRegExpCompileData(compile_data); |
| 181 |
161 // Variables are allocated after compilation. | 182 // Variables are allocated after compilation. |
162 } | 183 } |
163 | 184 |
164 | 185 |
165 FlowGraph* IrregexpCompilationPipeline::BuildFlowGraph( | 186 FlowGraph* IrregexpCompilationPipeline::BuildFlowGraph( |
166 Zone* zone, | 187 Zone* zone, |
167 ParsedFunction* parsed_function, | 188 ParsedFunction* parsed_function, |
168 const ZoneGrowableArray<const ICData*>& ic_data_array, | 189 const ZoneGrowableArray<const ICData*>& ic_data_array, |
169 intptr_t osr_id) { | 190 intptr_t osr_id) { |
170 // Compile to the dart IR. | 191 // Compile to the dart IR. |
(...skipping 2164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2335 | 2356 |
2336 | 2357 |
2337 bool BackgroundCompiler::IsDisabled() { | 2358 bool BackgroundCompiler::IsDisabled() { |
2338 UNREACHABLE(); | 2359 UNREACHABLE(); |
2339 return true; | 2360 return true; |
2340 } | 2361 } |
2341 | 2362 |
2342 #endif // DART_PRECOMPILED_RUNTIME | 2363 #endif // DART_PRECOMPILED_RUNTIME |
2343 | 2364 |
2344 } // namespace dart | 2365 } // namespace dart |
OLD | NEW |