Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(483)

Side by Side Diff: src/compiler/mips64/instruction-selector-mips64.cc

Issue 1019463003: MIPS: Tweak constants to be in favor of table switch. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/mips/instruction-selector-mips.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « src/compiler/mips/instruction-selector-mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698