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/adapters.h" | 5 #include "src/base/adapters.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 #include "src/ppc/frames-ppc.h" | 9 #include "src/ppc/frames-ppc.h" |
10 | 10 |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 } | 147 } |
148 | 148 |
149 DCHECK_NE(0u, input_count); | 149 DCHECK_NE(0u, input_count); |
150 DCHECK_NE(0u, output_count); | 150 DCHECK_NE(0u, output_count); |
151 DCHECK_GE(arraysize(inputs), input_count); | 151 DCHECK_GE(arraysize(inputs), input_count); |
152 DCHECK_GE(arraysize(outputs), output_count); | 152 DCHECK_GE(arraysize(outputs), output_count); |
153 | 153 |
154 opcode = cont->Encode(opcode); | 154 opcode = cont->Encode(opcode); |
155 if (cont->IsDeoptimize()) { | 155 if (cont->IsDeoptimize()) { |
156 selector->EmitDeoptimize(opcode, output_count, outputs, input_count, inputs, | 156 selector->EmitDeoptimize(opcode, output_count, outputs, input_count, inputs, |
157 cont->frame_state()); | 157 cont->reason(), cont->frame_state()); |
158 } else { | 158 } else { |
159 selector->Emit(opcode, output_count, outputs, input_count, inputs); | 159 selector->Emit(opcode, output_count, outputs, input_count, inputs); |
160 } | 160 } |
161 } | 161 } |
162 | 162 |
163 | 163 |
164 // Shared routine for multiple binary operations. | 164 // Shared routine for multiple binary operations. |
165 template <typename Matcher> | 165 template <typename Matcher> |
166 void VisitBinop(InstructionSelector* selector, Node* node, | 166 void VisitBinop(InstructionSelector* selector, Node* node, |
167 InstructionCode opcode, ImmediateMode operand_mode) { | 167 InstructionCode opcode, ImmediateMode operand_mode) { |
(...skipping 1323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1491 // Shared routine for multiple compare operations. | 1491 // Shared routine for multiple compare operations. |
1492 void VisitCompare(InstructionSelector* selector, InstructionCode opcode, | 1492 void VisitCompare(InstructionSelector* selector, InstructionCode opcode, |
1493 InstructionOperand left, InstructionOperand right, | 1493 InstructionOperand left, InstructionOperand right, |
1494 FlagsContinuation* cont) { | 1494 FlagsContinuation* cont) { |
1495 PPCOperandGenerator g(selector); | 1495 PPCOperandGenerator g(selector); |
1496 opcode = cont->Encode(opcode); | 1496 opcode = cont->Encode(opcode); |
1497 if (cont->IsBranch()) { | 1497 if (cont->IsBranch()) { |
1498 selector->Emit(opcode, g.NoOutput(), left, right, | 1498 selector->Emit(opcode, g.NoOutput(), left, right, |
1499 g.Label(cont->true_block()), g.Label(cont->false_block())); | 1499 g.Label(cont->true_block()), g.Label(cont->false_block())); |
1500 } else if (cont->IsDeoptimize()) { | 1500 } else if (cont->IsDeoptimize()) { |
1501 selector->EmitDeoptimize(opcode, g.NoOutput(), left, right, | 1501 selector->EmitDeoptimize(opcode, g.NoOutput(), left, right, cont->reason(), |
1502 cont->frame_state()); | 1502 cont->frame_state()); |
1503 } else { | 1503 } else { |
1504 DCHECK(cont->IsSet()); | 1504 DCHECK(cont->IsSet()); |
1505 selector->Emit(opcode, g.DefineAsRegister(cont->result()), left, right); | 1505 selector->Emit(opcode, g.DefineAsRegister(cont->result()), left, right); |
1506 } | 1506 } |
1507 } | 1507 } |
1508 | 1508 |
1509 | 1509 |
1510 // Shared routine for multiple word compare operations. | 1510 // Shared routine for multiple word compare operations. |
1511 void VisitWordCompare(InstructionSelector* selector, Node* node, | 1511 void VisitWordCompare(InstructionSelector* selector, Node* node, |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1734 } // namespace | 1734 } // namespace |
1735 | 1735 |
1736 | 1736 |
1737 void InstructionSelector::VisitBranch(Node* branch, BasicBlock* tbranch, | 1737 void InstructionSelector::VisitBranch(Node* branch, BasicBlock* tbranch, |
1738 BasicBlock* fbranch) { | 1738 BasicBlock* fbranch) { |
1739 FlagsContinuation cont(kNotEqual, tbranch, fbranch); | 1739 FlagsContinuation cont(kNotEqual, tbranch, fbranch); |
1740 VisitWord32CompareZero(this, branch, branch->InputAt(0), &cont); | 1740 VisitWord32CompareZero(this, branch, branch->InputAt(0), &cont); |
1741 } | 1741 } |
1742 | 1742 |
1743 void InstructionSelector::VisitDeoptimizeIf(Node* node) { | 1743 void InstructionSelector::VisitDeoptimizeIf(Node* node) { |
1744 FlagsContinuation cont = | 1744 FlagsContinuation cont = FlagsContinuation::ForDeoptimize( |
1745 FlagsContinuation::ForDeoptimize(kNotEqual, node->InputAt(1)); | 1745 kNotEqual, DeoptimizeReasonOf(node->op()), node->InputAt(1)); |
1746 VisitWord32CompareZero(this, node, node->InputAt(0), &cont); | 1746 VisitWord32CompareZero(this, node, node->InputAt(0), &cont); |
1747 } | 1747 } |
1748 | 1748 |
1749 void InstructionSelector::VisitDeoptimizeUnless(Node* node) { | 1749 void InstructionSelector::VisitDeoptimizeUnless(Node* node) { |
1750 FlagsContinuation cont = | 1750 FlagsContinuation cont = FlagsContinuation::ForDeoptimize( |
1751 FlagsContinuation::ForDeoptimize(kEqual, node->InputAt(1)); | 1751 kEqual, DeoptimizeReasonOf(node->op()), node->InputAt(1)); |
1752 VisitWord32CompareZero(this, node, node->InputAt(0), &cont); | 1752 VisitWord32CompareZero(this, node, node->InputAt(0), &cont); |
1753 } | 1753 } |
1754 | 1754 |
1755 void InstructionSelector::VisitSwitch(Node* node, const SwitchInfo& sw) { | 1755 void InstructionSelector::VisitSwitch(Node* node, const SwitchInfo& sw) { |
1756 PPCOperandGenerator g(this); | 1756 PPCOperandGenerator g(this); |
1757 InstructionOperand value_operand = g.UseRegister(node->InputAt(0)); | 1757 InstructionOperand value_operand = g.UseRegister(node->InputAt(0)); |
1758 | 1758 |
1759 // Emit either ArchTableSwitch or ArchLookupSwitch. | 1759 // Emit either ArchTableSwitch or ArchLookupSwitch. |
1760 size_t table_space_cost = 4 + sw.value_range; | 1760 size_t table_space_cost = 4 + sw.value_range; |
1761 size_t table_time_cost = 3; | 1761 size_t table_time_cost = 3; |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2063 // static | 2063 // static |
2064 MachineOperatorBuilder::AlignmentRequirements | 2064 MachineOperatorBuilder::AlignmentRequirements |
2065 InstructionSelector::AlignmentRequirements() { | 2065 InstructionSelector::AlignmentRequirements() { |
2066 return MachineOperatorBuilder::AlignmentRequirements:: | 2066 return MachineOperatorBuilder::AlignmentRequirements:: |
2067 FullUnalignedAccessSupport(); | 2067 FullUnalignedAccessSupport(); |
2068 } | 2068 } |
2069 | 2069 |
2070 } // namespace compiler | 2070 } // namespace compiler |
2071 } // namespace internal | 2071 } // namespace internal |
2072 } // namespace v8 | 2072 } // namespace v8 |
OLD | NEW |