| 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/flow_graph_compiler.h" | 8 #include "vm/flow_graph_compiler.h" |
| 9 | 9 |
| 10 #include "lib/error.h" | 10 #include "lib/error.h" |
| (...skipping 1632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1643 assembler()->j(true_condition, &is_true, Assembler::kNearJump); | 1643 assembler()->j(true_condition, &is_true, Assembler::kNearJump); |
| 1644 assembler()->Bind(&is_false); | 1644 assembler()->Bind(&is_false); |
| 1645 assembler()->LoadObject(result, Bool::False()); | 1645 assembler()->LoadObject(result, Bool::False()); |
| 1646 assembler()->jmp(&done); | 1646 assembler()->jmp(&done); |
| 1647 assembler()->Bind(&is_true); | 1647 assembler()->Bind(&is_true); |
| 1648 assembler()->LoadObject(result, Bool::True()); | 1648 assembler()->LoadObject(result, Bool::True()); |
| 1649 assembler()->Bind(&done); | 1649 assembler()->Bind(&done); |
| 1650 } | 1650 } |
| 1651 | 1651 |
| 1652 | 1652 |
| 1653 Condition FlowGraphCompiler::FlipCondition(Condition condition) { | |
| 1654 switch (condition) { | |
| 1655 case EQUAL: return EQUAL; | |
| 1656 case NOT_EQUAL: return NOT_EQUAL; | |
| 1657 case LESS: return GREATER; | |
| 1658 case LESS_EQUAL: return GREATER_EQUAL; | |
| 1659 case GREATER: return LESS; | |
| 1660 case GREATER_EQUAL: return LESS_EQUAL; | |
| 1661 case BELOW: return ABOVE; | |
| 1662 case BELOW_EQUAL: return ABOVE_EQUAL; | |
| 1663 case ABOVE: return BELOW; | |
| 1664 case ABOVE_EQUAL: return BELOW_EQUAL; | |
| 1665 default: | |
| 1666 UNIMPLEMENTED(); | |
| 1667 return EQUAL; | |
| 1668 } | |
| 1669 } | |
| 1670 | |
| 1671 | |
| 1672 bool FlowGraphCompiler::EvaluateCondition(Condition condition, | |
| 1673 intptr_t left, | |
| 1674 intptr_t right) { | |
| 1675 const uintptr_t unsigned_left = static_cast<uintptr_t>(left); | |
| 1676 const uintptr_t unsigned_right = static_cast<uintptr_t>(right); | |
| 1677 switch (condition) { | |
| 1678 case EQUAL: return left == right; | |
| 1679 case NOT_EQUAL: return left != right; | |
| 1680 case LESS: return left < right; | |
| 1681 case LESS_EQUAL: return left <= right; | |
| 1682 case GREATER: return left > right; | |
| 1683 case GREATER_EQUAL: return left >= right; | |
| 1684 case BELOW: return unsigned_left < unsigned_right; | |
| 1685 case BELOW_EQUAL: return unsigned_left <= unsigned_right; | |
| 1686 case ABOVE: return unsigned_left > unsigned_right; | |
| 1687 case ABOVE_EQUAL: return unsigned_left >= unsigned_right; | |
| 1688 default: | |
| 1689 UNIMPLEMENTED(); | |
| 1690 return false; | |
| 1691 } | |
| 1692 } | |
| 1693 | |
| 1694 | |
| 1695 FieldAddress FlowGraphCompiler::ElementAddressForIntIndex(intptr_t cid, | 1653 FieldAddress FlowGraphCompiler::ElementAddressForIntIndex(intptr_t cid, |
| 1696 intptr_t index_scale, | 1654 intptr_t index_scale, |
| 1697 Register array, | 1655 Register array, |
| 1698 intptr_t index) { | 1656 intptr_t index) { |
| 1699 const int64_t disp = | 1657 const int64_t disp = |
| 1700 static_cast<int64_t>(index) * index_scale + DataOffsetFor(cid); | 1658 static_cast<int64_t>(index) * index_scale + DataOffsetFor(cid); |
| 1701 ASSERT(Utils::IsInt(32, disp)); | 1659 ASSERT(Utils::IsInt(32, disp)); |
| 1702 return FieldAddress(array, static_cast<int32_t>(disp)); | 1660 return FieldAddress(array, static_cast<int32_t>(disp)); |
| 1703 } | 1661 } |
| 1704 | 1662 |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1939 __ movups(reg, Address(RSP, 0)); | 1897 __ movups(reg, Address(RSP, 0)); |
| 1940 __ addq(RSP, Immediate(kFpuRegisterSize)); | 1898 __ addq(RSP, Immediate(kFpuRegisterSize)); |
| 1941 } | 1899 } |
| 1942 | 1900 |
| 1943 | 1901 |
| 1944 #undef __ | 1902 #undef __ |
| 1945 | 1903 |
| 1946 } // namespace dart | 1904 } // namespace dart |
| 1947 | 1905 |
| 1948 #endif // defined TARGET_ARCH_X64 | 1906 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |