| 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" |
| (...skipping 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1254 if (value_high != 0) { | 1254 if (value_high != 0) { |
| 1255 movt(rd, value_high); | 1255 movt(rd, value_high); |
| 1256 } | 1256 } |
| 1257 add(rd, PP, ShifterOperand(LR)); | 1257 add(rd, PP, ShifterOperand(LR)); |
| 1258 } | 1258 } |
| 1259 ldr(rd, Address(rd, offset_lo)); | 1259 ldr(rd, Address(rd, offset_lo)); |
| 1260 } | 1260 } |
| 1261 } | 1261 } |
| 1262 | 1262 |
| 1263 | 1263 |
| 1264 void Assembler::LoadPoolPointer() { |
| 1265 const intptr_t object_pool_pc_dist = |
| 1266 Instructions::HeaderSize() - Instructions::object_pool_offset() + |
| 1267 CodeSize() + Instr::kPCReadOffset; |
| 1268 LoadFromOffset(kLoadWord, PP, PC, -object_pool_pc_dist); |
| 1269 } |
| 1270 |
| 1271 |
| 1264 void Assembler::LoadObject(Register rd, const Object& object) { | 1272 void Assembler::LoadObject(Register rd, const Object& object) { |
| 1265 // Smis and VM heap objects are never relocated; do not use object pool. | 1273 // Smis and VM heap objects are never relocated; do not use object pool. |
| 1266 if (object.IsSmi()) { | 1274 if (object.IsSmi()) { |
| 1267 LoadImmediate(rd, reinterpret_cast<int32_t>(object.raw())); | 1275 LoadImmediate(rd, reinterpret_cast<int32_t>(object.raw())); |
| 1268 } else if (object.InVMHeap()) { | 1276 } else if (object.InVMHeap()) { |
| 1269 // Make sure that class CallPattern is able to decode this load immediate. | 1277 // Make sure that class CallPattern is able to decode this load immediate. |
| 1270 const int32_t object_raw = reinterpret_cast<int32_t>(object.raw()); | 1278 const int32_t object_raw = reinterpret_cast<int32_t>(object.raw()); |
| 1271 movw(rd, Utils::Low16Bits(object_raw)); | 1279 movw(rd, Utils::Low16Bits(object_raw)); |
| 1272 const uint16_t value_high = Utils::High16Bits(object_raw); | 1280 const uint16_t value_high = Utils::High16Bits(object_raw); |
| 1273 if (value_high != 0) { | 1281 if (value_high != 0) { |
| (...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1965 | 1973 |
| 1966 if (offset != 0) { | 1974 if (offset != 0) { |
| 1967 // Adjust saved PC for any intrinsic code that could have been generated | 1975 // Adjust saved PC for any intrinsic code that could have been generated |
| 1968 // before a frame is created. Use PP as temp register. | 1976 // before a frame is created. Use PP as temp register. |
| 1969 ldr(PP, Address(FP, 2 * kWordSize)); | 1977 ldr(PP, Address(FP, 2 * kWordSize)); |
| 1970 AddImmediate(PP, PP, -offset); | 1978 AddImmediate(PP, PP, -offset); |
| 1971 str(PP, Address(FP, 2 * kWordSize)); | 1979 str(PP, Address(FP, 2 * kWordSize)); |
| 1972 } | 1980 } |
| 1973 | 1981 |
| 1974 // Setup pool pointer for this dart function. | 1982 // Setup pool pointer for this dart function. |
| 1975 const intptr_t object_pool_pc_dist = | 1983 LoadPoolPointer(); |
| 1976 Instructions::HeaderSize() - Instructions::object_pool_offset() + | |
| 1977 CodeSize() + Instr::kPCReadOffset; | |
| 1978 ldr(PP, Address(PC, -object_pool_pc_dist)); | |
| 1979 | 1984 |
| 1980 // Reserve space for locals. | 1985 // Reserve space for locals. |
| 1981 AddImmediate(SP, -frame_size); | 1986 AddImmediate(SP, -frame_size); |
| 1982 } | 1987 } |
| 1983 | 1988 |
| 1984 | 1989 |
| 1985 void Assembler::LeaveDartFrame() { | 1990 void Assembler::LeaveDartFrame() { |
| 1986 LeaveFrame((1 << PP) | (1 << FP) | (1 << LR)); | 1991 LeaveFrame((1 << PP) | (1 << FP) | (1 << LR)); |
| 1987 // Adjust SP for PC pushed in EnterDartFrame. | 1992 // Adjust SP for PC pushed in EnterDartFrame. |
| 1988 AddImmediate(SP, kWordSize); | 1993 AddImmediate(SP, kWordSize); |
| 1989 } | 1994 } |
| 1990 | 1995 |
| 1991 | 1996 |
| 1992 void Assembler::EnterStubFrame(bool uses_pp) { | 1997 void Assembler::EnterStubFrame(bool uses_pp) { |
| 1993 // Push 0 as saved PC for stub frames. | 1998 // Push 0 as saved PC for stub frames. |
| 1994 mov(IP, ShifterOperand(LR)); | 1999 mov(IP, ShifterOperand(LR)); |
| 1995 mov(LR, ShifterOperand(0)); | 2000 mov(LR, ShifterOperand(0)); |
| 1996 RegList regs = (1 << FP) | (1 << IP) | (1 << LR); | 2001 RegList regs = (1 << FP) | (1 << IP) | (1 << LR); |
| 1997 if (uses_pp) { | 2002 if (uses_pp) { |
| 1998 regs |= (1 << PP); | 2003 regs |= (1 << PP); |
| 1999 } | 2004 } |
| 2000 EnterFrame(regs, 0); | 2005 EnterFrame(regs, 0); |
| 2001 if (uses_pp) { | 2006 if (uses_pp) { |
| 2002 // Setup pool pointer for this stub. | 2007 // Setup pool pointer for this stub. |
| 2003 const intptr_t object_pool_pc_dist = | 2008 LoadPoolPointer(); |
| 2004 Instructions::HeaderSize() - Instructions::object_pool_offset() + | |
| 2005 CodeSize() + Instr::kPCReadOffset; | |
| 2006 ldr(PP, Address(PC, -object_pool_pc_dist)); | |
| 2007 } | 2009 } |
| 2008 } | 2010 } |
| 2009 | 2011 |
| 2010 | 2012 |
| 2011 void Assembler::LeaveStubFrame(bool uses_pp) { | 2013 void Assembler::LeaveStubFrame(bool uses_pp) { |
| 2012 RegList regs = (1 << FP) | (1 << LR); | 2014 RegList regs = (1 << FP) | (1 << LR); |
| 2013 if (uses_pp) { | 2015 if (uses_pp) { |
| 2014 regs |= (1 << PP); | 2016 regs |= (1 << PP); |
| 2015 } | 2017 } |
| 2016 LeaveFrame(regs); | 2018 LeaveFrame(regs); |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2124 | 2126 |
| 2125 const char* Assembler::FpuRegisterName(FpuRegister reg) { | 2127 const char* Assembler::FpuRegisterName(FpuRegister reg) { |
| 2126 ASSERT((0 <= reg) && (reg < kNumberOfFpuRegisters)); | 2128 ASSERT((0 <= reg) && (reg < kNumberOfFpuRegisters)); |
| 2127 return fpu_reg_names[reg]; | 2129 return fpu_reg_names[reg]; |
| 2128 } | 2130 } |
| 2129 | 2131 |
| 2130 } // namespace dart | 2132 } // namespace dart |
| 2131 | 2133 |
| 2132 #endif // defined TARGET_ARCH_ARM | 2134 #endif // defined TARGET_ARCH_ARM |
| 2133 | 2135 |
| OLD | NEW |