Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(422)

Side by Side Diff: runtime/vm/compiler.cc

Issue 2951053003: VM(RegExp): Allow OSR optimization of RegExp :matcher functions. (Closed)
Patch Set: Fix bugs with stack growing and block pruning Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 // Variables are allocated after compilation. 161 // Variables are allocated after compilation.
162 } 162 }
163 163
164 164
165 FlowGraph* IrregexpCompilationPipeline::BuildFlowGraph( 165 FlowGraph* IrregexpCompilationPipeline::BuildFlowGraph(
166 Zone* zone, 166 Zone* zone,
167 ParsedFunction* parsed_function, 167 ParsedFunction* parsed_function,
168 const ZoneGrowableArray<const ICData*>& ic_data_array, 168 const ZoneGrowableArray<const ICData*>& ic_data_array,
169 intptr_t osr_id) { 169 intptr_t osr_id) {
170 // Compile to the dart IR. 170 // Compile to the dart IR.
171 RegExpEngine::CompilationResult result = RegExpEngine::CompileIR( 171 RegExpEngine::CompilationResult result =
172 parsed_function->regexp_compile_data(), parsed_function, ic_data_array); 172 RegExpEngine::CompileIR(parsed_function->regexp_compile_data(),
173 parsed_function, ic_data_array, osr_id);
173 backtrack_goto_ = result.backtrack_goto; 174 backtrack_goto_ = result.backtrack_goto;
174 175
175 // Allocate variables now that we know the number of locals. 176 // Allocate variables now that we know the number of locals.
176 parsed_function->AllocateIrregexpVariables(result.num_stack_locals); 177 parsed_function->AllocateIrregexpVariables(result.num_stack_locals);
177 178
178 // Build the flow graph. 179 // When compiling for OSR, use a depth first search to prune instructions
erikcorry 2017/06/22 13:08:06 Actually "use a depth first search to find the ent
Vyacheslav Egorov (Google) 2017/06/22 14:58:48 Renamed to RelinkToOsrEntry()
179 FlowGraphBuilder builder(*parsed_function, ic_data_array, 180 // unreachable from the OSR entry. Catch entries are always considered
180 /* not building var desc */ NULL, 181 // reachable, even if they become unreachable after OSR.
181 /* not inlining */ NULL, osr_id); 182 if (osr_id != Compiler::kNoOSRDeoptId) {
183 result.graph_entry->PruneUnreachableForOSR(zone, result.num_blocks);
184 }
182 185
183 return new (zone) 186 return new (zone)
184 FlowGraph(*parsed_function, result.graph_entry, result.num_blocks); 187 FlowGraph(*parsed_function, result.graph_entry, result.num_blocks);
185 } 188 }
186 189
187 190
188 void IrregexpCompilationPipeline::FinalizeCompilation(FlowGraph* flow_graph) { 191 void IrregexpCompilationPipeline::FinalizeCompilation(FlowGraph* flow_graph) {
189 backtrack_goto_->ComputeOffsetTable(); 192 backtrack_goto_->ComputeOffsetTable();
190 } 193 }
191 194
(...skipping 2140 matching lines...) Expand 10 before | Expand all | Expand 10 after
2332 2335
2333 2336
2334 bool BackgroundCompiler::IsDisabled() { 2337 bool BackgroundCompiler::IsDisabled() {
2335 UNREACHABLE(); 2338 UNREACHABLE();
2336 return true; 2339 return true;
2337 } 2340 }
2338 2341
2339 #endif // DART_PRECOMPILED_RUNTIME 2342 #endif // DART_PRECOMPILED_RUNTIME
2340 2343
2341 } // namespace dart 2344 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698