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

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

Issue 762853004: MIPS: [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/mips/code-generator-mips.cc ('k') | src/mips/code-stubs-mips.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 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 // Emit the call instruction. 476 // Emit the call instruction.
477 InstructionOperand** first_output = 477 InstructionOperand** first_output =
478 buffer.outputs.size() > 0 ? &buffer.outputs.front() : NULL; 478 buffer.outputs.size() > 0 ? &buffer.outputs.front() : NULL;
479 Instruction* call_instr = 479 Instruction* call_instr =
480 Emit(opcode, buffer.outputs.size(), first_output, 480 Emit(opcode, buffer.outputs.size(), first_output,
481 buffer.instruction_args.size(), &buffer.instruction_args.front()); 481 buffer.instruction_args.size(), &buffer.instruction_args.front());
482 call_instr->MarkAsCall(); 482 call_instr->MarkAsCall();
483 } 483 }
484 484
485 485
486 void InstructionSelector::VisitCheckedLoad(Node* node) {
487 MachineType rep = RepresentationOf(OpParameter<MachineType>(node));
488 MachineType typ = TypeOf(OpParameter<MachineType>(node));
489 MipsOperandGenerator g(this);
490 Node* const buffer = node->InputAt(0);
491 Node* const offset = node->InputAt(1);
492 Node* const length = node->InputAt(2);
493 ArchOpcode opcode;
494 switch (rep) {
495 case kRepWord8:
496 opcode = typ == kTypeInt32 ? kCheckedLoadInt8 : kCheckedLoadUint8;
497 break;
498 case kRepWord16:
499 opcode = typ == kTypeInt32 ? kCheckedLoadInt16 : kCheckedLoadUint16;
500 break;
501 case kRepWord32:
502 opcode = kCheckedLoadWord32;
503 break;
504 case kRepFloat32:
505 opcode = kCheckedLoadFloat32;
506 break;
507 case kRepFloat64:
508 opcode = kCheckedLoadFloat64;
509 break;
510 default:
511 UNREACHABLE();
512 return;
513 }
514 InstructionOperand* offset_operand = g.UseRegister(offset);
515 Emit(opcode | AddressingModeField::encode(kMode_MRI),
516 g.DefineAsRegister(node), offset_operand, g.UseRegister(length),
517 g.UseRegister(buffer));
518 }
519
520
521 void InstructionSelector::VisitCheckedStore(Node* node) {
522 MachineType rep = RepresentationOf(OpParameter<MachineType>(node));
523 MipsOperandGenerator g(this);
524 Node* const buffer = node->InputAt(0);
525 Node* const offset = node->InputAt(1);
526 Node* const length = node->InputAt(2);
527 Node* const value = node->InputAt(3);
528 ArchOpcode opcode;
529 switch (rep) {
530 case kRepWord8:
531 opcode = kCheckedStoreWord8;
532 break;
533 case kRepWord16:
534 opcode = kCheckedStoreWord16;
535 break;
536 case kRepWord32:
537 opcode = kCheckedStoreWord32;
538 break;
539 case kRepFloat32:
540 opcode = kCheckedStoreFloat32;
541 break;
542 case kRepFloat64:
543 opcode = kCheckedStoreFloat64;
544 break;
545 default:
546 UNREACHABLE();
547 return;
548 }
549 InstructionOperand* offset_operand = g.UseRegister(offset);
550 Emit(opcode | AddressingModeField::encode(kMode_MRI), nullptr, offset_operand,
551 g.UseRegister(length), g.UseRegister(value), g.UseRegister(buffer));
552 }
553
554
486 namespace { 555 namespace {
487 556
488 // Shared routine for multiple compare operations. 557 // Shared routine for multiple compare operations.
489 static void VisitCompare(InstructionSelector* selector, InstructionCode opcode, 558 static void VisitCompare(InstructionSelector* selector, InstructionCode opcode,
490 InstructionOperand* left, InstructionOperand* right, 559 InstructionOperand* left, InstructionOperand* right,
491 FlagsContinuation* cont) { 560 FlagsContinuation* cont) {
492 MipsOperandGenerator g(selector); 561 MipsOperandGenerator g(selector);
493 opcode = cont->Encode(opcode); 562 opcode = cont->Encode(opcode);
494 if (cont->IsBranch()) { 563 if (cont->IsBranch()) {
495 selector->Emit(opcode, NULL, left, right, g.Label(cont->true_block()), 564 selector->Emit(opcode, NULL, left, right, g.Label(cont->true_block()),
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 781
713 // static 782 // static
714 MachineOperatorBuilder::Flags 783 MachineOperatorBuilder::Flags
715 InstructionSelector::SupportedMachineOperatorFlags() { 784 InstructionSelector::SupportedMachineOperatorFlags() {
716 return MachineOperatorBuilder::kNoFlags; 785 return MachineOperatorBuilder::kNoFlags;
717 } 786 }
718 787
719 } // namespace compiler 788 } // namespace compiler
720 } // namespace internal 789 } // namespace internal
721 } // namespace v8 790 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/mips/code-generator-mips.cc ('k') | src/mips/code-stubs-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698