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/compiler.h" | 10 #include "vm/compiler.h" |
(...skipping 1381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1392 // Check that the IC data array has NumberOfArgumentsChecked() == num_args. | 1392 // Check that the IC data array has NumberOfArgumentsChecked() == num_args. |
1393 // 'num_args_tested' is stored as an untagged int. | 1393 // 'num_args_tested' is stored as an untagged int. |
1394 __ ldr(R6, FieldAddress(R5, ICData::num_args_tested_offset())); | 1394 __ ldr(R6, FieldAddress(R5, ICData::num_args_tested_offset())); |
1395 __ CompareImmediate(R6, num_args); | 1395 __ CompareImmediate(R6, num_args); |
1396 __ b(&ok, EQ); | 1396 __ b(&ok, EQ); |
1397 __ Stop("Incorrect stub for IC data"); | 1397 __ Stop("Incorrect stub for IC data"); |
1398 __ Bind(&ok); | 1398 __ Bind(&ok); |
1399 } | 1399 } |
1400 #endif // DEBUG | 1400 #endif // DEBUG |
1401 | 1401 |
1402 // Check single stepping. | |
1403 Label not_stepping; | |
1404 __ ldr(R6, FieldAddress(CTX, Context::isolate_offset())); | |
1405 __ ldrb(R6, Address(R6, Isolate::single_step_offset())); | |
1406 __ CompareImmediate(R6, 0); | |
1407 __ b(¬_stepping, EQ); | |
1408 __ EnterStubFrame(); | |
1409 __ Push(R5); // Preserve IC data. | |
1410 __ CallRuntime(kSingleStepHandlerRuntimeEntry); | |
1411 __ Pop(R5); | |
1412 __ LeaveStubFrame(); | |
1413 __ Bind(¬_stepping); | |
1414 | |
1402 // Load arguments descriptor into R4. | 1415 // Load arguments descriptor into R4. |
1403 __ ldr(R4, FieldAddress(R5, ICData::arguments_descriptor_offset())); | 1416 __ ldr(R4, FieldAddress(R5, ICData::arguments_descriptor_offset())); |
1404 // Preserve return address, since LR is needed for subroutine call. | 1417 // Preserve return address, since LR is needed for subroutine call. |
1405 __ mov(R8, ShifterOperand(LR)); | 1418 __ mov(R8, ShifterOperand(LR)); |
1406 // Loop that checks if there is an IC data match. | 1419 // Loop that checks if there is an IC data match. |
1407 Label loop, update, test, found, get_class_id_as_smi; | 1420 Label loop, update, test, found, get_class_id_as_smi; |
1408 // R5: IC data object (preserved). | 1421 // R5: IC data object (preserved). |
1409 __ ldr(R6, FieldAddress(R5, ICData::ic_data_offset())); | 1422 __ ldr(R6, FieldAddress(R5, ICData::ic_data_offset())); |
1410 // R6: ic_data_array with check entries: classes and target functions. | 1423 // R6: ic_data_array with check entries: classes and target functions. |
1411 __ AddImmediate(R6, R6, Array::data_offset() - kHeapObjectTag); | 1424 __ AddImmediate(R6, R6, Array::data_offset() - kHeapObjectTag); |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1607 // Check that the IC data array has NumberOfArgumentsChecked() == 0. | 1620 // Check that the IC data array has NumberOfArgumentsChecked() == 0. |
1608 // 'num_args_tested' is stored as an untagged int. | 1621 // 'num_args_tested' is stored as an untagged int. |
1609 __ ldr(R6, FieldAddress(R5, ICData::num_args_tested_offset())); | 1622 __ ldr(R6, FieldAddress(R5, ICData::num_args_tested_offset())); |
1610 __ CompareImmediate(R6, 0); | 1623 __ CompareImmediate(R6, 0); |
1611 __ b(&ok, EQ); | 1624 __ b(&ok, EQ); |
1612 __ Stop("Incorrect IC data for unoptimized static call"); | 1625 __ Stop("Incorrect IC data for unoptimized static call"); |
1613 __ Bind(&ok); | 1626 __ Bind(&ok); |
1614 } | 1627 } |
1615 #endif // DEBUG | 1628 #endif // DEBUG |
1616 | 1629 |
1630 // Check single stepping. | |
1631 Label not_stepping; | |
1632 __ ldr(R6, FieldAddress(CTX, Context::isolate_offset())); | |
1633 __ ldrb(R6, Address(R6, Isolate::single_step_offset())); | |
1634 __ CompareImmediate(R6, 0); | |
1635 __ b(¬_stepping, EQ); | |
1636 __ EnterStubFrame(); | |
1637 __ Push(R5); // Preserve IC data. | |
1638 __ CallRuntime(kSingleStepHandlerRuntimeEntry); | |
1639 __ Pop(R5); | |
1640 __ LeaveStubFrame(); | |
1641 __ Bind(¬_stepping); | |
siva
2013/07/01 17:04:48
why not abstract this into a private function
Stub
hausner
2013/08/09 09:59:02
I'll do that in a separate checkin once I add more
| |
1642 | |
1617 // R5: IC data object (preserved). | 1643 // R5: IC data object (preserved). |
1618 __ ldr(R6, FieldAddress(R5, ICData::ic_data_offset())); | 1644 __ ldr(R6, FieldAddress(R5, ICData::ic_data_offset())); |
1619 // R6: ic_data_array with entries: target functions and count. | 1645 // R6: ic_data_array with entries: target functions and count. |
1620 __ AddImmediate(R6, R6, Array::data_offset() - kHeapObjectTag); | 1646 __ AddImmediate(R6, R6, Array::data_offset() - kHeapObjectTag); |
1621 // R6: points directly to the first ic data array element. | 1647 // R6: points directly to the first ic data array element. |
1622 const intptr_t target_offset = ICData::TargetIndexFor(0) * kWordSize; | 1648 const intptr_t target_offset = ICData::TargetIndexFor(0) * kWordSize; |
1623 const intptr_t count_offset = ICData::CountIndexFor(0) * kWordSize; | 1649 const intptr_t count_offset = ICData::CountIndexFor(0) * kWordSize; |
1624 | 1650 |
1625 // Increment count for this call. | 1651 // Increment count for this call. |
1626 Label increment_done; | 1652 Label increment_done; |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2043 } | 2069 } |
2044 | 2070 |
2045 | 2071 |
2046 // Called only from unoptimized code. All relevant registers have been saved. | 2072 // Called only from unoptimized code. All relevant registers have been saved. |
2047 // LR: return address. | 2073 // LR: return address. |
2048 // SP + 4: left operand. | 2074 // SP + 4: left operand. |
2049 // SP + 0: right operand. | 2075 // SP + 0: right operand. |
2050 // Return Zero condition flag set if equal. | 2076 // Return Zero condition flag set if equal. |
2051 void StubCode::GenerateUnoptimizedIdenticalWithNumberCheckStub( | 2077 void StubCode::GenerateUnoptimizedIdenticalWithNumberCheckStub( |
2052 Assembler* assembler) { | 2078 Assembler* assembler) { |
2079 // Check single stepping. | |
2080 Label not_stepping; | |
2081 __ ldr(R1, FieldAddress(CTX, Context::isolate_offset())); | |
2082 __ ldrb(R1, Address(R1, Isolate::single_step_offset())); | |
2083 __ CompareImmediate(R1, 0); | |
2084 __ b(¬_stepping, EQ); | |
2085 __ EnterStubFrame(); | |
2086 __ CallRuntime(kSingleStepHandlerRuntimeEntry); | |
2087 __ LeaveStubFrame(); | |
2088 __ Bind(¬_stepping); | |
2089 | |
2053 const Register temp = R2; | 2090 const Register temp = R2; |
2054 const Register left = R1; | 2091 const Register left = R1; |
2055 const Register right = R0; | 2092 const Register right = R0; |
2056 __ ldr(left, Address(SP, 1 * kWordSize)); | 2093 __ ldr(left, Address(SP, 1 * kWordSize)); |
2057 __ ldr(right, Address(SP, 0 * kWordSize)); | 2094 __ ldr(right, Address(SP, 0 * kWordSize)); |
2058 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); | 2095 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); |
2059 __ Ret(); | 2096 __ Ret(); |
2060 } | 2097 } |
2061 | 2098 |
2062 | 2099 |
(...skipping 13 matching lines...) Expand all Loading... | |
2076 __ ldr(left, Address(SP, 4 * kWordSize)); | 2113 __ ldr(left, Address(SP, 4 * kWordSize)); |
2077 __ ldr(right, Address(SP, 3 * kWordSize)); | 2114 __ ldr(right, Address(SP, 3 * kWordSize)); |
2078 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); | 2115 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); |
2079 __ PopList((1 << R0) | (1 << R1) | (1 << R2)); | 2116 __ PopList((1 << R0) | (1 << R1) | (1 << R2)); |
2080 __ Ret(); | 2117 __ Ret(); |
2081 } | 2118 } |
2082 | 2119 |
2083 } // namespace dart | 2120 } // namespace dart |
2084 | 2121 |
2085 #endif // defined TARGET_ARCH_ARM | 2122 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |