| 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 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1073 void InstructionSelector::VisitFloat64RoundTruncate(Node* node) { | 1073 void InstructionSelector::VisitFloat64RoundTruncate(Node* node) { |
| 1074 VisitRR(this, kArmVrintzF64, node); | 1074 VisitRR(this, kArmVrintzF64, node); |
| 1075 } | 1075 } |
| 1076 | 1076 |
| 1077 | 1077 |
| 1078 void InstructionSelector::VisitFloat64RoundTiesAway(Node* node) { | 1078 void InstructionSelector::VisitFloat64RoundTiesAway(Node* node) { |
| 1079 VisitRR(this, kArmVrintaF64, node); | 1079 VisitRR(this, kArmVrintaF64, node); |
| 1080 } | 1080 } |
| 1081 | 1081 |
| 1082 | 1082 |
| 1083 void InstructionSelector::VisitCall(Node* node, BasicBlock* handler) { | 1083 void InstructionSelector::VisitCall(Node* node, BasicBlock* handler, |
| 1084 CallMode call_mode) { |
| 1084 ArmOperandGenerator g(this); | 1085 ArmOperandGenerator g(this); |
| 1085 const CallDescriptor* descriptor = OpParameter<const CallDescriptor*>(node); | 1086 const CallDescriptor* descriptor = OpParameter<const CallDescriptor*>(node); |
| 1086 | 1087 |
| 1087 FrameStateDescriptor* frame_state_descriptor = NULL; | 1088 FrameStateDescriptor* frame_state_descriptor = NULL; |
| 1088 if (descriptor->NeedsFrameState()) { | 1089 if (descriptor->NeedsFrameState()) { |
| 1089 frame_state_descriptor = | 1090 frame_state_descriptor = |
| 1090 GetFrameStateDescriptor(node->InputAt(descriptor->InputCount())); | 1091 GetFrameStateDescriptor(node->InputAt(descriptor->InputCount())); |
| 1091 } | 1092 } |
| 1092 | 1093 |
| 1093 CallBuffer buffer(zone(), descriptor, frame_state_descriptor); | 1094 CallBuffer buffer(zone(), descriptor, frame_state_descriptor); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1105 } | 1106 } |
| 1106 | 1107 |
| 1107 // Pass label of exception handler block. | 1108 // Pass label of exception handler block. |
| 1108 CallDescriptor::Flags flags = descriptor->flags(); | 1109 CallDescriptor::Flags flags = descriptor->flags(); |
| 1109 if (handler != nullptr) { | 1110 if (handler != nullptr) { |
| 1110 flags |= CallDescriptor::kHasExceptionHandler; | 1111 flags |= CallDescriptor::kHasExceptionHandler; |
| 1111 buffer.instruction_args.push_back(g.Label(handler)); | 1112 buffer.instruction_args.push_back(g.Label(handler)); |
| 1112 } | 1113 } |
| 1113 | 1114 |
| 1114 // Select the appropriate opcode based on the call type. | 1115 // Select the appropriate opcode based on the call type. |
| 1116 bool is_tail_call = call_mode == TAIL_CALL; |
| 1115 InstructionCode opcode; | 1117 InstructionCode opcode; |
| 1116 switch (descriptor->kind()) { | 1118 switch (descriptor->kind()) { |
| 1117 case CallDescriptor::kCallCodeObject: { | 1119 case CallDescriptor::kCallCodeObject: { |
| 1118 opcode = kArchCallCodeObject; | 1120 opcode = is_tail_call ? kArchTailCallCodeObject : kArchCallCodeObject; |
| 1119 break; | 1121 break; |
| 1120 } | 1122 } |
| 1121 case CallDescriptor::kCallJSFunction: | 1123 case CallDescriptor::kCallJSFunction: |
| 1122 opcode = kArchCallJSFunction; | 1124 opcode = is_tail_call ? kArchTailCallJSFunction : kArchCallJSFunction; |
| 1123 break; | 1125 break; |
| 1124 default: | 1126 default: |
| 1125 UNREACHABLE(); | 1127 UNREACHABLE(); |
| 1126 return; | 1128 return; |
| 1127 } | 1129 } |
| 1128 opcode |= MiscField::encode(flags); | 1130 opcode |= MiscField::encode(flags); |
| 1129 | 1131 |
| 1130 // Emit the call instruction. | 1132 // Emit the call instruction. |
| 1133 size_t size = is_tail_call ? 0 : buffer.outputs.size(); |
| 1131 InstructionOperand* first_output = | 1134 InstructionOperand* first_output = |
| 1132 buffer.outputs.size() > 0 ? &buffer.outputs.front() : NULL; | 1135 size > 0 ? &buffer.outputs.front() : nullptr; |
| 1133 Instruction* call_instr = | 1136 Instruction* call_instr = |
| 1134 Emit(opcode, buffer.outputs.size(), first_output, | 1137 Emit(opcode, size, first_output, buffer.instruction_args.size(), |
| 1135 buffer.instruction_args.size(), &buffer.instruction_args.front()); | 1138 &buffer.instruction_args.front()); |
| 1136 call_instr->MarkAsCall(); | 1139 call_instr->MarkAsCall(); |
| 1137 } | 1140 } |
| 1138 | 1141 |
| 1139 | 1142 |
| 1140 namespace { | 1143 namespace { |
| 1141 | 1144 |
| 1142 // Shared routine for multiple float32 compare operations. | 1145 // Shared routine for multiple float32 compare operations. |
| 1143 void VisitFloat32Compare(InstructionSelector* selector, Node* node, | 1146 void VisitFloat32Compare(InstructionSelector* selector, Node* node, |
| 1144 FlagsContinuation* cont) { | 1147 FlagsContinuation* cont) { |
| 1145 ArmOperandGenerator g(selector); | 1148 ArmOperandGenerator g(selector); |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1521 flags |= MachineOperatorBuilder::kFloat64RoundDown | | 1524 flags |= MachineOperatorBuilder::kFloat64RoundDown | |
| 1522 MachineOperatorBuilder::kFloat64RoundTruncate | | 1525 MachineOperatorBuilder::kFloat64RoundTruncate | |
| 1523 MachineOperatorBuilder::kFloat64RoundTiesAway; | 1526 MachineOperatorBuilder::kFloat64RoundTiesAway; |
| 1524 } | 1527 } |
| 1525 return flags; | 1528 return flags; |
| 1526 } | 1529 } |
| 1527 | 1530 |
| 1528 } // namespace compiler | 1531 } // namespace compiler |
| 1529 } // namespace internal | 1532 } // namespace internal |
| 1530 } // namespace v8 | 1533 } // namespace v8 |
| OLD | NEW |