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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 return (0 <= value && value < (1 << 9)) || | 64 return (0 <= value && value < (1 << 9)) || |
65 (-(1 << 6) <= value && value < (1 << 6)); | 65 (-(1 << 6) <= value && value < (1 << 6)); |
66 case kNoImmediate: | 66 case kNoImmediate: |
67 return false; | 67 return false; |
68 } | 68 } |
69 return false; | 69 return false; |
70 } | 70 } |
71 }; | 71 }; |
72 | 72 |
73 | 73 |
74 static void VisitRR(InstructionSelector* selector, ArchOpcode opcode, | |
75 Node* node) { | |
76 Arm64OperandGenerator g(selector); | |
77 selector->Emit(opcode, g.DefineAsRegister(node), | |
78 g.UseRegister(node->InputAt(0))); | |
79 } | |
80 | |
81 | |
82 static void VisitRRR(InstructionSelector* selector, ArchOpcode opcode, | 74 static void VisitRRR(InstructionSelector* selector, ArchOpcode opcode, |
83 Node* node) { | 75 Node* node) { |
84 Arm64OperandGenerator g(selector); | 76 Arm64OperandGenerator g(selector); |
85 selector->Emit(opcode, g.DefineAsRegister(node), | 77 selector->Emit(opcode, g.DefineAsRegister(node), |
86 g.UseRegister(node->InputAt(0)), | 78 g.UseRegister(node->InputAt(0)), |
87 g.UseRegister(node->InputAt(1))); | 79 g.UseRegister(node->InputAt(1))); |
88 } | 80 } |
89 | 81 |
90 | 82 |
91 static void VisitRRRFloat64(InstructionSelector* selector, ArchOpcode opcode, | 83 static void VisitRRRFloat64(InstructionSelector* selector, ArchOpcode opcode, |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 void InstructionSelector::VisitInt32UMod(Node* node) { | 411 void InstructionSelector::VisitInt32UMod(Node* node) { |
420 VisitRRR(this, kArm64Umod32, node); | 412 VisitRRR(this, kArm64Umod32, node); |
421 } | 413 } |
422 | 414 |
423 | 415 |
424 void InstructionSelector::VisitInt64UMod(Node* node) { | 416 void InstructionSelector::VisitInt64UMod(Node* node) { |
425 VisitRRR(this, kArm64Umod, node); | 417 VisitRRR(this, kArm64Umod, node); |
426 } | 418 } |
427 | 419 |
428 | 420 |
429 void InstructionSelector::VisitConvertInt32ToInt64(Node* node) { | |
430 VisitRR(this, kArm64Int32ToInt64, node); | |
431 } | |
432 | |
433 | |
434 void InstructionSelector::VisitConvertInt64ToInt32(Node* node) { | |
435 VisitRR(this, kArm64Int64ToInt32, node); | |
436 } | |
437 | |
438 | |
439 void InstructionSelector::VisitChangeInt32ToFloat64(Node* node) { | 421 void InstructionSelector::VisitChangeInt32ToFloat64(Node* node) { |
440 Arm64OperandGenerator g(this); | 422 Arm64OperandGenerator g(this); |
441 Emit(kArm64Int32ToFloat64, g.DefineAsDoubleRegister(node), | 423 Emit(kArm64Int32ToFloat64, g.DefineAsDoubleRegister(node), |
442 g.UseRegister(node->InputAt(0))); | 424 g.UseRegister(node->InputAt(0))); |
443 } | 425 } |
444 | 426 |
445 | 427 |
446 void InstructionSelector::VisitChangeUint32ToFloat64(Node* node) { | 428 void InstructionSelector::VisitChangeUint32ToFloat64(Node* node) { |
447 Arm64OperandGenerator g(this); | 429 Arm64OperandGenerator g(this); |
448 Emit(kArm64Uint32ToFloat64, g.DefineAsDoubleRegister(node), | 430 Emit(kArm64Uint32ToFloat64, g.DefineAsDoubleRegister(node), |
449 g.UseRegister(node->InputAt(0))); | 431 g.UseRegister(node->InputAt(0))); |
450 } | 432 } |
451 | 433 |
452 | 434 |
453 void InstructionSelector::VisitChangeFloat64ToInt32(Node* node) { | 435 void InstructionSelector::VisitChangeFloat64ToInt32(Node* node) { |
454 Arm64OperandGenerator g(this); | 436 Arm64OperandGenerator g(this); |
455 Emit(kArm64Float64ToInt32, g.DefineAsRegister(node), | 437 Emit(kArm64Float64ToInt32, g.DefineAsRegister(node), |
456 g.UseDoubleRegister(node->InputAt(0))); | 438 g.UseDoubleRegister(node->InputAt(0))); |
457 } | 439 } |
458 | 440 |
459 | 441 |
460 void InstructionSelector::VisitChangeFloat64ToUint32(Node* node) { | 442 void InstructionSelector::VisitChangeFloat64ToUint32(Node* node) { |
461 Arm64OperandGenerator g(this); | 443 Arm64OperandGenerator g(this); |
462 Emit(kArm64Float64ToUint32, g.DefineAsRegister(node), | 444 Emit(kArm64Float64ToUint32, g.DefineAsRegister(node), |
463 g.UseDoubleRegister(node->InputAt(0))); | 445 g.UseDoubleRegister(node->InputAt(0))); |
464 } | 446 } |
465 | 447 |
466 | 448 |
| 449 void InstructionSelector::VisitChangeInt32ToInt64(Node* node) { |
| 450 Arm64OperandGenerator g(this); |
| 451 Emit(kArm64Sxtw, g.DefineAsRegister(node), g.UseRegister(node->InputAt(0))); |
| 452 } |
| 453 |
| 454 |
| 455 void InstructionSelector::VisitChangeUint32ToUint64(Node* node) { |
| 456 Arm64OperandGenerator g(this); |
| 457 Emit(kArm64Mov32, g.DefineAsRegister(node), g.UseRegister(node->InputAt(0))); |
| 458 } |
| 459 |
| 460 |
| 461 void InstructionSelector::VisitTruncateInt64ToInt32(Node* node) { |
| 462 Arm64OperandGenerator g(this); |
| 463 Emit(kArm64Mov32, g.DefineAsRegister(node), g.UseRegister(node->InputAt(0))); |
| 464 } |
| 465 |
| 466 |
467 void InstructionSelector::VisitFloat64Add(Node* node) { | 467 void InstructionSelector::VisitFloat64Add(Node* node) { |
468 VisitRRRFloat64(this, kArm64Float64Add, node); | 468 VisitRRRFloat64(this, kArm64Float64Add, node); |
469 } | 469 } |
470 | 470 |
471 | 471 |
472 void InstructionSelector::VisitFloat64Sub(Node* node) { | 472 void InstructionSelector::VisitFloat64Sub(Node* node) { |
473 VisitRRRFloat64(this, kArm64Float64Sub, node); | 473 VisitRRRFloat64(this, kArm64Float64Sub, node); |
474 } | 474 } |
475 | 475 |
476 | 476 |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 // Caller clean up of stack for C-style calls. | 671 // Caller clean up of stack for C-style calls. |
672 if (is_c_frame && aligned_push_count > 0) { | 672 if (is_c_frame && aligned_push_count > 0) { |
673 DCHECK(deoptimization == NULL && continuation == NULL); | 673 DCHECK(deoptimization == NULL && continuation == NULL); |
674 Emit(kArm64Drop | MiscField::encode(aligned_push_count), NULL); | 674 Emit(kArm64Drop | MiscField::encode(aligned_push_count), NULL); |
675 } | 675 } |
676 } | 676 } |
677 | 677 |
678 } // namespace compiler | 678 } // namespace compiler |
679 } // namespace internal | 679 } // namespace internal |
680 } // namespace v8 | 680 } // namespace v8 |
OLD | NEW |