| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/s390/frames-s390.h" | 9 #include "src/s390/frames-s390.h" |
| 10 | 10 |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 | 410 |
| 411 DCHECK_NE(0u, input_count); | 411 DCHECK_NE(0u, input_count); |
| 412 DCHECK_NE(0u, output_count); | 412 DCHECK_NE(0u, output_count); |
| 413 DCHECK_GE(arraysize(inputs), input_count); | 413 DCHECK_GE(arraysize(inputs), input_count); |
| 414 DCHECK_GE(arraysize(outputs), output_count); | 414 DCHECK_GE(arraysize(outputs), output_count); |
| 415 | 415 |
| 416 opcode = cont->Encode(opcode); | 416 opcode = cont->Encode(opcode); |
| 417 if (cont->IsDeoptimize()) { | 417 if (cont->IsDeoptimize()) { |
| 418 selector->EmitDeoptimize(opcode, output_count, outputs, input_count, inputs, | 418 selector->EmitDeoptimize(opcode, output_count, outputs, input_count, inputs, |
| 419 cont->reason(), cont->frame_state()); | 419 cont->reason(), cont->frame_state()); |
| 420 } else if (cont->IsTrap()) { |
| 421 inputs[input_count++] = g.UseImmediate(cont->trap_id()); |
| 422 selector->Emit(opcode, output_count, outputs, input_count, inputs); |
| 420 } else { | 423 } else { |
| 421 selector->Emit(opcode, output_count, outputs, input_count, inputs); | 424 selector->Emit(opcode, output_count, outputs, input_count, inputs); |
| 422 } | 425 } |
| 423 } | 426 } |
| 424 | 427 |
| 425 // Shared routine for multiple binary operations. | 428 // Shared routine for multiple binary operations. |
| 426 template <typename Matcher> | 429 template <typename Matcher> |
| 427 void VisitBinop(InstructionSelector* selector, Node* node, ArchOpcode opcode, | 430 void VisitBinop(InstructionSelector* selector, Node* node, ArchOpcode opcode, |
| 428 OperandModes operand_mode) { | 431 OperandModes operand_mode) { |
| 429 FlagsContinuation cont; | 432 FlagsContinuation cont; |
| (...skipping 1285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1715 InstructionOperand left, InstructionOperand right, | 1718 InstructionOperand left, InstructionOperand right, |
| 1716 FlagsContinuation* cont) { | 1719 FlagsContinuation* cont) { |
| 1717 S390OperandGenerator g(selector); | 1720 S390OperandGenerator g(selector); |
| 1718 opcode = cont->Encode(opcode); | 1721 opcode = cont->Encode(opcode); |
| 1719 if (cont->IsBranch()) { | 1722 if (cont->IsBranch()) { |
| 1720 selector->Emit(opcode, g.NoOutput(), left, right, | 1723 selector->Emit(opcode, g.NoOutput(), left, right, |
| 1721 g.Label(cont->true_block()), g.Label(cont->false_block())); | 1724 g.Label(cont->true_block()), g.Label(cont->false_block())); |
| 1722 } else if (cont->IsDeoptimize()) { | 1725 } else if (cont->IsDeoptimize()) { |
| 1723 selector->EmitDeoptimize(opcode, g.NoOutput(), left, right, cont->reason(), | 1726 selector->EmitDeoptimize(opcode, g.NoOutput(), left, right, cont->reason(), |
| 1724 cont->frame_state()); | 1727 cont->frame_state()); |
| 1728 } else if (cont->IsSet()) { |
| 1729 selector->Emit(opcode, g.DefineAsRegister(cont->result()), left, right); |
| 1725 } else { | 1730 } else { |
| 1726 DCHECK(cont->IsSet()); | 1731 DCHECK(cont->IsTrap()); |
| 1727 selector->Emit(opcode, g.DefineAsRegister(cont->result()), left, right); | 1732 selector->Emit(opcode, g.NoOutput(), left, right, |
| 1733 g.UseImmediate(cont->trap_id())); |
| 1728 } | 1734 } |
| 1729 } | 1735 } |
| 1730 | 1736 |
| 1731 // Shared routine for multiple word compare operations. | 1737 // Shared routine for multiple word compare operations. |
| 1732 void VisitWordCompare(InstructionSelector* selector, Node* node, | 1738 void VisitWordCompare(InstructionSelector* selector, Node* node, |
| 1733 InstructionCode opcode, FlagsContinuation* cont, | 1739 InstructionCode opcode, FlagsContinuation* cont, |
| 1734 bool commutative, OperandModes immediate_mode) { | 1740 bool commutative, OperandModes immediate_mode) { |
| 1735 S390OperandGenerator g(selector); | 1741 S390OperandGenerator g(selector); |
| 1736 Node* left = node->InputAt(0); | 1742 Node* left = node->InputAt(0); |
| 1737 Node* right = node->InputAt(1); | 1743 Node* right = node->InputAt(1); |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1998 VisitWord32CompareZero(this, node, node->InputAt(0), &cont); | 2004 VisitWord32CompareZero(this, node, node->InputAt(0), &cont); |
| 1999 } | 2005 } |
| 2000 | 2006 |
| 2001 void InstructionSelector::VisitDeoptimizeUnless(Node* node) { | 2007 void InstructionSelector::VisitDeoptimizeUnless(Node* node) { |
| 2002 FlagsContinuation cont = FlagsContinuation::ForDeoptimize( | 2008 FlagsContinuation cont = FlagsContinuation::ForDeoptimize( |
| 2003 kEqual, DeoptimizeReasonOf(node->op()), node->InputAt(1)); | 2009 kEqual, DeoptimizeReasonOf(node->op()), node->InputAt(1)); |
| 2004 VisitWord32CompareZero(this, node, node->InputAt(0), &cont); | 2010 VisitWord32CompareZero(this, node, node->InputAt(0), &cont); |
| 2005 } | 2011 } |
| 2006 | 2012 |
| 2007 void InstructionSelector::VisitTrapIf(Node* node, Runtime::FunctionId func_id) { | 2013 void InstructionSelector::VisitTrapIf(Node* node, Runtime::FunctionId func_id) { |
| 2008 UNREACHABLE(); | 2014 FlagsContinuation cont = |
| 2015 FlagsContinuation::ForTrap(kNotEqual, func_id, node->InputAt(1)); |
| 2016 VisitWord32CompareZero(this, node, node->InputAt(0), &cont); |
| 2009 } | 2017 } |
| 2010 | 2018 |
| 2011 void InstructionSelector::VisitTrapUnless(Node* node, | 2019 void InstructionSelector::VisitTrapUnless(Node* node, |
| 2012 Runtime::FunctionId func_id) { | 2020 Runtime::FunctionId func_id) { |
| 2013 UNREACHABLE(); | 2021 FlagsContinuation cont = |
| 2022 FlagsContinuation::ForTrap(kEqual, func_id, node->InputAt(1)); |
| 2023 VisitWord32CompareZero(this, node, node->InputAt(0), &cont); |
| 2014 } | 2024 } |
| 2015 | 2025 |
| 2016 void InstructionSelector::VisitSwitch(Node* node, const SwitchInfo& sw) { | 2026 void InstructionSelector::VisitSwitch(Node* node, const SwitchInfo& sw) { |
| 2017 S390OperandGenerator g(this); | 2027 S390OperandGenerator g(this); |
| 2018 InstructionOperand value_operand = g.UseRegister(node->InputAt(0)); | 2028 InstructionOperand value_operand = g.UseRegister(node->InputAt(0)); |
| 2019 | 2029 |
| 2020 // Emit either ArchTableSwitch or ArchLookupSwitch. | 2030 // Emit either ArchTableSwitch or ArchLookupSwitch. |
| 2021 size_t table_space_cost = 4 + sw.value_range; | 2031 size_t table_space_cost = 4 + sw.value_range; |
| 2022 size_t table_time_cost = 3; | 2032 size_t table_time_cost = 3; |
| 2023 size_t lookup_space_cost = 3 + 2 * sw.case_count; | 2033 size_t lookup_space_cost = 3 + 2 * sw.case_count; |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2300 // static | 2310 // static |
| 2301 MachineOperatorBuilder::AlignmentRequirements | 2311 MachineOperatorBuilder::AlignmentRequirements |
| 2302 InstructionSelector::AlignmentRequirements() { | 2312 InstructionSelector::AlignmentRequirements() { |
| 2303 return MachineOperatorBuilder::AlignmentRequirements:: | 2313 return MachineOperatorBuilder::AlignmentRequirements:: |
| 2304 FullUnalignedAccessSupport(); | 2314 FullUnalignedAccessSupport(); |
| 2305 } | 2315 } |
| 2306 | 2316 |
| 2307 } // namespace compiler | 2317 } // namespace compiler |
| 2308 } // namespace internal | 2318 } // namespace internal |
| 2309 } // namespace v8 | 2319 } // namespace v8 |
| OLD | NEW |