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