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 #include "src/compiler/node-properties-inl.h" | 7 #include "src/compiler/node-properties-inl.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 case kRepFloat32: | 447 case kRepFloat32: |
448 opcode = kCheckedLoadFloat32; | 448 opcode = kCheckedLoadFloat32; |
449 break; | 449 break; |
450 case kRepFloat64: | 450 case kRepFloat64: |
451 opcode = kCheckedLoadFloat64; | 451 opcode = kCheckedLoadFloat64; |
452 break; | 452 break; |
453 default: | 453 default: |
454 UNREACHABLE(); | 454 UNREACHABLE(); |
455 return; | 455 return; |
456 } | 456 } |
457 if (offset->opcode() == IrOpcode::kInt32Add && CanCover(node, offset)) { | |
458 Int32Matcher mlength(length); | |
459 Int32BinopMatcher moffset(offset); | |
460 if (mlength.HasValue() && moffset.right().HasValue() && | |
461 mlength.Value() > moffset.right().Value()) { | |
462 Int32Matcher mbuffer(buffer); | |
463 InstructionOperand* offset_operand = g.UseRegister(moffset.left().node()); | |
464 InstructionOperand* length_operand = | |
465 g.TempImmediate(mlength.Value() - moffset.right().Value()); | |
466 if (mbuffer.HasValue()) { | |
467 Emit(opcode | AddressingModeField::encode(kMode_MRI), | |
468 g.DefineAsRegister(node), offset_operand, length_operand, | |
469 offset_operand, | |
470 g.TempImmediate(mbuffer.Value() + moffset.right().Value())); | |
471 } else { | |
472 Emit(opcode | AddressingModeField::encode(kMode_MR1I), | |
473 g.DefineAsRegister(node), offset_operand, length_operand, | |
474 g.UseRegister(buffer), offset_operand, | |
475 g.UseImmediate(moffset.right().node())); | |
476 } | |
477 return; | |
478 } | |
479 } | |
480 InstructionOperand* offset_operand = g.UseRegister(offset); | 457 InstructionOperand* offset_operand = g.UseRegister(offset); |
481 InstructionOperand* length_operand = | 458 InstructionOperand* length_operand = |
482 g.CanBeImmediate(length) ? g.UseImmediate(length) : g.UseRegister(length); | 459 g.CanBeImmediate(length) ? g.UseImmediate(length) : g.UseRegister(length); |
483 if (g.CanBeImmediate(buffer)) { | 460 if (g.CanBeImmediate(buffer)) { |
484 Emit(opcode | AddressingModeField::encode(kMode_MRI), | 461 Emit(opcode | AddressingModeField::encode(kMode_MRI), |
485 g.DefineAsRegister(node), offset_operand, length_operand, | 462 g.DefineAsRegister(node), offset_operand, length_operand, |
486 offset_operand, g.UseImmediate(buffer)); | 463 offset_operand, g.UseImmediate(buffer)); |
487 } else { | 464 } else { |
488 Emit(opcode | AddressingModeField::encode(kMode_MR1), | 465 Emit(opcode | AddressingModeField::encode(kMode_MR1), |
489 g.DefineAsRegister(node), offset_operand, length_operand, | 466 g.DefineAsRegister(node), offset_operand, length_operand, |
(...skipping 28 matching lines...) Expand all Loading... |
518 break; | 495 break; |
519 default: | 496 default: |
520 UNREACHABLE(); | 497 UNREACHABLE(); |
521 return; | 498 return; |
522 } | 499 } |
523 InstructionOperand* value_operand = | 500 InstructionOperand* value_operand = |
524 g.CanBeImmediate(value) | 501 g.CanBeImmediate(value) |
525 ? g.UseImmediate(value) | 502 ? g.UseImmediate(value) |
526 : ((rep == kRepWord8 || rep == kRepBit) ? g.UseByteRegister(value) | 503 : ((rep == kRepWord8 || rep == kRepBit) ? g.UseByteRegister(value) |
527 : g.UseRegister(value)); | 504 : g.UseRegister(value)); |
528 if (offset->opcode() == IrOpcode::kInt32Add && CanCover(node, offset)) { | |
529 Int32Matcher mbuffer(buffer); | |
530 Int32Matcher mlength(length); | |
531 Int32BinopMatcher moffset(offset); | |
532 if (mlength.HasValue() && moffset.right().HasValue() && | |
533 mlength.Value() > moffset.right().Value()) { | |
534 InstructionOperand* offset_operand = g.UseRegister(moffset.left().node()); | |
535 InstructionOperand* length_operand = | |
536 g.TempImmediate(mlength.Value() - moffset.right().Value()); | |
537 if (mbuffer.HasValue()) { | |
538 Emit(opcode | AddressingModeField::encode(kMode_MRI), nullptr, | |
539 offset_operand, length_operand, value_operand, offset_operand, | |
540 g.TempImmediate(mbuffer.Value() + moffset.right().Value())); | |
541 } else { | |
542 Emit(opcode | AddressingModeField::encode(kMode_MR1I), nullptr, | |
543 offset_operand, length_operand, value_operand, | |
544 g.UseRegister(buffer), offset_operand, | |
545 g.UseImmediate(moffset.right().node())); | |
546 } | |
547 return; | |
548 } | |
549 } | |
550 InstructionOperand* offset_operand = g.UseRegister(offset); | 505 InstructionOperand* offset_operand = g.UseRegister(offset); |
551 InstructionOperand* length_operand = | 506 InstructionOperand* length_operand = |
552 g.CanBeImmediate(length) ? g.UseImmediate(length) : g.UseRegister(length); | 507 g.CanBeImmediate(length) ? g.UseImmediate(length) : g.UseRegister(length); |
553 if (g.CanBeImmediate(buffer)) { | 508 if (g.CanBeImmediate(buffer)) { |
554 Emit(opcode | AddressingModeField::encode(kMode_MRI), nullptr, | 509 Emit(opcode | AddressingModeField::encode(kMode_MRI), nullptr, |
555 offset_operand, length_operand, value_operand, offset_operand, | 510 offset_operand, length_operand, value_operand, offset_operand, |
556 g.UseImmediate(buffer)); | 511 g.UseImmediate(buffer)); |
557 } else { | 512 } else { |
558 Emit(opcode | AddressingModeField::encode(kMode_MR1), nullptr, | 513 Emit(opcode | AddressingModeField::encode(kMode_MR1), nullptr, |
559 offset_operand, length_operand, value_operand, g.UseRegister(buffer), | 514 offset_operand, length_operand, value_operand, g.UseRegister(buffer), |
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1242 return MachineOperatorBuilder::kFloat64Floor | | 1197 return MachineOperatorBuilder::kFloat64Floor | |
1243 MachineOperatorBuilder::kFloat64Ceil | | 1198 MachineOperatorBuilder::kFloat64Ceil | |
1244 MachineOperatorBuilder::kFloat64RoundTruncate | | 1199 MachineOperatorBuilder::kFloat64RoundTruncate | |
1245 MachineOperatorBuilder::kWord32ShiftIsSafe; | 1200 MachineOperatorBuilder::kWord32ShiftIsSafe; |
1246 } | 1201 } |
1247 return MachineOperatorBuilder::Flag::kNoFlags; | 1202 return MachineOperatorBuilder::Flag::kNoFlags; |
1248 } | 1203 } |
1249 } // namespace compiler | 1204 } // namespace compiler |
1250 } // namespace internal | 1205 } // namespace internal |
1251 } // namespace v8 | 1206 } // namespace v8 |
OLD | NEW |