| 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/base/bits.h" | 5 #include "src/base/bits.h" |
| 6 #include "src/compiler/instruction-selector-impl.h" | 6 #include "src/compiler/instruction-selector-impl.h" |
| 7 #include "src/compiler/node-matchers.h" | 7 #include "src/compiler/node-matchers.h" |
| 8 #include "src/compiler/node-properties.h" | 8 #include "src/compiler/node-properties.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| (...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 961 InstructionOperand default_operand = g.Label(default_branch); | 961 InstructionOperand default_operand = g.Label(default_branch); |
| 962 | 962 |
| 963 // Note that {value_range} can be 0 if {min_value} is -2^31 and {max_value} | 963 // Note that {value_range} can be 0 if {min_value} is -2^31 and {max_value} |
| 964 // is 2^31-1, so don't assume that it's non-zero below. | 964 // is 2^31-1, so don't assume that it's non-zero below. |
| 965 size_t value_range = | 965 size_t value_range = |
| 966 1u + bit_cast<uint32_t>(max_value) - bit_cast<uint32_t>(min_value); | 966 1u + bit_cast<uint32_t>(max_value) - bit_cast<uint32_t>(min_value); |
| 967 | 967 |
| 968 // Determine whether to issue an ArchTableSwitch or an ArchLookupSwitch | 968 // Determine whether to issue an ArchTableSwitch or an ArchLookupSwitch |
| 969 // instruction. | 969 // instruction. |
| 970 size_t table_space_cost = 10 + 2 * value_range; | 970 size_t table_space_cost = 10 + 2 * value_range; |
| 971 size_t table_time_cost = 10; | 971 size_t table_time_cost = 3; |
| 972 size_t lookup_space_cost = 2 + 2 * case_count; | 972 size_t lookup_space_cost = 2 + 2 * case_count; |
| 973 size_t lookup_time_cost = case_count; | 973 size_t lookup_time_cost = case_count; |
| 974 if (case_count > 0 && | 974 if (case_count > 0 && |
| 975 table_space_cost + 3 * table_time_cost <= | 975 table_space_cost + 3 * table_time_cost <= |
| 976 lookup_space_cost + 3 * lookup_time_cost && | 976 lookup_space_cost + 3 * lookup_time_cost && |
| 977 min_value > std::numeric_limits<int32_t>::min()) { | 977 min_value > std::numeric_limits<int32_t>::min()) { |
| 978 InstructionOperand index_operand = value_operand; | 978 InstructionOperand index_operand = value_operand; |
| 979 if (min_value) { | 979 if (min_value) { |
| 980 index_operand = g.TempRegister(); | 980 index_operand = g.TempRegister(); |
| 981 Emit(kMips64Sub, index_operand, value_operand, | 981 Emit(kMips64Sub, index_operand, value_operand, |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1150 // static | 1150 // static |
| 1151 MachineOperatorBuilder::Flags | 1151 MachineOperatorBuilder::Flags |
| 1152 InstructionSelector::SupportedMachineOperatorFlags() { | 1152 InstructionSelector::SupportedMachineOperatorFlags() { |
| 1153 return MachineOperatorBuilder::kFloat64RoundDown | | 1153 return MachineOperatorBuilder::kFloat64RoundDown | |
| 1154 MachineOperatorBuilder::kFloat64RoundTruncate; | 1154 MachineOperatorBuilder::kFloat64RoundTruncate; |
| 1155 } | 1155 } |
| 1156 | 1156 |
| 1157 } // namespace compiler | 1157 } // namespace compiler |
| 1158 } // namespace internal | 1158 } // namespace internal |
| 1159 } // namespace v8 | 1159 } // namespace v8 |
| OLD | NEW |