| 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 | 7 |
| 8 namespace v8 { | 8 namespace v8 { |
| 9 namespace internal { | 9 namespace internal { |
| 10 namespace compiler { | 10 namespace compiler { |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 } | 141 } |
| 142 | 142 |
| 143 | 143 |
| 144 void InstructionSelector::VisitLoad(Node* node) { | 144 void InstructionSelector::VisitLoad(Node* node) { |
| 145 MachineType rep = RepresentationOf(OpParameter<MachineType>(node)); | 145 MachineType rep = RepresentationOf(OpParameter<MachineType>(node)); |
| 146 MachineType typ = TypeOf(OpParameter<MachineType>(node)); | 146 MachineType typ = TypeOf(OpParameter<MachineType>(node)); |
| 147 Arm64OperandGenerator g(this); | 147 Arm64OperandGenerator g(this); |
| 148 Node* base = node->InputAt(0); | 148 Node* base = node->InputAt(0); |
| 149 Node* index = node->InputAt(1); | 149 Node* index = node->InputAt(1); |
| 150 | 150 |
| 151 InstructionOperand* result = rep == kRepFloat64 | 151 InstructionOperand* result = (rep == kRepFloat32 || rep == kRepFloat64) |
| 152 ? g.DefineAsDoubleRegister(node) | 152 ? g.DefineAsDoubleRegister(node) |
| 153 : g.DefineAsRegister(node); | 153 : g.DefineAsRegister(node); |
| 154 | 154 |
| 155 ArchOpcode opcode; | 155 ArchOpcode opcode; |
| 156 // TODO(titzer): signed/unsigned small loads | 156 // TODO(titzer): signed/unsigned small loads |
| 157 switch (rep) { | 157 switch (rep) { |
| 158 case kRepFloat32: |
| 159 opcode = kArm64LdrS; |
| 160 break; |
| 158 case kRepFloat64: | 161 case kRepFloat64: |
| 159 opcode = kArm64LdrD; | 162 opcode = kArm64LdrD; |
| 160 break; | 163 break; |
| 161 case kRepBit: // Fall through. | 164 case kRepBit: // Fall through. |
| 162 case kRepWord8: | 165 case kRepWord8: |
| 163 opcode = typ == kTypeInt32 ? kArm64Ldrsb : kArm64Ldrb; | 166 opcode = typ == kTypeInt32 ? kArm64Ldrsb : kArm64Ldrb; |
| 164 break; | 167 break; |
| 165 case kRepWord16: | 168 case kRepWord16: |
| 166 opcode = typ == kTypeInt32 ? kArm64Ldrsh : kArm64Ldrh; | 169 opcode = typ == kTypeInt32 ? kArm64Ldrsh : kArm64Ldrh; |
| 167 break; | 170 break; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 // and pass them here instead of using fixed regs | 203 // and pass them here instead of using fixed regs |
| 201 // TODO(dcarney): handle immediate indices. | 204 // TODO(dcarney): handle immediate indices. |
| 202 InstructionOperand* temps[] = {g.TempRegister(x11), g.TempRegister(x12)}; | 205 InstructionOperand* temps[] = {g.TempRegister(x11), g.TempRegister(x12)}; |
| 203 Emit(kArm64StoreWriteBarrier, NULL, g.UseFixed(base, x10), | 206 Emit(kArm64StoreWriteBarrier, NULL, g.UseFixed(base, x10), |
| 204 g.UseFixed(index, x11), g.UseFixed(value, x12), ARRAY_SIZE(temps), | 207 g.UseFixed(index, x11), g.UseFixed(value, x12), ARRAY_SIZE(temps), |
| 205 temps); | 208 temps); |
| 206 return; | 209 return; |
| 207 } | 210 } |
| 208 DCHECK_EQ(kNoWriteBarrier, store_rep.write_barrier_kind); | 211 DCHECK_EQ(kNoWriteBarrier, store_rep.write_barrier_kind); |
| 209 InstructionOperand* val; | 212 InstructionOperand* val; |
| 210 if (rep == kRepFloat64) { | 213 if (rep == kRepFloat32 || rep == kRepFloat64) { |
| 211 val = g.UseDoubleRegister(value); | 214 val = g.UseDoubleRegister(value); |
| 212 } else { | 215 } else { |
| 213 val = g.UseRegister(value); | 216 val = g.UseRegister(value); |
| 214 } | 217 } |
| 215 ArchOpcode opcode; | 218 ArchOpcode opcode; |
| 216 switch (rep) { | 219 switch (rep) { |
| 220 case kRepFloat32: |
| 221 opcode = kArm64StrS; |
| 222 break; |
| 217 case kRepFloat64: | 223 case kRepFloat64: |
| 218 opcode = kArm64StrD; | 224 opcode = kArm64StrD; |
| 219 break; | 225 break; |
| 220 case kRepBit: // Fall through. | 226 case kRepBit: // Fall through. |
| 221 case kRepWord8: | 227 case kRepWord8: |
| 222 opcode = kArm64Strb; | 228 opcode = kArm64Strb; |
| 223 break; | 229 break; |
| 224 case kRepWord16: | 230 case kRepWord16: |
| 225 opcode = kArm64Strh; | 231 opcode = kArm64Strh; |
| 226 break; | 232 break; |
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 673 // Caller clean up of stack for C-style calls. | 679 // Caller clean up of stack for C-style calls. |
| 674 if (is_c_frame && aligned_push_count > 0) { | 680 if (is_c_frame && aligned_push_count > 0) { |
| 675 DCHECK(deoptimization == NULL && continuation == NULL); | 681 DCHECK(deoptimization == NULL && continuation == NULL); |
| 676 Emit(kArm64Drop | MiscField::encode(aligned_push_count), NULL); | 682 Emit(kArm64Drop | MiscField::encode(aligned_push_count), NULL); |
| 677 } | 683 } |
| 678 } | 684 } |
| 679 | 685 |
| 680 } // namespace compiler | 686 } // namespace compiler |
| 681 } // namespace internal | 687 } // namespace internal |
| 682 } // namespace v8 | 688 } // namespace v8 |
| OLD | NEW |