| 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/code_generator.h" | 9 #include "vm/code_generator.h" |
| 10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 const intptr_t isolate_offset = NativeArguments::isolate_offset(); | 38 const intptr_t isolate_offset = NativeArguments::isolate_offset(); |
| 39 const intptr_t argc_tag_offset = NativeArguments::argc_tag_offset(); | 39 const intptr_t argc_tag_offset = NativeArguments::argc_tag_offset(); |
| 40 const intptr_t argv_offset = NativeArguments::argv_offset(); | 40 const intptr_t argv_offset = NativeArguments::argv_offset(); |
| 41 const intptr_t retval_offset = NativeArguments::retval_offset(); | 41 const intptr_t retval_offset = NativeArguments::retval_offset(); |
| 42 const intptr_t exitframe_last_param_slot_from_fp = 2; | 42 const intptr_t exitframe_last_param_slot_from_fp = 2; |
| 43 | 43 |
| 44 __ mov(IP, Operand(0)); | 44 __ mov(IP, Operand(0)); |
| 45 __ Push(IP); // Push 0 for the PC marker. | 45 __ Push(IP); // Push 0 for the PC marker. |
| 46 __ EnterFrame((1 << FP) | (1 << LR), 0); | 46 __ EnterFrame((1 << FP) | (1 << LR), 0); |
| 47 | 47 |
| 48 // Load current Isolate pointer from Context structure into R0. | 48 __ LoadIsolate(R0); |
| 49 __ ldr(R0, FieldAddress(CTX, Context::isolate_offset())); | |
| 50 | 49 |
| 51 // Save exit frame information to enable stack walking as we are about | 50 // Save exit frame information to enable stack walking as we are about |
| 52 // to transition to Dart VM C++ code. | 51 // to transition to Dart VM C++ code. |
| 53 __ StoreToOffset(kWord, SP, R0, Isolate::top_exit_frame_info_offset()); | 52 __ StoreToOffset(kWord, SP, R0, Isolate::top_exit_frame_info_offset()); |
| 54 | 53 |
| 55 // Save current Context pointer into Isolate structure. | 54 // Save current Context pointer into Isolate structure. |
| 56 __ StoreToOffset(kWord, CTX, R0, Isolate::top_context_offset()); | 55 __ StoreToOffset(kWord, CTX, R0, Isolate::top_context_offset()); |
| 57 | 56 |
| 58 // Cache Isolate pointer into CTX while executing runtime code. | 57 // Cache Isolate pointer into CTX while executing runtime code. |
| 59 __ mov(CTX, Operand(R0)); | 58 __ mov(CTX, Operand(R0)); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 void StubCode::GenerateCallNativeCFunctionStub(Assembler* assembler) { | 151 void StubCode::GenerateCallNativeCFunctionStub(Assembler* assembler) { |
| 153 const intptr_t isolate_offset = NativeArguments::isolate_offset(); | 152 const intptr_t isolate_offset = NativeArguments::isolate_offset(); |
| 154 const intptr_t argc_tag_offset = NativeArguments::argc_tag_offset(); | 153 const intptr_t argc_tag_offset = NativeArguments::argc_tag_offset(); |
| 155 const intptr_t argv_offset = NativeArguments::argv_offset(); | 154 const intptr_t argv_offset = NativeArguments::argv_offset(); |
| 156 const intptr_t retval_offset = NativeArguments::retval_offset(); | 155 const intptr_t retval_offset = NativeArguments::retval_offset(); |
| 157 | 156 |
| 158 __ mov(IP, Operand(0)); | 157 __ mov(IP, Operand(0)); |
| 159 __ Push(IP); // Push 0 for the PC marker. | 158 __ Push(IP); // Push 0 for the PC marker. |
| 160 __ EnterFrame((1 << FP) | (1 << LR), 0); | 159 __ EnterFrame((1 << FP) | (1 << LR), 0); |
| 161 | 160 |
| 162 // Load current Isolate pointer from Context structure into R0. | 161 __ LoadIsolate(R0); |
| 163 __ ldr(R0, FieldAddress(CTX, Context::isolate_offset())); | |
| 164 | 162 |
| 165 // Save exit frame information to enable stack walking as we are about | 163 // Save exit frame information to enable stack walking as we are about |
| 166 // to transition to native code. | 164 // to transition to native code. |
| 167 __ StoreToOffset(kWord, SP, R0, Isolate::top_exit_frame_info_offset()); | 165 __ StoreToOffset(kWord, SP, R0, Isolate::top_exit_frame_info_offset()); |
| 168 | 166 |
| 169 // Save current Context pointer into Isolate structure. | 167 // Save current Context pointer into Isolate structure. |
| 170 __ StoreToOffset(kWord, CTX, R0, Isolate::top_context_offset()); | 168 __ StoreToOffset(kWord, CTX, R0, Isolate::top_context_offset()); |
| 171 | 169 |
| 172 // Cache Isolate pointer into CTX while executing native code. | 170 // Cache Isolate pointer into CTX while executing native code. |
| 173 __ mov(CTX, Operand(R0)); | 171 __ mov(CTX, Operand(R0)); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 void StubCode::GenerateCallBootstrapCFunctionStub(Assembler* assembler) { | 258 void StubCode::GenerateCallBootstrapCFunctionStub(Assembler* assembler) { |
| 261 const intptr_t isolate_offset = NativeArguments::isolate_offset(); | 259 const intptr_t isolate_offset = NativeArguments::isolate_offset(); |
| 262 const intptr_t argc_tag_offset = NativeArguments::argc_tag_offset(); | 260 const intptr_t argc_tag_offset = NativeArguments::argc_tag_offset(); |
| 263 const intptr_t argv_offset = NativeArguments::argv_offset(); | 261 const intptr_t argv_offset = NativeArguments::argv_offset(); |
| 264 const intptr_t retval_offset = NativeArguments::retval_offset(); | 262 const intptr_t retval_offset = NativeArguments::retval_offset(); |
| 265 | 263 |
| 266 __ mov(IP, Operand(0)); | 264 __ mov(IP, Operand(0)); |
| 267 __ Push(IP); // Push 0 for the PC marker. | 265 __ Push(IP); // Push 0 for the PC marker. |
| 268 __ EnterFrame((1 << FP) | (1 << LR), 0); | 266 __ EnterFrame((1 << FP) | (1 << LR), 0); |
| 269 | 267 |
| 270 // Load current Isolate pointer from Context structure into R0. | 268 __ LoadIsolate(R0); |
| 271 __ ldr(R0, FieldAddress(CTX, Context::isolate_offset())); | |
| 272 | 269 |
| 273 // Save exit frame information to enable stack walking as we are about | 270 // Save exit frame information to enable stack walking as we are about |
| 274 // to transition to native code. | 271 // to transition to native code. |
| 275 __ StoreToOffset(kWord, SP, R0, Isolate::top_exit_frame_info_offset()); | 272 __ StoreToOffset(kWord, SP, R0, Isolate::top_exit_frame_info_offset()); |
| 276 | 273 |
| 277 // Save current Context pointer into Isolate structure. | 274 // Save current Context pointer into Isolate structure. |
| 278 __ StoreToOffset(kWord, CTX, R0, Isolate::top_context_offset()); | 275 __ StoreToOffset(kWord, CTX, R0, Isolate::top_context_offset()); |
| 279 | 276 |
| 280 // Cache Isolate pointer into CTX while executing native code. | 277 // Cache Isolate pointer into CTX while executing native code. |
| 281 __ mov(CTX, Operand(R0)); | 278 __ mov(CTX, Operand(R0)); |
| (...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 808 | 805 |
| 809 // The new Context structure contains a pointer to the current Isolate | 806 // The new Context structure contains a pointer to the current Isolate |
| 810 // structure. Cache the Context pointer in the CTX register so that it is | 807 // structure. Cache the Context pointer in the CTX register so that it is |
| 811 // available in generated code and calls to Isolate::Current() need not be | 808 // available in generated code and calls to Isolate::Current() need not be |
| 812 // done. The assumption is that this register will never be clobbered by | 809 // done. The assumption is that this register will never be clobbered by |
| 813 // compiled or runtime stub code. | 810 // compiled or runtime stub code. |
| 814 | 811 |
| 815 // Cache the new Context pointer into CTX while executing Dart code. | 812 // Cache the new Context pointer into CTX while executing Dart code. |
| 816 __ ldr(CTX, Address(R3, VMHandles::kOffsetOfRawPtrInHandle)); | 813 __ ldr(CTX, Address(R3, VMHandles::kOffsetOfRawPtrInHandle)); |
| 817 | 814 |
| 818 // Load Isolate pointer into temporary register R8. | |
| 819 __ LoadIsolate(R8); | 815 __ LoadIsolate(R8); |
| 820 | 816 |
| 821 // Save the current VMTag on the stack. | 817 // Save the current VMTag on the stack. |
| 822 ASSERT(kSavedVMTagSlotFromEntryFp == -25); | 818 ASSERT(kSavedVMTagSlotFromEntryFp == -25); |
| 823 __ LoadFromOffset(kWord, R5, R8, Isolate::vm_tag_offset()); | 819 __ LoadFromOffset(kWord, R5, R8, Isolate::vm_tag_offset()); |
| 824 __ Push(R5); | 820 __ Push(R5); |
| 825 | 821 |
| 826 // Mark that the isolate is executing Dart code. | 822 // Mark that the isolate is executing Dart code. |
| 827 __ LoadImmediate(R5, VMTag::kDartTagId); | 823 __ LoadImmediate(R5, VMTag::kDartTagId); |
| 828 __ StoreToOffset(kWord, R5, R8, Isolate::vm_tag_offset()); | 824 __ StoreToOffset(kWord, R5, R8, Isolate::vm_tag_offset()); |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 981 __ orr(R3, R3, Operand(IP)); | 977 __ orr(R3, R3, Operand(IP)); |
| 982 __ str(R3, FieldAddress(R0, Context::tags_offset())); | 978 __ str(R3, FieldAddress(R0, Context::tags_offset())); |
| 983 | 979 |
| 984 // Setup up number of context variables field. | 980 // Setup up number of context variables field. |
| 985 // R0: new object. | 981 // R0: new object. |
| 986 // R1: number of context variables as integer value (not object). | 982 // R1: number of context variables as integer value (not object). |
| 987 // R2: object size. | 983 // R2: object size. |
| 988 // R4: allocation stats address. | 984 // R4: allocation stats address. |
| 989 __ str(R1, FieldAddress(R0, Context::num_variables_offset())); | 985 __ str(R1, FieldAddress(R0, Context::num_variables_offset())); |
| 990 | 986 |
| 991 // Setup isolate field. | |
| 992 // Load Isolate pointer into R3. | |
| 993 // R0: new object. | |
| 994 // R1: number of context variables. | |
| 995 // R2: object size. | |
| 996 // R4: allocation stats address. | |
| 997 __ LoadIsolate(R3); | |
| 998 // R3: isolate, not an object. | |
| 999 __ str(R3, FieldAddress(R0, Context::isolate_offset())); | |
| 1000 | |
| 1001 // Setup the parent field. | 987 // Setup the parent field. |
| 1002 // R0: new object. | 988 // R0: new object. |
| 1003 // R1: number of context variables. | 989 // R1: number of context variables. |
| 1004 // R2: object size. | 990 // R2: object size. |
| 1005 // R4: allocation stats address. | 991 // R4: allocation stats address. |
| 1006 __ LoadImmediate(R3, reinterpret_cast<intptr_t>(Object::null())); | 992 __ LoadImmediate(R3, reinterpret_cast<intptr_t>(Object::null())); |
| 1007 __ str(R3, FieldAddress(R0, Context::parent_offset())); | 993 __ str(R3, FieldAddress(R0, Context::parent_offset())); |
| 1008 | 994 |
| 1009 // Initialize the context variables. | 995 // Initialize the context variables. |
| 1010 // R0: new object. | 996 // R0: new object. |
| (...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1754 __ LeaveStubFrame(); | 1740 __ LeaveStubFrame(); |
| 1755 __ bx(R0); | 1741 __ bx(R0); |
| 1756 } | 1742 } |
| 1757 | 1743 |
| 1758 | 1744 |
| 1759 // Called only from unoptimized code. All relevant registers have been saved. | 1745 // Called only from unoptimized code. All relevant registers have been saved. |
| 1760 void StubCode::GenerateDebugStepCheckStub( | 1746 void StubCode::GenerateDebugStepCheckStub( |
| 1761 Assembler* assembler) { | 1747 Assembler* assembler) { |
| 1762 // Check single stepping. | 1748 // Check single stepping. |
| 1763 Label stepping, done_stepping; | 1749 Label stepping, done_stepping; |
| 1764 __ ldr(R1, FieldAddress(CTX, Context::isolate_offset())); | 1750 __ LoadIsolate(R1); |
| 1765 __ ldrb(R1, Address(R1, Isolate::single_step_offset())); | 1751 __ ldrb(R1, Address(R1, Isolate::single_step_offset())); |
| 1766 __ CompareImmediate(R1, 0); | 1752 __ CompareImmediate(R1, 0); |
| 1767 __ b(&stepping, NE); | 1753 __ b(&stepping, NE); |
| 1768 __ Bind(&done_stepping); | 1754 __ Bind(&done_stepping); |
| 1769 __ Ret(); | 1755 __ Ret(); |
| 1770 | 1756 |
| 1771 __ Bind(&stepping); | 1757 __ Bind(&stepping); |
| 1772 __ EnterStubFrame(); | 1758 __ EnterStubFrame(); |
| 1773 __ CallRuntime(kSingleStepHandlerRuntimeEntry, 0); | 1759 __ CallRuntime(kSingleStepHandlerRuntimeEntry, 0); |
| 1774 __ LeaveStubFrame(); | 1760 __ LeaveStubFrame(); |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2014 | 2000 |
| 2015 // Called only from unoptimized code. All relevant registers have been saved. | 2001 // Called only from unoptimized code. All relevant registers have been saved. |
| 2016 // LR: return address. | 2002 // LR: return address. |
| 2017 // SP + 4: left operand. | 2003 // SP + 4: left operand. |
| 2018 // SP + 0: right operand. | 2004 // SP + 0: right operand. |
| 2019 // Return Zero condition flag set if equal. | 2005 // Return Zero condition flag set if equal. |
| 2020 void StubCode::GenerateUnoptimizedIdenticalWithNumberCheckStub( | 2006 void StubCode::GenerateUnoptimizedIdenticalWithNumberCheckStub( |
| 2021 Assembler* assembler) { | 2007 Assembler* assembler) { |
| 2022 // Check single stepping. | 2008 // Check single stepping. |
| 2023 Label stepping, done_stepping; | 2009 Label stepping, done_stepping; |
| 2024 __ ldr(R1, FieldAddress(CTX, Context::isolate_offset())); | 2010 __ LoadIsolate(R1); |
| 2025 __ ldrb(R1, Address(R1, Isolate::single_step_offset())); | 2011 __ ldrb(R1, Address(R1, Isolate::single_step_offset())); |
| 2026 __ CompareImmediate(R1, 0); | 2012 __ CompareImmediate(R1, 0); |
| 2027 __ b(&stepping, NE); | 2013 __ b(&stepping, NE); |
| 2028 __ Bind(&done_stepping); | 2014 __ Bind(&done_stepping); |
| 2029 | 2015 |
| 2030 const Register temp = R2; | 2016 const Register temp = R2; |
| 2031 const Register left = R1; | 2017 const Register left = R1; |
| 2032 const Register right = R0; | 2018 const Register right = R0; |
| 2033 __ ldr(left, Address(SP, 1 * kWordSize)); | 2019 __ ldr(left, Address(SP, 1 * kWordSize)); |
| 2034 __ ldr(right, Address(SP, 0 * kWordSize)); | 2020 __ ldr(right, Address(SP, 0 * kWordSize)); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 2055 const Register right = R0; | 2041 const Register right = R0; |
| 2056 __ ldr(left, Address(SP, 1 * kWordSize)); | 2042 __ ldr(left, Address(SP, 1 * kWordSize)); |
| 2057 __ ldr(right, Address(SP, 0 * kWordSize)); | 2043 __ ldr(right, Address(SP, 0 * kWordSize)); |
| 2058 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); | 2044 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); |
| 2059 __ Ret(); | 2045 __ Ret(); |
| 2060 } | 2046 } |
| 2061 | 2047 |
| 2062 } // namespace dart | 2048 } // namespace dart |
| 2063 | 2049 |
| 2064 #endif // defined TARGET_ARCH_ARM | 2050 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |