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

Side by Side Diff: dart/runtime/vm/stub_code_x64.cc

Issue 64033002: Version 0.8.10.8 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 1 month 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" 5 #include "vm/globals.h"
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 // Code above cannot cause GC. 446 // Code above cannot cause GC.
447 // There is a Dart Frame on the stack. We just need the PP. 447 // There is a Dart Frame on the stack. We just need the PP.
448 __ movq(PP, Address(RBP, -2 * kWordSize)); 448 __ movq(PP, Address(RBP, -2 * kWordSize));
449 __ LeaveFrame(); 449 __ LeaveFrame();
450 450
451 // Frame is fully rewritten at this point and it is safe to perform a GC. 451 // Frame is fully rewritten at this point and it is safe to perform a GC.
452 // Materialize any objects that were deferred by FillFrame because they 452 // Materialize any objects that were deferred by FillFrame because they
453 // require allocation. 453 // require allocation.
454 __ EnterStubFrame(); 454 __ EnterStubFrame();
455 if (preserve_result) { 455 if (preserve_result) {
456 __ pushq(Immediate(0)); // Workaround for dropped stack slot during GC.
456 __ pushq(RBX); // Preserve result, it will be GC-d here. 457 __ pushq(RBX); // Preserve result, it will be GC-d here.
457 } 458 }
458 __ pushq(Immediate(Smi::RawValue(0))); // Space for the result. 459 __ pushq(Immediate(Smi::RawValue(0))); // Space for the result.
459 __ CallRuntime(kDeoptimizeMaterializeRuntimeEntry, 0); 460 __ CallRuntime(kDeoptimizeMaterializeRuntimeEntry, 0);
460 // Result tells stub how many bytes to remove from the expression stack 461 // Result tells stub how many bytes to remove from the expression stack
461 // of the bottom-most frame. They were used as materialization arguments. 462 // of the bottom-most frame. They were used as materialization arguments.
462 __ popq(RBX); 463 __ popq(RBX);
463 __ SmiUntag(RBX); 464 __ SmiUntag(RBX);
464 if (preserve_result) { 465 if (preserve_result) {
465 __ popq(RAX); // Restore result. 466 __ popq(RAX); // Restore result.
467 __ Drop(1); // Workaround for dropped stack slot during GC.
466 } 468 }
467 __ LeaveFrame(); 469 __ LeaveFrame();
468 470
469 __ popq(RCX); // Pop return address. 471 __ popq(RCX); // Pop return address.
470 __ addq(RSP, RBX); // Remove materialization arguments. 472 __ addq(RSP, RBX); // Remove materialization arguments.
471 __ pushq(RCX); // Push return address. 473 __ pushq(RCX); // Push return address.
472 __ ret(); 474 __ ret();
473 } 475 }
474 476
475 477
(...skipping 1337 matching lines...) Expand 10 before | Expand all | Expand 10 after
1813 __ popq(RCX); // Restore IC data array. 1815 __ popq(RCX); // Restore IC data array.
1814 __ popq(RDX); // Restore arguments descriptor array. 1816 __ popq(RDX); // Restore arguments descriptor array.
1815 __ LeaveFrame(); 1817 __ LeaveFrame();
1816 __ ret(); 1818 __ ret();
1817 } 1819 }
1818 1820
1819 1821
1820 // RBX, R10: May contain arguments to runtime stub. 1822 // RBX, R10: May contain arguments to runtime stub.
1821 // TOS(0): return address (Dart code). 1823 // TOS(0): return address (Dart code).
1822 void StubCode::GenerateBreakpointRuntimeStub(Assembler* assembler) { 1824 void StubCode::GenerateBreakpointRuntimeStub(Assembler* assembler) {
1823 __ EnterStubFrame(); 1825 __ EnterStubFrameWithPP();
1824 // Preserve runtime args. 1826 // Preserve runtime args.
1825 __ pushq(RBX); 1827 __ pushq(RBX);
1826 __ pushq(R10); 1828 __ pushq(R10);
1827 // Room for result. Debugger stub returns address of the 1829 // Room for result. Debugger stub returns address of the
1828 // unpatched runtime stub. 1830 // unpatched runtime stub.
1829 __ LoadObject(R12, Object::null_object(), PP); 1831 __ LoadObject(R12, Object::null_object(), PP);
1830 __ pushq(R12); // Room for result. 1832 __ pushq(R12); // Room for result.
1831 __ CallRuntime(kBreakpointRuntimeHandlerRuntimeEntry, 0); 1833 __ CallRuntime(kBreakpointRuntimeHandlerRuntimeEntry, 0);
1832 __ popq(RAX); // Address of original. 1834 __ popq(RAX); // Address of original.
1833 __ popq(R10); // Restore arguments. 1835 __ popq(R10); // Restore arguments.
1834 __ popq(RBX); 1836 __ popq(RBX);
1835 __ LeaveFrame(); 1837 __ LeaveFrameWithPP();
1836 __ jmp(RAX); // Jump to original stub. 1838 __ jmp(RAX); // Jump to original stub.
1837 } 1839 }
1838 1840
1839 1841
1840 // RBX: ICData (unoptimized static call) 1842 // RBX: ICData (unoptimized static call)
1841 // TOS(0): return address (Dart code). 1843 // TOS(0): return address (Dart code).
1842 void StubCode::GenerateBreakpointStaticStub(Assembler* assembler) { 1844 void StubCode::GenerateBreakpointStaticStub(Assembler* assembler) {
1843 __ EnterStubFrame(); 1845 __ EnterStubFrame();
1844 __ LoadObject(R12, Object::null_object(), PP); 1846 __ LoadObject(R12, Object::null_object(), PP);
1845 __ pushq(RBX); // Preserve IC data for unoptimized call. 1847 __ pushq(RBX); // Preserve IC data for unoptimized call.
1846 __ pushq(R12); // Room for result. 1848 __ pushq(R12); // Room for result.
1847 __ CallRuntime(kBreakpointStaticHandlerRuntimeEntry, 0); 1849 __ CallRuntime(kBreakpointStaticHandlerRuntimeEntry, 0);
1848 __ popq(RAX); // Code object. 1850 __ popq(RAX); // Code object.
1849 __ popq(RBX); // Restore IC data. 1851 __ popq(RBX); // Restore IC data.
1850 __ LeaveFrame(); 1852 __ LeaveFrame();
1851 1853
1852 // Load arguments descriptor into R10. 1854 // Load arguments descriptor into R10.
1853 __ movq(R10, FieldAddress(RBX, ICData::arguments_descriptor_offset())); 1855 __ movq(R10, FieldAddress(RBX, ICData::arguments_descriptor_offset()));
1854 // Now call the static function. The breakpoint handler function 1856 // Now call the static function. The breakpoint handler function
1855 // ensures that the call target is compiled. 1857 // ensures that the call target is compiled.
1856 __ movq(RBX, FieldAddress(RAX, Code::instructions_offset())); 1858 __ movq(RBX, FieldAddress(RAX, Code::instructions_offset()));
1857 __ addq(RBX, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); 1859 __ addq(RBX, Immediate(Instructions::HeaderSize() - kHeapObjectTag));
1858 __ jmp(RBX); 1860 __ jmp(RBX);
1859 } 1861 }
1860 1862
1861 1863
1862 // TOS(0): return address (Dart code). 1864 // TOS(0): return address (Dart code).
1863 void StubCode::GenerateBreakpointReturnStub(Assembler* assembler) { 1865 void StubCode::GenerateBreakpointReturnStub(Assembler* assembler) {
1864 __ EnterStubFrame(); 1866 __ EnterStubFrameWithPP();
1865 __ pushq(RAX); 1867 __ pushq(RAX);
1866 __ CallRuntime(kBreakpointReturnHandlerRuntimeEntry, 0); 1868 __ CallRuntime(kBreakpointReturnHandlerRuntimeEntry, 0);
1867 __ popq(RAX); 1869 __ popq(RAX);
1868 __ LeaveFrame(); 1870 __ LeaveFrameWithPP();
1869 1871
1870 __ popq(R11); // discard return address of call to this stub. 1872 __ popq(R11); // discard return address of call to this stub.
1871 __ LeaveFrameWithPP(); 1873 __ LeaveFrameWithPP();
1872 __ ret(); 1874 __ ret();
1873 } 1875 }
1874 1876
1875 1877
1876 // RBX: Inline cache data array. 1878 // RBX: Inline cache data array.
1877 // TOS(0): return address (Dart code). 1879 // TOS(0): return address (Dart code).
1878 void StubCode::GenerateBreakpointDynamicStub(Assembler* assembler) { 1880 void StubCode::GenerateBreakpointDynamicStub(Assembler* assembler) {
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
2169 __ movq(right, Address(RSP, 3 * kWordSize)); 2171 __ movq(right, Address(RSP, 3 * kWordSize));
2170 GenerateIdenticalWithNumberCheckStub(assembler, left, right); 2172 GenerateIdenticalWithNumberCheckStub(assembler, left, right);
2171 __ popq(right); 2173 __ popq(right);
2172 __ popq(left); 2174 __ popq(left);
2173 __ ret(); 2175 __ ret();
2174 } 2176 }
2175 2177
2176 } // namespace dart 2178 } // namespace dart
2177 2179
2178 #endif // defined TARGET_ARCH_X64 2180 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698