| 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/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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 } | 204 } |
| 205 | 205 |
| 206 DCHECK_NE(0u, input_count); | 206 DCHECK_NE(0u, input_count); |
| 207 DCHECK_NE(0u, output_count); | 207 DCHECK_NE(0u, output_count); |
| 208 DCHECK_GE(arraysize(inputs), input_count); | 208 DCHECK_GE(arraysize(inputs), input_count); |
| 209 DCHECK_GE(arraysize(outputs), output_count); | 209 DCHECK_GE(arraysize(outputs), output_count); |
| 210 | 210 |
| 211 opcode = cont->Encode(opcode); | 211 opcode = cont->Encode(opcode); |
| 212 if (cont->IsDeoptimize()) { | 212 if (cont->IsDeoptimize()) { |
| 213 selector->EmitDeoptimize(opcode, output_count, outputs, input_count, inputs, | 213 selector->EmitDeoptimize(opcode, output_count, outputs, input_count, inputs, |
| 214 cont->kind(), cont->reason(), cont->frame_state()); | 214 cont->reason(), cont->frame_state()); |
| 215 } else { | 215 } else { |
| 216 selector->Emit(opcode, output_count, outputs, input_count, inputs); | 216 selector->Emit(opcode, output_count, outputs, input_count, inputs); |
| 217 } | 217 } |
| 218 } | 218 } |
| 219 | 219 |
| 220 static void VisitBinop(InstructionSelector* selector, Node* node, | 220 static void VisitBinop(InstructionSelector* selector, Node* node, |
| 221 InstructionCode opcode, bool has_reverse_opcode, | 221 InstructionCode opcode, bool has_reverse_opcode, |
| 222 InstructionCode reverse_opcode) { | 222 InstructionCode reverse_opcode) { |
| 223 FlagsContinuation cont; | 223 FlagsContinuation cont; |
| 224 VisitBinop(selector, node, opcode, has_reverse_opcode, reverse_opcode, &cont); | 224 VisitBinop(selector, node, opcode, has_reverse_opcode, reverse_opcode, &cont); |
| (...skipping 1135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1360 // Shared routine for multiple compare operations. | 1360 // Shared routine for multiple compare operations. |
| 1361 static void VisitCompare(InstructionSelector* selector, InstructionCode opcode, | 1361 static void VisitCompare(InstructionSelector* selector, InstructionCode opcode, |
| 1362 InstructionOperand left, InstructionOperand right, | 1362 InstructionOperand left, InstructionOperand right, |
| 1363 FlagsContinuation* cont) { | 1363 FlagsContinuation* cont) { |
| 1364 MipsOperandGenerator g(selector); | 1364 MipsOperandGenerator g(selector); |
| 1365 opcode = cont->Encode(opcode); | 1365 opcode = cont->Encode(opcode); |
| 1366 if (cont->IsBranch()) { | 1366 if (cont->IsBranch()) { |
| 1367 selector->Emit(opcode, g.NoOutput(), left, right, | 1367 selector->Emit(opcode, g.NoOutput(), left, right, |
| 1368 g.Label(cont->true_block()), g.Label(cont->false_block())); | 1368 g.Label(cont->true_block()), g.Label(cont->false_block())); |
| 1369 } else if (cont->IsDeoptimize()) { | 1369 } else if (cont->IsDeoptimize()) { |
| 1370 selector->EmitDeoptimize(opcode, g.NoOutput(), left, right, cont->kind(), | 1370 selector->EmitDeoptimize(opcode, g.NoOutput(), left, right, cont->reason(), |
| 1371 cont->reason(), cont->frame_state()); | 1371 cont->frame_state()); |
| 1372 } else if (cont->IsSet()) { | 1372 } else if (cont->IsSet()) { |
| 1373 selector->Emit(opcode, g.DefineAsRegister(cont->result()), left, right); | 1373 selector->Emit(opcode, g.DefineAsRegister(cont->result()), left, right); |
| 1374 } else { | 1374 } else { |
| 1375 DCHECK(cont->IsTrap()); | 1375 DCHECK(cont->IsTrap()); |
| 1376 selector->Emit(opcode, g.NoOutput(), left, right, | 1376 selector->Emit(opcode, g.NoOutput(), left, right, |
| 1377 g.TempImmediate(cont->trap_id())); | 1377 g.TempImmediate(cont->trap_id())); |
| 1378 } | 1378 } |
| 1379 } | 1379 } |
| 1380 | 1380 |
| 1381 | 1381 |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1573 | 1573 |
| 1574 // Continuation could not be combined with a compare, emit compare against 0. | 1574 // Continuation could not be combined with a compare, emit compare against 0. |
| 1575 MipsOperandGenerator g(selector); | 1575 MipsOperandGenerator g(selector); |
| 1576 InstructionCode const opcode = cont->Encode(kMipsCmp); | 1576 InstructionCode const opcode = cont->Encode(kMipsCmp); |
| 1577 InstructionOperand const value_operand = g.UseRegister(value); | 1577 InstructionOperand const value_operand = g.UseRegister(value); |
| 1578 if (cont->IsBranch()) { | 1578 if (cont->IsBranch()) { |
| 1579 selector->Emit(opcode, g.NoOutput(), value_operand, g.TempImmediate(0), | 1579 selector->Emit(opcode, g.NoOutput(), value_operand, g.TempImmediate(0), |
| 1580 g.Label(cont->true_block()), g.Label(cont->false_block())); | 1580 g.Label(cont->true_block()), g.Label(cont->false_block())); |
| 1581 } else if (cont->IsDeoptimize()) { | 1581 } else if (cont->IsDeoptimize()) { |
| 1582 selector->EmitDeoptimize(opcode, g.NoOutput(), value_operand, | 1582 selector->EmitDeoptimize(opcode, g.NoOutput(), value_operand, |
| 1583 g.TempImmediate(0), cont->kind(), cont->reason(), | 1583 g.TempImmediate(0), cont->reason(), |
| 1584 cont->frame_state()); | 1584 cont->frame_state()); |
| 1585 } else if (cont->IsSet()) { | 1585 } else if (cont->IsSet()) { |
| 1586 selector->Emit(opcode, g.DefineAsRegister(cont->result()), value_operand, | 1586 selector->Emit(opcode, g.DefineAsRegister(cont->result()), value_operand, |
| 1587 g.TempImmediate(0)); | 1587 g.TempImmediate(0)); |
| 1588 } else { | 1588 } else { |
| 1589 DCHECK(cont->IsTrap()); | 1589 DCHECK(cont->IsTrap()); |
| 1590 selector->Emit(opcode, g.NoOutput(), value_operand, g.TempImmediate(0), | 1590 selector->Emit(opcode, g.NoOutput(), value_operand, g.TempImmediate(0), |
| 1591 g.TempImmediate(cont->trap_id())); | 1591 g.TempImmediate(cont->trap_id())); |
| 1592 } | 1592 } |
| 1593 } | 1593 } |
| 1594 | 1594 |
| 1595 } // namespace | 1595 } // namespace |
| 1596 | 1596 |
| 1597 void InstructionSelector::VisitBranch(Node* branch, BasicBlock* tbranch, | 1597 void InstructionSelector::VisitBranch(Node* branch, BasicBlock* tbranch, |
| 1598 BasicBlock* fbranch) { | 1598 BasicBlock* fbranch) { |
| 1599 FlagsContinuation cont(kNotEqual, tbranch, fbranch); | 1599 FlagsContinuation cont(kNotEqual, tbranch, fbranch); |
| 1600 VisitWordCompareZero(this, branch, branch->InputAt(0), &cont); | 1600 VisitWordCompareZero(this, branch, branch->InputAt(0), &cont); |
| 1601 } | 1601 } |
| 1602 | 1602 |
| 1603 void InstructionSelector::VisitDeoptimizeIf(Node* node) { | 1603 void InstructionSelector::VisitDeoptimizeIf(Node* node) { |
| 1604 DeoptimizeParameters p = DeoptimizeParametersOf(node->op()); | |
| 1605 FlagsContinuation cont = FlagsContinuation::ForDeoptimize( | 1604 FlagsContinuation cont = FlagsContinuation::ForDeoptimize( |
| 1606 kNotEqual, p.kind(), p.reason(), node->InputAt(1)); | 1605 kNotEqual, DeoptimizeReasonOf(node->op()), node->InputAt(1)); |
| 1607 VisitWordCompareZero(this, node, node->InputAt(0), &cont); | 1606 VisitWordCompareZero(this, node, node->InputAt(0), &cont); |
| 1608 } | 1607 } |
| 1609 | 1608 |
| 1610 void InstructionSelector::VisitDeoptimizeUnless(Node* node) { | 1609 void InstructionSelector::VisitDeoptimizeUnless(Node* node) { |
| 1611 DeoptimizeParameters p = DeoptimizeParametersOf(node->op()); | |
| 1612 FlagsContinuation cont = FlagsContinuation::ForDeoptimize( | 1610 FlagsContinuation cont = FlagsContinuation::ForDeoptimize( |
| 1613 kEqual, p.kind(), p.reason(), node->InputAt(1)); | 1611 kEqual, DeoptimizeReasonOf(node->op()), node->InputAt(1)); |
| 1614 VisitWordCompareZero(this, node, node->InputAt(0), &cont); | 1612 VisitWordCompareZero(this, node, node->InputAt(0), &cont); |
| 1615 } | 1613 } |
| 1616 | 1614 |
| 1617 void InstructionSelector::VisitTrapIf(Node* node, Runtime::FunctionId func_id) { | 1615 void InstructionSelector::VisitTrapIf(Node* node, Runtime::FunctionId func_id) { |
| 1618 FlagsContinuation cont = | 1616 FlagsContinuation cont = |
| 1619 FlagsContinuation::ForTrap(kNotEqual, func_id, node->InputAt(1)); | 1617 FlagsContinuation::ForTrap(kNotEqual, func_id, node->InputAt(1)); |
| 1620 VisitWordCompareZero(this, node, node->InputAt(0), &cont); | 1618 VisitWordCompareZero(this, node, node->InputAt(0), &cont); |
| 1621 } | 1619 } |
| 1622 | 1620 |
| 1623 void InstructionSelector::VisitTrapUnless(Node* node, | 1621 void InstructionSelector::VisitTrapUnless(Node* node, |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1901 DCHECK(IsMipsArchVariant(kLoongson) || IsMipsArchVariant(kMips32r1) || | 1899 DCHECK(IsMipsArchVariant(kLoongson) || IsMipsArchVariant(kMips32r1) || |
| 1902 IsMipsArchVariant(kMips32r2)); | 1900 IsMipsArchVariant(kMips32r2)); |
| 1903 return MachineOperatorBuilder::AlignmentRequirements:: | 1901 return MachineOperatorBuilder::AlignmentRequirements:: |
| 1904 NoUnalignedAccessSupport(); | 1902 NoUnalignedAccessSupport(); |
| 1905 } | 1903 } |
| 1906 } | 1904 } |
| 1907 | 1905 |
| 1908 } // namespace compiler | 1906 } // namespace compiler |
| 1909 } // namespace internal | 1907 } // namespace internal |
| 1910 } // namespace v8 | 1908 } // namespace v8 |
| OLD | NEW |