| OLD | NEW |
| 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 1275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1286 // - If receiver is Smi -> load Smi class. | 1286 // - If receiver is Smi -> load Smi class. |
| 1287 // - If receiver is not-Smi -> load receiver's class. | 1287 // - If receiver is not-Smi -> load receiver's class. |
| 1288 // - Check if 'num_args' (including receiver) match any IC data group. | 1288 // - Check if 'num_args' (including receiver) match any IC data group. |
| 1289 // - Match found -> jump to target. | 1289 // - Match found -> jump to target. |
| 1290 // - Match not found -> jump to IC miss. | 1290 // - Match not found -> jump to IC miss. |
| 1291 void StubCode::GenerateNArgsCheckInlineCacheStub( | 1291 void StubCode::GenerateNArgsCheckInlineCacheStub( |
| 1292 Assembler* assembler, | 1292 Assembler* assembler, |
| 1293 intptr_t num_args, | 1293 intptr_t num_args, |
| 1294 const RuntimeEntry& handle_ic_miss, | 1294 const RuntimeEntry& handle_ic_miss, |
| 1295 Token::Kind kind, | 1295 Token::Kind kind, |
| 1296 RangeCollectionMode range_collection_mode) { | 1296 RangeCollectionMode range_collection_mode, |
| 1297 bool optimized) { |
| 1297 ASSERT(num_args > 0); | 1298 ASSERT(num_args > 0); |
| 1298 #if defined(DEBUG) | 1299 #if defined(DEBUG) |
| 1299 { Label ok; | 1300 { Label ok; |
| 1300 // Check that the IC data array has NumArgsTested() == num_args. | 1301 // Check that the IC data array has NumArgsTested() == num_args. |
| 1301 // 'NumArgsTested' is stored in the least significant bits of 'state_bits'. | 1302 // 'NumArgsTested' is stored in the least significant bits of 'state_bits'. |
| 1302 __ movl(EBX, FieldAddress(ECX, ICData::state_bits_offset())); | 1303 __ movl(EBX, FieldAddress(ECX, ICData::state_bits_offset())); |
| 1303 ASSERT(ICData::NumArgsTestedShift() == 0); // No shift needed. | 1304 ASSERT(ICData::NumArgsTestedShift() == 0); // No shift needed. |
| 1304 __ andl(EBX, Immediate(ICData::NumArgsTestedMask())); | 1305 __ andl(EBX, Immediate(ICData::NumArgsTestedMask())); |
| 1305 __ cmpl(EBX, Immediate(num_args)); | 1306 __ cmpl(EBX, Immediate(num_args)); |
| 1306 __ j(EQUAL, &ok, Assembler::kNearJump); | 1307 __ j(EQUAL, &ok, Assembler::kNearJump); |
| 1307 __ Stop("Incorrect stub for IC data"); | 1308 __ Stop("Incorrect stub for IC data"); |
| 1308 __ Bind(&ok); | 1309 __ Bind(&ok); |
| 1309 } | 1310 } |
| 1310 #endif // DEBUG | 1311 #endif // DEBUG |
| 1311 | 1312 |
| 1312 Label stepping, done_stepping; | 1313 Label stepping, done_stepping; |
| 1313 if (FLAG_support_debugger) { | 1314 if (FLAG_support_debugger && !optimized) { |
| 1314 __ Comment("Check single stepping"); | 1315 __ Comment("Check single stepping"); |
| 1315 uword single_step_address = reinterpret_cast<uword>(Isolate::Current()) + | 1316 uword single_step_address = reinterpret_cast<uword>(Isolate::Current()) + |
| 1316 Isolate::single_step_offset(); | 1317 Isolate::single_step_offset(); |
| 1317 __ cmpb(Address::Absolute(single_step_address), Immediate(0)); | 1318 __ cmpb(Address::Absolute(single_step_address), Immediate(0)); |
| 1318 __ j(NOT_EQUAL, &stepping); | 1319 __ j(NOT_EQUAL, &stepping); |
| 1319 __ Bind(&done_stepping); | 1320 __ Bind(&done_stepping); |
| 1320 } | 1321 } |
| 1321 __ Comment("Range feedback collection"); | 1322 __ Comment("Range feedback collection"); |
| 1322 Label not_smi_or_overflow; | 1323 Label not_smi_or_overflow; |
| 1323 if (range_collection_mode == kCollectRanges) { | 1324 if (range_collection_mode == kCollectRanges) { |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1461 __ movl(ECX, Address(EBP, kFirstLocalSlotFromFp * kWordSize)); | 1462 __ movl(ECX, Address(EBP, kFirstLocalSlotFromFp * kWordSize)); |
| 1462 Label done; | 1463 Label done; |
| 1463 __ UpdateRangeFeedback(EAX, 2, ECX, EBX, EDI, EDX, &done); | 1464 __ UpdateRangeFeedback(EAX, 2, ECX, EBX, EDI, EDX, &done); |
| 1464 __ Bind(&done); | 1465 __ Bind(&done); |
| 1465 __ LeaveFrame(); | 1466 __ LeaveFrame(); |
| 1466 __ ret(); | 1467 __ ret(); |
| 1467 } else { | 1468 } else { |
| 1468 __ jmp(EBX); | 1469 __ jmp(EBX); |
| 1469 } | 1470 } |
| 1470 | 1471 |
| 1471 if (FLAG_support_debugger) { | 1472 if (FLAG_support_debugger && !optimized) { |
| 1472 __ Bind(&stepping); | 1473 __ Bind(&stepping); |
| 1473 __ EnterStubFrame(); | 1474 __ EnterStubFrame(); |
| 1474 __ pushl(ECX); | 1475 __ pushl(ECX); |
| 1475 __ CallRuntime(kSingleStepHandlerRuntimeEntry, 0); | 1476 __ CallRuntime(kSingleStepHandlerRuntimeEntry, 0); |
| 1476 __ popl(ECX); | 1477 __ popl(ECX); |
| 1477 __ LeaveFrame(); | 1478 __ LeaveFrame(); |
| 1478 __ jmp(&done_stepping); | 1479 __ jmp(&done_stepping); |
| 1479 } | 1480 } |
| 1480 } | 1481 } |
| 1481 | 1482 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1565 // 1: N, number of arguments checked. | 1566 // 1: N, number of arguments checked. |
| 1566 // 2 .. (length - 1): group of checks, each check containing: | 1567 // 2 .. (length - 1): group of checks, each check containing: |
| 1567 // - N classes. | 1568 // - N classes. |
| 1568 // - 1 target function. | 1569 // - 1 target function. |
| 1569 void StubCode::GenerateOneArgOptimizedCheckInlineCacheStub( | 1570 void StubCode::GenerateOneArgOptimizedCheckInlineCacheStub( |
| 1570 Assembler* assembler) { | 1571 Assembler* assembler) { |
| 1571 GenerateOptimizedUsageCounterIncrement(assembler); | 1572 GenerateOptimizedUsageCounterIncrement(assembler); |
| 1572 GenerateNArgsCheckInlineCacheStub(assembler, 1, | 1573 GenerateNArgsCheckInlineCacheStub(assembler, 1, |
| 1573 kInlineCacheMissHandlerOneArgRuntimeEntry, | 1574 kInlineCacheMissHandlerOneArgRuntimeEntry, |
| 1574 Token::kILLEGAL, | 1575 Token::kILLEGAL, |
| 1575 kIgnoreRanges); | 1576 kIgnoreRanges, |
| 1577 true /* optimized */); |
| 1576 } | 1578 } |
| 1577 | 1579 |
| 1578 | 1580 |
| 1579 void StubCode::GenerateTwoArgsOptimizedCheckInlineCacheStub( | 1581 void StubCode::GenerateTwoArgsOptimizedCheckInlineCacheStub( |
| 1580 Assembler* assembler) { | 1582 Assembler* assembler) { |
| 1581 GenerateOptimizedUsageCounterIncrement(assembler); | 1583 GenerateOptimizedUsageCounterIncrement(assembler); |
| 1582 GenerateNArgsCheckInlineCacheStub(assembler, 2, | 1584 GenerateNArgsCheckInlineCacheStub(assembler, 2, |
| 1583 kInlineCacheMissHandlerTwoArgsRuntimeEntry, | 1585 kInlineCacheMissHandlerTwoArgsRuntimeEntry, |
| 1584 Token::kILLEGAL, | 1586 Token::kILLEGAL, |
| 1585 kIgnoreRanges); | 1587 kIgnoreRanges, |
| 1588 true /* optimized */); |
| 1586 } | 1589 } |
| 1587 | 1590 |
| 1588 | 1591 |
| 1589 // Intermediary stub between a static call and its target. ICData contains | 1592 // Intermediary stub between a static call and its target. ICData contains |
| 1590 // the target function and the call count. | 1593 // the target function and the call count. |
| 1591 // ECX: ICData | 1594 // ECX: ICData |
| 1592 void StubCode::GenerateZeroArgsUnoptimizedStaticCallStub(Assembler* assembler) { | 1595 void StubCode::GenerateZeroArgsUnoptimizedStaticCallStub(Assembler* assembler) { |
| 1593 GenerateUsageCounterIncrement(assembler, EBX); | 1596 GenerateUsageCounterIncrement(assembler, EBX); |
| 1594 | 1597 |
| 1595 #if defined(DEBUG) | 1598 #if defined(DEBUG) |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2086 // EBX: entry point. | 2089 // EBX: entry point. |
| 2087 void StubCode::GenerateMegamorphicLookupStub(Assembler* assembler) { | 2090 void StubCode::GenerateMegamorphicLookupStub(Assembler* assembler) { |
| 2088 EmitMegamorphicLookup(assembler, EDI, EBX, EBX); | 2091 EmitMegamorphicLookup(assembler, EDI, EBX, EBX); |
| 2089 __ ret(); | 2092 __ ret(); |
| 2090 } | 2093 } |
| 2091 | 2094 |
| 2092 | 2095 |
| 2093 } // namespace dart | 2096 } // namespace dart |
| 2094 | 2097 |
| 2095 #endif // defined TARGET_ARCH_IA32 | 2098 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |