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

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

Issue 940453003: MIPS: Fix 'MIPS: [turbofan] Optimize certain chains of Branch into a Switch.' (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix nit. Created 5 years, 10 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/code-generator-mips.cc ('k') | src/compiler/mips64/code-generator-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/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 743 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 InstructionOperand value_operand = g.UseRegister(node->InputAt(0)); 754 InstructionOperand value_operand = g.UseRegister(node->InputAt(0));
755 InstructionOperand default_operand = g.Label(default_branch); 755 InstructionOperand default_operand = g.Label(default_branch);
756 756
757 // Note that {value_range} can be 0 if {min_value} is -2^31 and {max_value} 757 // Note that {value_range} can be 0 if {min_value} is -2^31 and {max_value}
758 // is 2^31-1, so don't assume that it's non-zero below. 758 // is 2^31-1, so don't assume that it's non-zero below.
759 size_t value_range = 759 size_t value_range =
760 1u + bit_cast<uint32_t>(max_value) - bit_cast<uint32_t>(min_value); 760 1u + bit_cast<uint32_t>(max_value) - bit_cast<uint32_t>(min_value);
761 761
762 // Determine whether to issue an ArchTableSwitch or an ArchLookupSwitch 762 // Determine whether to issue an ArchTableSwitch or an ArchLookupSwitch
763 // instruction. 763 // instruction.
764 size_t table_space_cost = 4 + value_range; 764 size_t table_space_cost = 9 + value_range;
765 size_t table_time_cost = 3; 765 size_t table_time_cost = 9;
766 size_t lookup_space_cost = 3 + 2 * case_count; 766 size_t lookup_space_cost = 2 + 2 * case_count;
767 size_t lookup_time_cost = case_count; 767 size_t lookup_time_cost = case_count;
768 if (case_count > 0 && 768 if (case_count > 0 &&
769 table_space_cost + 3 * table_time_cost <= 769 table_space_cost + 3 * table_time_cost <=
770 lookup_space_cost + 3 * lookup_time_cost && 770 lookup_space_cost + 3 * lookup_time_cost &&
771 min_value > std::numeric_limits<int32_t>::min()) { 771 min_value > std::numeric_limits<int32_t>::min()) {
772 InstructionOperand index_operand = value_operand; 772 InstructionOperand index_operand = value_operand;
773 if (min_value) { 773 if (min_value) {
774 index_operand = g.TempRegister(); 774 index_operand = g.TempRegister();
775 Emit(kMipsSub, index_operand, value_operand, g.TempImmediate(min_value)); 775 Emit(kMipsSub, index_operand, value_operand, g.TempImmediate(min_value));
776 } 776 }
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
885 return MachineOperatorBuilder::kFloat64Floor | 885 return MachineOperatorBuilder::kFloat64Floor |
886 MachineOperatorBuilder::kFloat64Ceil | 886 MachineOperatorBuilder::kFloat64Ceil |
887 MachineOperatorBuilder::kFloat64RoundTruncate; 887 MachineOperatorBuilder::kFloat64RoundTruncate;
888 } 888 }
889 return MachineOperatorBuilder::kNoFlags; 889 return MachineOperatorBuilder::kNoFlags;
890 } 890 }
891 891
892 } // namespace compiler 892 } // namespace compiler
893 } // namespace internal 893 } // namespace internal
894 } // namespace v8 894 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/mips/code-generator-mips.cc ('k') | src/compiler/mips64/code-generator-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698