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

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

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

Powered by Google App Engine
This is Rietveld 408576698