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/assembler_macros.h" | |
10 #include "vm/code_generator.h" | 9 #include "vm/code_generator.h" |
11 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
12 #include "vm/instructions.h" | 11 #include "vm/instructions.h" |
13 #include "vm/stack_frame.h" | 12 #include "vm/stack_frame.h" |
14 #include "vm/stub_code.h" | 13 #include "vm/stub_code.h" |
15 | 14 |
16 #define __ assembler-> | 15 #define __ assembler-> |
17 | 16 |
18 namespace dart { | 17 namespace dart { |
19 | 18 |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 | 134 |
136 | 135 |
137 void StubCode::GenerateCallNativeCFunctionStub(Assembler* assembler) { | 136 void StubCode::GenerateCallNativeCFunctionStub(Assembler* assembler) { |
138 __ Unimplemented("CallNativeCFunction stub"); | 137 __ Unimplemented("CallNativeCFunction stub"); |
139 } | 138 } |
140 | 139 |
141 | 140 |
142 // Input parameters: | 141 // Input parameters: |
143 // R4: arguments descriptor array. | 142 // R4: arguments descriptor array. |
144 void StubCode::GenerateCallStaticFunctionStub(Assembler* assembler) { | 143 void StubCode::GenerateCallStaticFunctionStub(Assembler* assembler) { |
145 AssemblerMacros::EnterStubFrame(assembler); | 144 __ EnterStubFrame(); |
146 // Setup space on stack for return value and preserve arguments descriptor. | 145 // Setup space on stack for return value and preserve arguments descriptor. |
147 __ LoadImmediate(R0, reinterpret_cast<intptr_t>(Object::null())); | 146 __ LoadImmediate(R0, reinterpret_cast<intptr_t>(Object::null())); |
148 __ PushList((1 << R0) | (1 << R4)); | 147 __ PushList((1 << R0) | (1 << R4)); |
149 __ CallRuntime(kPatchStaticCallRuntimeEntry); | 148 __ CallRuntime(kPatchStaticCallRuntimeEntry); |
150 // Get Code object result and restore arguments descriptor array. | 149 // Get Code object result and restore arguments descriptor array. |
151 __ PopList((1 << R0) | (1 << R4)); | 150 __ PopList((1 << R0) | (1 << R4)); |
152 // Remove the stub frame as we are about to jump to the dart function. | 151 // Remove the stub frame as we are about to jump to the dart function. |
153 AssemblerMacros::LeaveStubFrame(assembler); | 152 __ LeaveStubFrame(); |
154 | 153 |
155 __ ldr(R0, FieldAddress(R0, Code::instructions_offset())); | 154 __ ldr(R0, FieldAddress(R0, Code::instructions_offset())); |
156 __ AddImmediate(R0, R0, Instructions::HeaderSize() - kHeapObjectTag); | 155 __ AddImmediate(R0, R0, Instructions::HeaderSize() - kHeapObjectTag); |
157 __ bx(R0); | 156 __ bx(R0); |
158 } | 157 } |
159 | 158 |
160 | 159 |
161 void StubCode::GenerateFixCallersTargetStub(Assembler* assembler) { | 160 void StubCode::GenerateFixCallersTargetStub(Assembler* assembler) { |
162 __ Unimplemented("FixCallersTarget stub"); | 161 __ Unimplemented("FixCallersTarget stub"); |
163 } | 162 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 | 194 |
196 // Called when invoking Dart code from C++ (VM code). | 195 // Called when invoking Dart code from C++ (VM code). |
197 // Input parameters: | 196 // Input parameters: |
198 // LR : points to return address. | 197 // LR : points to return address. |
199 // R0 : entrypoint of the Dart function to call. | 198 // R0 : entrypoint of the Dart function to call. |
200 // R1 : arguments descriptor array. | 199 // R1 : arguments descriptor array. |
201 // R2 : arguments array. | 200 // R2 : arguments array. |
202 // R3 : new context containing the current isolate pointer. | 201 // R3 : new context containing the current isolate pointer. |
203 void StubCode::GenerateInvokeDartCodeStub(Assembler* assembler) { | 202 void StubCode::GenerateInvokeDartCodeStub(Assembler* assembler) { |
204 // Save frame pointer coming in. | 203 // Save frame pointer coming in. |
205 AssemblerMacros::EnterStubFrame(assembler); | 204 __ EnterStubFrame(); |
206 | 205 |
207 // Save new context and C++ ABI callee-saved registers. | 206 // Save new context and C++ ABI callee-saved registers. |
208 const intptr_t kNewContextOffset = | 207 const intptr_t kNewContextOffset = |
209 -(1 + kAbiPreservedCpuRegCount) * kWordSize; | 208 -(1 + kAbiPreservedCpuRegCount) * kWordSize; |
210 __ PushList((1 << R3) | kAbiPreservedCpuRegs); | 209 __ PushList((1 << R3) | kAbiPreservedCpuRegs); |
211 | 210 |
212 // The new Context structure contains a pointer to the current Isolate | 211 // The new Context structure contains a pointer to the current Isolate |
213 // structure. Cache the Context pointer in the CTX register so that it is | 212 // structure. Cache the Context pointer in the CTX register so that it is |
214 // available in generated code and calls to Isolate::Current() need not be | 213 // available in generated code and calls to Isolate::Current() need not be |
215 // done. The assumption is that this register will never be clobbered by | 214 // done. The assumption is that this register will never be clobbered by |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 const intptr_t offset = Isolate::top_exit_frame_info_offset(); | 309 const intptr_t offset = Isolate::top_exit_frame_info_offset(); |
311 const int32_t offset12_hi = offset & ~kOffset12Mask; // signed | 310 const int32_t offset12_hi = offset & ~kOffset12Mask; // signed |
312 const uint32_t offset12_lo = offset & kOffset12Mask; // unsigned | 311 const uint32_t offset12_lo = offset & kOffset12Mask; // unsigned |
313 __ AddImmediate(R7, CTX, offset12_hi); | 312 __ AddImmediate(R7, CTX, offset12_hi); |
314 __ str(R5, Address(R7, offset12_lo)); | 313 __ str(R5, Address(R7, offset12_lo)); |
315 } | 314 } |
316 | 315 |
317 // Restore C++ ABI callee-saved registers. | 316 // Restore C++ ABI callee-saved registers. |
318 __ PopList((1 << R3) | kAbiPreservedCpuRegs); // Ignore restored R3. | 317 __ PopList((1 << R3) | kAbiPreservedCpuRegs); // Ignore restored R3. |
319 | 318 |
320 // Restore the frame pointer. | 319 // Restore the frame pointer and return. |
321 AssemblerMacros::LeaveStubFrame(assembler); | 320 __ LeaveStubFrame(); |
322 | |
323 __ Ret(); | 321 __ Ret(); |
324 } | 322 } |
325 | 323 |
326 | 324 |
327 void StubCode::GenerateAllocateContextStub(Assembler* assembler) { | 325 void StubCode::GenerateAllocateContextStub(Assembler* assembler) { |
328 __ Unimplemented("AllocateContext stub"); | 326 __ Unimplemented("AllocateContext stub"); |
329 } | 327 } |
330 | 328 |
331 | 329 |
332 void StubCode::GenerateUpdateStoreBufferStub(Assembler* assembler) { | 330 void StubCode::GenerateUpdateStoreBufferStub(Assembler* assembler) { |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 } | 473 } |
476 | 474 |
477 | 475 |
478 void StubCode::GenerateIdenticalWithNumberCheckStub(Assembler* assembler) { | 476 void StubCode::GenerateIdenticalWithNumberCheckStub(Assembler* assembler) { |
479 __ Unimplemented("IdenticalWithNumberCheck stub"); | 477 __ Unimplemented("IdenticalWithNumberCheck stub"); |
480 } | 478 } |
481 | 479 |
482 } // namespace dart | 480 } // namespace dart |
483 | 481 |
484 #endif // defined TARGET_ARCH_ARM | 482 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |