| 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 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 return VisitBranch(input, tbranch, fbranch); | 586 return VisitBranch(input, tbranch, fbranch); |
| 587 } | 587 } |
| 588 case BasicBlock::kSwitch: { | 588 case BasicBlock::kSwitch: { |
| 589 DCHECK_EQ(IrOpcode::kSwitch, input->opcode()); | 589 DCHECK_EQ(IrOpcode::kSwitch, input->opcode()); |
| 590 SwitchInfo sw; | 590 SwitchInfo sw; |
| 591 // Last successor must be Default. | 591 // Last successor must be Default. |
| 592 sw.default_branch = block->successors().back(); | 592 sw.default_branch = block->successors().back(); |
| 593 DCHECK_EQ(IrOpcode::kIfDefault, sw.default_branch->front()->opcode()); | 593 DCHECK_EQ(IrOpcode::kIfDefault, sw.default_branch->front()->opcode()); |
| 594 // All other successors must be cases. | 594 // All other successors must be cases. |
| 595 sw.case_count = block->SuccessorCount() - 1; | 595 sw.case_count = block->SuccessorCount() - 1; |
| 596 DCHECK_LE(1u, sw.case_count); | |
| 597 sw.case_branches = &block->successors().front(); | 596 sw.case_branches = &block->successors().front(); |
| 598 // Determine case values and their min/max. | 597 // Determine case values and their min/max. |
| 599 sw.case_values = zone()->NewArray<int32_t>(sw.case_count); | 598 sw.case_values = zone()->NewArray<int32_t>(sw.case_count); |
| 600 sw.min_value = std::numeric_limits<int32_t>::max(); | 599 sw.min_value = std::numeric_limits<int32_t>::max(); |
| 601 sw.max_value = std::numeric_limits<int32_t>::min(); | 600 sw.max_value = std::numeric_limits<int32_t>::min(); |
| 602 for (size_t index = 0; index < sw.case_count; ++index) { | 601 for (size_t index = 0; index < sw.case_count; ++index) { |
| 603 BasicBlock* branch = sw.case_branches[index]; | 602 BasicBlock* branch = sw.case_branches[index]; |
| 604 int32_t value = OpParameter<int32_t>(branch->front()->op()); | 603 int32_t value = OpParameter<int32_t>(branch->front()->op()); |
| 605 sw.case_values[index] = value; | 604 sw.case_values[index] = value; |
| 606 if (sw.min_value > value) sw.min_value = value; | 605 if (sw.min_value > value) sw.min_value = value; |
| (...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1398 return new (instruction_zone()) FrameStateDescriptor( | 1397 return new (instruction_zone()) FrameStateDescriptor( |
| 1399 instruction_zone(), state_info.type(), state_info.bailout_id(), | 1398 instruction_zone(), state_info.type(), state_info.bailout_id(), |
| 1400 state_info.state_combine(), parameters, locals, stack, | 1399 state_info.state_combine(), parameters, locals, stack, |
| 1401 state_info.shared_info(), outer_state); | 1400 state_info.shared_info(), outer_state); |
| 1402 } | 1401 } |
| 1403 | 1402 |
| 1404 | 1403 |
| 1405 } // namespace compiler | 1404 } // namespace compiler |
| 1406 } // namespace internal | 1405 } // namespace internal |
| 1407 } // namespace v8 | 1406 } // namespace v8 |
| OLD | NEW |