| 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 <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "src/compiler/instruction-selector-impl.h" | 9 #include "src/compiler/instruction-selector-impl.h" |
| 10 #include "src/compiler/node-matchers.h" | 10 #include "src/compiler/node-matchers.h" |
| (...skipping 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1024 Node* outer_node = state->InputAt(4); | 1024 Node* outer_node = state->InputAt(4); |
| 1025 if (outer_node->opcode() == IrOpcode::kFrameState) { | 1025 if (outer_node->opcode() == IrOpcode::kFrameState) { |
| 1026 outer_state = GetFrameStateDescriptor(outer_node); | 1026 outer_state = GetFrameStateDescriptor(outer_node); |
| 1027 } | 1027 } |
| 1028 | 1028 |
| 1029 return new (instruction_zone()) FrameStateDescriptor( | 1029 return new (instruction_zone()) FrameStateDescriptor( |
| 1030 instruction_zone(), state_info, parameters, locals, stack, outer_state); | 1030 instruction_zone(), state_info, parameters, locals, stack, outer_state); |
| 1031 } | 1031 } |
| 1032 | 1032 |
| 1033 | 1033 |
| 1034 static InstructionOperand UseOrImmediate(OperandGenerator* g, Node* input) { | 1034 static InstructionOperand SlotOrImmediate(OperandGenerator* g, Node* input) { |
| 1035 switch (input->opcode()) { | 1035 switch (input->opcode()) { |
| 1036 case IrOpcode::kInt32Constant: | 1036 case IrOpcode::kInt32Constant: |
| 1037 case IrOpcode::kNumberConstant: | 1037 case IrOpcode::kNumberConstant: |
| 1038 case IrOpcode::kFloat64Constant: | 1038 case IrOpcode::kFloat64Constant: |
| 1039 case IrOpcode::kHeapConstant: | 1039 case IrOpcode::kHeapConstant: |
| 1040 return g->UseImmediate(input); | 1040 return g->UseImmediate(input); |
| 1041 default: | 1041 default: |
| 1042 return g->UseUnique(input); | 1042 return g->UseUniqueSlot(input); |
| 1043 } | 1043 } |
| 1044 } | 1044 } |
| 1045 | 1045 |
| 1046 | 1046 |
| 1047 void InstructionSelector::AddFrameStateInputs( | 1047 void InstructionSelector::AddFrameStateInputs( |
| 1048 Node* state, InstructionOperandVector* inputs, | 1048 Node* state, InstructionOperandVector* inputs, |
| 1049 FrameStateDescriptor* descriptor) { | 1049 FrameStateDescriptor* descriptor) { |
| 1050 DCHECK_EQ(IrOpcode::kFrameState, state->op()->opcode()); | 1050 DCHECK_EQ(IrOpcode::kFrameState, state->op()->opcode()); |
| 1051 | 1051 |
| 1052 if (descriptor->outer_state() != NULL) { | 1052 if (descriptor->outer_state() != NULL) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1067 DCHECK_EQ(descriptor->locals_count(), StateValuesAccess(locals).size()); | 1067 DCHECK_EQ(descriptor->locals_count(), StateValuesAccess(locals).size()); |
| 1068 DCHECK_EQ(descriptor->stack_count(), StateValuesAccess(stack).size()); | 1068 DCHECK_EQ(descriptor->stack_count(), StateValuesAccess(stack).size()); |
| 1069 | 1069 |
| 1070 ZoneVector<MachineType> types(instruction_zone()); | 1070 ZoneVector<MachineType> types(instruction_zone()); |
| 1071 types.reserve(descriptor->GetSize()); | 1071 types.reserve(descriptor->GetSize()); |
| 1072 | 1072 |
| 1073 OperandGenerator g(this); | 1073 OperandGenerator g(this); |
| 1074 size_t value_index = 0; | 1074 size_t value_index = 0; |
| 1075 for (StateValuesAccess::TypedNode input_node : | 1075 for (StateValuesAccess::TypedNode input_node : |
| 1076 StateValuesAccess(parameters)) { | 1076 StateValuesAccess(parameters)) { |
| 1077 inputs->push_back(UseOrImmediate(&g, input_node.node)); | 1077 inputs->push_back(SlotOrImmediate(&g, input_node.node)); |
| 1078 descriptor->SetType(value_index++, input_node.type); | 1078 descriptor->SetType(value_index++, input_node.type); |
| 1079 } | 1079 } |
| 1080 if (descriptor->HasContext()) { | 1080 if (descriptor->HasContext()) { |
| 1081 inputs->push_back(UseOrImmediate(&g, context)); | 1081 inputs->push_back(SlotOrImmediate(&g, context)); |
| 1082 descriptor->SetType(value_index++, kMachAnyTagged); | 1082 descriptor->SetType(value_index++, kMachAnyTagged); |
| 1083 } | 1083 } |
| 1084 for (StateValuesAccess::TypedNode input_node : StateValuesAccess(locals)) { | 1084 for (StateValuesAccess::TypedNode input_node : StateValuesAccess(locals)) { |
| 1085 inputs->push_back(UseOrImmediate(&g, input_node.node)); | 1085 inputs->push_back(SlotOrImmediate(&g, input_node.node)); |
| 1086 descriptor->SetType(value_index++, input_node.type); | 1086 descriptor->SetType(value_index++, input_node.type); |
| 1087 } | 1087 } |
| 1088 for (StateValuesAccess::TypedNode input_node : StateValuesAccess(stack)) { | 1088 for (StateValuesAccess::TypedNode input_node : StateValuesAccess(stack)) { |
| 1089 inputs->push_back(UseOrImmediate(&g, input_node.node)); | 1089 inputs->push_back(SlotOrImmediate(&g, input_node.node)); |
| 1090 descriptor->SetType(value_index++, input_node.type); | 1090 descriptor->SetType(value_index++, input_node.type); |
| 1091 } | 1091 } |
| 1092 DCHECK(value_index == descriptor->GetSize()); | 1092 DCHECK(value_index == descriptor->GetSize()); |
| 1093 } | 1093 } |
| 1094 | 1094 |
| 1095 | 1095 |
| 1096 #if !V8_TURBOFAN_BACKEND | 1096 #if !V8_TURBOFAN_BACKEND |
| 1097 | 1097 |
| 1098 #define DECLARE_UNIMPLEMENTED_SELECTOR(x) \ | 1098 #define DECLARE_UNIMPLEMENTED_SELECTOR(x) \ |
| 1099 void InstructionSelector::Visit##x(Node* node) { UNIMPLEMENTED(); } | 1099 void InstructionSelector::Visit##x(Node* node) { UNIMPLEMENTED(); } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1124 MachineOperatorBuilder::Flags | 1124 MachineOperatorBuilder::Flags |
| 1125 InstructionSelector::SupportedMachineOperatorFlags() { | 1125 InstructionSelector::SupportedMachineOperatorFlags() { |
| 1126 return MachineOperatorBuilder::Flag::kNoFlags; | 1126 return MachineOperatorBuilder::Flag::kNoFlags; |
| 1127 } | 1127 } |
| 1128 | 1128 |
| 1129 #endif // !V8_TURBOFAN_BACKEND | 1129 #endif // !V8_TURBOFAN_BACKEND |
| 1130 | 1130 |
| 1131 } // namespace compiler | 1131 } // namespace compiler |
| 1132 } // namespace internal | 1132 } // namespace internal |
| 1133 } // namespace v8 | 1133 } // namespace v8 |
| OLD | NEW |