OLD | NEW |
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 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 | 506 |
507 | 507 |
508 void InstructionSelector::VisitChangeFloat64ToUint32(Node* node) { | 508 void InstructionSelector::VisitChangeFloat64ToUint32(Node* node) { |
509 X64OperandGenerator g(this); | 509 X64OperandGenerator g(this); |
510 // TODO(turbofan): X64 SSE cvttsd2siq should support operands. | 510 // TODO(turbofan): X64 SSE cvttsd2siq should support operands. |
511 Emit(kSSEFloat64ToUint32, g.DefineAsRegister(node), | 511 Emit(kSSEFloat64ToUint32, g.DefineAsRegister(node), |
512 g.UseDoubleRegister(node->InputAt(0))); | 512 g.UseDoubleRegister(node->InputAt(0))); |
513 } | 513 } |
514 | 514 |
515 | 515 |
| 516 void InstructionSelector::VisitChangeInt32ToInt64(Node* node) { |
| 517 X64OperandGenerator g(this); |
| 518 Emit(kX64Movsxlq, g.DefineAsRegister(node), g.Use(node->InputAt(0))); |
| 519 } |
| 520 |
| 521 |
| 522 void InstructionSelector::VisitChangeUint32ToUint64(Node* node) { |
| 523 X64OperandGenerator g(this); |
| 524 Emit(kX64Movl, g.DefineAsRegister(node), g.Use(node->InputAt(0))); |
| 525 } |
| 526 |
| 527 |
| 528 void InstructionSelector::VisitTruncateInt64ToInt32(Node* node) { |
| 529 X64OperandGenerator g(this); |
| 530 Emit(kX64Movl, g.DefineAsRegister(node), g.Use(node->InputAt(0))); |
| 531 } |
| 532 |
| 533 |
516 void InstructionSelector::VisitFloat64Add(Node* node) { | 534 void InstructionSelector::VisitFloat64Add(Node* node) { |
517 X64OperandGenerator g(this); | 535 X64OperandGenerator g(this); |
518 Emit(kSSEFloat64Add, g.DefineSameAsFirst(node), | 536 Emit(kSSEFloat64Add, g.DefineSameAsFirst(node), |
519 g.UseDoubleRegister(node->InputAt(0)), | 537 g.UseDoubleRegister(node->InputAt(0)), |
520 g.UseDoubleRegister(node->InputAt(1))); | 538 g.UseDoubleRegister(node->InputAt(1))); |
521 } | 539 } |
522 | 540 |
523 | 541 |
524 void InstructionSelector::VisitFloat64Sub(Node* node) { | 542 void InstructionSelector::VisitFloat64Sub(Node* node) { |
525 X64OperandGenerator g(this); | 543 X64OperandGenerator g(this); |
(...skipping 21 matching lines...) Expand all Loading... |
547 | 565 |
548 void InstructionSelector::VisitFloat64Mod(Node* node) { | 566 void InstructionSelector::VisitFloat64Mod(Node* node) { |
549 X64OperandGenerator g(this); | 567 X64OperandGenerator g(this); |
550 InstructionOperand* temps[] = {g.TempRegister(rax)}; | 568 InstructionOperand* temps[] = {g.TempRegister(rax)}; |
551 Emit(kSSEFloat64Mod, g.DefineSameAsFirst(node), | 569 Emit(kSSEFloat64Mod, g.DefineSameAsFirst(node), |
552 g.UseDoubleRegister(node->InputAt(0)), | 570 g.UseDoubleRegister(node->InputAt(0)), |
553 g.UseDoubleRegister(node->InputAt(1)), 1, temps); | 571 g.UseDoubleRegister(node->InputAt(1)), 1, temps); |
554 } | 572 } |
555 | 573 |
556 | 574 |
557 void InstructionSelector::VisitConvertInt64ToInt32(Node* node) { | |
558 X64OperandGenerator g(this); | |
559 // TODO(dcarney): other modes | |
560 Emit(kX64Int64ToInt32, g.DefineAsRegister(node), | |
561 g.UseRegister(node->InputAt(0))); | |
562 } | |
563 | |
564 | |
565 void InstructionSelector::VisitConvertInt32ToInt64(Node* node) { | |
566 X64OperandGenerator g(this); | |
567 // TODO(dcarney): other modes | |
568 Emit(kX64Int32ToInt64, g.DefineAsRegister(node), | |
569 g.UseRegister(node->InputAt(0))); | |
570 } | |
571 | |
572 | |
573 void InstructionSelector::VisitInt32AddWithOverflow(Node* node, | 575 void InstructionSelector::VisitInt32AddWithOverflow(Node* node, |
574 FlagsContinuation* cont) { | 576 FlagsContinuation* cont) { |
575 VisitBinop(this, node, kX64Add32, cont); | 577 VisitBinop(this, node, kX64Add32, cont); |
576 } | 578 } |
577 | 579 |
578 | 580 |
579 void InstructionSelector::VisitInt32SubWithOverflow(Node* node, | 581 void InstructionSelector::VisitInt32SubWithOverflow(Node* node, |
580 FlagsContinuation* cont) { | 582 FlagsContinuation* cont) { |
581 VisitBinop(this, node, kX64Sub32, cont); | 583 VisitBinop(this, node, kX64Sub32, cont); |
582 } | 584 } |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
726 if (descriptor->kind() == CallDescriptor::kCallAddress && | 728 if (descriptor->kind() == CallDescriptor::kCallAddress && |
727 buffer.pushed_count > 0) { | 729 buffer.pushed_count > 0) { |
728 DCHECK(deoptimization == NULL && continuation == NULL); | 730 DCHECK(deoptimization == NULL && continuation == NULL); |
729 Emit(kPopStack | MiscField::encode(buffer.pushed_count), NULL); | 731 Emit(kPopStack | MiscField::encode(buffer.pushed_count), NULL); |
730 } | 732 } |
731 } | 733 } |
732 | 734 |
733 } // namespace compiler | 735 } // namespace compiler |
734 } // namespace internal | 736 } // namespace internal |
735 } // namespace v8 | 737 } // namespace v8 |
OLD | NEW |