Chromium Code Reviews| 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 #ifndef VM_FLOW_GRAPH_OPTIMIZER_H_ | 5 #ifndef VM_FLOW_GRAPH_OPTIMIZER_H_ |
| 6 #define VM_FLOW_GRAPH_OPTIMIZER_H_ | 6 #define VM_FLOW_GRAPH_OPTIMIZER_H_ |
| 7 | 7 |
| 8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
| 9 #include "vm/flow_graph.h" | 9 #include "vm/flow_graph.h" |
| 10 | 10 |
| 11 namespace dart { | 11 namespace dart { |
| 12 | 12 |
| 13 class CSEInstructionMap; | 13 class CSEInstructionMap; |
| 14 template <typename T> class GrowableArray; | 14 template <typename T> class GrowableArray; |
| 15 class ParsedFunction; | 15 class ParsedFunction; |
| 16 | 16 |
| 17 class FlowGraphOptimizer : public FlowGraphVisitor { | 17 class FlowGraphOptimizer : public FlowGraphVisitor { |
| 18 public: | 18 public: |
| 19 explicit FlowGraphOptimizer(FlowGraph* flow_graph) | 19 explicit FlowGraphOptimizer(FlowGraph* flow_graph, |
| 20 bool use_speculative_inlining = false, | |
| 21 GrowableArray<intptr_t>* black_list = NULL) | |
|
srdjan
2015/11/17 20:39:19
s/black_list/inlining_black_list/
Florian Schneider
2015/11/18 14:01:05
Done.
| |
| 20 : FlowGraphVisitor(flow_graph->reverse_postorder()), | 22 : FlowGraphVisitor(flow_graph->reverse_postorder()), |
| 21 flow_graph_(flow_graph) { } | 23 flow_graph_(flow_graph), |
| 24 use_speculative_inlining_(use_speculative_inlining), | |
| 25 inlining_black_list_(black_list) { | |
| 26 ASSERT(!use_speculative_inlining || (black_list != NULL)); | |
| 27 } | |
| 22 virtual ~FlowGraphOptimizer() {} | 28 virtual ~FlowGraphOptimizer() {} |
| 23 | 29 |
| 24 FlowGraph* flow_graph() const { return flow_graph_; } | 30 FlowGraph* flow_graph() const { return flow_graph_; } |
| 25 | 31 |
| 26 // Add ICData to InstanceCalls, so that optimizations can be run on them. | 32 // Add ICData to InstanceCalls, so that optimizations can be run on them. |
| 27 // TODO(srdjan): StaticCals as well? | 33 // TODO(srdjan): StaticCals as well? |
| 28 void PopulateWithICData(); | 34 void PopulateWithICData(); |
| 29 | 35 |
| 30 // Use ICData to optimize, replace or eliminate instructions. | 36 // Use ICData to optimize, replace or eliminate instructions. |
| 31 void ApplyICData(); | 37 void ApplyICData(); |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 257 void InstanceCallNoopt(InstanceCallInstr* instr); | 263 void InstanceCallNoopt(InstanceCallInstr* instr); |
| 258 | 264 |
| 259 RawField* GetField(intptr_t class_id, const String& field_name); | 265 RawField* GetField(intptr_t class_id, const String& field_name); |
| 260 | 266 |
| 261 Thread* thread() const { return flow_graph_->thread(); } | 267 Thread* thread() const { return flow_graph_->thread(); } |
| 262 Isolate* isolate() const { return flow_graph_->isolate(); } | 268 Isolate* isolate() const { return flow_graph_->isolate(); } |
| 263 Zone* zone() const { return flow_graph_->zone(); } | 269 Zone* zone() const { return flow_graph_->zone(); } |
| 264 | 270 |
| 265 const Function& function() const { return flow_graph_->function(); } | 271 const Function& function() const { return flow_graph_->function(); } |
| 266 | 272 |
| 273 bool IsBlackListedForInlining(intptr_t deopt_id); | |
| 274 | |
| 267 FlowGraph* flow_graph_; | 275 FlowGraph* flow_graph_; |
| 268 | 276 |
| 277 const bool use_speculative_inlining_; | |
| 278 | |
| 279 GrowableArray<intptr_t>* inlining_black_list_; | |
| 280 | |
| 269 DISALLOW_COPY_AND_ASSIGN(FlowGraphOptimizer); | 281 DISALLOW_COPY_AND_ASSIGN(FlowGraphOptimizer); |
| 270 }; | 282 }; |
| 271 | 283 |
| 272 | 284 |
| 273 // Loop invariant code motion. | 285 // Loop invariant code motion. |
| 274 class LICM : public ValueObject { | 286 class LICM : public ValueObject { |
| 275 public: | 287 public: |
| 276 explicit LICM(FlowGraph* flow_graph); | 288 explicit LICM(FlowGraph* flow_graph); |
| 277 | 289 |
| 278 void Optimize(); | 290 void Optimize(); |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 434 // Optimize spill stores inside try-blocks by identifying values that always | 446 // Optimize spill stores inside try-blocks by identifying values that always |
| 435 // contain a single known constant at catch block entry. | 447 // contain a single known constant at catch block entry. |
| 436 class TryCatchAnalyzer : public AllStatic { | 448 class TryCatchAnalyzer : public AllStatic { |
| 437 public: | 449 public: |
| 438 static void Optimize(FlowGraph* flow_graph); | 450 static void Optimize(FlowGraph* flow_graph); |
| 439 }; | 451 }; |
| 440 | 452 |
| 441 } // namespace dart | 453 } // namespace dart |
| 442 | 454 |
| 443 #endif // VM_FLOW_GRAPH_OPTIMIZER_H_ | 455 #endif // VM_FLOW_GRAPH_OPTIMIZER_H_ |
| OLD | NEW |