| 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/simulator.h" | 9 #include "vm/simulator.h" |
| 10 #include "vm/runtime_entry.h" | 10 #include "vm/runtime_entry.h" |
| 11 #include "vm/stack_frame.h" |
| 11 #include "vm/stub_code.h" | 12 #include "vm/stub_code.h" |
| 12 | 13 |
| 13 // An extra check since we are assuming the existence of /proc/cpuinfo below. | 14 // An extra check since we are assuming the existence of /proc/cpuinfo below. |
| 14 #if !defined(USING_SIMULATOR) && !defined(__linux__) | 15 #if !defined(USING_SIMULATOR) && !defined(__linux__) |
| 15 #error ARM cross-compile only supported on Linux | 16 #error ARM cross-compile only supported on Linux |
| 16 #endif | 17 #endif |
| 17 | 18 |
| 18 namespace dart { | 19 namespace dart { |
| 19 | 20 |
| 20 DEFINE_FLAG(bool, print_stop_message, true, "Print stop message."); | 21 DEFINE_FLAG(bool, print_stop_message, true, "Print stop message."); |
| (...skipping 2018 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2039 } | 2040 } |
| 2040 | 2041 |
| 2041 | 2042 |
| 2042 void Assembler::CallRuntime(const RuntimeEntry& entry) { | 2043 void Assembler::CallRuntime(const RuntimeEntry& entry) { |
| 2043 entry.Call(this); | 2044 entry.Call(this); |
| 2044 } | 2045 } |
| 2045 | 2046 |
| 2046 | 2047 |
| 2047 void Assembler::EnterDartFrame(intptr_t frame_size) { | 2048 void Assembler::EnterDartFrame(intptr_t frame_size) { |
| 2048 const intptr_t offset = CodeSize(); | 2049 const intptr_t offset = CodeSize(); |
| 2050 |
| 2049 // Save PC in frame for fast identification of corresponding code. | 2051 // Save PC in frame for fast identification of corresponding code. |
| 2050 // Note that callee-saved registers can be added to the register list. | 2052 // Note that callee-saved registers can be added to the register list. |
| 2051 EnterFrame((1 << PP) | (1 << FP) | (1 << LR) | (1 << PC), 0); | 2053 EnterFrame((1 << PP) | (1 << FP) | (1 << LR) | (1 << PC), 0); |
| 2052 | 2054 |
| 2053 if (offset != 0) { | 2055 if (offset != 0) { |
| 2054 // Adjust saved PC for any intrinsic code that could have been generated | 2056 // Adjust saved PC for any intrinsic code that could have been generated |
| 2055 // before a frame is created. Use PP as temp register. | 2057 // before a frame is created. Use PP as temp register. |
| 2056 ldr(PP, Address(FP, 2 * kWordSize)); | 2058 ldr(PP, Address(FP, 2 * kWordSize)); |
| 2057 AddImmediate(PP, PP, -offset); | 2059 AddImmediate(PP, PP, -offset); |
| 2058 str(PP, Address(FP, 2 * kWordSize)); | 2060 str(PP, Address(FP, 2 * kWordSize)); |
| 2059 } | 2061 } |
| 2060 | 2062 |
| 2061 // Setup pool pointer for this dart function. | 2063 // Setup pool pointer for this dart function. |
| 2062 LoadPoolPointer(); | 2064 LoadPoolPointer(); |
| 2063 | 2065 |
| 2064 // Reserve space for locals. | 2066 // Reserve space for locals. |
| 2065 AddImmediate(SP, -frame_size); | 2067 AddImmediate(SP, -frame_size); |
| 2066 } | 2068 } |
| 2067 | 2069 |
| 2068 | 2070 |
| 2071 // On entry to a function compiled for OSR, the caller's frame pointer, the |
| 2072 // stack locals, and any copied parameters are already in place. The frame |
| 2073 // pointer is already set up. The PC marker is not correct for the |
| 2074 // optimized function and there may be extra space for spill slots to |
| 2075 // allocate. We must also set up the pool pointer for the function. |
| 2076 void Assembler::EnterOsrFrame(intptr_t extra_size) { |
| 2077 const intptr_t offset = CodeSize(); |
| 2078 |
| 2079 Comment("EnterOsrFrame"); |
| 2080 mov(TMP, ShifterOperand(PC)); |
| 2081 |
| 2082 AddImmediate(TMP, -offset); |
| 2083 str(TMP, Address(FP, kPcMarkerSlotFromFp * kWordSize)); |
| 2084 |
| 2085 // Setup pool pointer for this dart function. |
| 2086 LoadPoolPointer(); |
| 2087 |
| 2088 AddImmediate(SP, -extra_size); |
| 2089 } |
| 2090 |
| 2091 |
| 2069 void Assembler::LeaveDartFrame() { | 2092 void Assembler::LeaveDartFrame() { |
| 2070 LeaveFrame((1 << PP) | (1 << FP) | (1 << LR)); | 2093 LeaveFrame((1 << PP) | (1 << FP) | (1 << LR)); |
| 2071 // Adjust SP for PC pushed in EnterDartFrame. | 2094 // Adjust SP for PC pushed in EnterDartFrame. |
| 2072 AddImmediate(SP, kWordSize); | 2095 AddImmediate(SP, kWordSize); |
| 2073 } | 2096 } |
| 2074 | 2097 |
| 2075 | 2098 |
| 2076 void Assembler::EnterStubFrame(bool uses_pp) { | 2099 void Assembler::EnterStubFrame(bool uses_pp) { |
| 2077 // Push 0 as saved PC for stub frames. | 2100 // Push 0 as saved PC for stub frames. |
| 2078 mov(IP, ShifterOperand(LR)); | 2101 mov(IP, ShifterOperand(LR)); |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2235 | 2258 |
| 2236 const char* Assembler::FpuRegisterName(FpuRegister reg) { | 2259 const char* Assembler::FpuRegisterName(FpuRegister reg) { |
| 2237 ASSERT((0 <= reg) && (reg < kNumberOfFpuRegisters)); | 2260 ASSERT((0 <= reg) && (reg < kNumberOfFpuRegisters)); |
| 2238 return fpu_reg_names[reg]; | 2261 return fpu_reg_names[reg]; |
| 2239 } | 2262 } |
| 2240 | 2263 |
| 2241 } // namespace dart | 2264 } // namespace dart |
| 2242 | 2265 |
| 2243 #endif // defined TARGET_ARCH_ARM | 2266 #endif // defined TARGET_ARCH_ARM |
| 2244 | 2267 |
| OLD | NEW |