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-impl.h" | 5 #include "src/compiler/instruction-selector-impl.h" |
6 #include "src/compiler/node-matchers.h" | 6 #include "src/compiler/node-matchers.h" |
7 #include "src/compiler/node-properties.h" | 7 #include "src/compiler/node-properties.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 1186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1197 void InstructionSelector::VisitFloat64RoundTruncate(Node* node) { | 1197 void InstructionSelector::VisitFloat64RoundTruncate(Node* node) { |
1198 VisitRR(this, kArm64Float64RoundTruncate, node); | 1198 VisitRR(this, kArm64Float64RoundTruncate, node); |
1199 } | 1199 } |
1200 | 1200 |
1201 | 1201 |
1202 void InstructionSelector::VisitFloat64RoundTiesAway(Node* node) { | 1202 void InstructionSelector::VisitFloat64RoundTiesAway(Node* node) { |
1203 VisitRR(this, kArm64Float64RoundTiesAway, node); | 1203 VisitRR(this, kArm64Float64RoundTiesAway, node); |
1204 } | 1204 } |
1205 | 1205 |
1206 | 1206 |
1207 void InstructionSelector::VisitCall(Node* node, BasicBlock* handler) { | 1207 void InstructionSelector::VisitCall(Node* node, BasicBlock* handler, |
| 1208 CallMode call_mode) { |
1208 Arm64OperandGenerator g(this); | 1209 Arm64OperandGenerator g(this); |
1209 const CallDescriptor* descriptor = OpParameter<const CallDescriptor*>(node); | 1210 const CallDescriptor* descriptor = OpParameter<const CallDescriptor*>(node); |
1210 | 1211 |
1211 FrameStateDescriptor* frame_state_descriptor = NULL; | 1212 FrameStateDescriptor* frame_state_descriptor = NULL; |
1212 if (descriptor->NeedsFrameState()) { | 1213 if (descriptor->NeedsFrameState()) { |
1213 frame_state_descriptor = | 1214 frame_state_descriptor = |
1214 GetFrameStateDescriptor(node->InputAt(descriptor->InputCount())); | 1215 GetFrameStateDescriptor(node->InputAt(descriptor->InputCount())); |
1215 } | 1216 } |
1216 | 1217 |
1217 CallBuffer buffer(zone(), descriptor, frame_state_descriptor); | 1218 CallBuffer buffer(zone(), descriptor, frame_state_descriptor); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1253 } | 1254 } |
1254 | 1255 |
1255 // Pass label of exception handler block. | 1256 // Pass label of exception handler block. |
1256 CallDescriptor::Flags flags = descriptor->flags(); | 1257 CallDescriptor::Flags flags = descriptor->flags(); |
1257 if (handler != nullptr) { | 1258 if (handler != nullptr) { |
1258 flags |= CallDescriptor::kHasExceptionHandler; | 1259 flags |= CallDescriptor::kHasExceptionHandler; |
1259 buffer.instruction_args.push_back(g.Label(handler)); | 1260 buffer.instruction_args.push_back(g.Label(handler)); |
1260 } | 1261 } |
1261 | 1262 |
1262 // Select the appropriate opcode based on the call type. | 1263 // Select the appropriate opcode based on the call type. |
| 1264 bool is_tail_call = call_mode == TAIL_CALL; |
1263 InstructionCode opcode; | 1265 InstructionCode opcode; |
1264 switch (descriptor->kind()) { | 1266 switch (descriptor->kind()) { |
1265 case CallDescriptor::kCallCodeObject: { | 1267 case CallDescriptor::kCallCodeObject: { |
1266 opcode = kArchCallCodeObject; | 1268 opcode = is_tail_call ? kArchTailCallCodeObject : kArchCallCodeObject; |
1267 break; | 1269 break; |
1268 } | 1270 } |
1269 case CallDescriptor::kCallJSFunction: | 1271 case CallDescriptor::kCallJSFunction: |
1270 opcode = kArchCallJSFunction; | 1272 opcode = is_tail_call ? kArchTailCallJSFunction : kArchCallJSFunction; |
1271 break; | 1273 break; |
1272 default: | 1274 default: |
1273 UNREACHABLE(); | 1275 UNREACHABLE(); |
1274 return; | 1276 return; |
1275 } | 1277 } |
1276 opcode |= MiscField::encode(flags); | 1278 opcode |= MiscField::encode(flags); |
1277 | 1279 |
1278 // Emit the call instruction. | 1280 // Emit the call instruction. |
| 1281 size_t size = is_tail_call ? 0 : buffer.outputs.size(); |
1279 InstructionOperand* first_output = | 1282 InstructionOperand* first_output = |
1280 buffer.outputs.size() > 0 ? &buffer.outputs.front() : NULL; | 1283 size > 0 ? &buffer.outputs.front() : nullptr; |
1281 Instruction* call_instr = | 1284 Instruction* call_instr = |
1282 Emit(opcode, buffer.outputs.size(), first_output, | 1285 Emit(opcode, size, first_output, buffer.instruction_args.size(), |
1283 buffer.instruction_args.size(), &buffer.instruction_args.front()); | 1286 &buffer.instruction_args.front()); |
1284 call_instr->MarkAsCall(); | 1287 call_instr->MarkAsCall(); |
1285 } | 1288 } |
1286 | 1289 |
1287 | 1290 |
1288 namespace { | 1291 namespace { |
1289 | 1292 |
1290 // Shared routine for multiple compare operations. | 1293 // Shared routine for multiple compare operations. |
1291 void VisitCompare(InstructionSelector* selector, InstructionCode opcode, | 1294 void VisitCompare(InstructionSelector* selector, InstructionCode opcode, |
1292 InstructionOperand left, InstructionOperand right, | 1295 InstructionOperand left, InstructionOperand right, |
1293 FlagsContinuation* cont) { | 1296 FlagsContinuation* cont) { |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1773 MachineOperatorBuilder::kFloat64RoundTruncate | | 1776 MachineOperatorBuilder::kFloat64RoundTruncate | |
1774 MachineOperatorBuilder::kFloat64RoundTiesAway | | 1777 MachineOperatorBuilder::kFloat64RoundTiesAway | |
1775 MachineOperatorBuilder::kWord32ShiftIsSafe | | 1778 MachineOperatorBuilder::kWord32ShiftIsSafe | |
1776 MachineOperatorBuilder::kInt32DivIsSafe | | 1779 MachineOperatorBuilder::kInt32DivIsSafe | |
1777 MachineOperatorBuilder::kUint32DivIsSafe; | 1780 MachineOperatorBuilder::kUint32DivIsSafe; |
1778 } | 1781 } |
1779 | 1782 |
1780 } // namespace compiler | 1783 } // namespace compiler |
1781 } // namespace internal | 1784 } // namespace internal |
1782 } // namespace v8 | 1785 } // namespace v8 |
OLD | NEW |