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

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

Issue 286363006: Add flag —enable-debugger (default true) in order to disable debugger single stepping code. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 7 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
« no previous file with comments | « runtime/vm/stub_code_arm64.cc ('k') | runtime/vm/stub_code_mips.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 11 matching lines...) Expand all
22 #define __ assembler-> 22 #define __ assembler->
23 23
24 namespace dart { 24 namespace dart {
25 25
26 DEFINE_FLAG(bool, inline_alloc, true, "Inline allocation of objects."); 26 DEFINE_FLAG(bool, inline_alloc, true, "Inline allocation of objects.");
27 DEFINE_FLAG(bool, use_slow_path, false, 27 DEFINE_FLAG(bool, use_slow_path, false,
28 "Set to true for debugging & verifying the slow paths."); 28 "Set to true for debugging & verifying the slow paths.");
29 DECLARE_FLAG(bool, trace_optimized_ic_calls); 29 DECLARE_FLAG(bool, trace_optimized_ic_calls);
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 33
33 // Input parameters: 34 // Input parameters:
34 // ESP : points to return address. 35 // ESP : points to return address.
35 // ESP + 4 : address of last argument in argument array. 36 // ESP + 4 : address of last argument in argument array.
36 // ESP + 4*EDX : address of first argument in argument array. 37 // ESP + 4*EDX : address of first argument in argument array.
37 // ESP + 4*EDX + 4 : address of return value. 38 // ESP + 4*EDX + 4 : address of return value.
38 // ECX : address of the runtime function to call. 39 // ECX : address of the runtime function to call.
39 // EDX : number of arguments to the call. 40 // EDX : number of arguments to the call.
40 // Must preserve callee saved registers EDI and EBX. 41 // Must preserve callee saved registers EDI and EBX.
41 void StubCode::GenerateCallToRuntimeStub(Assembler* assembler) { 42 void StubCode::GenerateCallToRuntimeStub(Assembler* assembler) {
(...skipping 1252 matching lines...) Expand 10 before | Expand all | Expand 10 after
1294 __ movl(EBX, FieldAddress(ECX, ICData::state_bits_offset())); 1295 __ movl(EBX, FieldAddress(ECX, ICData::state_bits_offset()));
1295 ASSERT(ICData::NumArgsTestedShift() == 0); // No shift needed. 1296 ASSERT(ICData::NumArgsTestedShift() == 0); // No shift needed.
1296 __ andl(EBX, Immediate(ICData::NumArgsTestedMask())); 1297 __ andl(EBX, Immediate(ICData::NumArgsTestedMask()));
1297 __ cmpl(EBX, Immediate(num_args)); 1298 __ cmpl(EBX, Immediate(num_args));
1298 __ j(EQUAL, &ok, Assembler::kNearJump); 1299 __ j(EQUAL, &ok, Assembler::kNearJump);
1299 __ Stop("Incorrect stub for IC data"); 1300 __ Stop("Incorrect stub for IC data");
1300 __ Bind(&ok); 1301 __ Bind(&ok);
1301 } 1302 }
1302 #endif // DEBUG 1303 #endif // DEBUG
1303 1304
1304 // Check single stepping. 1305 if (FLAG_enable_debugger) {
1305 Label not_stepping; 1306 // Check single stepping.
1306 __ movl(EAX, FieldAddress(CTX, Context::isolate_offset())); 1307 Label not_stepping;
1307 __ movzxb(EAX, Address(EAX, Isolate::single_step_offset())); 1308 __ movl(EAX, FieldAddress(CTX, Context::isolate_offset()));
1308 __ cmpl(EAX, Immediate(0)); 1309 __ movzxb(EAX, Address(EAX, Isolate::single_step_offset()));
1309 __ j(EQUAL, &not_stepping, Assembler::kNearJump); 1310 __ cmpl(EAX, Immediate(0));
1311 __ j(EQUAL, &not_stepping, Assembler::kNearJump);
1310 1312
1311 __ EnterStubFrame(); 1313 __ EnterStubFrame();
1312 __ pushl(ECX); 1314 __ pushl(ECX);
1313 __ CallRuntime(kSingleStepHandlerRuntimeEntry, 0); 1315 __ CallRuntime(kSingleStepHandlerRuntimeEntry, 0);
1314 __ popl(ECX); 1316 __ popl(ECX);
1315 __ LeaveFrame(); 1317 __ LeaveFrame();
1316 __ Bind(&not_stepping); 1318 __ Bind(&not_stepping);
1319 }
1317 1320
1318 // ECX: IC data object (preserved). 1321 // ECX: IC data object (preserved).
1319 // Load arguments descriptor into EDX. 1322 // Load arguments descriptor into EDX.
1320 __ movl(EDX, FieldAddress(ECX, ICData::arguments_descriptor_offset())); 1323 __ movl(EDX, FieldAddress(ECX, ICData::arguments_descriptor_offset()));
1321 // Loop that checks if there is an IC data match. 1324 // Loop that checks if there is an IC data match.
1322 Label loop, update, test, found, get_class_id_as_smi; 1325 Label loop, update, test, found, get_class_id_as_smi;
1323 // ECX: IC data object (preserved). 1326 // ECX: IC data object (preserved).
1324 __ movl(EBX, FieldAddress(ECX, ICData::ic_data_offset())); 1327 __ movl(EBX, FieldAddress(ECX, ICData::ic_data_offset()));
1325 // EBX: ic_data_array with check entries: classes and target functions. 1328 // EBX: ic_data_array with check entries: classes and target functions.
1326 __ leal(EBX, FieldAddress(EBX, Array::data_offset())); 1329 __ leal(EBX, FieldAddress(EBX, Array::data_offset()));
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
1519 // 'NumArgsTested' is stored in the least significant bits of 'state_bits'. 1522 // 'NumArgsTested' is stored in the least significant bits of 'state_bits'.
1520 __ movl(EBX, FieldAddress(ECX, ICData::state_bits_offset())); 1523 __ movl(EBX, FieldAddress(ECX, ICData::state_bits_offset()));
1521 ASSERT(ICData::NumArgsTestedShift() == 0); // No shift needed. 1524 ASSERT(ICData::NumArgsTestedShift() == 0); // No shift needed.
1522 __ andl(EBX, Immediate(ICData::NumArgsTestedMask())); 1525 __ andl(EBX, Immediate(ICData::NumArgsTestedMask()));
1523 __ cmpl(EBX, Immediate(0)); 1526 __ cmpl(EBX, Immediate(0));
1524 __ j(EQUAL, &ok, Assembler::kNearJump); 1527 __ j(EQUAL, &ok, Assembler::kNearJump);
1525 __ Stop("Incorrect IC data for unoptimized static call"); 1528 __ Stop("Incorrect IC data for unoptimized static call");
1526 __ Bind(&ok); 1529 __ Bind(&ok);
1527 } 1530 }
1528 #endif // DEBUG 1531 #endif // DEBUG
1529 // Check single stepping. 1532 if (FLAG_enable_debugger) {
1530 Label not_stepping; 1533 // Check single stepping.
1531 __ movl(EAX, FieldAddress(CTX, Context::isolate_offset())); 1534 Label not_stepping;
1532 __ movzxb(EAX, Address(EAX, Isolate::single_step_offset())); 1535 __ movl(EAX, FieldAddress(CTX, Context::isolate_offset()));
1533 __ cmpl(EAX, Immediate(0)); 1536 __ movzxb(EAX, Address(EAX, Isolate::single_step_offset()));
1534 __ j(EQUAL, &not_stepping, Assembler::kNearJump); 1537 __ cmpl(EAX, Immediate(0));
1538 __ j(EQUAL, &not_stepping, Assembler::kNearJump);
1535 1539
1536 __ EnterStubFrame(); 1540 __ EnterStubFrame();
1537 __ pushl(ECX); 1541 __ pushl(ECX);
1538 __ CallRuntime(kSingleStepHandlerRuntimeEntry, 0); 1542 __ CallRuntime(kSingleStepHandlerRuntimeEntry, 0);
1539 __ popl(ECX); 1543 __ popl(ECX);
1540 __ LeaveFrame(); 1544 __ LeaveFrame();
1541 __ Bind(&not_stepping); 1545 __ Bind(&not_stepping);
1546 }
1542 1547
1543 // ECX: IC data object (preserved). 1548 // ECX: IC data object (preserved).
1544 __ movl(EBX, FieldAddress(ECX, ICData::ic_data_offset())); 1549 __ movl(EBX, FieldAddress(ECX, ICData::ic_data_offset()));
1545 // EBX: ic_data_array with entries: target functions and count. 1550 // EBX: ic_data_array with entries: target functions and count.
1546 __ leal(EBX, FieldAddress(EBX, Array::data_offset())); 1551 __ leal(EBX, FieldAddress(EBX, Array::data_offset()));
1547 // EBX: points directly to the first ic data array element. 1552 // EBX: points directly to the first ic data array element.
1548 const intptr_t target_offset = ICData::TargetIndexFor(0) * kWordSize; 1553 const intptr_t target_offset = ICData::TargetIndexFor(0) * kWordSize;
1549 const intptr_t count_offset = ICData::CountIndexFor(0) * kWordSize; 1554 const intptr_t count_offset = ICData::CountIndexFor(0) * kWordSize;
1550 1555
1551 // Increment count for this call. 1556 // Increment count for this call.
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
1613 __ popl(EAX); // Address of original stub. 1618 __ popl(EAX); // Address of original stub.
1614 __ popl(EDX); // Restore arguments. 1619 __ popl(EDX); // Restore arguments.
1615 __ popl(ECX); 1620 __ popl(ECX);
1616 __ LeaveFrame(); 1621 __ LeaveFrame();
1617 __ jmp(EAX); // Jump to original stub. 1622 __ jmp(EAX); // Jump to original stub.
1618 } 1623 }
1619 1624
1620 1625
1621 // Called only from unoptimized code. 1626 // Called only from unoptimized code.
1622 void StubCode::GenerateDebugStepCheckStub(Assembler* assembler) { 1627 void StubCode::GenerateDebugStepCheckStub(Assembler* assembler) {
1623 // Check single stepping. 1628 if (FLAG_enable_debugger) {
1624 Label not_stepping; 1629 // Check single stepping.
1625 __ movl(EAX, FieldAddress(CTX, Context::isolate_offset())); 1630 Label not_stepping;
1626 __ movzxb(EAX, Address(EAX, Isolate::single_step_offset())); 1631 __ movl(EAX, FieldAddress(CTX, Context::isolate_offset()));
1627 __ cmpl(EAX, Immediate(0)); 1632 __ movzxb(EAX, Address(EAX, Isolate::single_step_offset()));
1628 __ j(EQUAL, &not_stepping, Assembler::kNearJump); 1633 __ cmpl(EAX, Immediate(0));
1634 __ j(EQUAL, &not_stepping, Assembler::kNearJump);
1629 1635
1630 __ EnterStubFrame(); 1636 __ EnterStubFrame();
1631 __ CallRuntime(kSingleStepHandlerRuntimeEntry, 0); 1637 __ CallRuntime(kSingleStepHandlerRuntimeEntry, 0);
1632 __ LeaveFrame(); 1638 __ LeaveFrame();
1633 __ Bind(&not_stepping); 1639 __ Bind(&not_stepping);
1640 }
1634 __ ret(); 1641 __ ret();
1635 } 1642 }
1636 1643
1637 1644
1638 // Used to check class and type arguments. Arguments passed on stack: 1645 // Used to check class and type arguments. Arguments passed on stack:
1639 // TOS + 0: return address. 1646 // TOS + 0: return address.
1640 // TOS + 1: instantiator type arguments (can be NULL). 1647 // TOS + 1: instantiator type arguments (can be NULL).
1641 // TOS + 2: instance. 1648 // TOS + 2: instance.
1642 // TOS + 3: SubtypeTestCache. 1649 // TOS + 3: SubtypeTestCache.
1643 // Result in ECX: null -> not found, otherwise result (true or false). 1650 // Result in ECX: null -> not found, otherwise result (true or false).
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
1866 } 1873 }
1867 1874
1868 1875
1869 // Called only from unoptimized code. All relevant registers have been saved. 1876 // Called only from unoptimized code. All relevant registers have been saved.
1870 // TOS + 0: return address 1877 // TOS + 0: return address
1871 // TOS + 1: right argument. 1878 // TOS + 1: right argument.
1872 // TOS + 2: left argument. 1879 // TOS + 2: left argument.
1873 // Returns ZF set. 1880 // Returns ZF set.
1874 void StubCode::GenerateUnoptimizedIdenticalWithNumberCheckStub( 1881 void StubCode::GenerateUnoptimizedIdenticalWithNumberCheckStub(
1875 Assembler* assembler) { 1882 Assembler* assembler) {
1876 // Check single stepping. 1883 if (FLAG_enable_debugger) {
1877 Label not_stepping; 1884 // Check single stepping.
1878 __ movl(EAX, FieldAddress(CTX, Context::isolate_offset())); 1885 Label not_stepping;
1879 __ movzxb(EAX, Address(EAX, Isolate::single_step_offset())); 1886 __ movl(EAX, FieldAddress(CTX, Context::isolate_offset()));
1880 __ cmpl(EAX, Immediate(0)); 1887 __ movzxb(EAX, Address(EAX, Isolate::single_step_offset()));
1881 __ j(EQUAL, &not_stepping, Assembler::kNearJump); 1888 __ cmpl(EAX, Immediate(0));
1889 __ j(EQUAL, &not_stepping, Assembler::kNearJump);
1882 1890
1883 __ EnterStubFrame(); 1891 __ EnterStubFrame();
1884 __ CallRuntime(kSingleStepHandlerRuntimeEntry, 0); 1892 __ CallRuntime(kSingleStepHandlerRuntimeEntry, 0);
1885 __ LeaveFrame(); 1893 __ LeaveFrame();
1886 __ Bind(&not_stepping); 1894 __ Bind(&not_stepping);
1895 }
1887 1896
1888 const Register left = EAX; 1897 const Register left = EAX;
1889 const Register right = EDX; 1898 const Register right = EDX;
1890 const Register temp = ECX; 1899 const Register temp = ECX;
1891 __ movl(left, Address(ESP, 2 * kWordSize)); 1900 __ movl(left, Address(ESP, 2 * kWordSize));
1892 __ movl(right, Address(ESP, 1 * kWordSize)); 1901 __ movl(right, Address(ESP, 1 * kWordSize));
1893 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); 1902 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp);
1894 __ ret(); 1903 __ ret();
1895 } 1904 }
1896 1905
(...skipping 10 matching lines...) Expand all
1907 const Register temp = ECX; 1916 const Register temp = ECX;
1908 __ movl(left, Address(ESP, 2 * kWordSize)); 1917 __ movl(left, Address(ESP, 2 * kWordSize));
1909 __ movl(right, Address(ESP, 1 * kWordSize)); 1918 __ movl(right, Address(ESP, 1 * kWordSize));
1910 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); 1919 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp);
1911 __ ret(); 1920 __ ret();
1912 } 1921 }
1913 1922
1914 } // namespace dart 1923 } // namespace dart
1915 1924
1916 #endif // defined TARGET_ARCH_IA32 1925 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/stub_code_arm64.cc ('k') | runtime/vm/stub_code_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698