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/object_store.h" | 10 #include "vm/object_store.h" |
(...skipping 1675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1686 | 1686 |
1687 // Now call the static function. The breakpoint handler function | 1687 // Now call the static function. The breakpoint handler function |
1688 // ensures that the call target is compiled. | 1688 // ensures that the call target is compiled. |
1689 __ movq(RAX, FieldAddress(RBX, Function::code_offset())); | 1689 __ movq(RAX, FieldAddress(RBX, Function::code_offset())); |
1690 __ movq(RBX, FieldAddress(RAX, Code::instructions_offset())); | 1690 __ movq(RBX, FieldAddress(RAX, Code::instructions_offset())); |
1691 __ addq(RBX, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); | 1691 __ addq(RBX, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); |
1692 __ jmp(RBX); | 1692 __ jmp(RBX); |
1693 } | 1693 } |
1694 | 1694 |
1695 | 1695 |
| 1696 // TOS(0): return address (Dart code). |
| 1697 void StubCode::GenerateBreakpointReturnStub(Assembler* assembler) { |
| 1698 __ EnterFrame(0); |
| 1699 __ pushq(RAX); |
| 1700 __ CallRuntimeFromStub(kBreakpointReturnHandlerRuntimeEntry); |
| 1701 __ popq(RAX); |
| 1702 __ LeaveFrame(); |
| 1703 |
| 1704 __ popq(R11); // discard return address of call to this stub. |
| 1705 __ LeaveFrame(); |
| 1706 __ ret(); |
| 1707 } |
| 1708 |
| 1709 |
1696 // RBX: Inline cache data array. | 1710 // RBX: Inline cache data array. |
1697 // R10: Arguments array. | 1711 // R10: Arguments array. |
1698 // TOS(0): return address (Dart code). | 1712 // TOS(0): return address (Dart code). |
1699 void StubCode::GenerateBreakpointDynamicStub(Assembler* assembler) { | 1713 void StubCode::GenerateBreakpointDynamicStub(Assembler* assembler) { |
1700 __ Untested("BreakpointDynamic stub"); | |
1701 __ EnterFrame(0); | 1714 __ EnterFrame(0); |
1702 __ pushq(RBX); | 1715 __ pushq(RBX); |
1703 __ pushq(R10); | 1716 __ pushq(R10); |
1704 __ CallRuntimeFromStub(kBreakpointDynamicHandlerRuntimeEntry); | 1717 __ CallRuntimeFromStub(kBreakpointDynamicHandlerRuntimeEntry); |
1705 __ popq(R10); | 1718 __ popq(R10); |
1706 __ popq(RBX); | 1719 __ popq(RBX); |
1707 __ LeaveFrame(); | 1720 __ LeaveFrame(); |
1708 // Now call the dynamic function. | 1721 |
| 1722 // Find out which dispatch stub to call. |
| 1723 Label ic_cache_one_arg; |
| 1724 __ movq(RCX, FieldAddress(RBX, ICData::num_args_tested_offset())); |
| 1725 const Immediate value = Immediate(reinterpret_cast<intptr_t>(Smi::New(1))); |
| 1726 __ cmpq(RCX, value); |
| 1727 __ j(EQUAL, &ic_cache_one_arg, Assembler::kNearJump); |
| 1728 __ jmp(&StubCode::TwoArgsCheckInlineCacheLabel()); |
| 1729 __ Bind(&ic_cache_one_arg); |
1709 __ jmp(&StubCode::OneArgCheckInlineCacheLabel()); | 1730 __ jmp(&StubCode::OneArgCheckInlineCacheLabel()); |
1710 } | 1731 } |
1711 | 1732 |
1712 } // namespace dart | 1733 } // namespace dart |
1713 | 1734 |
1714 #endif // defined TARGET_ARCH_X64 | 1735 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |