| 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 | 8 |
| 9 namespace v8 { | 9 namespace v8 { |
| 10 namespace internal { | 10 namespace internal { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 case kArmLdr: | 61 case kArmLdr: |
| 62 case kArmStr: | 62 case kArmStr: |
| 63 case kArmStoreWriteBarrier: | 63 case kArmStoreWriteBarrier: |
| 64 return value >= -4095 && value <= 4095; | 64 return value >= -4095 && value <= 4095; |
| 65 | 65 |
| 66 case kArmLdrh: | 66 case kArmLdrh: |
| 67 case kArmLdrsh: | 67 case kArmLdrsh: |
| 68 case kArmStrh: | 68 case kArmStrh: |
| 69 return value >= -255 && value <= 255; | 69 return value >= -255 && value <= 255; |
| 70 | 70 |
| 71 case kArchCallAddress: | |
| 72 case kArchCallCodeObject: | 71 case kArchCallCodeObject: |
| 73 case kArchCallJSFunction: | 72 case kArchCallJSFunction: |
| 74 case kArchDrop: | |
| 75 case kArchJmp: | 73 case kArchJmp: |
| 76 case kArchNop: | 74 case kArchNop: |
| 77 case kArchRet: | 75 case kArchRet: |
| 78 case kArchTruncateDoubleToI: | 76 case kArchTruncateDoubleToI: |
| 79 case kArmMul: | 77 case kArmMul: |
| 80 case kArmMla: | 78 case kArmMla: |
| 81 case kArmMls: | 79 case kArmMls: |
| 82 case kArmSdiv: | 80 case kArmSdiv: |
| 83 case kArmUdiv: | 81 case kArmUdiv: |
| 84 case kArmBfc: | 82 case kArmBfc: |
| (...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 796 Emit(kArmPush, NULL, g.UseRegister(*input)); | 794 Emit(kArmPush, NULL, g.UseRegister(*input)); |
| 797 } | 795 } |
| 798 | 796 |
| 799 // Select the appropriate opcode based on the call type. | 797 // Select the appropriate opcode based on the call type. |
| 800 InstructionCode opcode; | 798 InstructionCode opcode; |
| 801 switch (descriptor->kind()) { | 799 switch (descriptor->kind()) { |
| 802 case CallDescriptor::kCallCodeObject: { | 800 case CallDescriptor::kCallCodeObject: { |
| 803 opcode = kArchCallCodeObject; | 801 opcode = kArchCallCodeObject; |
| 804 break; | 802 break; |
| 805 } | 803 } |
| 806 case CallDescriptor::kCallAddress: | |
| 807 opcode = kArchCallAddress; | |
| 808 break; | |
| 809 case CallDescriptor::kCallJSFunction: | 804 case CallDescriptor::kCallJSFunction: |
| 810 opcode = kArchCallJSFunction; | 805 opcode = kArchCallJSFunction; |
| 811 break; | 806 break; |
| 812 default: | 807 default: |
| 813 UNREACHABLE(); | 808 UNREACHABLE(); |
| 814 return; | 809 return; |
| 815 } | 810 } |
| 816 opcode |= MiscField::encode(descriptor->flags()); | 811 opcode |= MiscField::encode(descriptor->flags()); |
| 817 | 812 |
| 818 // Emit the call instruction. | 813 // Emit the call instruction. |
| 819 Instruction* call_instr = | 814 Instruction* call_instr = |
| 820 Emit(opcode, buffer.outputs.size(), &buffer.outputs.front(), | 815 Emit(opcode, buffer.outputs.size(), &buffer.outputs.front(), |
| 821 buffer.instruction_args.size(), &buffer.instruction_args.front()); | 816 buffer.instruction_args.size(), &buffer.instruction_args.front()); |
| 822 | 817 |
| 823 call_instr->MarkAsCall(); | 818 call_instr->MarkAsCall(); |
| 824 if (deoptimization != NULL) { | 819 if (deoptimization != NULL) { |
| 825 DCHECK(continuation != NULL); | 820 DCHECK(continuation != NULL); |
| 826 call_instr->MarkAsControl(); | 821 call_instr->MarkAsControl(); |
| 827 } | 822 } |
| 828 | |
| 829 // Caller clean up of stack for C-style calls. | |
| 830 if (descriptor->kind() == CallDescriptor::kCallAddress && | |
| 831 !buffer.pushed_nodes.empty()) { | |
| 832 DCHECK(deoptimization == NULL && continuation == NULL); | |
| 833 Emit(kArchDrop | MiscField::encode(buffer.pushed_nodes.size()), NULL); | |
| 834 } | |
| 835 } | 823 } |
| 836 | 824 |
| 837 | 825 |
| 838 void InstructionSelector::VisitInt32AddWithOverflow(Node* node, | 826 void InstructionSelector::VisitInt32AddWithOverflow(Node* node, |
| 839 FlagsContinuation* cont) { | 827 FlagsContinuation* cont) { |
| 840 VisitBinop(this, node, kArmAdd, kArmAdd, cont); | 828 VisitBinop(this, node, kArmAdd, kArmAdd, cont); |
| 841 } | 829 } |
| 842 | 830 |
| 843 | 831 |
| 844 void InstructionSelector::VisitInt32SubWithOverflow(Node* node, | 832 void InstructionSelector::VisitInt32SubWithOverflow(Node* node, |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 946 } else { | 934 } else { |
| 947 DCHECK(cont->IsSet()); | 935 DCHECK(cont->IsSet()); |
| 948 Emit(cont->Encode(kArmVcmpF64), g.DefineAsRegister(cont->result()), | 936 Emit(cont->Encode(kArmVcmpF64), g.DefineAsRegister(cont->result()), |
| 949 g.UseRegister(m.left().node()), g.UseRegister(m.right().node())); | 937 g.UseRegister(m.left().node()), g.UseRegister(m.right().node())); |
| 950 } | 938 } |
| 951 } | 939 } |
| 952 | 940 |
| 953 } // namespace compiler | 941 } // namespace compiler |
| 954 } // namespace internal | 942 } // namespace internal |
| 955 } // namespace v8 | 943 } // namespace v8 |
| OLD | NEW |