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

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 1514 matching lines...) Expand 10 before | Expand all | Expand 10 after
1574 __ popl(ECX); // Restore IC data array. 1573 __ popl(ECX); // Restore IC data array.
1575 __ popl(EDX); // Restore arguments descriptor array. 1574 __ popl(EDX); // Restore arguments descriptor array.
1576 __ LeaveFrame(); 1575 __ LeaveFrame();
1577 1576
1578 __ movl(EAX, FieldAddress(EAX, Function::instructions_offset())); 1577 __ movl(EAX, FieldAddress(EAX, Function::instructions_offset()));
1579 __ addl(EAX, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); 1578 __ addl(EAX, Immediate(Instructions::HeaderSize() - kHeapObjectTag));
1580 __ jmp(EAX); 1579 __ jmp(EAX);
1581 } 1580 }
1582 1581
1583 1582
1584 // EDX, ECX: May contain arguments to runtime stub. 1583 // ECX: Contains an ICData.
1585 void StubCode::GenerateBreakpointRuntimeStub(Assembler* assembler) { 1584 void StubCode::GenerateICCallBreakpointStub(Assembler* assembler) {
1586 __ EnterStubFrame(); 1585 __ EnterStubFrame();
1587 // Save runtime args. 1586 // Save IC data.
1587 __ pushl(ECX);
1588 // Room for result. Debugger stub returns address of the
1589 // unpatched runtime stub.
1590 const Immediate& raw_null =
1591 Immediate(reinterpret_cast<intptr_t>(Object::null()));
1592 __ pushl(raw_null); // Room for result.
1593 __ CallRuntime(kBreakpointRuntimeHandlerRuntimeEntry, 0);
1594 __ popl(EAX); // Address of original stub.
1595 __ popl(ECX); // Restore IC data.
1596 __ LeaveFrame();
1597 __ jmp(EAX); // Jump to original stub.
1598 }
1599
1600
1601 // ECX: Contains Smi 0 (need to preserve a GC-safe value for the lazy compile
1602 // stub).
1603 // EDX: Contains an arguments descriptor.
1604 void StubCode::GenerateClosureCallBreakpointStub(Assembler* assembler) {
1605 __ EnterStubFrame();
1606 // Save arguments to original stub.
1588 __ pushl(ECX); 1607 __ pushl(ECX);
1589 __ pushl(EDX); 1608 __ pushl(EDX);
1590 // Room for result. Debugger stub returns address of the 1609 // Room for result. Debugger stub returns address of the
1591 // unpatched runtime stub. 1610 // unpatched runtime stub.
1592 const Immediate& raw_null = 1611 const Immediate& raw_null =
1593 Immediate(reinterpret_cast<intptr_t>(Object::null())); 1612 Immediate(reinterpret_cast<intptr_t>(Object::null()));
1594 __ pushl(raw_null); // Room for result. 1613 __ pushl(raw_null); // Room for result.
1595 __ CallRuntime(kBreakpointRuntimeHandlerRuntimeEntry, 0); 1614 __ CallRuntime(kBreakpointRuntimeHandlerRuntimeEntry, 0);
1596 __ popl(EAX); // Address of original stub. 1615 __ popl(EAX); // Address of original stub.
1597 __ popl(EDX); // Restore arguments. 1616 __ popl(EDX); // Restore arguments to original stub.
1598 __ popl(ECX); 1617 __ popl(ECX);
1599 __ LeaveFrame(); 1618 __ LeaveFrame();
1600 __ jmp(EAX); // Jump to original stub. 1619 __ jmp(EAX); // Jump to original stub.
1601 } 1620 }
1602 1621
1603 1622
1623 void StubCode::GenerateRuntimeCallBreakpointStub(Assembler* assembler) {
1624 __ EnterStubFrame();
1625 // Room for result. Debugger stub returns address of the
1626 // unpatched runtime stub.
1627 const Immediate& raw_null =
1628 Immediate(reinterpret_cast<intptr_t>(Object::null()));
1629 __ pushl(raw_null); // Room for result.
1630 __ CallRuntime(kBreakpointRuntimeHandlerRuntimeEntry, 0);
1631 __ popl(EAX); // Address of original stub.
1632 __ LeaveFrame();
1633 __ jmp(EAX); // Jump to original stub.
1634 }
1635
1636
1604 // Called only from unoptimized code. 1637 // Called only from unoptimized code.
1605 void StubCode::GenerateDebugStepCheckStub(Assembler* assembler) { 1638 void StubCode::GenerateDebugStepCheckStub(Assembler* assembler) {
1606 if (FLAG_enable_debugger) { 1639 if (FLAG_enable_debugger) {
1607 // Check single stepping. 1640 // Check single stepping.
1608 Label not_stepping; 1641 Label not_stepping;
1609 __ movl(EAX, FieldAddress(CTX, Context::isolate_offset())); 1642 __ movl(EAX, FieldAddress(CTX, Context::isolate_offset()));
1610 __ movzxb(EAX, Address(EAX, Isolate::single_step_offset())); 1643 __ movzxb(EAX, Address(EAX, Isolate::single_step_offset()));
1611 __ cmpl(EAX, Immediate(0)); 1644 __ cmpl(EAX, Immediate(0));
1612 __ j(EQUAL, &not_stepping, Assembler::kNearJump); 1645 __ j(EQUAL, &not_stepping, Assembler::kNearJump);
1613 1646
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
1894 const Register temp = ECX; 1927 const Register temp = ECX;
1895 __ movl(left, Address(ESP, 2 * kWordSize)); 1928 __ movl(left, Address(ESP, 2 * kWordSize));
1896 __ movl(right, Address(ESP, 1 * kWordSize)); 1929 __ movl(right, Address(ESP, 1 * kWordSize));
1897 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); 1930 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp);
1898 __ ret(); 1931 __ ret();
1899 } 1932 }
1900 1933
1901 } // namespace dart 1934 } // namespace dart
1902 1935
1903 #endif // defined TARGET_ARCH_IA32 1936 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698