| 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/base/adapters.h" | 9 #include "src/base/adapters.h" |
| 10 #include "src/compiler/instruction-selector-impl.h" | 10 #include "src/compiler/instruction-selector-impl.h" |
| (...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1070 case IrOpcode::kFloat64InsertLowWord32: | 1070 case IrOpcode::kFloat64InsertLowWord32: |
| 1071 return MarkAsFloat64(node), VisitFloat64InsertLowWord32(node); | 1071 return MarkAsFloat64(node), VisitFloat64InsertLowWord32(node); |
| 1072 case IrOpcode::kFloat64InsertHighWord32: | 1072 case IrOpcode::kFloat64InsertHighWord32: |
| 1073 return MarkAsFloat64(node), VisitFloat64InsertHighWord32(node); | 1073 return MarkAsFloat64(node), VisitFloat64InsertHighWord32(node); |
| 1074 case IrOpcode::kStackSlot: | 1074 case IrOpcode::kStackSlot: |
| 1075 return VisitStackSlot(node); | 1075 return VisitStackSlot(node); |
| 1076 case IrOpcode::kLoadStackPointer: | 1076 case IrOpcode::kLoadStackPointer: |
| 1077 return VisitLoadStackPointer(node); | 1077 return VisitLoadStackPointer(node); |
| 1078 case IrOpcode::kLoadFramePointer: | 1078 case IrOpcode::kLoadFramePointer: |
| 1079 return VisitLoadFramePointer(node); | 1079 return VisitLoadFramePointer(node); |
| 1080 case IrOpcode::kLoadParentFramePointer: |
| 1081 return VisitLoadParentFramePointer(node); |
| 1080 case IrOpcode::kCheckedLoad: { | 1082 case IrOpcode::kCheckedLoad: { |
| 1081 MachineRepresentation rep = | 1083 MachineRepresentation rep = |
| 1082 CheckedLoadRepresentationOf(node->op()).representation(); | 1084 CheckedLoadRepresentationOf(node->op()).representation(); |
| 1083 MarkAsRepresentation(rep, node); | 1085 MarkAsRepresentation(rep, node); |
| 1084 return VisitCheckedLoad(node); | 1086 return VisitCheckedLoad(node); |
| 1085 } | 1087 } |
| 1086 case IrOpcode::kCheckedStore: | 1088 case IrOpcode::kCheckedStore: |
| 1087 return VisitCheckedStore(node); | 1089 return VisitCheckedStore(node); |
| 1088 default: | 1090 default: |
| 1089 V8_Fatal(__FILE__, __LINE__, "Unexpected operator #%d:%s @ node #%d", | 1091 V8_Fatal(__FILE__, __LINE__, "Unexpected operator #%d:%s @ node #%d", |
| 1090 node->opcode(), node->op()->mnemonic(), node->id()); | 1092 node->opcode(), node->op()->mnemonic(), node->id()); |
| 1091 break; | 1093 break; |
| 1092 } | 1094 } |
| 1093 } | 1095 } |
| 1094 | 1096 |
| 1095 | 1097 |
| 1096 void InstructionSelector::VisitLoadStackPointer(Node* node) { | 1098 void InstructionSelector::VisitLoadStackPointer(Node* node) { |
| 1097 OperandGenerator g(this); | 1099 OperandGenerator g(this); |
| 1098 Emit(kArchStackPointer, g.DefineAsRegister(node)); | 1100 Emit(kArchStackPointer, g.DefineAsRegister(node)); |
| 1099 } | 1101 } |
| 1100 | 1102 |
| 1101 | 1103 |
| 1102 void InstructionSelector::VisitLoadFramePointer(Node* node) { | 1104 void InstructionSelector::VisitLoadFramePointer(Node* node) { |
| 1103 OperandGenerator g(this); | 1105 OperandGenerator g(this); |
| 1106 frame_->MarkNeedsFrame(); |
| 1104 Emit(kArchFramePointer, g.DefineAsRegister(node)); | 1107 Emit(kArchFramePointer, g.DefineAsRegister(node)); |
| 1105 } | 1108 } |
| 1106 | 1109 |
| 1110 void InstructionSelector::VisitLoadParentFramePointer(Node* node) { |
| 1111 OperandGenerator g(this); |
| 1112 Emit(kArchParentFramePointer, g.DefineAsRegister(node)); |
| 1113 } |
| 1107 | 1114 |
| 1108 void InstructionSelector::EmitTableSwitch(const SwitchInfo& sw, | 1115 void InstructionSelector::EmitTableSwitch(const SwitchInfo& sw, |
| 1109 InstructionOperand& index_operand) { | 1116 InstructionOperand& index_operand) { |
| 1110 OperandGenerator g(this); | 1117 OperandGenerator g(this); |
| 1111 size_t input_count = 2 + sw.value_range; | 1118 size_t input_count = 2 + sw.value_range; |
| 1112 auto* inputs = zone()->NewArray<InstructionOperand>(input_count); | 1119 auto* inputs = zone()->NewArray<InstructionOperand>(input_count); |
| 1113 inputs[0] = index_operand; | 1120 inputs[0] = index_operand; |
| 1114 InstructionOperand default_operand = g.Label(sw.default_branch); | 1121 InstructionOperand default_operand = g.Label(sw.default_branch); |
| 1115 std::fill(&inputs[1], &inputs[input_count], default_operand); | 1122 std::fill(&inputs[1], &inputs[input_count], default_operand); |
| 1116 for (size_t index = 0; index < sw.case_count; ++index) { | 1123 for (size_t index = 0; index < sw.case_count; ++index) { |
| (...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1640 return new (instruction_zone()) FrameStateDescriptor( | 1647 return new (instruction_zone()) FrameStateDescriptor( |
| 1641 instruction_zone(), state_info.type(), state_info.bailout_id(), | 1648 instruction_zone(), state_info.type(), state_info.bailout_id(), |
| 1642 state_info.state_combine(), parameters, locals, stack, | 1649 state_info.state_combine(), parameters, locals, stack, |
| 1643 state_info.shared_info(), outer_state); | 1650 state_info.shared_info(), outer_state); |
| 1644 } | 1651 } |
| 1645 | 1652 |
| 1646 | 1653 |
| 1647 } // namespace compiler | 1654 } // namespace compiler |
| 1648 } // namespace internal | 1655 } // namespace internal |
| 1649 } // namespace v8 | 1656 } // namespace v8 |
| OLD | NEW |