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

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

Issue 1761863002: [turbofan] Re-enables the jump table emission in the mips instruction selector. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Update. Created 4 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 | « no previous file | src/compiler/mips64/instruction-selector-mips64.cc » ('j') | 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/adapters.h" 5 #include "src/base/adapters.h"
6 #include "src/base/bits.h" 6 #include "src/base/bits.h"
7 #include "src/compiler/instruction-selector-impl.h" 7 #include "src/compiler/instruction-selector-impl.h"
8 #include "src/compiler/node-matchers.h" 8 #include "src/compiler/node-matchers.h"
9 #include "src/compiler/node-properties.h" 9 #include "src/compiler/node-properties.h"
10 10
(...skipping 1198 matching lines...) Expand 10 before | Expand all | Expand 10 after
1209 void InstructionSelector::VisitDeoptimizeUnless(Node* node) { 1209 void InstructionSelector::VisitDeoptimizeUnless(Node* node) {
1210 FlagsContinuation cont = 1210 FlagsContinuation cont =
1211 FlagsContinuation::ForDeoptimize(kEqual, node->InputAt(1)); 1211 FlagsContinuation::ForDeoptimize(kEqual, node->InputAt(1));
1212 VisitWordCompareZero(this, node, node->InputAt(0), &cont); 1212 VisitWordCompareZero(this, node, node->InputAt(0), &cont);
1213 } 1213 }
1214 1214
1215 void InstructionSelector::VisitSwitch(Node* node, const SwitchInfo& sw) { 1215 void InstructionSelector::VisitSwitch(Node* node, const SwitchInfo& sw) {
1216 MipsOperandGenerator g(this); 1216 MipsOperandGenerator g(this);
1217 InstructionOperand value_operand = g.UseRegister(node->InputAt(0)); 1217 InstructionOperand value_operand = g.UseRegister(node->InputAt(0));
1218 1218
1219 // TODO(mips): TableSwitch is broken, as it messes with ra without saving it 1219 // Emit either ArchTableSwitch or ArchLookupSwitch.
1220 // properly (which breaks with frame elision, i.e. inside stubs). 1220 size_t table_space_cost = 9 + sw.value_range;
1221 if (false) { 1221 size_t table_time_cost = 3;
1222 // Emit either ArchTableSwitch or ArchLookupSwitch. 1222 size_t lookup_space_cost = 2 + 2 * sw.case_count;
1223 size_t table_space_cost = 9 + sw.value_range; 1223 size_t lookup_time_cost = sw.case_count;
1224 size_t table_time_cost = 3; 1224 if (sw.case_count > 0 &&
1225 size_t lookup_space_cost = 2 + 2 * sw.case_count; 1225 table_space_cost + 3 * table_time_cost <=
1226 size_t lookup_time_cost = sw.case_count; 1226 lookup_space_cost + 3 * lookup_time_cost &&
1227 if (sw.case_count > 0 && 1227 sw.min_value > std::numeric_limits<int32_t>::min()) {
1228 table_space_cost + 3 * table_time_cost <= 1228 InstructionOperand index_operand = value_operand;
1229 lookup_space_cost + 3 * lookup_time_cost && 1229 if (sw.min_value) {
1230 sw.min_value > std::numeric_limits<int32_t>::min()) { 1230 index_operand = g.TempRegister();
1231 InstructionOperand index_operand = value_operand; 1231 Emit(kMipsSub, index_operand, value_operand,
1232 if (sw.min_value) { 1232 g.TempImmediate(sw.min_value));
1233 index_operand = g.TempRegister();
1234 Emit(kMipsSub, index_operand, value_operand,
1235 g.TempImmediate(sw.min_value));
1236 }
1237 // Generate a table lookup.
1238 return EmitTableSwitch(sw, index_operand);
1239 } 1233 }
1234 // Generate a table lookup.
1235 return EmitTableSwitch(sw, index_operand);
1240 } 1236 }
1241 1237
1242 // Generate a sequence of conditional jumps. 1238 // Generate a sequence of conditional jumps.
1243 return EmitLookupSwitch(sw, value_operand); 1239 return EmitLookupSwitch(sw, value_operand);
1244 } 1240 }
1245 1241
1246 1242
1247 void InstructionSelector::VisitWord32Equal(Node* const node) { 1243 void InstructionSelector::VisitWord32Equal(Node* const node) {
1248 FlagsContinuation cont = FlagsContinuation::ForSet(kEqual, node); 1244 FlagsContinuation cont = FlagsContinuation::ForSet(kEqual, node);
1249 Int32BinopMatcher m(node); 1245 Int32BinopMatcher m(node);
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
1392 MachineOperatorBuilder::kFloat32Max | 1388 MachineOperatorBuilder::kFloat32Max |
1393 MachineOperatorBuilder::kFloat32RoundDown | 1389 MachineOperatorBuilder::kFloat32RoundDown |
1394 MachineOperatorBuilder::kFloat32RoundUp | 1390 MachineOperatorBuilder::kFloat32RoundUp |
1395 MachineOperatorBuilder::kFloat32RoundTruncate | 1391 MachineOperatorBuilder::kFloat32RoundTruncate |
1396 MachineOperatorBuilder::kFloat32RoundTiesEven; 1392 MachineOperatorBuilder::kFloat32RoundTiesEven;
1397 } 1393 }
1398 1394
1399 } // namespace compiler 1395 } // namespace compiler
1400 } // namespace internal 1396 } // namespace internal
1401 } // namespace v8 1397 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler/mips64/instruction-selector-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698