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

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

Issue 782493002: MIPS; Improve checked load/store operators for constant offset and length. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Comments addressed. 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') | no next file » | 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 690 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 case kRepFloat32: 701 case kRepFloat32:
702 opcode = kCheckedLoadFloat32; 702 opcode = kCheckedLoadFloat32;
703 break; 703 break;
704 case kRepFloat64: 704 case kRepFloat64:
705 opcode = kCheckedLoadFloat64; 705 opcode = kCheckedLoadFloat64;
706 break; 706 break;
707 default: 707 default:
708 UNREACHABLE(); 708 UNREACHABLE();
709 return; 709 return;
710 } 710 }
711 InstructionOperand* offset_operand = g.UseRegister(offset); 711 InstructionOperand* offset_operand = g.CanBeImmediate(offset, opcode)
712 ? g.UseImmediate(offset)
713 : g.UseRegister(offset);
714
715 InstructionOperand* length_operand =
716 (!g.CanBeImmediate(offset, opcode)) ? g.CanBeImmediate(length, opcode)
717 ? g.UseImmediate(length)
718 : g.UseRegister(length)
719 : g.UseRegister(length);
720
712 Emit(opcode | AddressingModeField::encode(kMode_MRI), 721 Emit(opcode | AddressingModeField::encode(kMode_MRI),
713 g.DefineAsRegister(node), offset_operand, g.UseRegister(length), 722 g.DefineAsRegister(node), offset_operand, length_operand,
714 g.UseRegister(buffer)); 723 g.UseRegister(buffer));
715 } 724 }
716 725
717 726
718 void InstructionSelector::VisitCheckedStore(Node* node) { 727 void InstructionSelector::VisitCheckedStore(Node* node) {
719 MachineType rep = RepresentationOf(OpParameter<MachineType>(node)); 728 MachineType rep = RepresentationOf(OpParameter<MachineType>(node));
720 Mips64OperandGenerator g(this); 729 Mips64OperandGenerator g(this);
721 Node* const buffer = node->InputAt(0); 730 Node* const buffer = node->InputAt(0);
722 Node* const offset = node->InputAt(1); 731 Node* const offset = node->InputAt(1);
723 Node* const length = node->InputAt(2); 732 Node* const length = node->InputAt(2);
(...skipping 12 matching lines...) Expand all
736 case kRepFloat32: 745 case kRepFloat32:
737 opcode = kCheckedStoreFloat32; 746 opcode = kCheckedStoreFloat32;
738 break; 747 break;
739 case kRepFloat64: 748 case kRepFloat64:
740 opcode = kCheckedStoreFloat64; 749 opcode = kCheckedStoreFloat64;
741 break; 750 break;
742 default: 751 default:
743 UNREACHABLE(); 752 UNREACHABLE();
744 return; 753 return;
745 } 754 }
746 InstructionOperand* offset_operand = g.UseRegister(offset); 755 InstructionOperand* offset_operand = g.CanBeImmediate(offset, opcode)
756 ? g.UseImmediate(offset)
757 : g.UseRegister(offset);
758
759 InstructionOperand* length_operand =
760 (!g.CanBeImmediate(offset, opcode)) ? g.CanBeImmediate(length, opcode)
761 ? g.UseImmediate(length)
762 : g.UseRegister(length)
763 : g.UseRegister(length);
764
747 Emit(opcode | AddressingModeField::encode(kMode_MRI), nullptr, offset_operand, 765 Emit(opcode | AddressingModeField::encode(kMode_MRI), nullptr, offset_operand,
748 g.UseRegister(length), g.UseRegister(value), g.UseRegister(buffer)); 766 length_operand, g.UseRegister(value), g.UseRegister(buffer));
749 } 767 }
750 768
751 769
752 namespace { 770 namespace {
753 771
754 // Shared routine for multiple compare operations. 772 // Shared routine for multiple compare operations.
755 static void VisitCompare(InstructionSelector* selector, InstructionCode opcode, 773 static void VisitCompare(InstructionSelector* selector, InstructionCode opcode,
756 InstructionOperand* left, InstructionOperand* right, 774 InstructionOperand* left, InstructionOperand* right,
757 FlagsContinuation* cont) { 775 FlagsContinuation* cont) {
758 Mips64OperandGenerator g(selector); 776 Mips64OperandGenerator g(selector);
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
1050 1068
1051 // static 1069 // static
1052 MachineOperatorBuilder::Flags 1070 MachineOperatorBuilder::Flags
1053 InstructionSelector::SupportedMachineOperatorFlags() { 1071 InstructionSelector::SupportedMachineOperatorFlags() {
1054 return MachineOperatorBuilder::kNoFlags; 1072 return MachineOperatorBuilder::kNoFlags;
1055 } 1073 }
1056 1074
1057 } // namespace compiler 1075 } // namespace compiler
1058 } // namespace internal 1076 } // namespace internal
1059 } // namespace v8 1077 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/mips64/code-generator-mips64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698