OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/compiler/instruction-selector.h" | 5 #include "src/compiler/instruction-selector.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "src/base/adapters.h" | 9 #include "src/base/adapters.h" |
10 #include "src/compiler/instruction-selector-impl.h" | 10 #include "src/compiler/instruction-selector-impl.h" |
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 int effect_level = 0; | 706 int effect_level = 0; |
707 for (Node* const node : *block) { | 707 for (Node* const node : *block) { |
708 if (node->opcode() == IrOpcode::kStore || | 708 if (node->opcode() == IrOpcode::kStore || |
709 node->opcode() == IrOpcode::kCheckedStore || | 709 node->opcode() == IrOpcode::kCheckedStore || |
710 node->opcode() == IrOpcode::kCall) { | 710 node->opcode() == IrOpcode::kCall) { |
711 ++effect_level; | 711 ++effect_level; |
712 } | 712 } |
713 SetEffectLevel(node, effect_level); | 713 SetEffectLevel(node, effect_level); |
714 } | 714 } |
715 | 715 |
| 716 // We visit the control first, then the nodes in the block, so the block's |
| 717 // control input should be on the same effect level as the last node. |
| 718 if (block->control_input() != nullptr) { |
| 719 SetEffectLevel(block->control_input(), effect_level); |
| 720 } |
| 721 |
716 // Generate code for the block control "top down", but schedule the code | 722 // Generate code for the block control "top down", but schedule the code |
717 // "bottom up". | 723 // "bottom up". |
718 VisitControl(block); | 724 VisitControl(block); |
719 std::reverse(instructions_.begin() + current_block_end, instructions_.end()); | 725 std::reverse(instructions_.begin() + current_block_end, instructions_.end()); |
720 | 726 |
721 // Visit code in reverse control flow order, because architecture-specific | 727 // Visit code in reverse control flow order, because architecture-specific |
722 // matching may cover more than one node at a time. | 728 // matching may cover more than one node at a time. |
723 for (auto node : base::Reversed(*block)) { | 729 for (auto node : base::Reversed(*block)) { |
724 // Skip nodes that are unused or already defined. | 730 // Skip nodes that are unused or already defined. |
725 if (!IsUsed(node) || IsDefined(node)) continue; | 731 if (!IsUsed(node) || IsDefined(node)) continue; |
(...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1818 return new (instruction_zone()) FrameStateDescriptor( | 1824 return new (instruction_zone()) FrameStateDescriptor( |
1819 instruction_zone(), state_info.type(), state_info.bailout_id(), | 1825 instruction_zone(), state_info.type(), state_info.bailout_id(), |
1820 state_info.state_combine(), parameters, locals, stack, | 1826 state_info.state_combine(), parameters, locals, stack, |
1821 state_info.shared_info(), outer_state); | 1827 state_info.shared_info(), outer_state); |
1822 } | 1828 } |
1823 | 1829 |
1824 | 1830 |
1825 } // namespace compiler | 1831 } // namespace compiler |
1826 } // namespace internal | 1832 } // namespace internal |
1827 } // namespace v8 | 1833 } // namespace v8 |
OLD | NEW |