| 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 |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 Definition* right_instr); | 247 Definition* right_instr); |
| 248 void TryMergeTruncDivMod(GrowableArray<BinarySmiOpInstr*>* merge_candidates); | 248 void TryMergeTruncDivMod(GrowableArray<BinarySmiOpInstr*>* merge_candidates); |
| 249 void TryMergeMathUnary(GrowableArray<MathUnaryInstr*>* merge_candidates); | 249 void TryMergeMathUnary(GrowableArray<MathUnaryInstr*>* merge_candidates); |
| 250 | 250 |
| 251 void AppendLoadIndexedForMerged(Definition* instr, intptr_t ix, intptr_t cid); | 251 void AppendLoadIndexedForMerged(Definition* instr, intptr_t ix, intptr_t cid); |
| 252 void AppendExtractNthOutputForMerged(Definition* instr, intptr_t ix, | 252 void AppendExtractNthOutputForMerged(Definition* instr, intptr_t ix, |
| 253 Representation rep, intptr_t cid); | 253 Representation rep, intptr_t cid); |
| 254 bool TryStringLengthOneEquality(InstanceCallInstr* call, Token::Kind op_kind); | 254 bool TryStringLengthOneEquality(InstanceCallInstr* call, Token::Kind op_kind); |
| 255 | 255 |
| 256 Isolate* isolate() const { return flow_graph_->isolate(); } | 256 Isolate* isolate() const { return flow_graph_->isolate(); } |
| 257 Zone* zone() const { return flow_graph_->zone(); } |
| 257 | 258 |
| 258 FlowGraph* flow_graph_; | 259 FlowGraph* flow_graph_; |
| 259 | 260 |
| 260 DISALLOW_COPY_AND_ASSIGN(FlowGraphOptimizer); | 261 DISALLOW_COPY_AND_ASSIGN(FlowGraphOptimizer); |
| 261 }; | 262 }; |
| 262 | 263 |
| 263 | 264 |
| 264 // Loop invariant code motion. | 265 // Loop invariant code motion. |
| 265 class LICM : public ValueObject { | 266 class LICM : public ValueObject { |
| 266 public: | 267 public: |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 void InsertMaterializations(Definition* alloc); | 405 void InsertMaterializations(Definition* alloc); |
| 405 | 406 |
| 406 void CreateMaterializationAt( | 407 void CreateMaterializationAt( |
| 407 Instruction* exit, | 408 Instruction* exit, |
| 408 Definition* alloc, | 409 Definition* alloc, |
| 409 const ZoneGrowableArray<const Object*>& fields); | 410 const ZoneGrowableArray<const Object*>& fields); |
| 410 | 411 |
| 411 void EliminateAllocation(Definition* alloc); | 412 void EliminateAllocation(Definition* alloc); |
| 412 | 413 |
| 413 Isolate* isolate() const { return flow_graph_->isolate(); } | 414 Isolate* isolate() const { return flow_graph_->isolate(); } |
| 415 Zone* zone() const { return flow_graph_->zone(); } |
| 414 | 416 |
| 415 FlowGraph* flow_graph_; | 417 FlowGraph* flow_graph_; |
| 416 | 418 |
| 417 GrowableArray<Definition*> candidates_; | 419 GrowableArray<Definition*> candidates_; |
| 418 GrowableArray<MaterializeObjectInstr*> materializations_; | 420 GrowableArray<MaterializeObjectInstr*> materializations_; |
| 419 | 421 |
| 420 ExitsCollector exits_collector_; | 422 ExitsCollector exits_collector_; |
| 421 }; | 423 }; |
| 422 | 424 |
| 423 | 425 |
| 424 // Optimize spill stores inside try-blocks by identifying values that always | 426 // Optimize spill stores inside try-blocks by identifying values that always |
| 425 // contain a single known constant at catch block entry. | 427 // contain a single known constant at catch block entry. |
| 426 class TryCatchAnalyzer : public AllStatic { | 428 class TryCatchAnalyzer : public AllStatic { |
| 427 public: | 429 public: |
| 428 static void Optimize(FlowGraph* flow_graph); | 430 static void Optimize(FlowGraph* flow_graph); |
| 429 }; | 431 }; |
| 430 | 432 |
| 431 } // namespace dart | 433 } // namespace dart |
| 432 | 434 |
| 433 #endif // VM_FLOW_GRAPH_OPTIMIZER_H_ | 435 #endif // VM_FLOW_GRAPH_OPTIMIZER_H_ |
| OLD | NEW |