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

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

Issue 504143003: Support Int32 representation for selected binary operations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 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
OLDNEW
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/flow_graph_compiler.h" 8 #include "vm/flow_graph_compiler.h"
9 9
10 #include "vm/ast_printer.h" 10 #include "vm/ast_printer.h"
(...skipping 1558 matching lines...) Expand 10 before | Expand all | Expand 10 after
1569 ASSERT(destination.IsQuadStackSlot()); 1569 ASSERT(destination.IsQuadStackSlot());
1570 __ movups(XMM0, source.ToStackSlotAddress()); 1570 __ movups(XMM0, source.ToStackSlotAddress());
1571 __ movups(destination.ToStackSlotAddress(), XMM0); 1571 __ movups(destination.ToStackSlotAddress(), XMM0);
1572 } 1572 }
1573 } else { 1573 } else {
1574 ASSERT(source.IsConstant()); 1574 ASSERT(source.IsConstant());
1575 if (destination.IsRegister()) { 1575 if (destination.IsRegister()) {
1576 const Object& constant = source.constant(); 1576 const Object& constant = source.constant();
1577 if (constant.IsSmi() && (Smi::Cast(constant).Value() == 0)) { 1577 if (constant.IsSmi() && (Smi::Cast(constant).Value() == 0)) {
1578 __ xorl(destination.reg(), destination.reg()); 1578 __ xorl(destination.reg(), destination.reg());
1579 } else if (constant.IsSmi() &&
1580 source.constant_instruction()->representation() == kUnboxedInt32) {
1581 __ movl(destination.reg(), Immediate(Smi::Cast(constant).Value()));
1579 } else { 1582 } else {
1580 __ LoadObjectSafely(destination.reg(), constant); 1583 __ LoadObjectSafely(destination.reg(), constant);
1581 } 1584 }
1582 } else if (destination.IsFpuRegister()) { 1585 } else if (destination.IsFpuRegister()) {
1583 const Double& constant = Double::Cast(source.constant()); 1586 const Double& constant = Double::Cast(source.constant());
1584 uword addr = FlowGraphBuilder::FindDoubleConstant(constant.value()); 1587 uword addr = FlowGraphBuilder::FindDoubleConstant(constant.value());
1585 if (addr == 0) { 1588 if (addr == 0) {
1586 __ pushl(EAX); 1589 __ pushl(EAX);
1587 __ LoadObject(EAX, constant); 1590 __ LoadObject(EAX, constant);
1588 __ movsd(destination.fpu_reg(), 1591 __ movsd(destination.fpu_reg(),
(...skipping 13 matching lines...) Expand all
1602 __ movsd(XMM0, FieldAddress(EAX, Double::value_offset())); 1605 __ movsd(XMM0, FieldAddress(EAX, Double::value_offset()));
1603 __ popl(EAX); 1606 __ popl(EAX);
1604 } else if (Utils::DoublesBitEqual(constant.value(), 0.0)) { 1607 } else if (Utils::DoublesBitEqual(constant.value(), 0.0)) {
1605 __ xorps(XMM0, XMM0); 1608 __ xorps(XMM0, XMM0);
1606 } else { 1609 } else {
1607 __ movsd(XMM0, Address::Absolute(addr)); 1610 __ movsd(XMM0, Address::Absolute(addr));
1608 } 1611 }
1609 __ movsd(destination.ToStackSlotAddress(), XMM0); 1612 __ movsd(destination.ToStackSlotAddress(), XMM0);
1610 } else { 1613 } else {
1611 ASSERT(destination.IsStackSlot()); 1614 ASSERT(destination.IsStackSlot());
1612 StoreObject(destination.ToStackSlotAddress(), source.constant()); 1615 const Object& constant = source.constant();
1616 if (constant.IsSmi() &&
1617 source.constant_instruction()->representation() == kUnboxedInt32) {
1618 __ movl(destination.ToStackSlotAddress(),
1619 Immediate(Smi::Cast(constant).Value()));
1620 } else {
1621 StoreObject(destination.ToStackSlotAddress(), source.constant());
1622 }
1613 } 1623 }
1614 } 1624 }
1615 1625
1616 move->Eliminate(); 1626 move->Eliminate();
1617 } 1627 }
1618 1628
1619 1629
1620 void ParallelMoveResolver::EmitSwap(int index) { 1630 void ParallelMoveResolver::EmitSwap(int index) {
1621 MoveOperands* move = moves_[index]; 1631 MoveOperands* move = moves_[index];
1622 const Location source = move->src(); 1632 const Location source = move->src();
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
1763 __ movups(reg, Address(ESP, 0)); 1773 __ movups(reg, Address(ESP, 0));
1764 __ addl(ESP, Immediate(kFpuRegisterSize)); 1774 __ addl(ESP, Immediate(kFpuRegisterSize));
1765 } 1775 }
1766 1776
1767 1777
1768 #undef __ 1778 #undef __
1769 1779
1770 } // namespace dart 1780 } // namespace dart
1771 1781
1772 #endif // defined TARGET_ARCH_IA32 1782 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698