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/code-generator.h" | 5 #include "src/compiler/code-generator.h" |
6 | 6 |
7 #include "src/arm64/macro-assembler-arm64.h" | 7 #include "src/arm64/macro-assembler-arm64.h" |
8 #include "src/compiler/code-generator-impl.h" | 8 #include "src/compiler/code-generator-impl.h" |
9 #include "src/compiler/gap-resolver.h" | 9 #include "src/compiler/gap-resolver.h" |
10 #include "src/compiler/node-matchers.h" | 10 #include "src/compiler/node-matchers.h" |
11 #include "src/scopes.h" | 11 #include "src/scopes.h" |
12 | 12 |
13 namespace v8 { | 13 namespace v8 { |
14 namespace internal { | 14 namespace internal { |
15 namespace compiler { | 15 namespace compiler { |
16 | 16 |
17 #define __ masm()-> | 17 #define __ masm()-> |
18 | 18 |
19 | 19 |
20 // Adds Arm64-specific methods to convert InstructionOperands. | 20 // Adds Arm64-specific methods to convert InstructionOperands. |
21 class Arm64OperandConverter FINAL : public InstructionOperandConverter { | 21 class Arm64OperandConverter FINAL : public InstructionOperandConverter { |
22 public: | 22 public: |
23 Arm64OperandConverter(CodeGenerator* gen, Instruction* instr) | 23 Arm64OperandConverter(CodeGenerator* gen, Instruction* instr) |
24 : InstructionOperandConverter(gen, instr) {} | 24 : InstructionOperandConverter(gen, instr) {} |
25 | 25 |
26 DoubleRegister InputFloat32Register(int index) { | 26 DoubleRegister InputFloat32Register(size_t index) { |
27 return InputDoubleRegister(index).S(); | 27 return InputDoubleRegister(index).S(); |
28 } | 28 } |
29 | 29 |
30 DoubleRegister InputFloat64Register(int index) { | 30 DoubleRegister InputFloat64Register(size_t index) { |
31 return InputDoubleRegister(index); | 31 return InputDoubleRegister(index); |
32 } | 32 } |
33 | 33 |
34 DoubleRegister OutputFloat32Register() { return OutputDoubleRegister().S(); } | 34 DoubleRegister OutputFloat32Register() { return OutputDoubleRegister().S(); } |
35 | 35 |
36 DoubleRegister OutputFloat64Register() { return OutputDoubleRegister(); } | 36 DoubleRegister OutputFloat64Register() { return OutputDoubleRegister(); } |
37 | 37 |
38 Register InputRegister32(int index) { | 38 Register InputRegister32(size_t index) { |
39 return ToRegister(instr_->InputAt(index)).W(); | 39 return ToRegister(instr_->InputAt(index)).W(); |
40 } | 40 } |
41 | 41 |
42 Register InputRegister64(int index) { return InputRegister(index); } | 42 Register InputRegister64(size_t index) { return InputRegister(index); } |
43 | 43 |
44 Operand InputImmediate(int index) { | 44 Operand InputImmediate(size_t index) { |
45 return ToImmediate(instr_->InputAt(index)); | 45 return ToImmediate(instr_->InputAt(index)); |
46 } | 46 } |
47 | 47 |
48 Operand InputOperand(int index) { return ToOperand(instr_->InputAt(index)); } | 48 Operand InputOperand(size_t index) { |
| 49 return ToOperand(instr_->InputAt(index)); |
| 50 } |
49 | 51 |
50 Operand InputOperand64(int index) { return InputOperand(index); } | 52 Operand InputOperand64(size_t index) { return InputOperand(index); } |
51 | 53 |
52 Operand InputOperand32(int index) { | 54 Operand InputOperand32(size_t index) { |
53 return ToOperand32(instr_->InputAt(index)); | 55 return ToOperand32(instr_->InputAt(index)); |
54 } | 56 } |
55 | 57 |
56 Register OutputRegister64() { return OutputRegister(); } | 58 Register OutputRegister64() { return OutputRegister(); } |
57 | 59 |
58 Register OutputRegister32() { return ToRegister(instr_->Output()).W(); } | 60 Register OutputRegister32() { return ToRegister(instr_->Output()).W(); } |
59 | 61 |
60 Operand InputOperand2_32(int index) { | 62 Operand InputOperand2_32(size_t index) { |
61 switch (AddressingModeField::decode(instr_->opcode())) { | 63 switch (AddressingModeField::decode(instr_->opcode())) { |
62 case kMode_None: | 64 case kMode_None: |
63 return InputOperand32(index); | 65 return InputOperand32(index); |
64 case kMode_Operand2_R_LSL_I: | 66 case kMode_Operand2_R_LSL_I: |
65 return Operand(InputRegister32(index), LSL, InputInt5(index + 1)); | 67 return Operand(InputRegister32(index), LSL, InputInt5(index + 1)); |
66 case kMode_Operand2_R_LSR_I: | 68 case kMode_Operand2_R_LSR_I: |
67 return Operand(InputRegister32(index), LSR, InputInt5(index + 1)); | 69 return Operand(InputRegister32(index), LSR, InputInt5(index + 1)); |
68 case kMode_Operand2_R_ASR_I: | 70 case kMode_Operand2_R_ASR_I: |
69 return Operand(InputRegister32(index), ASR, InputInt5(index + 1)); | 71 return Operand(InputRegister32(index), ASR, InputInt5(index + 1)); |
70 case kMode_Operand2_R_ROR_I: | 72 case kMode_Operand2_R_ROR_I: |
71 return Operand(InputRegister32(index), ROR, InputInt5(index + 1)); | 73 return Operand(InputRegister32(index), ROR, InputInt5(index + 1)); |
72 case kMode_MRI: | 74 case kMode_MRI: |
73 case kMode_MRR: | 75 case kMode_MRR: |
74 break; | 76 break; |
75 } | 77 } |
76 UNREACHABLE(); | 78 UNREACHABLE(); |
77 return Operand(-1); | 79 return Operand(-1); |
78 } | 80 } |
79 | 81 |
80 Operand InputOperand2_64(int index) { | 82 Operand InputOperand2_64(size_t index) { |
81 switch (AddressingModeField::decode(instr_->opcode())) { | 83 switch (AddressingModeField::decode(instr_->opcode())) { |
82 case kMode_None: | 84 case kMode_None: |
83 return InputOperand64(index); | 85 return InputOperand64(index); |
84 case kMode_Operand2_R_LSL_I: | 86 case kMode_Operand2_R_LSL_I: |
85 return Operand(InputRegister64(index), LSL, InputInt6(index + 1)); | 87 return Operand(InputRegister64(index), LSL, InputInt6(index + 1)); |
86 case kMode_Operand2_R_LSR_I: | 88 case kMode_Operand2_R_LSR_I: |
87 return Operand(InputRegister64(index), LSR, InputInt6(index + 1)); | 89 return Operand(InputRegister64(index), LSR, InputInt6(index + 1)); |
88 case kMode_Operand2_R_ASR_I: | 90 case kMode_Operand2_R_ASR_I: |
89 return Operand(InputRegister64(index), ASR, InputInt6(index + 1)); | 91 return Operand(InputRegister64(index), ASR, InputInt6(index + 1)); |
90 case kMode_Operand2_R_ROR_I: | 92 case kMode_Operand2_R_ROR_I: |
91 return Operand(InputRegister64(index), ROR, InputInt6(index + 1)); | 93 return Operand(InputRegister64(index), ROR, InputInt6(index + 1)); |
92 case kMode_MRI: | 94 case kMode_MRI: |
93 case kMode_MRR: | 95 case kMode_MRR: |
94 break; | 96 break; |
95 } | 97 } |
96 UNREACHABLE(); | 98 UNREACHABLE(); |
97 return Operand(-1); | 99 return Operand(-1); |
98 } | 100 } |
99 | 101 |
100 MemOperand MemoryOperand(int* first_index) { | 102 MemOperand MemoryOperand(size_t* first_index) { |
101 const int index = *first_index; | 103 const size_t index = *first_index; |
102 switch (AddressingModeField::decode(instr_->opcode())) { | 104 switch (AddressingModeField::decode(instr_->opcode())) { |
103 case kMode_None: | 105 case kMode_None: |
104 case kMode_Operand2_R_LSL_I: | 106 case kMode_Operand2_R_LSL_I: |
105 case kMode_Operand2_R_LSR_I: | 107 case kMode_Operand2_R_LSR_I: |
106 case kMode_Operand2_R_ASR_I: | 108 case kMode_Operand2_R_ASR_I: |
107 case kMode_Operand2_R_ROR_I: | 109 case kMode_Operand2_R_ROR_I: |
108 break; | 110 break; |
109 case kMode_MRI: | 111 case kMode_MRI: |
110 *first_index += 2; | 112 *first_index += 2; |
111 return MemOperand(InputRegister(index + 0), InputInt32(index + 1)); | 113 return MemOperand(InputRegister(index + 0), InputInt32(index + 1)); |
112 case kMode_MRR: | 114 case kMode_MRR: |
113 *first_index += 2; | 115 *first_index += 2; |
114 return MemOperand(InputRegister(index + 0), InputRegister(index + 1)); | 116 return MemOperand(InputRegister(index + 0), InputRegister(index + 1)); |
115 } | 117 } |
116 UNREACHABLE(); | 118 UNREACHABLE(); |
117 return MemOperand(no_reg); | 119 return MemOperand(no_reg); |
118 } | 120 } |
119 | 121 |
120 MemOperand MemoryOperand(int first_index = 0) { | 122 MemOperand MemoryOperand(size_t first_index = 0) { |
121 return MemoryOperand(&first_index); | 123 return MemoryOperand(&first_index); |
122 } | 124 } |
123 | 125 |
124 Operand ToOperand(InstructionOperand* op) { | 126 Operand ToOperand(InstructionOperand* op) { |
125 if (op->IsRegister()) { | 127 if (op->IsRegister()) { |
126 return Operand(ToRegister(op)); | 128 return Operand(ToRegister(op)); |
127 } | 129 } |
128 return ToImmediate(op); | 130 return ToImmediate(op); |
129 } | 131 } |
130 | 132 |
(...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1153 } | 1155 } |
1154 } | 1156 } |
1155 MarkLazyDeoptSite(); | 1157 MarkLazyDeoptSite(); |
1156 } | 1158 } |
1157 | 1159 |
1158 #undef __ | 1160 #undef __ |
1159 | 1161 |
1160 } // namespace compiler | 1162 } // namespace compiler |
1161 } // namespace internal | 1163 } // namespace internal |
1162 } // namespace v8 | 1164 } // namespace v8 |
OLD | NEW |