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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 return ImmediateFitsAddrMode1Instruction(value) || | 48 return ImmediateFitsAddrMode1Instruction(value) || |
49 ImmediateFitsAddrMode1Instruction(-value); | 49 ImmediateFitsAddrMode1Instruction(-value); |
50 | 50 |
51 case kArmTst: | 51 case kArmTst: |
52 case kArmTeq: | 52 case kArmTeq: |
53 case kArmOrr: | 53 case kArmOrr: |
54 case kArmEor: | 54 case kArmEor: |
55 case kArmRsb: | 55 case kArmRsb: |
56 return ImmediateFitsAddrMode1Instruction(value); | 56 return ImmediateFitsAddrMode1Instruction(value); |
57 | 57 |
| 58 case kArmVldr32: |
| 59 case kArmVstr32: |
58 case kArmVldr64: | 60 case kArmVldr64: |
59 case kArmVstr64: | 61 case kArmVstr64: |
60 return value >= -1020 && value <= 1020 && (value % 4) == 0; | 62 return value >= -1020 && value <= 1020 && (value % 4) == 0; |
61 | 63 |
62 case kArmLdrb: | 64 case kArmLdrb: |
63 case kArmLdrsb: | 65 case kArmLdrsb: |
64 case kArmStrb: | 66 case kArmStrb: |
65 case kArmLdr: | 67 case kArmLdr: |
66 case kArmStr: | 68 case kArmStr: |
67 case kArmStoreWriteBarrier: | 69 case kArmStoreWriteBarrier: |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 } | 289 } |
288 | 290 |
289 | 291 |
290 void InstructionSelector::VisitLoad(Node* node) { | 292 void InstructionSelector::VisitLoad(Node* node) { |
291 MachineType rep = RepresentationOf(OpParameter<MachineType>(node)); | 293 MachineType rep = RepresentationOf(OpParameter<MachineType>(node)); |
292 MachineType typ = TypeOf(OpParameter<MachineType>(node)); | 294 MachineType typ = TypeOf(OpParameter<MachineType>(node)); |
293 ArmOperandGenerator g(this); | 295 ArmOperandGenerator g(this); |
294 Node* base = node->InputAt(0); | 296 Node* base = node->InputAt(0); |
295 Node* index = node->InputAt(1); | 297 Node* index = node->InputAt(1); |
296 | 298 |
297 InstructionOperand* result = rep == kRepFloat64 | 299 InstructionOperand* result = (rep == kRepFloat32 || rep == kRepFloat64) |
298 ? g.DefineAsDoubleRegister(node) | 300 ? g.DefineAsDoubleRegister(node) |
299 : g.DefineAsRegister(node); | 301 : g.DefineAsRegister(node); |
300 | 302 |
301 ArchOpcode opcode; | 303 ArchOpcode opcode; |
302 switch (rep) { | 304 switch (rep) { |
| 305 case kRepFloat32: |
| 306 opcode = kArmVldr32; |
| 307 break; |
303 case kRepFloat64: | 308 case kRepFloat64: |
304 opcode = kArmVldr64; | 309 opcode = kArmVldr64; |
305 break; | 310 break; |
306 case kRepBit: // Fall through. | 311 case kRepBit: // Fall through. |
307 case kRepWord8: | 312 case kRepWord8: |
308 opcode = typ == kTypeUint32 ? kArmLdrb : kArmLdrsb; | 313 opcode = typ == kTypeUint32 ? kArmLdrb : kArmLdrsb; |
309 break; | 314 break; |
310 case kRepWord16: | 315 case kRepWord16: |
311 opcode = typ == kTypeUint32 ? kArmLdrh : kArmLdrsh; | 316 opcode = typ == kTypeUint32 ? kArmLdrh : kArmLdrsh; |
312 break; | 317 break; |
(...skipping 29 matching lines...) Expand all Loading... |
342 // TODO(dcarney): refactor RecordWrite function to take temp registers | 347 // TODO(dcarney): refactor RecordWrite function to take temp registers |
343 // and pass them here instead of using fixed regs | 348 // and pass them here instead of using fixed regs |
344 // TODO(dcarney): handle immediate indices. | 349 // TODO(dcarney): handle immediate indices. |
345 InstructionOperand* temps[] = {g.TempRegister(r5), g.TempRegister(r6)}; | 350 InstructionOperand* temps[] = {g.TempRegister(r5), g.TempRegister(r6)}; |
346 Emit(kArmStoreWriteBarrier, NULL, g.UseFixed(base, r4), | 351 Emit(kArmStoreWriteBarrier, NULL, g.UseFixed(base, r4), |
347 g.UseFixed(index, r5), g.UseFixed(value, r6), ARRAY_SIZE(temps), | 352 g.UseFixed(index, r5), g.UseFixed(value, r6), ARRAY_SIZE(temps), |
348 temps); | 353 temps); |
349 return; | 354 return; |
350 } | 355 } |
351 DCHECK_EQ(kNoWriteBarrier, store_rep.write_barrier_kind); | 356 DCHECK_EQ(kNoWriteBarrier, store_rep.write_barrier_kind); |
352 InstructionOperand* val = | 357 InstructionOperand* val = (rep == kRepFloat32 || rep == kRepFloat64) |
353 rep == kRepFloat64 ? g.UseDoubleRegister(value) : g.UseRegister(value); | 358 ? g.UseDoubleRegister(value) |
| 359 : g.UseRegister(value); |
354 | 360 |
355 ArchOpcode opcode; | 361 ArchOpcode opcode; |
356 switch (rep) { | 362 switch (rep) { |
| 363 case kRepFloat32: |
| 364 opcode = kArmVstr32; |
| 365 break; |
357 case kRepFloat64: | 366 case kRepFloat64: |
358 opcode = kArmVstr64; | 367 opcode = kArmVstr64; |
359 break; | 368 break; |
360 case kRepBit: // Fall through. | 369 case kRepBit: // Fall through. |
361 case kRepWord8: | 370 case kRepWord8: |
362 opcode = kArmStrb; | 371 opcode = kArmStrb; |
363 break; | 372 break; |
364 case kRepWord16: | 373 case kRepWord16: |
365 opcode = kArmStrh; | 374 opcode = kArmStrh; |
366 break; | 375 break; |
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
955 DCHECK(cont->IsSet()); | 964 DCHECK(cont->IsSet()); |
956 Emit(cont->Encode(kArmVcmpF64), g.DefineAsRegister(cont->result()), | 965 Emit(cont->Encode(kArmVcmpF64), g.DefineAsRegister(cont->result()), |
957 g.UseDoubleRegister(m.left().node()), | 966 g.UseDoubleRegister(m.left().node()), |
958 g.UseDoubleRegister(m.right().node())); | 967 g.UseDoubleRegister(m.right().node())); |
959 } | 968 } |
960 } | 969 } |
961 | 970 |
962 } // namespace compiler | 971 } // namespace compiler |
963 } // namespace internal | 972 } // namespace internal |
964 } // namespace v8 | 973 } // namespace v8 |
OLD | NEW |