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 28 matching lines...) Expand all Loading... |
39 void StubCode::GenerateCallToRuntimeStub(Assembler* assembler) { | 39 void StubCode::GenerateCallToRuntimeStub(Assembler* assembler) { |
40 const intptr_t isolate_offset = NativeArguments::isolate_offset(); | 40 const intptr_t isolate_offset = NativeArguments::isolate_offset(); |
41 const intptr_t argc_tag_offset = NativeArguments::argc_tag_offset(); | 41 const intptr_t argc_tag_offset = NativeArguments::argc_tag_offset(); |
42 const intptr_t argv_offset = NativeArguments::argv_offset(); | 42 const intptr_t argv_offset = NativeArguments::argv_offset(); |
43 const intptr_t retval_offset = NativeArguments::retval_offset(); | 43 const intptr_t retval_offset = NativeArguments::retval_offset(); |
44 const intptr_t exitframe_last_param_slot_from_fp = 2; | 44 const intptr_t exitframe_last_param_slot_from_fp = 2; |
45 | 45 |
46 __ mov(IP, Operand(0)); | 46 __ mov(IP, Operand(0)); |
47 __ Push(IP); // Push 0 for the PC marker. | 47 __ Push(IP); // Push 0 for the PC marker. |
48 __ EnterFrame((1 << FP) | (1 << LR), 0); | 48 __ EnterFrame((1 << FP) | (1 << LR), 0); |
49 __ SmiUntag(R4); | |
50 | 49 |
51 // Load current Isolate pointer from Context structure into R0. | 50 // Load current Isolate pointer from Context structure into R0. |
52 __ ldr(R0, FieldAddress(CTX, Context::isolate_offset())); | 51 __ ldr(R0, FieldAddress(CTX, Context::isolate_offset())); |
53 | 52 |
54 // Save exit frame information to enable stack walking as we are about | 53 // Save exit frame information to enable stack walking as we are about |
55 // to transition to Dart VM C++ code. | 54 // to transition to Dart VM C++ code. |
56 __ StoreToOffset(kWord, SP, R0, Isolate::top_exit_frame_info_offset()); | 55 __ StoreToOffset(kWord, SP, R0, Isolate::top_exit_frame_info_offset()); |
57 | 56 |
58 // Save current Context pointer into Isolate structure. | 57 // Save current Context pointer into Isolate structure. |
59 __ StoreToOffset(kWord, CTX, R0, Isolate::top_context_offset()); | 58 __ StoreToOffset(kWord, CTX, R0, Isolate::top_context_offset()); |
(...skipping 1464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1524 __ Pop(R0); // Restore argument. | 1523 __ Pop(R0); // Restore argument. |
1525 __ PopList((1 << R4) | (1 << R5)); // Restore arg desc. and IC data. | 1524 __ PopList((1 << R4) | (1 << R5)); // Restore arg desc. and IC data. |
1526 __ LeaveStubFrame(); | 1525 __ LeaveStubFrame(); |
1527 | 1526 |
1528 __ ldr(R2, FieldAddress(R0, Function::instructions_offset())); | 1527 __ ldr(R2, FieldAddress(R0, Function::instructions_offset())); |
1529 __ AddImmediate(R2, Instructions::HeaderSize() - kHeapObjectTag); | 1528 __ AddImmediate(R2, Instructions::HeaderSize() - kHeapObjectTag); |
1530 __ bx(R2); | 1529 __ bx(R2); |
1531 } | 1530 } |
1532 | 1531 |
1533 | 1532 |
1534 void StubCode::GenerateBreakpointRuntimeStub(Assembler* assembler) { | 1533 // R5: Contains an ICData. |
| 1534 void StubCode::GenerateICCallBreakpointStub(Assembler* assembler) { |
1535 __ EnterStubFrame(); | 1535 __ EnterStubFrame(); |
1536 __ LoadImmediate(R0, reinterpret_cast<intptr_t>(Object::null())); | 1536 __ LoadImmediate(R0, reinterpret_cast<intptr_t>(Object::null())); |
1537 // Preserve arguments descriptor and make room for result. | 1537 // Preserve arguments descriptor and make room for result. |
| 1538 __ PushList((1 << R0) | (1 << R5)); |
| 1539 __ CallRuntime(kBreakpointRuntimeHandlerRuntimeEntry, 0); |
| 1540 __ PopList((1 << R0) | (1 << R5)); |
| 1541 __ LeaveStubFrame(); |
| 1542 __ bx(R0); |
| 1543 } |
| 1544 |
| 1545 |
| 1546 // R5: Contains Smi 0 (need to preserve a GC-safe value for the lazy compile |
| 1547 // stub). |
| 1548 // R4: Contains an arguments descriptor. |
| 1549 void StubCode::GenerateClosureCallBreakpointStub(Assembler* assembler) { |
| 1550 __ EnterStubFrame(); |
| 1551 __ LoadImmediate(R0, reinterpret_cast<intptr_t>(Object::null())); |
| 1552 // Preserve arguments descriptor and make room for result. |
1538 __ PushList((1 << R0) | (1 << R4) | (1 << R5)); | 1553 __ PushList((1 << R0) | (1 << R4) | (1 << R5)); |
1539 __ CallRuntime(kBreakpointRuntimeHandlerRuntimeEntry, 0); | 1554 __ CallRuntime(kBreakpointRuntimeHandlerRuntimeEntry, 0); |
1540 __ PopList((1 << R0) | (1 << R4) | (1 << R5)); | 1555 __ PopList((1 << R0) | (1 << R4) | (1 << R5)); |
1541 __ LeaveStubFrame(); | 1556 __ LeaveStubFrame(); |
1542 __ bx(R0); | 1557 __ bx(R0); |
1543 } | 1558 } |
1544 | 1559 |
1545 | 1560 |
| 1561 void StubCode::GenerateRuntimeCallBreakpointStub(Assembler* assembler) { |
| 1562 __ EnterStubFrame(); |
| 1563 __ LoadImmediate(R0, reinterpret_cast<intptr_t>(Object::null())); |
| 1564 // Make room for result. |
| 1565 __ PushList((1 << R0)); |
| 1566 __ CallRuntime(kBreakpointRuntimeHandlerRuntimeEntry, 0); |
| 1567 __ PopList((1 << R0)); |
| 1568 __ LeaveStubFrame(); |
| 1569 __ bx(R0); |
| 1570 } |
| 1571 |
| 1572 |
1546 // Called only from unoptimized code. All relevant registers have been saved. | 1573 // Called only from unoptimized code. All relevant registers have been saved. |
1547 void StubCode::GenerateDebugStepCheckStub( | 1574 void StubCode::GenerateDebugStepCheckStub( |
1548 Assembler* assembler) { | 1575 Assembler* assembler) { |
1549 if (FLAG_enable_debugger) { | 1576 if (FLAG_enable_debugger) { |
1550 // Check single stepping. | 1577 // Check single stepping. |
1551 Label not_stepping; | 1578 Label not_stepping; |
1552 __ ldr(R1, FieldAddress(CTX, Context::isolate_offset())); | 1579 __ ldr(R1, FieldAddress(CTX, Context::isolate_offset())); |
1553 __ ldrb(R1, Address(R1, Isolate::single_step_offset())); | 1580 __ ldrb(R1, Address(R1, Isolate::single_step_offset())); |
1554 __ CompareImmediate(R1, 0); | 1581 __ CompareImmediate(R1, 0); |
1555 __ b(¬_stepping, EQ); | 1582 __ b(¬_stepping, EQ); |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1832 const Register right = R0; | 1859 const Register right = R0; |
1833 __ ldr(left, Address(SP, 1 * kWordSize)); | 1860 __ ldr(left, Address(SP, 1 * kWordSize)); |
1834 __ ldr(right, Address(SP, 0 * kWordSize)); | 1861 __ ldr(right, Address(SP, 0 * kWordSize)); |
1835 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); | 1862 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); |
1836 __ Ret(); | 1863 __ Ret(); |
1837 } | 1864 } |
1838 | 1865 |
1839 } // namespace dart | 1866 } // namespace dart |
1840 | 1867 |
1841 #endif // defined TARGET_ARCH_ARM | 1868 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |