| 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 24 matching lines...) Expand all Loading... |
| 35 int32_t value = m.Value(); | 35 int32_t value = m.Value(); |
| 36 switch (ArchOpcodeField::decode(opcode)) { | 36 switch (ArchOpcodeField::decode(opcode)) { |
| 37 case kMipsShl: | 37 case kMipsShl: |
| 38 case kMipsSar: | 38 case kMipsSar: |
| 39 case kMipsShr: | 39 case kMipsShr: |
| 40 return is_uint5(value); | 40 return is_uint5(value); |
| 41 case kMipsXor: | 41 case kMipsXor: |
| 42 return is_uint16(value); | 42 return is_uint16(value); |
| 43 case kMipsLdc1: | 43 case kMipsLdc1: |
| 44 case kMipsSdc1: | 44 case kMipsSdc1: |
| 45 case kCheckedLoadFloat32: |
| 46 case kCheckedLoadFloat64: |
| 47 case kCheckedStoreFloat32: |
| 48 case kCheckedStoreFloat64: |
| 45 return is_int16(value + kIntSize); | 49 return is_int16(value + kIntSize); |
| 46 default: | 50 default: |
| 47 return is_int16(value); | 51 return is_int16(value); |
| 48 } | 52 } |
| 49 } | 53 } |
| 50 | 54 |
| 51 private: | 55 private: |
| 52 bool ImmediateFitsAddrMode1Instruction(int32_t imm) const { | 56 bool ImmediateFitsAddrMode1Instruction(int32_t imm) const { |
| 53 TRACE_UNIMPL(); | 57 TRACE_UNIMPL(); |
| 54 return false; | 58 return false; |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 case kRepFloat32: | 510 case kRepFloat32: |
| 507 opcode = kCheckedLoadFloat32; | 511 opcode = kCheckedLoadFloat32; |
| 508 break; | 512 break; |
| 509 case kRepFloat64: | 513 case kRepFloat64: |
| 510 opcode = kCheckedLoadFloat64; | 514 opcode = kCheckedLoadFloat64; |
| 511 break; | 515 break; |
| 512 default: | 516 default: |
| 513 UNREACHABLE(); | 517 UNREACHABLE(); |
| 514 return; | 518 return; |
| 515 } | 519 } |
| 516 InstructionOperand* offset_operand = g.UseRegister(offset); | 520 InstructionOperand* offset_operand = g.CanBeImmediate(offset, opcode) |
| 521 ? g.UseImmediate(offset) |
| 522 : g.UseRegister(offset); |
| 523 |
| 524 InstructionOperand* length_operand = |
| 525 (!g.CanBeImmediate(offset, opcode)) ? g.CanBeImmediate(length, opcode) |
| 526 ? g.UseImmediate(length) |
| 527 : g.UseRegister(length) |
| 528 : g.UseRegister(length); |
| 529 |
| 517 Emit(opcode | AddressingModeField::encode(kMode_MRI), | 530 Emit(opcode | AddressingModeField::encode(kMode_MRI), |
| 518 g.DefineAsRegister(node), offset_operand, g.UseRegister(length), | 531 g.DefineAsRegister(node), offset_operand, length_operand, |
| 519 g.UseRegister(buffer)); | 532 g.UseRegister(buffer)); |
| 520 } | 533 } |
| 521 | 534 |
| 522 | 535 |
| 523 void InstructionSelector::VisitCheckedStore(Node* node) { | 536 void InstructionSelector::VisitCheckedStore(Node* node) { |
| 524 MachineType rep = RepresentationOf(OpParameter<MachineType>(node)); | 537 MachineType rep = RepresentationOf(OpParameter<MachineType>(node)); |
| 525 MipsOperandGenerator g(this); | 538 MipsOperandGenerator g(this); |
| 526 Node* const buffer = node->InputAt(0); | 539 Node* const buffer = node->InputAt(0); |
| 527 Node* const offset = node->InputAt(1); | 540 Node* const offset = node->InputAt(1); |
| 528 Node* const length = node->InputAt(2); | 541 Node* const length = node->InputAt(2); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 541 case kRepFloat32: | 554 case kRepFloat32: |
| 542 opcode = kCheckedStoreFloat32; | 555 opcode = kCheckedStoreFloat32; |
| 543 break; | 556 break; |
| 544 case kRepFloat64: | 557 case kRepFloat64: |
| 545 opcode = kCheckedStoreFloat64; | 558 opcode = kCheckedStoreFloat64; |
| 546 break; | 559 break; |
| 547 default: | 560 default: |
| 548 UNREACHABLE(); | 561 UNREACHABLE(); |
| 549 return; | 562 return; |
| 550 } | 563 } |
| 551 InstructionOperand* offset_operand = g.UseRegister(offset); | 564 InstructionOperand* offset_operand = g.CanBeImmediate(offset, opcode) |
| 565 ? g.UseImmediate(offset) |
| 566 : g.UseRegister(offset); |
| 567 |
| 568 InstructionOperand* length_operand = |
| 569 (!g.CanBeImmediate(offset, opcode)) ? g.CanBeImmediate(length, opcode) |
| 570 ? g.UseImmediate(length) |
| 571 : g.UseRegister(length) |
| 572 : g.UseRegister(length); |
| 573 |
| 552 Emit(opcode | AddressingModeField::encode(kMode_MRI), nullptr, offset_operand, | 574 Emit(opcode | AddressingModeField::encode(kMode_MRI), nullptr, offset_operand, |
| 553 g.UseRegister(length), g.UseRegister(value), g.UseRegister(buffer)); | 575 length_operand, g.UseRegister(value), g.UseRegister(buffer)); |
| 554 } | 576 } |
| 555 | 577 |
| 556 | 578 |
| 557 namespace { | 579 namespace { |
| 558 | 580 |
| 559 // Shared routine for multiple compare operations. | 581 // Shared routine for multiple compare operations. |
| 560 static void VisitCompare(InstructionSelector* selector, InstructionCode opcode, | 582 static void VisitCompare(InstructionSelector* selector, InstructionCode opcode, |
| 561 InstructionOperand* left, InstructionOperand* right, | 583 InstructionOperand* left, InstructionOperand* right, |
| 562 FlagsContinuation* cont) { | 584 FlagsContinuation* cont) { |
| 563 MipsOperandGenerator g(selector); | 585 MipsOperandGenerator g(selector); |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 783 | 805 |
| 784 // static | 806 // static |
| 785 MachineOperatorBuilder::Flags | 807 MachineOperatorBuilder::Flags |
| 786 InstructionSelector::SupportedMachineOperatorFlags() { | 808 InstructionSelector::SupportedMachineOperatorFlags() { |
| 787 return MachineOperatorBuilder::kNoFlags; | 809 return MachineOperatorBuilder::kNoFlags; |
| 788 } | 810 } |
| 789 | 811 |
| 790 } // namespace compiler | 812 } // namespace compiler |
| 791 } // namespace internal | 813 } // namespace internal |
| 792 } // namespace v8 | 814 } // namespace v8 |
| OLD | NEW |