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

Side by Side Diff: runtime/vm/intermediate_language_x64.cc

Issue 11031024: Remove now unused BinaryMintOp from the IL. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 2 months 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/intermediate_language_ia32.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 "lib/error.h" 10 #include "lib/error.h"
(...skipping 1702 matching lines...) Expand 10 before | Expand all | Expand 10 after
1713 UNREACHABLE(); 1713 UNREACHABLE();
1714 break; 1714 break;
1715 } 1715 }
1716 default: 1716 default:
1717 UNREACHABLE(); 1717 UNREACHABLE();
1718 break; 1718 break;
1719 } 1719 }
1720 } 1720 }
1721 1721
1722 1722
1723 LocationSummary* BinaryMintOpInstr::MakeLocationSummary() const {
1724 ASSERT(op_kind() == Token::kBIT_AND);
1725 const intptr_t kNumInputs = 2;
1726 const intptr_t kNumTemps = 0;
1727 LocationSummary* summary =
1728 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall);
1729 summary->set_in(0, Location::RegisterLocation(RAX));
1730 summary->set_in(1, Location::RegisterLocation(RCX));
1731 summary->set_out(Location::RegisterLocation(RAX));
1732 return summary;
1733 }
1734
1735
1736 void BinaryMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
1737 // TODO(regis): For now, we only support Token::kBIT_AND for a Mint or Smi
1738 // receiver and a Mint or Smi argument. We fall back to the run time call if
1739 // both receiver and argument are Mint or if one of them is Mint and the other
1740 // is a negative Smi.
1741 Register left = locs()->in(0).reg();
1742 Register right = locs()->in(1).reg();
1743 Register result = locs()->out().reg();
1744 ASSERT(left == result);
1745 ASSERT(op_kind() == Token::kBIT_AND);
1746 Label* deopt = compiler->AddDeoptStub(instance_call()->deopt_id(),
1747 kDeoptBinaryMintOp);
1748 Label mint_static_call, smi_static_call, non_smi, smi_smi, done;
1749 __ testq(left, Immediate(kSmiTagMask)); // Is receiver Smi?
1750 __ j(NOT_ZERO, &non_smi);
1751 __ testq(right, Immediate(kSmiTagMask)); // Is argument Smi?
1752 __ j(ZERO, &smi_smi);
1753 __ CompareClassId(right, kMintCid); // Is argument Mint?
1754 __ j(NOT_EQUAL, deopt); // Argument neither Smi nor Mint.
1755 __ cmpq(left, Immediate(0));
1756 __ j(LESS, &smi_static_call); // Negative Smi receiver, Mint argument.
1757
1758 // Positive Smi receiver, Mint argument.
1759 // Load lower argument Mint word, convert to Smi. It is OK to loose bits.
1760 __ movq(right, FieldAddress(right, Mint::value_offset()));
1761 __ SmiTag(right);
1762 __ andq(result, right);
1763 __ jmp(&done);
1764
1765 __ Bind(&non_smi); // Receiver is non-Smi.
1766 __ CompareClassId(left, kMintCid); // Is receiver Mint?
1767 __ j(NOT_EQUAL, deopt); // Receiver neither Smi nor Mint.
1768 __ testq(right, Immediate(kSmiTagMask)); // Is argument Smi?
1769 __ j(NOT_ZERO, &mint_static_call); // Mint receiver, non-Smi argument.
1770 __ cmpq(right, Immediate(0));
1771 __ j(LESS, &mint_static_call); // Mint receiver, negative Smi argument.
1772
1773 // Mint receiver, positive Smi argument.
1774 // Load lower receiver Mint word, convert to Smi. It is OK to loose bits.
1775 __ movq(result, FieldAddress(left, Mint::value_offset()));
1776 __ SmiTag(result);
1777 __ Bind(&smi_smi);
1778 __ andq(result, right);
1779 __ jmp(&done);
1780
1781 __ Bind(&smi_static_call);
1782 {
1783 Function& target = Function::ZoneHandle(
1784 ic_data()->GetTargetForReceiverClassId(kSmiCid));
1785 if (target.IsNull()) {
1786 __ jmp(deopt);
1787 } else {
1788 __ pushq(left);
1789 __ pushq(right);
1790 compiler->GenerateStaticCall(
1791 instance_call()->deopt_id(),
1792 instance_call()->token_pos(),
1793 target,
1794 instance_call()->ArgumentCount(),
1795 instance_call()->argument_names(),
1796 locs());
1797 ASSERT(result == RAX);
1798 __ jmp(&done);
1799 }
1800 }
1801
1802 __ Bind(&mint_static_call);
1803 {
1804 Function& target = Function::ZoneHandle(
1805 ic_data()->GetTargetForReceiverClassId(kMintCid));
1806 if (target.IsNull()) {
1807 __ jmp(deopt);
1808 } else {
1809 __ pushq(left);
1810 __ pushq(right);
1811 compiler->GenerateStaticCall(
1812 instance_call()->deopt_id(),
1813 instance_call()->token_pos(),
1814 target,
1815 instance_call()->ArgumentCount(),
1816 instance_call()->argument_names(),
1817 locs());
1818 ASSERT(result == RAX);
1819 }
1820 }
1821 __ Bind(&done);
1822 }
1823
1824
1825 LocationSummary* CheckEitherNonSmiInstr::MakeLocationSummary() const { 1723 LocationSummary* CheckEitherNonSmiInstr::MakeLocationSummary() const {
1826 ASSERT((left()->ResultCid() != kDoubleCid) && 1724 ASSERT((left()->ResultCid() != kDoubleCid) &&
1827 (right()->ResultCid() != kDoubleCid)); 1725 (right()->ResultCid() != kDoubleCid));
1828 const intptr_t kNumInputs = 2; 1726 const intptr_t kNumInputs = 2;
1829 const intptr_t kNumTemps = 1; 1727 const intptr_t kNumTemps = 1;
1830 LocationSummary* summary = 1728 LocationSummary* summary =
1831 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 1729 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
1832 summary->set_in(0, Location::RequiresRegister()); 1730 summary->set_in(0, Location::RequiresRegister());
1833 summary->set_in(1, Location::RequiresRegister()); 1731 summary->set_in(1, Location::RequiresRegister());
1834 summary->set_temp(0, Location::RequiresRegister()); 1732 summary->set_temp(0, Location::RequiresRegister());
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
2281 void UnboxedMintBinaryOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2179 void UnboxedMintBinaryOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2282 UNIMPLEMENTED(); 2180 UNIMPLEMENTED();
2283 } 2181 }
2284 2182
2285 2183
2286 } // namespace dart 2184 } // namespace dart
2287 2185
2288 #undef __ 2186 #undef __
2289 2187
2290 #endif // defined TARGET_ARCH_X64 2188 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698