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 1463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1523 __ Pop(R0); // Restore argument. | 1522 __ Pop(R0); // Restore argument. |
1524 __ PopList((1 << R4) | (1 << R5)); // Restore arg desc. and IC data. | 1523 __ PopList((1 << R4) | (1 << R5)); // Restore arg desc. and IC data. |
1525 __ LeaveStubFrame(); | 1524 __ LeaveStubFrame(); |
1526 | 1525 |
1527 __ ldr(R2, FieldAddress(R0, Function::instructions_offset())); | 1526 __ ldr(R2, FieldAddress(R0, Function::instructions_offset())); |
1528 __ AddImmediate(R2, Instructions::HeaderSize() - kHeapObjectTag); | 1527 __ AddImmediate(R2, Instructions::HeaderSize() - kHeapObjectTag); |
1529 __ bx(R2); | 1528 __ bx(R2); |
1530 } | 1529 } |
1531 | 1530 |
1532 | 1531 |
1533 void StubCode::GenerateBreakpointRuntimeStub(Assembler* assembler) { | 1532 // R5: Contains an ICData. |
1533 void StubCode::GenerateICCallBreakpointStub(Assembler* assembler) { | |
1534 __ EnterStubFrame(); | 1534 __ EnterStubFrame(); |
1535 __ LoadImmediate(R0, reinterpret_cast<intptr_t>(Object::null())); | 1535 __ LoadImmediate(R0, reinterpret_cast<intptr_t>(Object::null())); |
1536 // Preserve arguments descriptor and make room for result. | 1536 // Preserve arguments descriptor and make room for result. |
1537 __ PushList((1 << R0) | (1 << R5)); | |
1538 __ CallRuntime(kBreakpointRuntimeHandlerRuntimeEntry, 0); | |
1539 __ PopList((1 << R0) | (1 << R5)); | |
1540 __ LeaveStubFrame(); | |
1541 __ bx(R0); | |
1542 } | |
1543 | |
1544 | |
1545 // R5: Contains Smi 0 (need to preserve a GC-safe value for the lazy compile | |
1546 // stub). | |
1547 // R4: Contains an arguments descriptor. | |
1548 void StubCode::GenerateClosureCallBreakpointStub(Assembler* assembler) { | |
1549 __ EnterStubFrame(); | |
1550 __ LoadImmediate(R0, reinterpret_cast<intptr_t>(Object::null())); | |
1551 // Preserve arguments descriptor and make room for result. | |
1537 __ PushList((1 << R0) | (1 << R4) | (1 << R5)); | 1552 __ PushList((1 << R0) | (1 << R4) | (1 << R5)); |
1538 __ CallRuntime(kBreakpointRuntimeHandlerRuntimeEntry, 0); | 1553 __ CallRuntime(kBreakpointRuntimeHandlerRuntimeEntry, 0); |
1539 __ PopList((1 << R0) | (1 << R4) | (1 << R5)); | 1554 __ PopList((1 << R0) | (1 << R4) | (1 << R5)); |
1540 __ LeaveStubFrame(); | 1555 __ LeaveStubFrame(); |
1541 __ bx(R0); | 1556 __ bx(R0); |
1542 } | 1557 } |
1543 | 1558 |
1559 // R5: Garbage or function address. | |
1560 // R4: Garbage or raw argument count. | |
1561 void StubCode::GenerateRuntimeCallBreakpointStub(Assembler* assembler) { | |
1562 __ EnterStubFrame(); | |
1563 __ LoadImmediate(R0, reinterpret_cast<intptr_t>(Object::null())); | |
1564 // Preserve arguments descriptor and make room for result. | |
1565 __ AndImmediate(R5, R5, ~kSmiTagMask); | |
1566 __ SmiTag(R4); | |
1567 __ PushList((1 << R0) | (1 << R4) | (1 << R5)); | |
Florian Schneider
2014/06/30 09:00:40
Why do you need to preserve R4 and R5 here?
rmacnak
2014/07/01 01:08:51
Don't I need to preserve them for the original stu
Florian Schneider
2014/07/03 19:56:03
I don't think so. When doing a code search for kR
| |
1568 __ CallRuntime(kBreakpointRuntimeHandlerRuntimeEntry, 0); | |
1569 __ PopList((1 << R0) | (1 << R4) | (1 << R5)); | |
1570 __ SmiUntag(R4); | |
1571 __ LeaveStubFrame(); | |
1572 __ bx(R0); | |
1573 } | |
1574 | |
1544 | 1575 |
1545 // Called only from unoptimized code. All relevant registers have been saved. | 1576 // Called only from unoptimized code. All relevant registers have been saved. |
1546 void StubCode::GenerateDebugStepCheckStub( | 1577 void StubCode::GenerateDebugStepCheckStub( |
1547 Assembler* assembler) { | 1578 Assembler* assembler) { |
1548 if (FLAG_enable_debugger) { | 1579 if (FLAG_enable_debugger) { |
1549 // Check single stepping. | 1580 // Check single stepping. |
1550 Label not_stepping; | 1581 Label not_stepping; |
1551 __ ldr(R1, FieldAddress(CTX, Context::isolate_offset())); | 1582 __ ldr(R1, FieldAddress(CTX, Context::isolate_offset())); |
1552 __ ldrb(R1, Address(R1, Isolate::single_step_offset())); | 1583 __ ldrb(R1, Address(R1, Isolate::single_step_offset())); |
1553 __ CompareImmediate(R1, 0); | 1584 __ CompareImmediate(R1, 0); |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1831 const Register right = R0; | 1862 const Register right = R0; |
1832 __ ldr(left, Address(SP, 1 * kWordSize)); | 1863 __ ldr(left, Address(SP, 1 * kWordSize)); |
1833 __ ldr(right, Address(SP, 0 * kWordSize)); | 1864 __ ldr(right, Address(SP, 0 * kWordSize)); |
1834 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); | 1865 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); |
1835 __ Ret(); | 1866 __ Ret(); |
1836 } | 1867 } |
1837 | 1868 |
1838 } // namespace dart | 1869 } // namespace dart |
1839 | 1870 |
1840 #endif // defined TARGET_ARCH_ARM | 1871 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |