OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. |
6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
7 | 7 |
8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
9 | 9 |
10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 } | 546 } |
547 if (operation_cid() == kDoubleCid) { | 547 if (operation_cid() == kDoubleCid) { |
548 // Deoptimizes if both arguments are Smi, or if none is Double or Smi. | 548 // Deoptimizes if both arguments are Smi, or if none is Double or Smi. |
549 EmitDoubleComparisonOp(compiler, *locs(), kind(), branch); | 549 EmitDoubleComparisonOp(compiler, *locs(), kind(), branch); |
550 return; | 550 return; |
551 } | 551 } |
552 UNREACHABLE(); | 552 UNREACHABLE(); |
553 } | 553 } |
554 | 554 |
555 | 555 |
| 556 LocationSummary* TestSmiInstr::MakeLocationSummary() const { |
| 557 const intptr_t kNumInputs = 2; |
| 558 const intptr_t kNumTemps = 0; |
| 559 LocationSummary* locs = |
| 560 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 561 locs->set_in(0, Location::RequiresRegister()); |
| 562 // Only one input can be a constant operand. The case of two constant |
| 563 // operands should be handled by constant propagation. |
| 564 locs->set_in(1, Location::RegisterOrConstant(right())); |
| 565 return locs; |
| 566 } |
| 567 |
| 568 |
| 569 void TestSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 570 // Never emitted outside of the BranchInstr. |
| 571 UNREACHABLE(); |
| 572 } |
| 573 |
| 574 |
| 575 void TestSmiInstr::EmitBranchCode(FlowGraphCompiler* compiler, |
| 576 BranchInstr* branch) { |
| 577 Condition branch_condition = (kind() == Token::kNE) ? NOT_ZERO : ZERO; |
| 578 Register left_reg = locs()->in(0).reg(); |
| 579 Location right = locs()->in(1); |
| 580 if (right.IsConstant()) { |
| 581 ASSERT(right.constant().IsSmi()); |
| 582 const int64_t imm = |
| 583 reinterpret_cast<int64_t>(right.constant().raw()); |
| 584 __ TestImmediate(left_reg, Immediate(imm), PP); |
| 585 } else { |
| 586 __ testq(left_reg, right.reg()); |
| 587 } |
| 588 branch->EmitBranchOnCondition(compiler, branch_condition); |
| 589 } |
| 590 |
| 591 |
556 LocationSummary* RelationalOpInstr::MakeLocationSummary() const { | 592 LocationSummary* RelationalOpInstr::MakeLocationSummary() const { |
557 const intptr_t kNumInputs = 2; | 593 const intptr_t kNumInputs = 2; |
558 const intptr_t kNumTemps = 0; | 594 const intptr_t kNumTemps = 0; |
559 if (operation_cid() == kDoubleCid) { | 595 if (operation_cid() == kDoubleCid) { |
560 LocationSummary* summary = | 596 LocationSummary* summary = |
561 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); | 597 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
562 summary->set_in(0, Location::RequiresFpuRegister()); | 598 summary->set_in(0, Location::RequiresFpuRegister()); |
563 summary->set_in(1, Location::RequiresFpuRegister()); | 599 summary->set_in(1, Location::RequiresFpuRegister()); |
564 summary->set_out(Location::RequiresRegister()); | 600 summary->set_out(Location::RequiresRegister()); |
565 return summary; | 601 return summary; |
(...skipping 3957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4523 PcDescriptors::kOther, | 4559 PcDescriptors::kOther, |
4524 locs()); | 4560 locs()); |
4525 __ Drop(2); // Discard type arguments and receiver. | 4561 __ Drop(2); // Discard type arguments and receiver. |
4526 } | 4562 } |
4527 | 4563 |
4528 } // namespace dart | 4564 } // namespace dart |
4529 | 4565 |
4530 #undef __ | 4566 #undef __ |
4531 | 4567 |
4532 #endif // defined TARGET_ARCH_X64 | 4568 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |