Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Side by Side Diff: src/compiler/mips64/instruction-selector-mips64.cc

Issue 773113005: MIPS64: [turbofan] Add checked load/store operators. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/mips64/code-generator-mips64.cc ('k') | src/mips64/code-stubs-mips64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 673
674 // Emit the call instruction. 674 // Emit the call instruction.
675 Instruction* call_instr = 675 Instruction* call_instr =
676 Emit(opcode, buffer.outputs.size(), &buffer.outputs.front(), 676 Emit(opcode, buffer.outputs.size(), &buffer.outputs.front(),
677 buffer.instruction_args.size(), &buffer.instruction_args.front()); 677 buffer.instruction_args.size(), &buffer.instruction_args.front());
678 678
679 call_instr->MarkAsCall(); 679 call_instr->MarkAsCall();
680 } 680 }
681 681
682 682
683 void InstructionSelector::VisitCheckedLoad(Node* node) {
684 MachineType rep = RepresentationOf(OpParameter<MachineType>(node));
685 MachineType typ = TypeOf(OpParameter<MachineType>(node));
686 Mips64OperandGenerator g(this);
687 Node* const buffer = node->InputAt(0);
688 Node* const offset = node->InputAt(1);
689 Node* const length = node->InputAt(2);
690 ArchOpcode opcode;
691 switch (rep) {
692 case kRepWord8:
693 opcode = typ == kTypeInt32 ? kCheckedLoadInt8 : kCheckedLoadUint8;
694 break;
695 case kRepWord16:
696 opcode = typ == kTypeInt32 ? kCheckedLoadInt16 : kCheckedLoadUint16;
697 break;
698 case kRepWord32:
699 opcode = kCheckedLoadWord32;
700 break;
701 case kRepFloat32:
702 opcode = kCheckedLoadFloat32;
703 break;
704 case kRepFloat64:
705 opcode = kCheckedLoadFloat64;
706 break;
707 default:
708 UNREACHABLE();
709 return;
710 }
711 InstructionOperand* offset_operand = g.UseRegister(offset);
712 Emit(opcode | AddressingModeField::encode(kMode_MRI),
713 g.DefineAsRegister(node), offset_operand, g.UseRegister(length),
714 g.UseRegister(buffer));
715 }
716
717
718 void InstructionSelector::VisitCheckedStore(Node* node) {
719 MachineType rep = RepresentationOf(OpParameter<MachineType>(node));
720 Mips64OperandGenerator g(this);
721 Node* const buffer = node->InputAt(0);
722 Node* const offset = node->InputAt(1);
723 Node* const length = node->InputAt(2);
724 Node* const value = node->InputAt(3);
725 ArchOpcode opcode;
726 switch (rep) {
727 case kRepWord8:
728 opcode = kCheckedStoreWord8;
729 break;
730 case kRepWord16:
731 opcode = kCheckedStoreWord16;
732 break;
733 case kRepWord32:
734 opcode = kCheckedStoreWord32;
735 break;
736 case kRepFloat32:
737 opcode = kCheckedStoreFloat32;
738 break;
739 case kRepFloat64:
740 opcode = kCheckedStoreFloat64;
741 break;
742 default:
743 UNREACHABLE();
744 return;
745 }
746 InstructionOperand* offset_operand = g.UseRegister(offset);
747 Emit(opcode | AddressingModeField::encode(kMode_MRI), nullptr, offset_operand,
748 g.UseRegister(length), g.UseRegister(value), g.UseRegister(buffer));
749 }
750
751
683 namespace { 752 namespace {
684 753
685 // Shared routine for multiple compare operations. 754 // Shared routine for multiple compare operations.
686 static void VisitCompare(InstructionSelector* selector, InstructionCode opcode, 755 static void VisitCompare(InstructionSelector* selector, InstructionCode opcode,
687 InstructionOperand* left, InstructionOperand* right, 756 InstructionOperand* left, InstructionOperand* right,
688 FlagsContinuation* cont) { 757 FlagsContinuation* cont) {
689 Mips64OperandGenerator g(selector); 758 Mips64OperandGenerator g(selector);
690 opcode = cont->Encode(opcode); 759 opcode = cont->Encode(opcode);
691 if (cont->IsBranch()) { 760 if (cont->IsBranch()) {
692 selector->Emit(opcode, NULL, left, right, g.Label(cont->true_block()), 761 selector->Emit(opcode, NULL, left, right, g.Label(cont->true_block()),
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
981 1050
982 // static 1051 // static
983 MachineOperatorBuilder::Flags 1052 MachineOperatorBuilder::Flags
984 InstructionSelector::SupportedMachineOperatorFlags() { 1053 InstructionSelector::SupportedMachineOperatorFlags() {
985 return MachineOperatorBuilder::kNoFlags; 1054 return MachineOperatorBuilder::kNoFlags;
986 } 1055 }
987 1056
988 } // namespace compiler 1057 } // namespace compiler
989 } // namespace internal 1058 } // namespace internal
990 } // namespace v8 1059 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/mips64/code-generator-mips64.cc ('k') | src/mips64/code-stubs-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698