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 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 }; | 428 }; |
429 | 429 |
430 | 430 |
431 class AllocationSinking : public ZoneAllocated { | 431 class AllocationSinking : public ZoneAllocated { |
432 public: | 432 public: |
433 explicit AllocationSinking(FlowGraph* flow_graph) | 433 explicit AllocationSinking(FlowGraph* flow_graph) |
434 : flow_graph_(flow_graph), | 434 : flow_graph_(flow_graph), |
435 candidates_(5), | 435 candidates_(5), |
436 materializations_(5) { } | 436 materializations_(5) { } |
437 | 437 |
438 const GrowableArray<AllocateObjectInstr*>& candidates() const { | 438 const GrowableArray<Definition*>& candidates() const { |
439 return candidates_; | 439 return candidates_; |
440 } | 440 } |
441 | 441 |
442 // Find the materialization insterted for the given allocation | 442 // Find the materialization insterted for the given allocation |
443 // at the given exit. | 443 // at the given exit. |
444 MaterializeObjectInstr* MaterializationFor(Definition* alloc, | 444 MaterializeObjectInstr* MaterializationFor(Definition* alloc, |
445 Instruction* exit); | 445 Instruction* exit); |
446 | 446 |
447 void Optimize(); | 447 void Optimize(); |
448 | 448 |
(...skipping 24 matching lines...) Expand all Loading... |
473 }; | 473 }; |
474 | 474 |
475 void CollectCandidates(); | 475 void CollectCandidates(); |
476 | 476 |
477 void NormalizeMaterializations(); | 477 void NormalizeMaterializations(); |
478 | 478 |
479 void RemoveUnusedMaterializations(); | 479 void RemoveUnusedMaterializations(); |
480 | 480 |
481 void DiscoverFailedCandidates(); | 481 void DiscoverFailedCandidates(); |
482 | 482 |
483 void InsertMaterializations(AllocateObjectInstr* alloc); | 483 void InsertMaterializations(Definition* alloc); |
484 | 484 |
485 void CreateMaterializationAt( | 485 void CreateMaterializationAt( |
486 Instruction* exit, | 486 Instruction* exit, |
487 AllocateObjectInstr* alloc, | 487 Definition* alloc, |
488 const Class& cls, | |
489 const ZoneGrowableArray<const Object*>& fields); | 488 const ZoneGrowableArray<const Object*>& fields); |
490 | 489 |
491 void EliminateAllocation(AllocateObjectInstr* alloc); | 490 void EliminateAllocation(Definition* alloc); |
492 | 491 |
493 Isolate* isolate() const { return flow_graph_->isolate(); } | 492 Isolate* isolate() const { return flow_graph_->isolate(); } |
494 | 493 |
495 FlowGraph* flow_graph_; | 494 FlowGraph* flow_graph_; |
496 | 495 |
497 GrowableArray<AllocateObjectInstr*> candidates_; | 496 GrowableArray<Definition*> candidates_; |
498 GrowableArray<MaterializeObjectInstr*> materializations_; | 497 GrowableArray<MaterializeObjectInstr*> materializations_; |
499 | 498 |
500 ExitsCollector exits_collector_; | 499 ExitsCollector exits_collector_; |
501 }; | 500 }; |
502 | 501 |
503 | 502 |
504 // Optimize spill stores inside try-blocks by identifying values that always | 503 // Optimize spill stores inside try-blocks by identifying values that always |
505 // contain a single known constant at catch block entry. | 504 // contain a single known constant at catch block entry. |
506 class TryCatchAnalyzer : public AllStatic { | 505 class TryCatchAnalyzer : public AllStatic { |
507 public: | 506 public: |
508 static void Optimize(FlowGraph* flow_graph); | 507 static void Optimize(FlowGraph* flow_graph); |
509 }; | 508 }; |
510 | 509 |
511 } // namespace dart | 510 } // namespace dart |
512 | 511 |
513 #endif // VM_FLOW_GRAPH_OPTIMIZER_H_ | 512 #endif // VM_FLOW_GRAPH_OPTIMIZER_H_ |
OLD | NEW |