Index: src/compiler/arm64/instruction-selector-arm64.cc |
diff --git a/src/compiler/arm64/instruction-selector-arm64.cc b/src/compiler/arm64/instruction-selector-arm64.cc |
index 9617edea183c0cdba01ffd7066abdd4f72fcf18e..17b6b7634ce49a4613f22e9c772af8cabfbaea5a 100644 |
--- a/src/compiler/arm64/instruction-selector-arm64.cc |
+++ b/src/compiler/arm64/instruction-selector-arm64.cc |
@@ -362,6 +362,76 @@ void InstructionSelector::VisitStore(Node* node) { |
} |
+void InstructionSelector::VisitCheckedLoad(Node* node) { |
+ MachineType rep = RepresentationOf(OpParameter<MachineType>(node)); |
+ MachineType typ = TypeOf(OpParameter<MachineType>(node)); |
+ Arm64OperandGenerator g(this); |
+ Node* const buffer = node->InputAt(0); |
+ Node* const offset = node->InputAt(1); |
+ Node* const length = node->InputAt(2); |
+ ArchOpcode opcode; |
+ switch (rep) { |
+ case kRepWord8: |
+ opcode = typ == kTypeInt32 ? kCheckedLoadInt8 : kCheckedLoadUint8; |
+ break; |
+ case kRepWord16: |
+ opcode = typ == kTypeInt32 ? kCheckedLoadInt16 : kCheckedLoadUint16; |
+ break; |
+ case kRepWord32: |
+ opcode = kCheckedLoadWord32; |
+ break; |
+ case kRepFloat32: |
+ opcode = kCheckedLoadFloat32; |
+ break; |
+ case kRepFloat64: |
+ opcode = kCheckedLoadFloat64; |
+ break; |
+ default: |
+ UNREACHABLE(); |
+ return; |
+ } |
+ InstructionOperand* offset_operand = g.UseRegister(offset); |
+ Emit(opcode | AddressingModeField::encode(kMode_MRR), |
+ g.DefineAsRegister(node), offset_operand, g.UseRegister(length), |
+ g.UseRegister(buffer), offset_operand); |
+} |
+ |
+ |
+void InstructionSelector::VisitCheckedStore(Node* node) { |
+ MachineType rep = RepresentationOf(OpParameter<MachineType>(node)); |
+ Arm64OperandGenerator g(this); |
+ Node* const buffer = node->InputAt(0); |
+ Node* const offset = node->InputAt(1); |
+ Node* const length = node->InputAt(2); |
+ Node* const value = node->InputAt(3); |
+ ArchOpcode opcode; |
+ switch (rep) { |
+ case kRepWord8: |
+ opcode = kCheckedStoreWord8; |
+ break; |
+ case kRepWord16: |
+ opcode = kCheckedStoreWord16; |
+ break; |
+ case kRepWord32: |
+ opcode = kCheckedStoreWord32; |
+ break; |
+ case kRepFloat32: |
+ opcode = kCheckedStoreFloat32; |
+ break; |
+ case kRepFloat64: |
+ opcode = kCheckedStoreFloat64; |
+ break; |
+ default: |
+ UNREACHABLE(); |
+ return; |
+ } |
+ InstructionOperand* offset_operand = g.UseRegister(offset); |
+ Emit(opcode | AddressingModeField::encode(kMode_MRR), nullptr, offset_operand, |
+ g.UseRegister(length), g.UseRegister(value), g.UseRegister(buffer), |
+ offset_operand); |
+} |
+ |
+ |
template <typename Matcher> |
static void VisitLogical(InstructionSelector* selector, Node* node, Matcher* m, |
ArchOpcode opcode, bool left_can_cover, |