| 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 1292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1303 RawObject::kClassIdTagBit / kBitsPerByte; | 1303 RawObject::kClassIdTagBit / kBitsPerByte; |
| 1304 ldrh(result, FieldAddress(object, class_id_offset)); | 1304 ldrh(result, FieldAddress(object, class_id_offset)); |
| 1305 } | 1305 } |
| 1306 | 1306 |
| 1307 | 1307 |
| 1308 void Assembler::LoadClassById(Register result, Register class_id) { | 1308 void Assembler::LoadClassById(Register result, Register class_id) { |
| 1309 ASSERT(result != class_id); | 1309 ASSERT(result != class_id); |
| 1310 ldr(result, FieldAddress(CTX, Context::isolate_offset())); | 1310 ldr(result, FieldAddress(CTX, Context::isolate_offset())); |
| 1311 const intptr_t table_offset_in_isolate = | 1311 const intptr_t table_offset_in_isolate = |
| 1312 Isolate::class_table_offset() + ClassTable::table_offset(); | 1312 Isolate::class_table_offset() + ClassTable::table_offset(); |
| 1313 ldr(result, Address(result, table_offset_in_isolate)); | 1313 LoadFromOffset(kLoadWord, result, result, table_offset_in_isolate); |
| 1314 ldr(result, Address(result, class_id, LSL, 2)); | 1314 ldr(result, Address(result, class_id, LSL, 2)); |
| 1315 } | 1315 } |
| 1316 | 1316 |
| 1317 | 1317 |
| 1318 void Assembler::LoadClass(Register result, Register object, Register scratch) { | 1318 void Assembler::LoadClass(Register result, Register object, Register scratch) { |
| 1319 ASSERT(scratch != result); | 1319 ASSERT(scratch != result); |
| 1320 LoadClassId(scratch, object); | 1320 LoadClassId(scratch, object); |
| 1321 | 1321 |
| 1322 ldr(result, FieldAddress(CTX, Context::isolate_offset())); | 1322 ldr(result, FieldAddress(CTX, Context::isolate_offset())); |
| 1323 const intptr_t table_offset_in_isolate = | 1323 const intptr_t table_offset_in_isolate = |
| 1324 Isolate::class_table_offset() + ClassTable::table_offset(); | 1324 Isolate::class_table_offset() + ClassTable::table_offset(); |
| 1325 ldr(result, Address(result, table_offset_in_isolate)); | 1325 LoadFromOffset(kLoadWord, result, result, table_offset_in_isolate); |
| 1326 ldr(result, Address(result, scratch, LSL, 2)); | 1326 ldr(result, Address(result, scratch, LSL, 2)); |
| 1327 } | 1327 } |
| 1328 | 1328 |
| 1329 | 1329 |
| 1330 void Assembler::CompareClassId(Register object, | 1330 void Assembler::CompareClassId(Register object, |
| 1331 intptr_t class_id, | 1331 intptr_t class_id, |
| 1332 Register scratch) { | 1332 Register scratch) { |
| 1333 LoadClassId(scratch, object); | 1333 LoadClassId(scratch, object); |
| 1334 CompareImmediate(scratch, class_id); | 1334 CompareImmediate(scratch, class_id); |
| 1335 } | 1335 } |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1783 } | 1783 } |
| 1784 } | 1784 } |
| 1785 | 1785 |
| 1786 | 1786 |
| 1787 void Assembler::CompareImmediate(Register rn, int32_t value, Condition cond) { | 1787 void Assembler::CompareImmediate(Register rn, int32_t value, Condition cond) { |
| 1788 ShifterOperand shifter_op; | 1788 ShifterOperand shifter_op; |
| 1789 if (ShifterOperand::CanHold(value, &shifter_op)) { | 1789 if (ShifterOperand::CanHold(value, &shifter_op)) { |
| 1790 cmp(rn, shifter_op, cond); | 1790 cmp(rn, shifter_op, cond); |
| 1791 } else { | 1791 } else { |
| 1792 ASSERT(rn != IP); | 1792 ASSERT(rn != IP); |
| 1793 LoadImmediate(IP, cond); | 1793 LoadImmediate(IP, value, cond); |
| 1794 cmp(rn, ShifterOperand(IP), cond); | 1794 cmp(rn, ShifterOperand(IP), cond); |
| 1795 } | 1795 } |
| 1796 } | 1796 } |
| 1797 | 1797 |
| 1798 | 1798 |
| 1799 static int NumRegsBelowFP(RegList regs) { | 1799 static int NumRegsBelowFP(RegList regs) { |
| 1800 int count = 0; | 1800 int count = 0; |
| 1801 for (int i = 0; i < FP; i++) { | 1801 for (int i = 0; i < FP; i++) { |
| 1802 if ((regs & (1 << i)) != 0) { | 1802 if ((regs & (1 << i)) != 0) { |
| 1803 count++; | 1803 count++; |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1903 } | 1903 } |
| 1904 | 1904 |
| 1905 | 1905 |
| 1906 void Assembler::LeaveDartFrame() { | 1906 void Assembler::LeaveDartFrame() { |
| 1907 LeaveFrame((1 << PP) | (1 << FP) | (1 << LR)); | 1907 LeaveFrame((1 << PP) | (1 << FP) | (1 << LR)); |
| 1908 // Adjust SP for PC pushed in EnterDartFrame. | 1908 // Adjust SP for PC pushed in EnterDartFrame. |
| 1909 AddImmediate(SP, kWordSize); | 1909 AddImmediate(SP, kWordSize); |
| 1910 } | 1910 } |
| 1911 | 1911 |
| 1912 | 1912 |
| 1913 void Assembler::EnterStubFrame() { | 1913 void Assembler::EnterStubFrame(bool uses_pp) { |
| 1914 // Push 0 as saved PC for stub frames. | 1914 // Push 0 as saved PC for stub frames. |
| 1915 mov(IP, ShifterOperand(LR)); | 1915 mov(IP, ShifterOperand(LR)); |
| 1916 mov(LR, ShifterOperand(0)); | 1916 mov(LR, ShifterOperand(0)); |
| 1917 EnterFrame((1 << FP) | (1 << IP) | (1 << LR), 0); | 1917 RegList regs = (1 << FP) | (1 << IP) | (1 << LR); |
| 1918 if (uses_pp) { |
| 1919 regs |= (1 << PP); |
| 1920 } |
| 1921 EnterFrame(regs, 0); |
| 1922 if (uses_pp) { |
| 1923 // Setup pool pointer for this stub. |
| 1924 const intptr_t object_pool_pc_dist = |
| 1925 Instructions::HeaderSize() - Instructions::object_pool_offset() + |
| 1926 CodeSize() + Instr::kPCReadOffset; |
| 1927 ldr(PP, Address(PC, -object_pool_pc_dist)); |
| 1928 } |
| 1918 } | 1929 } |
| 1919 | 1930 |
| 1920 | 1931 |
| 1921 void Assembler::LeaveStubFrame() { | 1932 void Assembler::LeaveStubFrame(bool uses_pp) { |
| 1922 LeaveFrame((1 << FP) | (1 << LR)); | 1933 RegList regs = (1 << FP) | (1 << LR); |
| 1934 if (uses_pp) { |
| 1935 regs |= (1 << PP); |
| 1936 } |
| 1937 LeaveFrame(regs); |
| 1923 // Adjust SP for null PC pushed in EnterStubFrame. | 1938 // Adjust SP for null PC pushed in EnterStubFrame. |
| 1924 AddImmediate(SP, kWordSize); | 1939 AddImmediate(SP, kWordSize); |
| 1925 } | 1940 } |
| 1926 | 1941 |
| 1927 | 1942 |
| 1928 void Assembler::TryAllocate(const Class& cls, | 1943 void Assembler::TryAllocate(const Class& cls, |
| 1929 Label* failure, | 1944 Label* failure, |
| 1930 bool near_jump, | 1945 bool near_jump, |
| 1931 Register instance_reg) { | 1946 Register instance_reg) { |
| 1932 UNIMPLEMENTED(); | 1947 UNIMPLEMENTED(); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2002 // Do not reuse an existing entry, since each reference may be patched | 2017 // Do not reuse an existing entry, since each reference may be patched |
| 2003 // independently. | 2018 // independently. |
| 2004 object_pool_.Add(smi, Heap::kOld); | 2019 object_pool_.Add(smi, Heap::kOld); |
| 2005 return object_pool_.Length() - 1; | 2020 return object_pool_.Length() - 1; |
| 2006 } | 2021 } |
| 2007 | 2022 |
| 2008 } // namespace dart | 2023 } // namespace dart |
| 2009 | 2024 |
| 2010 #endif // defined TARGET_ARCH_ARM | 2025 #endif // defined TARGET_ARCH_ARM |
| 2011 | 2026 |
| OLD | NEW |