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/compiler/instruction-selector.h" | 5 #include "src/compiler/instruction-selector.h" |
6 | 6 |
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-inl.h" | 9 #include "src/compiler/node-properties-inl.h" |
10 #include "src/compiler/pipeline.h" | 10 #include "src/compiler/pipeline.h" |
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 case IrOpcode::kIfFalse: | 536 case IrOpcode::kIfFalse: |
537 case IrOpcode::kEffectPhi: | 537 case IrOpcode::kEffectPhi: |
538 case IrOpcode::kMerge: | 538 case IrOpcode::kMerge: |
539 case IrOpcode::kTerminate: | 539 case IrOpcode::kTerminate: |
540 // No code needed for these graph artifacts. | 540 // No code needed for these graph artifacts. |
541 return kMachNone; | 541 return kMachNone; |
542 case IrOpcode::kFinish: | 542 case IrOpcode::kFinish: |
543 return kMachAnyTagged; | 543 return kMachAnyTagged; |
544 case IrOpcode::kParameter: | 544 case IrOpcode::kParameter: |
545 return linkage()->GetParameterType(OpParameter<int>(node)); | 545 return linkage()->GetParameterType(OpParameter<int>(node)); |
| 546 case IrOpcode::kOsrValue: |
| 547 return kMachAnyTagged; |
546 case IrOpcode::kPhi: | 548 case IrOpcode::kPhi: |
547 return OpParameter<MachineType>(node); | 549 return OpParameter<MachineType>(node); |
548 case IrOpcode::kProjection: | 550 case IrOpcode::kProjection: |
549 // TODO(jarin) Really project from outputs. | 551 // TODO(jarin) Really project from outputs. |
550 return kMachAnyTagged; | 552 return kMachAnyTagged; |
551 case IrOpcode::kInt32Constant: | 553 case IrOpcode::kInt32Constant: |
552 return kMachInt32; | 554 return kMachInt32; |
553 case IrOpcode::kInt64Constant: | 555 case IrOpcode::kInt64Constant: |
554 return kMachInt64; | 556 return kMachInt64; |
555 case IrOpcode::kExternalConstant: | 557 case IrOpcode::kExternalConstant: |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 case IrOpcode::kMerge: | 676 case IrOpcode::kMerge: |
675 // No code needed for these graph artifacts. | 677 // No code needed for these graph artifacts. |
676 return; | 678 return; |
677 case IrOpcode::kFinish: | 679 case IrOpcode::kFinish: |
678 return MarkAsReference(node), VisitFinish(node); | 680 return MarkAsReference(node), VisitFinish(node); |
679 case IrOpcode::kParameter: { | 681 case IrOpcode::kParameter: { |
680 MachineType type = linkage()->GetParameterType(OpParameter<int>(node)); | 682 MachineType type = linkage()->GetParameterType(OpParameter<int>(node)); |
681 MarkAsRepresentation(type, node); | 683 MarkAsRepresentation(type, node); |
682 return VisitParameter(node); | 684 return VisitParameter(node); |
683 } | 685 } |
| 686 case IrOpcode::kOsrValue: |
| 687 return MarkAsReference(node), VisitOsrValue(node); |
684 case IrOpcode::kPhi: { | 688 case IrOpcode::kPhi: { |
685 MachineType type = OpParameter<MachineType>(node); | 689 MachineType type = OpParameter<MachineType>(node); |
686 MarkAsRepresentation(type, node); | 690 MarkAsRepresentation(type, node); |
687 return VisitPhi(node); | 691 return VisitPhi(node); |
688 } | 692 } |
689 case IrOpcode::kProjection: | 693 case IrOpcode::kProjection: |
690 return VisitProjection(node); | 694 return VisitProjection(node); |
691 case IrOpcode::kInt32Constant: | 695 case IrOpcode::kInt32Constant: |
692 case IrOpcode::kInt64Constant: | 696 case IrOpcode::kInt64Constant: |
693 case IrOpcode::kExternalConstant: | 697 case IrOpcode::kExternalConstant: |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
958 | 962 |
959 void InstructionSelector::VisitParameter(Node* node) { | 963 void InstructionSelector::VisitParameter(Node* node) { |
960 OperandGenerator g(this); | 964 OperandGenerator g(this); |
961 int index = OpParameter<int>(node); | 965 int index = OpParameter<int>(node); |
962 Emit(kArchNop, | 966 Emit(kArchNop, |
963 g.DefineAsLocation(node, linkage()->GetParameterLocation(index), | 967 g.DefineAsLocation(node, linkage()->GetParameterLocation(index), |
964 linkage()->GetParameterType(index))); | 968 linkage()->GetParameterType(index))); |
965 } | 969 } |
966 | 970 |
967 | 971 |
| 972 void InstructionSelector::VisitOsrValue(Node* node) { |
| 973 OperandGenerator g(this); |
| 974 int index = OpParameter<int>(node); |
| 975 Emit(kArchNop, g.DefineAsLocation(node, linkage()->GetOsrValueLocation(index), |
| 976 kMachAnyTagged)); |
| 977 } |
| 978 |
| 979 |
968 void InstructionSelector::VisitPhi(Node* node) { | 980 void InstructionSelector::VisitPhi(Node* node) { |
969 const int input_count = node->op()->ValueInputCount(); | 981 const int input_count = node->op()->ValueInputCount(); |
970 PhiInstruction* phi = new (instruction_zone()) | 982 PhiInstruction* phi = new (instruction_zone()) |
971 PhiInstruction(instruction_zone(), GetVirtualRegister(node), | 983 PhiInstruction(instruction_zone(), GetVirtualRegister(node), |
972 static_cast<size_t>(input_count)); | 984 static_cast<size_t>(input_count)); |
973 sequence()->InstructionBlockAt(current_block_->GetRpoNumber())->AddPhi(phi); | 985 sequence()->InstructionBlockAt(current_block_->GetRpoNumber())->AddPhi(phi); |
974 for (int i = 0; i < input_count; ++i) { | 986 for (int i = 0; i < input_count; ++i) { |
975 Node* const input = node->InputAt(i); | 987 Node* const input = node->InputAt(i); |
976 MarkAsUsed(input); | 988 MarkAsUsed(input); |
977 phi->Extend(instruction_zone(), GetVirtualRegister(input)); | 989 phi->Extend(instruction_zone(), GetVirtualRegister(input)); |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1149 MachineOperatorBuilder::Flags | 1161 MachineOperatorBuilder::Flags |
1150 InstructionSelector::SupportedMachineOperatorFlags() { | 1162 InstructionSelector::SupportedMachineOperatorFlags() { |
1151 return MachineOperatorBuilder::Flag::kNoFlags; | 1163 return MachineOperatorBuilder::Flag::kNoFlags; |
1152 } | 1164 } |
1153 | 1165 |
1154 #endif // !V8_TURBOFAN_BACKEND | 1166 #endif // !V8_TURBOFAN_BACKEND |
1155 | 1167 |
1156 } // namespace compiler | 1168 } // namespace compiler |
1157 } // namespace internal | 1169 } // namespace internal |
1158 } // namespace v8 | 1170 } // namespace v8 |
OLD | NEW |