OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 } | 361 } |
362 } | 362 } |
363 } | 363 } |
364 | 364 |
365 | 365 |
366 HGlobalValueNumberingPhase::HGlobalValueNumberingPhase(HGraph* graph) | 366 HGlobalValueNumberingPhase::HGlobalValueNumberingPhase(HGraph* graph) |
367 : HPhase("H_Global value numbering", graph), | 367 : HPhase("H_Global value numbering", graph), |
368 removed_side_effects_(false), | 368 removed_side_effects_(false), |
369 block_side_effects_(graph->blocks()->length(), zone()), | 369 block_side_effects_(graph->blocks()->length(), zone()), |
370 loop_side_effects_(graph->blocks()->length(), zone()), | 370 loop_side_effects_(graph->blocks()->length(), zone()), |
371 visited_on_paths_(zone(), graph->blocks()->length()) { | 371 visited_on_paths_(graph->blocks()->length(), zone()) { |
372 ASSERT(!AllowHandleAllocation::IsAllowed()); | 372 ASSERT(!AllowHandleAllocation::IsAllowed()); |
373 block_side_effects_.AddBlock(GVNFlagSet(), graph->blocks()->length(), | 373 block_side_effects_.AddBlock(GVNFlagSet(), graph->blocks()->length(), |
374 zone()); | 374 zone()); |
375 loop_side_effects_.AddBlock(GVNFlagSet(), graph->blocks()->length(), | 375 loop_side_effects_.AddBlock(GVNFlagSet(), graph->blocks()->length(), |
376 zone()); | 376 zone()); |
377 } | 377 } |
378 | 378 |
379 void HGlobalValueNumberingPhase::Analyze() { | 379 void HGlobalValueNumberingPhase::Analyze() { |
380 removed_side_effects_ = false; | 380 removed_side_effects_ = false; |
381 ComputeBlockSideEffects(); | 381 ComputeBlockSideEffects(); |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 | 614 |
615 | 615 |
616 GVNFlagSet | 616 GVNFlagSet |
617 HGlobalValueNumberingPhase::CollectSideEffectsOnPathsToDominatedBlock( | 617 HGlobalValueNumberingPhase::CollectSideEffectsOnPathsToDominatedBlock( |
618 HBasicBlock* dominator, HBasicBlock* dominated) { | 618 HBasicBlock* dominator, HBasicBlock* dominated) { |
619 GVNFlagSet side_effects; | 619 GVNFlagSet side_effects; |
620 for (int i = 0; i < dominated->predecessors()->length(); ++i) { | 620 for (int i = 0; i < dominated->predecessors()->length(); ++i) { |
621 HBasicBlock* block = dominated->predecessors()->at(i); | 621 HBasicBlock* block = dominated->predecessors()->at(i); |
622 if (dominator->block_id() < block->block_id() && | 622 if (dominator->block_id() < block->block_id() && |
623 block->block_id() < dominated->block_id() && | 623 block->block_id() < dominated->block_id() && |
624 visited_on_paths_.Add(block->block_id())) { | 624 !visited_on_paths_.Contains(block->block_id())) { |
| 625 visited_on_paths_.Add(block->block_id()); |
625 side_effects.Add(block_side_effects_[block->block_id()]); | 626 side_effects.Add(block_side_effects_[block->block_id()]); |
626 if (block->IsLoopHeader()) { | 627 if (block->IsLoopHeader()) { |
627 side_effects.Add(loop_side_effects_[block->block_id()]); | 628 side_effects.Add(loop_side_effects_[block->block_id()]); |
628 } | 629 } |
629 side_effects.Add(CollectSideEffectsOnPathsToDominatedBlock( | 630 side_effects.Add(CollectSideEffectsOnPathsToDominatedBlock( |
630 dominator, block)); | 631 dominator, block)); |
631 } | 632 } |
632 } | 633 } |
633 return side_effects; | 634 return side_effects; |
634 } | 635 } |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
849 dominated); | 850 dominated); |
850 successor_map->Kill(side_effects_on_all_paths); | 851 successor_map->Kill(side_effects_on_all_paths); |
851 successor_dominators->Kill(side_effects_on_all_paths); | 852 successor_dominators->Kill(side_effects_on_all_paths); |
852 } | 853 } |
853 } | 854 } |
854 current = next; | 855 current = next; |
855 } | 856 } |
856 } | 857 } |
857 | 858 |
858 } } // namespace v8::internal | 859 } } // namespace v8::internal |
OLD | NEW |