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

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

Issue 763963002: [turbofan] Add checked load/store operators. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Reapply fix. 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/arm64/code-generator-arm64.cc ('k') | src/compiler/code-generator.h » ('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/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 7
8 namespace v8 { 8 namespace v8 {
9 namespace internal { 9 namespace internal {
10 namespace compiler { 10 namespace compiler {
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 if (g.CanBeImmediate(index, immediate_mode)) { 355 if (g.CanBeImmediate(index, immediate_mode)) {
356 Emit(opcode | AddressingModeField::encode(kMode_MRI), NULL, 356 Emit(opcode | AddressingModeField::encode(kMode_MRI), NULL,
357 g.UseRegister(base), g.UseImmediate(index), g.UseRegister(value)); 357 g.UseRegister(base), g.UseImmediate(index), g.UseRegister(value));
358 } else { 358 } else {
359 Emit(opcode | AddressingModeField::encode(kMode_MRR), NULL, 359 Emit(opcode | AddressingModeField::encode(kMode_MRR), NULL,
360 g.UseRegister(base), g.UseRegister(index), g.UseRegister(value)); 360 g.UseRegister(base), g.UseRegister(index), g.UseRegister(value));
361 } 361 }
362 } 362 }
363 363
364 364
365 void InstructionSelector::VisitCheckedLoad(Node* node) {
366 MachineType rep = RepresentationOf(OpParameter<MachineType>(node));
367 MachineType typ = TypeOf(OpParameter<MachineType>(node));
368 Arm64OperandGenerator g(this);
369 Node* const buffer = node->InputAt(0);
370 Node* const offset = node->InputAt(1);
371 Node* const length = node->InputAt(2);
372 ArchOpcode opcode;
373 switch (rep) {
374 case kRepWord8:
375 opcode = typ == kTypeInt32 ? kCheckedLoadInt8 : kCheckedLoadUint8;
376 break;
377 case kRepWord16:
378 opcode = typ == kTypeInt32 ? kCheckedLoadInt16 : kCheckedLoadUint16;
379 break;
380 case kRepWord32:
381 opcode = kCheckedLoadWord32;
382 break;
383 case kRepFloat32:
384 opcode = kCheckedLoadFloat32;
385 break;
386 case kRepFloat64:
387 opcode = kCheckedLoadFloat64;
388 break;
389 default:
390 UNREACHABLE();
391 return;
392 }
393 InstructionOperand* offset_operand = g.UseRegister(offset);
394 Emit(opcode | AddressingModeField::encode(kMode_MRR),
395 g.DefineAsRegister(node), offset_operand, g.UseRegister(length),
396 g.UseRegister(buffer), offset_operand);
397 }
398
399
400 void InstructionSelector::VisitCheckedStore(Node* node) {
401 MachineType rep = RepresentationOf(OpParameter<MachineType>(node));
402 Arm64OperandGenerator g(this);
403 Node* const buffer = node->InputAt(0);
404 Node* const offset = node->InputAt(1);
405 Node* const length = node->InputAt(2);
406 Node* const value = node->InputAt(3);
407 ArchOpcode opcode;
408 switch (rep) {
409 case kRepWord8:
410 opcode = kCheckedStoreWord8;
411 break;
412 case kRepWord16:
413 opcode = kCheckedStoreWord16;
414 break;
415 case kRepWord32:
416 opcode = kCheckedStoreWord32;
417 break;
418 case kRepFloat32:
419 opcode = kCheckedStoreFloat32;
420 break;
421 case kRepFloat64:
422 opcode = kCheckedStoreFloat64;
423 break;
424 default:
425 UNREACHABLE();
426 return;
427 }
428 InstructionOperand* offset_operand = g.UseRegister(offset);
429 Emit(opcode | AddressingModeField::encode(kMode_MRR), nullptr, offset_operand,
430 g.UseRegister(length), g.UseRegister(value), g.UseRegister(buffer),
431 offset_operand);
432 }
433
434
365 template <typename Matcher> 435 template <typename Matcher>
366 static void VisitLogical(InstructionSelector* selector, Node* node, Matcher* m, 436 static void VisitLogical(InstructionSelector* selector, Node* node, Matcher* m,
367 ArchOpcode opcode, bool left_can_cover, 437 ArchOpcode opcode, bool left_can_cover,
368 bool right_can_cover, ImmediateMode imm_mode) { 438 bool right_can_cover, ImmediateMode imm_mode) {
369 Arm64OperandGenerator g(selector); 439 Arm64OperandGenerator g(selector);
370 440
371 // Map instruction to equivalent operation with inverted right input. 441 // Map instruction to equivalent operation with inverted right input.
372 ArchOpcode inv_opcode = opcode; 442 ArchOpcode inv_opcode = opcode;
373 switch (opcode) { 443 switch (opcode) {
374 case kArm64And32: 444 case kArm64And32:
(...skipping 1081 matching lines...) Expand 10 before | Expand all | Expand 10 after
1456 InstructionSelector::SupportedMachineOperatorFlags() { 1526 InstructionSelector::SupportedMachineOperatorFlags() {
1457 return MachineOperatorBuilder::kFloat64Floor | 1527 return MachineOperatorBuilder::kFloat64Floor |
1458 MachineOperatorBuilder::kFloat64Ceil | 1528 MachineOperatorBuilder::kFloat64Ceil |
1459 MachineOperatorBuilder::kFloat64RoundTruncate | 1529 MachineOperatorBuilder::kFloat64RoundTruncate |
1460 MachineOperatorBuilder::kFloat64RoundTiesAway | 1530 MachineOperatorBuilder::kFloat64RoundTiesAway |
1461 MachineOperatorBuilder::kWord32ShiftIsSafe; 1531 MachineOperatorBuilder::kWord32ShiftIsSafe;
1462 } 1532 }
1463 } // namespace compiler 1533 } // namespace compiler
1464 } // namespace internal 1534 } // namespace internal
1465 } // namespace v8 1535 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/arm64/code-generator-arm64.cc ('k') | src/compiler/code-generator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698