OLD | NEW |
| (Empty) |
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 | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 #include "vm/globals.h" | |
6 #if defined(TARGET_ARCH_ARM) | |
7 | |
8 #include "vm/assembler_macros.h" | |
9 | |
10 #include "vm/assembler.h" | |
11 | |
12 namespace dart { | |
13 | |
14 #define __ assembler-> | |
15 | |
16 | |
17 void AssemblerMacros::TryAllocate(Assembler* assembler, | |
18 const Class& cls, | |
19 Label* failure, | |
20 bool near_jump, | |
21 Register instance_reg) { | |
22 UNIMPLEMENTED(); | |
23 } | |
24 | |
25 | |
26 void AssemblerMacros::EnterDartFrame(Assembler* assembler, | |
27 intptr_t frame_size) { | |
28 const intptr_t offset = assembler->CodeSize(); | |
29 // Save PC in frame for fast identification of corresponding code. | |
30 // Note that callee-saved registers can be added to the register list. | |
31 __ EnterFrame((1 << PP) | (1 << FP) | (1 << LR) | (1 << PC), 0); | |
32 | |
33 if (offset != 0) { | |
34 // Adjust saved PC for any intrinsic code that could have been generated | |
35 // before a frame is created. Use PP as temp register. | |
36 __ ldr(PP, Address(FP, 2 * kWordSize)); | |
37 __ AddImmediate(PP, PP, -offset); | |
38 __ str(PP, Address(FP, 2 * kWordSize)); | |
39 } | |
40 | |
41 // Setup pool pointer for this dart function. | |
42 const intptr_t object_pool_pc_dist = | |
43 Instructions::HeaderSize() - Instructions::object_pool_offset() + | |
44 assembler->CodeSize() + Instr::kPCReadOffset; | |
45 __ ldr(PP, Address(PC, -object_pool_pc_dist)); | |
46 | |
47 // Reserve space for locals. | |
48 __ AddImmediate(SP, -frame_size); | |
49 } | |
50 | |
51 | |
52 void AssemblerMacros::LeaveDartFrame(Assembler* assembler) { | |
53 __ LeaveFrame((1 << PP) | (1 << FP) | (1 << LR)); | |
54 // Adjust SP for PC pushed in EnterDartFrame. | |
55 __ AddImmediate(SP, kWordSize); | |
56 } | |
57 | |
58 | |
59 void AssemblerMacros::EnterStubFrame(Assembler* assembler) { | |
60 // Push 0 as saved PC for stub frames. | |
61 __ mov(IP, ShifterOperand(LR)); | |
62 __ mov(LR, ShifterOperand(0)); | |
63 __ EnterFrame((1 << FP) | (1 << IP) | (1 << LR), 0); | |
64 } | |
65 | |
66 | |
67 void AssemblerMacros::LeaveStubFrame(Assembler* assembler) { | |
68 __ LeaveFrame((1 << FP) | (1 << LR)); | |
69 // Adjust SP for null PC pushed in EnterStubFrame. | |
70 __ AddImmediate(SP, kWordSize); | |
71 } | |
72 | |
73 } // namespace dart | |
74 | |
75 #endif // defined TARGET_ARCH_ARM | |
76 | |
OLD | NEW |