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 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
778 // Emit either ArchTableSwitch or ArchLookupSwitch. | 778 // Emit either ArchTableSwitch or ArchLookupSwitch. |
779 size_t table_space_cost = 9 + sw.value_range; | 779 size_t table_space_cost = 9 + sw.value_range; |
780 size_t table_time_cost = 3; | 780 size_t table_time_cost = 3; |
781 size_t lookup_space_cost = 2 + 2 * sw.case_count; | 781 size_t lookup_space_cost = 2 + 2 * sw.case_count; |
782 size_t lookup_time_cost = sw.case_count; | 782 size_t lookup_time_cost = sw.case_count; |
783 if (sw.case_count > 0 && | 783 if (sw.case_count > 0 && |
784 table_space_cost + 3 * table_time_cost <= | 784 table_space_cost + 3 * table_time_cost <= |
785 lookup_space_cost + 3 * lookup_time_cost && | 785 lookup_space_cost + 3 * lookup_time_cost && |
786 sw.min_value > std::numeric_limits<int32_t>::min()) { | 786 sw.min_value > std::numeric_limits<int32_t>::min()) { |
787 InstructionOperand index_operand = value_operand; | 787 InstructionOperand index_operand = value_operand; |
788 if (min_value) { | 788 if (sw.min_value) { |
789 index_operand = g.TempRegister(); | 789 index_operand = g.TempRegister(); |
790 Emit(kMipsSub, index_operand, value_operand, | 790 Emit(kMipsSub, index_operand, value_operand, |
791 g.TempImmediate(sw.min_value)); | 791 g.TempImmediate(sw.min_value)); |
792 } | 792 } |
793 // Generate a table lookup. | 793 // Generate a table lookup. |
794 return EmitTableSwitch(sw, index_operand); | 794 return EmitTableSwitch(sw, index_operand); |
795 } | 795 } |
796 | 796 |
797 // Generate a sequence of conditional jumps. | 797 // Generate a sequence of conditional jumps. |
798 return EmitLookupSwitch(sw, value_operand); | 798 return EmitLookupSwitch(sw, value_operand); |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
909 if (IsMipsArchVariant(kMips32r2) || IsMipsArchVariant(kMips32r6)) { | 909 if (IsMipsArchVariant(kMips32r2) || IsMipsArchVariant(kMips32r6)) { |
910 return MachineOperatorBuilder::kFloat64RoundDown | | 910 return MachineOperatorBuilder::kFloat64RoundDown | |
911 MachineOperatorBuilder::kFloat64RoundTruncate; | 911 MachineOperatorBuilder::kFloat64RoundTruncate; |
912 } | 912 } |
913 return MachineOperatorBuilder::kNoFlags; | 913 return MachineOperatorBuilder::kNoFlags; |
914 } | 914 } |
915 | 915 |
916 } // namespace compiler | 916 } // namespace compiler |
917 } // namespace internal | 917 } // namespace internal |
918 } // namespace v8 | 918 } // namespace v8 |
OLD | NEW |