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

Side by Side Diff: src/compiler/mips64/instruction-selector-mips64.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/mips/instruction-selector-mips.cc ('k') | src/compiler/type-hint-analyzer.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 1693 matching lines...) Expand 10 before | Expand all | Expand 10 after
1704 void InstructionSelector::VisitDeoptimizeUnless(Node* node) { 1704 void InstructionSelector::VisitDeoptimizeUnless(Node* node) {
1705 FlagsContinuation cont = 1705 FlagsContinuation cont =
1706 FlagsContinuation::ForDeoptimize(kEqual, node->InputAt(1)); 1706 FlagsContinuation::ForDeoptimize(kEqual, node->InputAt(1));
1707 VisitWordCompareZero(this, node, node->InputAt(0), &cont); 1707 VisitWordCompareZero(this, node, node->InputAt(0), &cont);
1708 } 1708 }
1709 1709
1710 void InstructionSelector::VisitSwitch(Node* node, const SwitchInfo& sw) { 1710 void InstructionSelector::VisitSwitch(Node* node, const SwitchInfo& sw) {
1711 Mips64OperandGenerator g(this); 1711 Mips64OperandGenerator g(this);
1712 InstructionOperand value_operand = g.UseRegister(node->InputAt(0)); 1712 InstructionOperand value_operand = g.UseRegister(node->InputAt(0));
1713 1713
1714 // Emit either ArchTableSwitch or ArchLookupSwitch. 1714 // TODO(mips): TableSwitch is broken, as it messes with ra without saving it
1715 size_t table_space_cost = 10 + 2 * sw.value_range; 1715 // properly (which breaks with frame elision, i.e. inside stubs).
1716 size_t table_time_cost = 3; 1716 if (false) {
1717 size_t lookup_space_cost = 2 + 2 * sw.case_count; 1717 // Emit either ArchTableSwitch or ArchLookupSwitch.
1718 size_t lookup_time_cost = sw.case_count; 1718 size_t table_space_cost = 10 + 2 * sw.value_range;
1719 if (sw.case_count > 0 && 1719 size_t table_time_cost = 3;
1720 table_space_cost + 3 * table_time_cost <= 1720 size_t lookup_space_cost = 2 + 2 * sw.case_count;
1721 lookup_space_cost + 3 * lookup_time_cost && 1721 size_t lookup_time_cost = sw.case_count;
1722 sw.min_value > std::numeric_limits<int32_t>::min()) { 1722 if (sw.case_count > 0 &&
1723 InstructionOperand index_operand = value_operand; 1723 table_space_cost + 3 * table_time_cost <=
1724 if (sw.min_value) { 1724 lookup_space_cost + 3 * lookup_time_cost &&
1725 index_operand = g.TempRegister(); 1725 sw.min_value > std::numeric_limits<int32_t>::min()) {
1726 Emit(kMips64Sub, index_operand, value_operand, 1726 InstructionOperand index_operand = value_operand;
1727 g.TempImmediate(sw.min_value)); 1727 if (sw.min_value) {
1728 index_operand = g.TempRegister();
1729 Emit(kMips64Sub, index_operand, value_operand,
1730 g.TempImmediate(sw.min_value));
1731 }
1732 // Generate a table lookup.
1733 return EmitTableSwitch(sw, index_operand);
1728 } 1734 }
1729 // Generate a table lookup.
1730 return EmitTableSwitch(sw, index_operand);
1731 } 1735 }
1732 1736
1733 // Generate a sequence of conditional jumps. 1737 // Generate a sequence of conditional jumps.
1734 return EmitLookupSwitch(sw, value_operand); 1738 return EmitLookupSwitch(sw, value_operand);
1735 } 1739 }
1736 1740
1737 1741
1738 void InstructionSelector::VisitWord32Equal(Node* const node) { 1742 void InstructionSelector::VisitWord32Equal(Node* const node) {
1739 FlagsContinuation cont = FlagsContinuation::ForSet(kEqual, node); 1743 FlagsContinuation cont = FlagsContinuation::ForSet(kEqual, node);
1740 Int32BinopMatcher m(node); 1744 Int32BinopMatcher m(node);
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
1935 MachineOperatorBuilder::kFloat32RoundUp | 1939 MachineOperatorBuilder::kFloat32RoundUp |
1936 MachineOperatorBuilder::kFloat64RoundTruncate | 1940 MachineOperatorBuilder::kFloat64RoundTruncate |
1937 MachineOperatorBuilder::kFloat32RoundTruncate | 1941 MachineOperatorBuilder::kFloat32RoundTruncate |
1938 MachineOperatorBuilder::kFloat64RoundTiesEven | 1942 MachineOperatorBuilder::kFloat64RoundTiesEven |
1939 MachineOperatorBuilder::kFloat32RoundTiesEven; 1943 MachineOperatorBuilder::kFloat32RoundTiesEven;
1940 } 1944 }
1941 1945
1942 } // namespace compiler 1946 } // namespace compiler
1943 } // namespace internal 1947 } // namespace internal
1944 } // namespace v8 1948 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/mips/instruction-selector-mips.cc ('k') | src/compiler/type-hint-analyzer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698