| 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_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
| 7 | 7 |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/code_generator.h" | 9 #include "vm/code_generator.h" |
| 10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
| (...skipping 1318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1329 // - If receiver is Smi -> load Smi class. | 1329 // - If receiver is Smi -> load Smi class. |
| 1330 // - If receiver is not-Smi -> load receiver's class. | 1330 // - If receiver is not-Smi -> load receiver's class. |
| 1331 // - Check if 'num_args' (including receiver) match any IC data group. | 1331 // - Check if 'num_args' (including receiver) match any IC data group. |
| 1332 // - Match found -> jump to target. | 1332 // - Match found -> jump to target. |
| 1333 // - Match not found -> jump to IC miss. | 1333 // - Match not found -> jump to IC miss. |
| 1334 void StubCode::GenerateNArgsCheckInlineCacheStub( | 1334 void StubCode::GenerateNArgsCheckInlineCacheStub( |
| 1335 Assembler* assembler, | 1335 Assembler* assembler, |
| 1336 intptr_t num_args, | 1336 intptr_t num_args, |
| 1337 const RuntimeEntry& handle_ic_miss, | 1337 const RuntimeEntry& handle_ic_miss, |
| 1338 Token::Kind kind, | 1338 Token::Kind kind, |
| 1339 RangeCollectionMode range_collection_mode) { | 1339 RangeCollectionMode range_collection_mode, |
| 1340 bool optimized) { |
| 1340 ASSERT(num_args > 0); | 1341 ASSERT(num_args > 0); |
| 1341 #if defined(DEBUG) | 1342 #if defined(DEBUG) |
| 1342 { Label ok; | 1343 { Label ok; |
| 1343 // Check that the IC data array has NumArgsTested() == num_args. | 1344 // Check that the IC data array has NumArgsTested() == num_args. |
| 1344 // 'NumArgsTested' is stored in the least significant bits of 'state_bits'. | 1345 // 'NumArgsTested' is stored in the least significant bits of 'state_bits'. |
| 1345 __ ldr(R6, FieldAddress(R5, ICData::state_bits_offset())); | 1346 __ ldr(R6, FieldAddress(R5, ICData::state_bits_offset())); |
| 1346 ASSERT(ICData::NumArgsTestedShift() == 0); // No shift needed. | 1347 ASSERT(ICData::NumArgsTestedShift() == 0); // No shift needed. |
| 1347 __ and_(R6, R6, Operand(ICData::NumArgsTestedMask())); | 1348 __ and_(R6, R6, Operand(ICData::NumArgsTestedMask())); |
| 1348 __ CompareImmediate(R6, num_args); | 1349 __ CompareImmediate(R6, num_args); |
| 1349 __ b(&ok, EQ); | 1350 __ b(&ok, EQ); |
| 1350 __ Stop("Incorrect stub for IC data"); | 1351 __ Stop("Incorrect stub for IC data"); |
| 1351 __ Bind(&ok); | 1352 __ Bind(&ok); |
| 1352 } | 1353 } |
| 1353 #endif // DEBUG | 1354 #endif // DEBUG |
| 1354 | 1355 |
| 1355 Label stepping, done_stepping; | 1356 Label stepping, done_stepping; |
| 1356 if (FLAG_support_debugger) { | 1357 if (FLAG_support_debugger && !optimized) { |
| 1357 __ Comment("Check single stepping"); | 1358 __ Comment("Check single stepping"); |
| 1358 __ LoadIsolate(R6); | 1359 __ LoadIsolate(R6); |
| 1359 __ ldrb(R6, Address(R6, Isolate::single_step_offset())); | 1360 __ ldrb(R6, Address(R6, Isolate::single_step_offset())); |
| 1360 __ CompareImmediate(R6, 0); | 1361 __ CompareImmediate(R6, 0); |
| 1361 __ b(&stepping, NE); | 1362 __ b(&stepping, NE); |
| 1362 __ Bind(&done_stepping); | 1363 __ Bind(&done_stepping); |
| 1363 } | 1364 } |
| 1364 | 1365 |
| 1365 __ Comment("Range feedback collection"); | 1366 __ Comment("Range feedback collection"); |
| 1366 Label not_smi_or_overflow; | 1367 Label not_smi_or_overflow; |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1500 Label done; | 1501 Label done; |
| 1501 __ ldr(R5, Address(FP, kFirstLocalSlotFromFp * kWordSize)); | 1502 __ ldr(R5, Address(FP, kFirstLocalSlotFromFp * kWordSize)); |
| 1502 __ UpdateRangeFeedback(R0, 2, R5, R1, R4, &done); | 1503 __ UpdateRangeFeedback(R0, 2, R5, R1, R4, &done); |
| 1503 __ Bind(&done); | 1504 __ Bind(&done); |
| 1504 __ LeaveStubFrame(); | 1505 __ LeaveStubFrame(); |
| 1505 __ Ret(); | 1506 __ Ret(); |
| 1506 } else { | 1507 } else { |
| 1507 __ bx(R2); | 1508 __ bx(R2); |
| 1508 } | 1509 } |
| 1509 | 1510 |
| 1510 if (FLAG_support_debugger) { | 1511 if (FLAG_support_debugger && !optimized) { |
| 1511 __ Bind(&stepping); | 1512 __ Bind(&stepping); |
| 1512 __ EnterStubFrame(); | 1513 __ EnterStubFrame(); |
| 1513 __ Push(R5); // Preserve IC data. | 1514 __ Push(R5); // Preserve IC data. |
| 1514 __ CallRuntime(kSingleStepHandlerRuntimeEntry, 0); | 1515 __ CallRuntime(kSingleStepHandlerRuntimeEntry, 0); |
| 1515 __ Pop(R5); | 1516 __ Pop(R5); |
| 1516 __ LeaveStubFrame(); | 1517 __ LeaveStubFrame(); |
| 1517 __ b(&done_stepping); | 1518 __ b(&done_stepping); |
| 1518 } | 1519 } |
| 1519 } | 1520 } |
| 1520 | 1521 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1593 Token::kILLEGAL, | 1594 Token::kILLEGAL, |
| 1594 kCollectRanges); | 1595 kCollectRanges); |
| 1595 } | 1596 } |
| 1596 | 1597 |
| 1597 | 1598 |
| 1598 void StubCode::GenerateOneArgOptimizedCheckInlineCacheStub( | 1599 void StubCode::GenerateOneArgOptimizedCheckInlineCacheStub( |
| 1599 Assembler* assembler) { | 1600 Assembler* assembler) { |
| 1600 GenerateOptimizedUsageCounterIncrement(assembler); | 1601 GenerateOptimizedUsageCounterIncrement(assembler); |
| 1601 GenerateNArgsCheckInlineCacheStub(assembler, 1, | 1602 GenerateNArgsCheckInlineCacheStub(assembler, 1, |
| 1602 kInlineCacheMissHandlerOneArgRuntimeEntry, Token::kILLEGAL, | 1603 kInlineCacheMissHandlerOneArgRuntimeEntry, Token::kILLEGAL, |
| 1603 kIgnoreRanges); | 1604 kIgnoreRanges, true /* optimized */); |
| 1604 } | 1605 } |
| 1605 | 1606 |
| 1606 | 1607 |
| 1607 void StubCode::GenerateTwoArgsOptimizedCheckInlineCacheStub( | 1608 void StubCode::GenerateTwoArgsOptimizedCheckInlineCacheStub( |
| 1608 Assembler* assembler) { | 1609 Assembler* assembler) { |
| 1609 GenerateOptimizedUsageCounterIncrement(assembler); | 1610 GenerateOptimizedUsageCounterIncrement(assembler); |
| 1610 GenerateNArgsCheckInlineCacheStub(assembler, 2, | 1611 GenerateNArgsCheckInlineCacheStub(assembler, 2, |
| 1611 kInlineCacheMissHandlerTwoArgsRuntimeEntry, Token::kILLEGAL, | 1612 kInlineCacheMissHandlerTwoArgsRuntimeEntry, Token::kILLEGAL, |
| 1612 kIgnoreRanges); | 1613 kIgnoreRanges, true /* optimized */); |
| 1613 } | 1614 } |
| 1614 | 1615 |
| 1615 | 1616 |
| 1616 // Intermediary stub between a static call and its target. ICData contains | 1617 // Intermediary stub between a static call and its target. ICData contains |
| 1617 // the target function and the call count. | 1618 // the target function and the call count. |
| 1618 // R5: ICData | 1619 // R5: ICData |
| 1619 void StubCode::GenerateZeroArgsUnoptimizedStaticCallStub(Assembler* assembler) { | 1620 void StubCode::GenerateZeroArgsUnoptimizedStaticCallStub(Assembler* assembler) { |
| 1620 GenerateUsageCounterIncrement(assembler, R6); | 1621 GenerateUsageCounterIncrement(assembler, R6); |
| 1621 #if defined(DEBUG) | 1622 #if defined(DEBUG) |
| 1622 { Label ok; | 1623 { Label ok; |
| (...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2101 // Result: | 2102 // Result: |
| 2102 // R1: entry point. | 2103 // R1: entry point. |
| 2103 void StubCode::GenerateMegamorphicLookupStub(Assembler* assembler) { | 2104 void StubCode::GenerateMegamorphicLookupStub(Assembler* assembler) { |
| 2104 EmitMegamorphicLookup(assembler, R0, R1, R1); | 2105 EmitMegamorphicLookup(assembler, R0, R1, R1); |
| 2105 __ Ret(); | 2106 __ Ret(); |
| 2106 } | 2107 } |
| 2107 | 2108 |
| 2108 } // namespace dart | 2109 } // namespace dart |
| 2109 | 2110 |
| 2110 #endif // defined TARGET_ARCH_ARM | 2111 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |