OLD | NEW |
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" | 5 #include "vm/globals.h" |
6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
7 | 7 |
8 #include "vm/code_generator.h" | 8 #include "vm/code_generator.h" |
9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
10 #include "vm/ic_data.h" | 10 #include "vm/ic_data.h" |
(...skipping 1700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1711 | 1711 |
1712 // Now call the static function. The breakpoint handler function | 1712 // Now call the static function. The breakpoint handler function |
1713 // ensures that the call target is compiled. | 1713 // ensures that the call target is compiled. |
1714 __ movq(RAX, FieldAddress(RBX, Function::code_offset())); | 1714 __ movq(RAX, FieldAddress(RBX, Function::code_offset())); |
1715 __ movq(RBX, FieldAddress(RAX, Code::instructions_offset())); | 1715 __ movq(RBX, FieldAddress(RAX, Code::instructions_offset())); |
1716 __ addq(RBX, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); | 1716 __ addq(RBX, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); |
1717 __ jmp(RBX); | 1717 __ jmp(RBX); |
1718 } | 1718 } |
1719 | 1719 |
1720 | 1720 |
| 1721 // TOS(0): return address (Dart code). |
| 1722 void StubCode::GenerateBreakpointReturnStub(Assembler* assembler) { |
| 1723 __ EnterFrame(0); |
| 1724 __ pushq(RAX); |
| 1725 __ CallRuntimeFromStub(kBreakpointReturnHandlerRuntimeEntry); |
| 1726 __ popq(RAX); |
| 1727 __ LeaveFrame(); |
| 1728 |
| 1729 __ popq(R11); // discard return address of call to this stub. |
| 1730 __ LeaveFrame(); |
| 1731 __ ret(); |
| 1732 } |
| 1733 |
| 1734 |
1721 // RBX: Inline cache data array. | 1735 // RBX: Inline cache data array. |
1722 // R10: Arguments array. | 1736 // R10: Arguments array. |
1723 // TOS(0): return address (Dart code). | 1737 // TOS(0): return address (Dart code). |
1724 void StubCode::GenerateBreakpointDynamicStub(Assembler* assembler) { | 1738 void StubCode::GenerateBreakpointDynamicStub(Assembler* assembler) { |
1725 __ Untested("BreakpointDynamic stub"); | |
1726 __ EnterFrame(0); | 1739 __ EnterFrame(0); |
1727 __ pushq(RBX); | 1740 __ pushq(RBX); |
1728 __ pushq(R10); | 1741 __ pushq(R10); |
1729 __ CallRuntimeFromStub(kBreakpointDynamicHandlerRuntimeEntry); | 1742 __ CallRuntimeFromStub(kBreakpointDynamicHandlerRuntimeEntry); |
1730 __ popq(R10); | 1743 __ popq(R10); |
1731 __ popq(RBX); | 1744 __ popq(RBX); |
1732 __ LeaveFrame(); | 1745 __ LeaveFrame(); |
1733 // Now call the dynamic function. | 1746 |
| 1747 // Find out which dispatch stub to call. |
| 1748 Label ic_cache_one_arg; |
| 1749 __ movq(RCX, FieldAddress(RBX, |
| 1750 Array::data_offset() + ICData::kNumArgsCheckedIndex * kWordSize)); |
| 1751 const Immediate value = Immediate(reinterpret_cast<intptr_t>(Smi::New(1))); |
| 1752 __ cmpq(RCX, value); |
| 1753 __ j(EQUAL, &ic_cache_one_arg, Assembler::kNearJump); |
| 1754 __ jmp(&StubCode::TwoArgsCheckInlineCacheLabel()); |
| 1755 __ Bind(&ic_cache_one_arg); |
1734 __ jmp(&StubCode::OneArgCheckInlineCacheLabel()); | 1756 __ jmp(&StubCode::OneArgCheckInlineCacheLabel()); |
1735 } | 1757 } |
1736 | 1758 |
1737 } // namespace dart | 1759 } // namespace dart |
1738 | 1760 |
1739 #endif // defined TARGET_ARCH_X64 | 1761 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |