| 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 1571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1582 __ LoadFromOffset(kWord, R0, R6, target_offset); | 1582 __ LoadFromOffset(kWord, R0, R6, target_offset); |
| 1583 __ LoadFromOffset(kWord, R1, R6, count_offset); | 1583 __ LoadFromOffset(kWord, R1, R6, count_offset); |
| 1584 __ adds(R1, R1, ShifterOperand(Smi::RawValue(1))); | 1584 __ adds(R1, R1, ShifterOperand(Smi::RawValue(1))); |
| 1585 __ StoreToOffset(kWord, R1, R6, count_offset); | 1585 __ StoreToOffset(kWord, R1, R6, count_offset); |
| 1586 __ b(&call_target_function, VC); // No overflow. | 1586 __ b(&call_target_function, VC); // No overflow. |
| 1587 __ LoadImmediate(R1, Smi::RawValue(Smi::kMaxValue)); | 1587 __ LoadImmediate(R1, Smi::RawValue(Smi::kMaxValue)); |
| 1588 __ StoreToOffset(kWord, R1, R6, count_offset); | 1588 __ StoreToOffset(kWord, R1, R6, count_offset); |
| 1589 | 1589 |
| 1590 __ Bind(&call_target_function); | 1590 __ Bind(&call_target_function); |
| 1591 // R0: target function. | 1591 // R0: target function. |
| 1592 __ ldr(R0, FieldAddress(R0, Function::code_offset())); | 1592 __ ldr(R1, FieldAddress(R0, Function::code_offset())); |
| 1593 __ ldr(R0, FieldAddress(R0, Code::instructions_offset())); | 1593 if (FLAG_collect_code) { |
| 1594 // If we are collecting code, the code object may be null. |
| 1595 Label is_compiled; |
| 1596 __ CompareImmediate(R1, reinterpret_cast<intptr_t>(Object::null())); |
| 1597 __ b(&is_compiled, NE); |
| 1598 __ EnterStubFrame(); |
| 1599 // Preserve arg desc. and IC data object. |
| 1600 __ PushList((1 << R4) | (1 << R5)); |
| 1601 __ Push(R0); // Pass function. |
| 1602 __ CallRuntime(kCompileFunctionRuntimeEntry, 1); |
| 1603 __ Pop(R0); // Discard argument. |
| 1604 __ PopList((1 << R4) | (1 << R5)); // Restore arg desc. and IC data. |
| 1605 __ LeaveStubFrame(); |
| 1606 // R0: target function. |
| 1607 __ ldr(R1, FieldAddress(R0, Function::code_offset())); |
| 1608 __ Bind(&is_compiled); |
| 1609 } |
| 1610 __ ldr(R0, FieldAddress(R1, Code::instructions_offset())); |
| 1594 __ AddImmediate(R0, Instructions::HeaderSize() - kHeapObjectTag); | 1611 __ AddImmediate(R0, Instructions::HeaderSize() - kHeapObjectTag); |
| 1595 __ bx(R0); | 1612 __ bx(R0); |
| 1596 | 1613 |
| 1597 // Instance in R0, return its class-id in R0 as Smi. | 1614 // Instance in R0, return its class-id in R0 as Smi. |
| 1598 __ Bind(&get_class_id_as_smi); | 1615 __ Bind(&get_class_id_as_smi); |
| 1599 | 1616 |
| 1600 // Test if Smi -> load Smi class for comparison. | 1617 // Test if Smi -> load Smi class for comparison. |
| 1601 __ tst(R0, ShifterOperand(kSmiTagMask)); | 1618 __ tst(R0, ShifterOperand(kSmiTagMask)); |
| 1602 __ mov(R0, ShifterOperand(Smi::RawValue(kSmiCid)), EQ); | 1619 __ mov(R0, ShifterOperand(Smi::RawValue(kSmiCid)), EQ); |
| 1603 __ bx(LR, EQ); | 1620 __ bx(LR, EQ); |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1751 } | 1768 } |
| 1752 | 1769 |
| 1753 | 1770 |
| 1754 void StubCode::GenerateTwoArgsUnoptimizedStaticCallStub(Assembler* assembler) { | 1771 void StubCode::GenerateTwoArgsUnoptimizedStaticCallStub(Assembler* assembler) { |
| 1755 GenerateUsageCounterIncrement(assembler, R6); | 1772 GenerateUsageCounterIncrement(assembler, R6); |
| 1756 GenerateNArgsCheckInlineCacheStub( | 1773 GenerateNArgsCheckInlineCacheStub( |
| 1757 assembler, 2, kStaticCallMissHandlerTwoArgsRuntimeEntry); | 1774 assembler, 2, kStaticCallMissHandlerTwoArgsRuntimeEntry); |
| 1758 } | 1775 } |
| 1759 | 1776 |
| 1760 | 1777 |
| 1778 // Stub for calling the CompileFunction runtime call. |
| 1779 // R5: IC-Data. |
| 1780 // R4: Arguments descriptor. |
| 1781 // R0: Function. |
| 1782 void StubCode::GenerateCompileFunctionRuntimeCallStub(Assembler* assembler) { |
| 1783 // Preserve arg desc. and IC data object. |
| 1784 __ EnterStubFrame(); |
| 1785 __ PushList((1 << R4) | (1 << R5)); |
| 1786 __ Push(R0); // Pass function. |
| 1787 __ CallRuntime(kCompileFunctionRuntimeEntry, 1); |
| 1788 __ Pop(R0); // Restore argument. |
| 1789 __ PopList((1 << R4) | (1 << R5)); // Restore arg desc. and IC data. |
| 1790 __ LeaveStubFrame(); |
| 1791 __ Ret(); |
| 1792 } |
| 1793 |
| 1794 |
| 1761 void StubCode::GenerateBreakpointRuntimeStub(Assembler* assembler) { | 1795 void StubCode::GenerateBreakpointRuntimeStub(Assembler* assembler) { |
| 1762 __ Comment("BreakpointRuntime stub"); | 1796 __ Comment("BreakpointRuntime stub"); |
| 1763 __ EnterStubFrame(); | 1797 __ EnterStubFrame(); |
| 1764 __ LoadImmediate(R0, reinterpret_cast<intptr_t>(Object::null())); | 1798 __ LoadImmediate(R0, reinterpret_cast<intptr_t>(Object::null())); |
| 1765 // Preserve arguments descriptor and make room for result. | 1799 // Preserve arguments descriptor and make room for result. |
| 1766 __ PushList((1 << R0) | (1 << R4) | (1 << R5)); | 1800 __ PushList((1 << R0) | (1 << R4) | (1 << R5)); |
| 1767 __ CallRuntime(kBreakpointRuntimeHandlerRuntimeEntry, 0); | 1801 __ CallRuntime(kBreakpointRuntimeHandlerRuntimeEntry, 0); |
| 1768 __ PopList((1 << R0) | (1 << R4) | (1 << R5)); | 1802 __ PopList((1 << R0) | (1 << R4) | (1 << R5)); |
| 1769 __ LeaveStubFrame(); | 1803 __ LeaveStubFrame(); |
| 1770 __ bx(R0); | 1804 __ bx(R0); |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2106 __ ldr(left, Address(SP, 4 * kWordSize)); | 2140 __ ldr(left, Address(SP, 4 * kWordSize)); |
| 2107 __ ldr(right, Address(SP, 3 * kWordSize)); | 2141 __ ldr(right, Address(SP, 3 * kWordSize)); |
| 2108 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); | 2142 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); |
| 2109 __ PopList((1 << R0) | (1 << R1) | (1 << R2)); | 2143 __ PopList((1 << R0) | (1 << R1) | (1 << R2)); |
| 2110 __ Ret(); | 2144 __ Ret(); |
| 2111 } | 2145 } |
| 2112 | 2146 |
| 2113 } // namespace dart | 2147 } // namespace dart |
| 2114 | 2148 |
| 2115 #endif // defined TARGET_ARCH_ARM | 2149 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |