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_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
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 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
544 return; | 544 return; |
545 } | 545 } |
546 if (operation_cid() == kDoubleCid) { | 546 if (operation_cid() == kDoubleCid) { |
547 EmitDoubleComparisonOp(compiler, *locs(), kind(), branch); | 547 EmitDoubleComparisonOp(compiler, *locs(), kind(), branch); |
548 return; | 548 return; |
549 } | 549 } |
550 UNREACHABLE(); | 550 UNREACHABLE(); |
551 } | 551 } |
552 | 552 |
553 | 553 |
554 LocationSummary* TestSmiInstr::MakeLocationSummary() const { | |
555 const intptr_t kNumInputs = 2; | |
556 const intptr_t kNumTemps = 0; | |
557 LocationSummary* locs = | |
558 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); | |
559 locs->set_in(0, Location::RequiresRegister()); | |
560 // Only one input can be a constant operand. The case of two constant | |
561 // operands should be handled by constant propagation. | |
562 locs->set_in(1, Location::RegisterOrConstant(right())); | |
563 return locs; | |
564 } | |
565 | |
566 | |
567 void TestSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | |
568 // Never emitted outside of the BranchInstr. | |
569 UNREACHABLE(); | |
570 } | |
571 | |
572 | |
573 void TestSmiInstr::EmitBranchCode(FlowGraphCompiler* compiler, | |
574 BranchInstr* branch) { | |
575 Condition branch_condition = (kind() == Token::kNE) ? NOT_ZERO : ZERO; | |
576 Register left = locs()->in(0).reg(); | |
577 Location right = locs()->in(1); | |
578 if (right.IsConstant()) { | |
579 ASSERT(right.constant().IsSmi()); | |
580 const int32_t imm = | |
581 reinterpret_cast<int32_t>(right.constant().raw()); | |
582 __ testl(left, Immediate(imm)); | |
sra1
2013/11/06 18:01:46
Does this need the xor-with-cookie treatment?
Florian Schneider
2013/11/06 18:13:46
No, using Location::RegisterOrConstant in TestSmiI
| |
583 } else { | |
584 __ testl(left, right.reg()); | |
585 } | |
586 branch->EmitBranchOnCondition(compiler, branch_condition); | |
587 } | |
588 | |
589 | |
554 LocationSummary* RelationalOpInstr::MakeLocationSummary() const { | 590 LocationSummary* RelationalOpInstr::MakeLocationSummary() const { |
555 const intptr_t kNumInputs = 2; | 591 const intptr_t kNumInputs = 2; |
556 const intptr_t kNumTemps = 0; | 592 const intptr_t kNumTemps = 0; |
557 if (operation_cid() == kMintCid) { | 593 if (operation_cid() == kMintCid) { |
558 const intptr_t kNumTemps = 2; | 594 const intptr_t kNumTemps = 2; |
559 LocationSummary* locs = | 595 LocationSummary* locs = |
560 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); | 596 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
561 locs->set_in(0, Location::RequiresFpuRegister()); | 597 locs->set_in(0, Location::RequiresFpuRegister()); |
562 locs->set_in(1, Location::RequiresFpuRegister()); | 598 locs->set_in(1, Location::RequiresFpuRegister()); |
563 locs->set_temp(0, Location::RequiresRegister()); | 599 locs->set_temp(0, Location::RequiresRegister()); |
(...skipping 4321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4885 PcDescriptors::kOther, | 4921 PcDescriptors::kOther, |
4886 locs()); | 4922 locs()); |
4887 __ Drop(2); // Discard type arguments and receiver. | 4923 __ Drop(2); // Discard type arguments and receiver. |
4888 } | 4924 } |
4889 | 4925 |
4890 } // namespace dart | 4926 } // namespace dart |
4891 | 4927 |
4892 #undef __ | 4928 #undef __ |
4893 | 4929 |
4894 #endif // defined TARGET_ARCH_IA32 | 4930 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |