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 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 return AllowCodeMotion() && !instr->block()->IsDeoptimizing(); | 612 return AllowCodeMotion() && !instr->block()->IsDeoptimizing(); |
613 } | 613 } |
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_.Add(block->block_id())) { |
625 side_effects.Add(block_side_effects_[block->block_id()]); | 625 side_effects.Add(block_side_effects_[block->block_id()]); |
626 if (block->IsLoopHeader()) { | 626 if (block->IsLoopHeader()) { |
627 side_effects.Add(loop_side_effects_[block->block_id()]); | 627 side_effects.Add(loop_side_effects_[block->block_id()]); |
628 } | 628 } |
629 side_effects.Add(CollectSideEffectsOnPathsToDominatedBlock( | 629 side_effects.Add(CollectSideEffectsOnPathsToDominatedBlock( |
630 dominator, block)); | 630 dominator, block)); |
631 } | 631 } |
632 } | 632 } |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
766 HValueMap* map = current->map(); | 766 HValueMap* map = current->map(); |
767 HSideEffectMap* dominators = current->dominators(); | 767 HSideEffectMap* dominators = current->dominators(); |
768 | 768 |
769 TRACE_GVN_2("Analyzing block B%d%s\n", | 769 TRACE_GVN_2("Analyzing block B%d%s\n", |
770 block->block_id(), | 770 block->block_id(), |
771 block->IsLoopHeader() ? " (loop header)" : ""); | 771 block->IsLoopHeader() ? " (loop header)" : ""); |
772 | 772 |
773 // If this is a loop header kill everything killed by the loop. | 773 // If this is a loop header kill everything killed by the loop. |
774 if (block->IsLoopHeader()) { | 774 if (block->IsLoopHeader()) { |
775 map->Kill(loop_side_effects_[block->block_id()]); | 775 map->Kill(loop_side_effects_[block->block_id()]); |
| 776 dominators->Kill(loop_side_effects_[block->block_id()]); |
776 } | 777 } |
777 | 778 |
778 // Go through all instructions of the current block. | 779 // Go through all instructions of the current block. |
779 for (HInstructionIterator it(block); !it.Done(); it.Advance()) { | 780 for (HInstructionIterator it(block); !it.Done(); it.Advance()) { |
780 HInstruction* instr = it.Current(); | 781 HInstruction* instr = it.Current(); |
781 if (instr->CheckFlag(HValue::kTrackSideEffectDominators)) { | 782 if (instr->CheckFlag(HValue::kTrackSideEffectDominators)) { |
782 for (int i = 0; i < kNumberOfTrackedSideEffects; i++) { | 783 for (int i = 0; i < kNumberOfTrackedSideEffects; i++) { |
783 HValue* other = dominators->at(i); | 784 HValue* other = dominators->at(i); |
784 GVNFlag changes_flag = HValue::ChangesFlagFromInt(i); | 785 GVNFlag changes_flag = HValue::ChangesFlagFromInt(i); |
785 GVNFlag depends_on_flag = HValue::DependsOnFlagFromInt(i); | 786 GVNFlag depends_on_flag = HValue::DependsOnFlagFromInt(i); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
848 dominated); | 849 dominated); |
849 successor_map->Kill(side_effects_on_all_paths); | 850 successor_map->Kill(side_effects_on_all_paths); |
850 successor_dominators->Kill(side_effects_on_all_paths); | 851 successor_dominators->Kill(side_effects_on_all_paths); |
851 } | 852 } |
852 } | 853 } |
853 current = next; | 854 current = next; |
854 } | 855 } |
855 } | 856 } |
856 | 857 |
857 } } // namespace v8::internal | 858 } } // namespace v8::internal |
OLD | NEW |