| 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/bits.h" | 5 #include "src/base/bits.h" | 
| 6 #include "src/compiler/instruction-selector-impl.h" | 6 #include "src/compiler/instruction-selector-impl.h" | 
| 7 #include "src/compiler/node-matchers.h" | 7 #include "src/compiler/node-matchers.h" | 
| 8 #include "src/compiler/node-properties.h" | 8 #include "src/compiler/node-properties.h" | 
| 9 | 9 | 
| 10 namespace v8 { | 10 namespace v8 { | 
| (...skipping 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1011   VisitRRFloat64(this, kArmVroundTruncateF64, node); | 1011   VisitRRFloat64(this, kArmVroundTruncateF64, node); | 
| 1012 } | 1012 } | 
| 1013 | 1013 | 
| 1014 | 1014 | 
| 1015 void InstructionSelector::VisitFloat64RoundTiesAway(Node* node) { | 1015 void InstructionSelector::VisitFloat64RoundTiesAway(Node* node) { | 
| 1016   DCHECK(CpuFeatures::IsSupported(ARMv8)); | 1016   DCHECK(CpuFeatures::IsSupported(ARMv8)); | 
| 1017   VisitRRFloat64(this, kArmVroundTiesAwayF64, node); | 1017   VisitRRFloat64(this, kArmVroundTiesAwayF64, node); | 
| 1018 } | 1018 } | 
| 1019 | 1019 | 
| 1020 | 1020 | 
| 1021 void InstructionSelector::VisitCall(Node* node) { | 1021 void InstructionSelector::VisitCall(Node* node, BasicBlock* handler) { | 
| 1022   ArmOperandGenerator g(this); | 1022   ArmOperandGenerator g(this); | 
| 1023   const CallDescriptor* descriptor = OpParameter<const CallDescriptor*>(node); | 1023   const CallDescriptor* descriptor = OpParameter<const CallDescriptor*>(node); | 
| 1024 | 1024 | 
| 1025   FrameStateDescriptor* frame_state_descriptor = NULL; | 1025   FrameStateDescriptor* frame_state_descriptor = NULL; | 
| 1026   if (descriptor->NeedsFrameState()) { | 1026   if (descriptor->NeedsFrameState()) { | 
| 1027     frame_state_descriptor = | 1027     frame_state_descriptor = | 
| 1028         GetFrameStateDescriptor(node->InputAt(descriptor->InputCount())); | 1028         GetFrameStateDescriptor(node->InputAt(descriptor->InputCount())); | 
| 1029   } | 1029   } | 
| 1030 | 1030 | 
| 1031   CallBuffer buffer(zone(), descriptor, frame_state_descriptor); | 1031   CallBuffer buffer(zone(), descriptor, frame_state_descriptor); | 
| 1032 | 1032 | 
| 1033   // Compute InstructionOperands for inputs and outputs. | 1033   // Compute InstructionOperands for inputs and outputs. | 
| 1034   // TODO(turbofan): on ARM64 it's probably better to use the code object in a | 1034   // TODO(turbofan): on ARM64 it's probably better to use the code object in a | 
| 1035   // register if there are multiple uses of it. Improve constant pool and the | 1035   // register if there are multiple uses of it. Improve constant pool and the | 
| 1036   // heuristics in the register allocator for where to emit constants. | 1036   // heuristics in the register allocator for where to emit constants. | 
| 1037   InitializeCallBuffer(node, &buffer, true, false); | 1037   InitializeCallBuffer(node, &buffer, true, false); | 
| 1038 | 1038 | 
| 1039   // TODO(dcarney): might be possible to use claim/poke instead | 1039   // TODO(dcarney): might be possible to use claim/poke instead | 
| 1040   // Push any stack arguments. | 1040   // Push any stack arguments. | 
| 1041   for (auto i = buffer.pushed_nodes.rbegin(); i != buffer.pushed_nodes.rend(); | 1041   for (auto i = buffer.pushed_nodes.rbegin(); i != buffer.pushed_nodes.rend(); | 
| 1042        ++i) { | 1042        ++i) { | 
| 1043     Emit(kArmPush, g.NoOutput(), g.UseRegister(*i)); | 1043     Emit(kArmPush, g.NoOutput(), g.UseRegister(*i)); | 
| 1044   } | 1044   } | 
| 1045 | 1045 | 
|  | 1046   // Pass label of exception handler block. | 
|  | 1047   CallDescriptor::Flags flags = descriptor->flags(); | 
|  | 1048   if (handler != nullptr) { | 
|  | 1049     flags |= CallDescriptor::kHasExceptionHandler; | 
|  | 1050     buffer.instruction_args.push_back(g.Label(handler)); | 
|  | 1051   } | 
|  | 1052 | 
| 1046   // Select the appropriate opcode based on the call type. | 1053   // Select the appropriate opcode based on the call type. | 
| 1047   InstructionCode opcode; | 1054   InstructionCode opcode; | 
| 1048   switch (descriptor->kind()) { | 1055   switch (descriptor->kind()) { | 
| 1049     case CallDescriptor::kCallCodeObject: { | 1056     case CallDescriptor::kCallCodeObject: { | 
| 1050       opcode = kArchCallCodeObject; | 1057       opcode = kArchCallCodeObject; | 
| 1051       break; | 1058       break; | 
| 1052     } | 1059     } | 
| 1053     case CallDescriptor::kCallJSFunction: | 1060     case CallDescriptor::kCallJSFunction: | 
| 1054       opcode = kArchCallJSFunction; | 1061       opcode = kArchCallJSFunction; | 
| 1055       break; | 1062       break; | 
| 1056     default: | 1063     default: | 
| 1057       UNREACHABLE(); | 1064       UNREACHABLE(); | 
| 1058       return; | 1065       return; | 
| 1059   } | 1066   } | 
| 1060   opcode |= MiscField::encode(descriptor->flags()); | 1067   opcode |= MiscField::encode(flags); | 
| 1061 | 1068 | 
| 1062   // Emit the call instruction. | 1069   // Emit the call instruction. | 
| 1063   InstructionOperand* first_output = | 1070   InstructionOperand* first_output = | 
| 1064       buffer.outputs.size() > 0 ? &buffer.outputs.front() : NULL; | 1071       buffer.outputs.size() > 0 ? &buffer.outputs.front() : NULL; | 
| 1065   Instruction* call_instr = | 1072   Instruction* call_instr = | 
| 1066       Emit(opcode, buffer.outputs.size(), first_output, | 1073       Emit(opcode, buffer.outputs.size(), first_output, | 
| 1067            buffer.instruction_args.size(), &buffer.instruction_args.front()); | 1074            buffer.instruction_args.size(), &buffer.instruction_args.front()); | 
| 1068   call_instr->MarkAsCall(); | 1075   call_instr->MarkAsCall(); | 
| 1069 } | 1076 } | 
| 1070 | 1077 | 
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1399              MachineOperatorBuilder::kFloat64Ceil | | 1406              MachineOperatorBuilder::kFloat64Ceil | | 
| 1400              MachineOperatorBuilder::kFloat64RoundTruncate | | 1407              MachineOperatorBuilder::kFloat64RoundTruncate | | 
| 1401              MachineOperatorBuilder::kFloat64RoundTiesAway; | 1408              MachineOperatorBuilder::kFloat64RoundTiesAway; | 
| 1402   } | 1409   } | 
| 1403   return flags; | 1410   return flags; | 
| 1404 } | 1411 } | 
| 1405 | 1412 | 
| 1406 }  // namespace compiler | 1413 }  // namespace compiler | 
| 1407 }  // namespace internal | 1414 }  // namespace internal | 
| 1408 }  // namespace v8 | 1415 }  // namespace v8 | 
| OLD | NEW | 
|---|