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/intrinsifier.h" | 8 #include "vm/intrinsifier.h" |
9 | 9 |
10 #include "vm/assembler.h" | 10 #include "vm/assembler.h" |
(...skipping 1637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1648 } | 1648 } |
1649 | 1649 |
1650 | 1650 |
1651 // On stack: user tag (+1), return-address (+0). | 1651 // On stack: user tag (+1), return-address (+0). |
1652 void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { | 1652 void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { |
1653 // RBX: Isolate. | 1653 // RBX: Isolate. |
1654 Isolate* isolate = Isolate::Current(); | 1654 Isolate* isolate = Isolate::Current(); |
1655 const Immediate& isolate_address = | 1655 const Immediate& isolate_address = |
1656 Immediate(reinterpret_cast<int64_t>(isolate)); | 1656 Immediate(reinterpret_cast<int64_t>(isolate)); |
1657 __ movq(RBX, isolate_address); | 1657 __ movq(RBX, isolate_address); |
1658 // RAX: UserTag. | 1658 // RAX: Current user tag. |
1659 __ movq(RAX, Address(RSP, + 1 * kWordSize)); | 1659 __ movq(RAX, Address(RBX, Isolate::current_tag_offset())); |
| 1660 // R10: UserTag. |
| 1661 __ movq(R10, Address(RSP, + 1 * kWordSize)); |
1660 // Set Isolate::current_tag_. | 1662 // Set Isolate::current_tag_. |
1661 __ movq(Address(RBX, Isolate::current_tag_offset()), RAX); | 1663 __ movq(Address(RBX, Isolate::current_tag_offset()), R10); |
1662 // RAX: UserTag's tag. | 1664 // R10: UserTag's tag. |
1663 __ movq(RAX, FieldAddress(RAX, UserTag::tag_offset())); | 1665 __ movq(R10, FieldAddress(R10, UserTag::tag_offset())); |
1664 // Set Isolate::user_tag_. | 1666 // Set Isolate::user_tag_. |
1665 __ movq(Address(RBX, Isolate::user_tag_offset()), RAX); | 1667 __ movq(Address(RBX, Isolate::user_tag_offset()), R10); |
| 1668 __ ret(); |
| 1669 } |
| 1670 |
| 1671 |
| 1672 void Intrinsifier::UserTag_defaultTag(Assembler* assembler) { |
| 1673 // RBX: Address of default tag. |
| 1674 Isolate* isolate = Isolate::Current(); |
| 1675 const Immediate& default_tag_addr = |
| 1676 Immediate(reinterpret_cast<int64_t>(isolate->object_store()) + |
| 1677 ObjectStore::default_tag_offset()); |
| 1678 __ movq(RBX, default_tag_addr); |
1666 // Set return value. | 1679 // Set return value. |
1667 __ LoadObject(RAX, Object::null_object(), PP); | 1680 __ movq(RAX, Address(RBX, 0)); |
1668 __ ret(); | 1681 __ ret(); |
1669 } | 1682 } |
1670 | 1683 |
1671 | 1684 |
1672 void Intrinsifier::Profiler_getCurrentTag(Assembler* assembler) { | 1685 void Intrinsifier::Profiler_getCurrentTag(Assembler* assembler) { |
1673 // RBX: Isolate. | 1686 // RBX: Isolate. |
1674 Isolate* isolate = Isolate::Current(); | 1687 Isolate* isolate = Isolate::Current(); |
1675 const Immediate& isolate_address = | 1688 const Immediate& isolate_address = |
1676 Immediate(reinterpret_cast<int64_t>(isolate)); | |
1677 __ movq(RBX, isolate_address); | |
1678 // Set return value to Isolate::current_tag_. | |
1679 __ movq(RAX, Address(RBX, Isolate::current_tag_offset())); | |
1680 __ ret(); | |
1681 } | |
1682 | |
1683 | |
1684 void Intrinsifier::Profiler_clearCurrentTag(Assembler* assembler) { | |
1685 // RBX: Isolate. | |
1686 Isolate* isolate = Isolate::Current(); | |
1687 const Immediate& isolate_address = | |
1688 Immediate(reinterpret_cast<int64_t>(isolate)); | 1689 Immediate(reinterpret_cast<int64_t>(isolate)); |
1689 __ movq(RBX, isolate_address); | 1690 __ movq(RBX, isolate_address); |
1690 // Set return value to Isolate::current_tag_. | 1691 // Set return value to Isolate::current_tag_. |
1691 __ movq(RAX, Address(RBX, Isolate::current_tag_offset())); | 1692 __ movq(RAX, Address(RBX, Isolate::current_tag_offset())); |
1692 // Clear Isolate::current_tag_. | |
1693 __ LoadObject(RCX, Object::null_object(), PP); | |
1694 __ movq(Address(RBX, Isolate::current_tag_offset()), RCX); | |
1695 // Clear Isolate::user_tag_. | |
1696 __ movq(Address(RBX, Isolate::user_tag_offset()), Immediate(0)); | |
1697 __ ret(); | 1693 __ ret(); |
1698 } | 1694 } |
1699 | 1695 |
1700 #undef __ | 1696 #undef __ |
1701 | 1697 |
1702 } // namespace dart | 1698 } // namespace dart |
1703 | 1699 |
1704 #endif // defined TARGET_ARCH_X64 | 1700 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |