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

Side by Side Diff: runtime/vm/stub_code_ia32.cc

Issue 339183010: Specialize breakpoint stubs by set of live registers of the stubs they are intercepting. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 5 months 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_IA32) 6 #if defined(TARGET_ARCH_IA32)
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 19 matching lines...) Expand all
30 DEFINE_FLAG(bool, verify_incoming_contexts, false, ""); 30 DEFINE_FLAG(bool, verify_incoming_contexts, false, "");
31 31
32 DECLARE_FLAG(bool, enable_debugger); 32 DECLARE_FLAG(bool, enable_debugger);
33 33
34 // Input parameters: 34 // Input parameters:
35 // ESP : points to return address. 35 // ESP : points to return address.
36 // ESP + 4 : address of last argument in argument array. 36 // ESP + 4 : address of last argument in argument array.
37 // ESP + 4*EDX : address of first argument in argument array. 37 // ESP + 4*EDX : address of first argument in argument array.
38 // ESP + 4*EDX + 4 : address of return value. 38 // ESP + 4*EDX + 4 : address of return value.
39 // ECX : address of the runtime function to call. 39 // ECX : address of the runtime function to call.
40 // EDX : number of arguments to the call as Smi. 40 // EDX : number of arguments to the call.
41 // Must preserve callee saved registers EDI and EBX. 41 // Must preserve callee saved registers EDI and EBX.
42 void StubCode::GenerateCallToRuntimeStub(Assembler* assembler) { 42 void StubCode::GenerateCallToRuntimeStub(Assembler* assembler) {
43 const intptr_t isolate_offset = NativeArguments::isolate_offset(); 43 const intptr_t isolate_offset = NativeArguments::isolate_offset();
44 const intptr_t argc_tag_offset = NativeArguments::argc_tag_offset(); 44 const intptr_t argc_tag_offset = NativeArguments::argc_tag_offset();
45 const intptr_t argv_offset = NativeArguments::argv_offset(); 45 const intptr_t argv_offset = NativeArguments::argv_offset();
46 const intptr_t retval_offset = NativeArguments::retval_offset(); 46 const intptr_t retval_offset = NativeArguments::retval_offset();
47 47
48 __ EnterFrame(0); 48 __ EnterFrame(0);
49 __ SmiUntag(EDX);
50 49
51 // Load current Isolate pointer from Context structure into EAX. 50 // Load current Isolate pointer from Context structure into EAX.
52 __ movl(EAX, FieldAddress(CTX, Context::isolate_offset())); 51 __ movl(EAX, FieldAddress(CTX, Context::isolate_offset()));
53 52
54 // Save exit frame information to enable stack walking as we are about 53 // Save exit frame information to enable stack walking as we are about
55 // to transition to Dart VM C++ code. 54 // to transition to Dart VM C++ code.
56 __ movl(Address(EAX, Isolate::top_exit_frame_info_offset()), ESP); 55 __ movl(Address(EAX, Isolate::top_exit_frame_info_offset()), ESP);
57 56
58 #if defined(DEBUG) 57 #if defined(DEBUG)
59 if (FLAG_verify_incoming_contexts) { 58 if (FLAG_verify_incoming_contexts) {
(...skipping 1513 matching lines...) Expand 10 before | Expand all | Expand 10 after
1573 __ popl(ECX); // Restore IC data array. 1572 __ popl(ECX); // Restore IC data array.
1574 __ popl(EDX); // Restore arguments descriptor array. 1573 __ popl(EDX); // Restore arguments descriptor array.
1575 __ LeaveFrame(); 1574 __ LeaveFrame();
1576 1575
1577 __ movl(EAX, FieldAddress(EAX, Function::instructions_offset())); 1576 __ movl(EAX, FieldAddress(EAX, Function::instructions_offset()));
1578 __ addl(EAX, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); 1577 __ addl(EAX, Immediate(Instructions::HeaderSize() - kHeapObjectTag));
1579 __ jmp(EAX); 1578 __ jmp(EAX);
1580 } 1579 }
1581 1580
1582 1581
1583 // EDX, ECX: May contain arguments to runtime stub. 1582 // ECX: Contains an ICData.
1584 void StubCode::GenerateBreakpointRuntimeStub(Assembler* assembler) { 1583 void StubCode::GenerateICCallBreakpointStub(Assembler* assembler) {
1585 __ EnterStubFrame(); 1584 __ EnterStubFrame();
1586 // Save runtime args. 1585 // Save IC data.
1586 __ pushl(ECX);
1587 // Room for result. Debugger stub returns address of the
1588 // unpatched runtime stub.
1589 const Immediate& raw_null =
1590 Immediate(reinterpret_cast<intptr_t>(Object::null()));
1591 __ pushl(raw_null); // Room for result.
1592 __ CallRuntime(kBreakpointRuntimeHandlerRuntimeEntry, 0);
1593 __ popl(EAX); // Address of original stub.
1594 __ popl(ECX); // Restore IC data.
1595 __ LeaveFrame();
1596 __ jmp(EAX); // Jump to original stub.
1597 }
1598
1599
1600 // ECX: Contains Smi 0 (need to preserve a GC-safe value for the lazy compile
1601 // stub).
1602 // EDX: Contains an arguments descriptor.
1603 void StubCode::GenerateClosureCallBreakpointStub(Assembler* assembler) {
1604 __ EnterStubFrame();
1605 // Save arguments to original stub.
1587 __ pushl(ECX); 1606 __ pushl(ECX);
1588 __ pushl(EDX); 1607 __ pushl(EDX);
1589 // Room for result. Debugger stub returns address of the 1608 // Room for result. Debugger stub returns address of the
1590 // unpatched runtime stub. 1609 // unpatched runtime stub.
1610 const Immediate& raw_null =
1611 Immediate(reinterpret_cast<intptr_t>(Object::null()));
1612 __ pushl(raw_null); // Room for result.
1613 __ CallRuntime(kBreakpointRuntimeHandlerRuntimeEntry, 0);
1614 __ popl(EAX); // Address of original stub.
1615 __ popl(EDX); // Restore arguments to original stub.
1616 __ popl(ECX);
1617 __ LeaveFrame();
1618 __ jmp(EAX); // Jump to original stub.
1619 }
1620
1621
1622 // ECX: Garbage or function address.
1623 // EDX: Garbage or raw argument count.
1624 void StubCode::GenerateRuntimeCallBreakpointStub(Assembler* assembler) {
1625 __ EnterStubFrame();
1626 // Save runtime args.
1627 __ andl(ECX, Immediate(~kSmiTagMask)); // Make garbage GC-safe, no-op for
1628 // aligned function pointer
1629 __ pushl(ECX);
1630 __ SmiTag(EDX); // Make garbage or raw argument count GC-safe.
1631 __ pushl(EDX);
1632 // Room for result. Debugger stub returns address of the
1633 // unpatched runtime stub.
1591 const Immediate& raw_null = 1634 const Immediate& raw_null =
1592 Immediate(reinterpret_cast<intptr_t>(Object::null())); 1635 Immediate(reinterpret_cast<intptr_t>(Object::null()));
1593 __ pushl(raw_null); // Room for result. 1636 __ pushl(raw_null); // Room for result.
1594 __ CallRuntime(kBreakpointRuntimeHandlerRuntimeEntry, 0); 1637 __ CallRuntime(kBreakpointRuntimeHandlerRuntimeEntry, 0);
1595 __ popl(EAX); // Address of original stub. 1638 __ popl(EAX); // Address of original stub.
1596 __ popl(EDX); // Restore arguments. 1639 __ popl(EDX); // Restore arguments.
1640 __ SmiUntag(EDX);
1597 __ popl(ECX); 1641 __ popl(ECX);
1598 __ LeaveFrame(); 1642 __ LeaveFrame();
1599 __ jmp(EAX); // Jump to original stub. 1643 __ jmp(EAX); // Jump to original stub.
1600 } 1644 }
1601 1645
1602 1646
1603 // Called only from unoptimized code. 1647 // Called only from unoptimized code.
1604 void StubCode::GenerateDebugStepCheckStub(Assembler* assembler) { 1648 void StubCode::GenerateDebugStepCheckStub(Assembler* assembler) {
1605 if (FLAG_enable_debugger) { 1649 if (FLAG_enable_debugger) {
1606 // Check single stepping. 1650 // Check single stepping.
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
1893 const Register temp = ECX; 1937 const Register temp = ECX;
1894 __ movl(left, Address(ESP, 2 * kWordSize)); 1938 __ movl(left, Address(ESP, 2 * kWordSize));
1895 __ movl(right, Address(ESP, 1 * kWordSize)); 1939 __ movl(right, Address(ESP, 1 * kWordSize));
1896 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); 1940 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp);
1897 __ ret(); 1941 __ ret();
1898 } 1942 }
1899 1943
1900 } // namespace dart 1944 } // namespace dart
1901 1945
1902 #endif // defined TARGET_ARCH_IA32 1946 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698