| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 // Save current Context pointer into Isolate structure. | 57 // Save current Context pointer into Isolate structure. |
| 58 __ StoreToOffset(kWord, CTX, R0, Isolate::top_context_offset()); | 58 __ StoreToOffset(kWord, CTX, R0, Isolate::top_context_offset()); |
| 59 | 59 |
| 60 // Cache Isolate pointer into CTX while executing runtime code. | 60 // Cache Isolate pointer into CTX while executing runtime code. |
| 61 __ mov(CTX, Operand(R0)); | 61 __ mov(CTX, Operand(R0)); |
| 62 | 62 |
| 63 #if defined(DEBUG) | 63 #if defined(DEBUG) |
| 64 { Label ok; | 64 { Label ok; |
| 65 // Check that we are always entering from Dart code. | 65 // Check that we are always entering from Dart code. |
| 66 __ LoadFromOffset(kWord, R6, CTX, Isolate::vm_tag_offset()); | 66 __ LoadFromOffset(kWord, R6, CTX, Isolate::vm_tag_offset()); |
| 67 __ CompareImmediate(R6, VMTag::kScriptTagId); | 67 __ CompareImmediate(R6, VMTag::kDartTagId); |
| 68 __ b(&ok, EQ); | 68 __ b(&ok, EQ); |
| 69 __ Stop("Not coming from Dart code."); | 69 __ Stop("Not coming from Dart code."); |
| 70 __ Bind(&ok); | 70 __ Bind(&ok); |
| 71 } | 71 } |
| 72 #endif | 72 #endif |
| 73 | 73 |
| 74 // Mark that the isolate is executing VM code. | 74 // Mark that the isolate is executing VM code. |
| 75 __ StoreToOffset(kWord, R5, CTX, Isolate::vm_tag_offset()); | 75 __ StoreToOffset(kWord, R5, CTX, Isolate::vm_tag_offset()); |
| 76 | 76 |
| 77 // Reserve space for arguments and align frame before entering C++ world. | 77 // Reserve space for arguments and align frame before entering C++ world. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 95 // Set argv in NativeArguments. | 95 // Set argv in NativeArguments. |
| 96 __ AddImmediate(R2, exitframe_last_param_slot_from_fp * kWordSize); | 96 __ AddImmediate(R2, exitframe_last_param_slot_from_fp * kWordSize); |
| 97 | 97 |
| 98 ASSERT(retval_offset == 3 * kWordSize); | 98 ASSERT(retval_offset == 3 * kWordSize); |
| 99 __ add(R3, R2, Operand(kWordSize)); // Retval is next to 1st argument. | 99 __ add(R3, R2, Operand(kWordSize)); // Retval is next to 1st argument. |
| 100 | 100 |
| 101 // Call runtime or redirection via simulator. | 101 // Call runtime or redirection via simulator. |
| 102 __ blx(R5); | 102 __ blx(R5); |
| 103 | 103 |
| 104 // Mark that the isolate is executing Dart code. | 104 // Mark that the isolate is executing Dart code. |
| 105 __ LoadImmediate(R2, VMTag::kScriptTagId); | 105 __ LoadImmediate(R2, VMTag::kDartTagId); |
| 106 __ StoreToOffset(kWord, R2, CTX, Isolate::vm_tag_offset()); | 106 __ StoreToOffset(kWord, R2, CTX, Isolate::vm_tag_offset()); |
| 107 | 107 |
| 108 // Reset exit frame information in Isolate structure. | 108 // Reset exit frame information in Isolate structure. |
| 109 __ LoadImmediate(R2, 0); | 109 __ LoadImmediate(R2, 0); |
| 110 __ StoreToOffset(kWord, R2, CTX, Isolate::top_exit_frame_info_offset()); | 110 __ StoreToOffset(kWord, R2, CTX, Isolate::top_exit_frame_info_offset()); |
| 111 | 111 |
| 112 // Load Context pointer from Isolate structure into R2. | 112 // Load Context pointer from Isolate structure into R2. |
| 113 __ LoadFromOffset(kWord, R2, CTX, Isolate::top_context_offset()); | 113 __ LoadFromOffset(kWord, R2, CTX, Isolate::top_context_offset()); |
| 114 | 114 |
| 115 // Reset Context pointer in Isolate structure. | 115 // Reset Context pointer in Isolate structure. |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 // Save current Context pointer into Isolate structure. | 171 // Save current Context pointer into Isolate structure. |
| 172 __ StoreToOffset(kWord, CTX, R0, Isolate::top_context_offset()); | 172 __ StoreToOffset(kWord, CTX, R0, Isolate::top_context_offset()); |
| 173 | 173 |
| 174 // Cache Isolate pointer into CTX while executing native code. | 174 // Cache Isolate pointer into CTX while executing native code. |
| 175 __ mov(CTX, Operand(R0)); | 175 __ mov(CTX, Operand(R0)); |
| 176 | 176 |
| 177 #if defined(DEBUG) | 177 #if defined(DEBUG) |
| 178 { Label ok; | 178 { Label ok; |
| 179 // Check that we are always entering from Dart code. | 179 // Check that we are always entering from Dart code. |
| 180 __ LoadFromOffset(kWord, R6, CTX, Isolate::vm_tag_offset()); | 180 __ LoadFromOffset(kWord, R6, CTX, Isolate::vm_tag_offset()); |
| 181 __ CompareImmediate(R6, VMTag::kScriptTagId); | 181 __ CompareImmediate(R6, VMTag::kDartTagId); |
| 182 __ b(&ok, EQ); | 182 __ b(&ok, EQ); |
| 183 __ Stop("Not coming from Dart code."); | 183 __ Stop("Not coming from Dart code."); |
| 184 __ Bind(&ok); | 184 __ Bind(&ok); |
| 185 } | 185 } |
| 186 #endif | 186 #endif |
| 187 | 187 |
| 188 // Mark that the isolate is executing Native code. | 188 // Mark that the isolate is executing Native code. |
| 189 __ StoreToOffset(kWord, R5, CTX, Isolate::vm_tag_offset()); | 189 __ StoreToOffset(kWord, R5, CTX, Isolate::vm_tag_offset()); |
| 190 | 190 |
| 191 // Reserve space for the native arguments structure passed on the stack (the | 191 // Reserve space for the native arguments structure passed on the stack (the |
| (...skipping 30 matching lines...) Expand all Loading... |
| 222 uword entry = reinterpret_cast<uword>(NativeEntry::NativeCallWrapper); | 222 uword entry = reinterpret_cast<uword>(NativeEntry::NativeCallWrapper); |
| 223 entry = Simulator::RedirectExternalReference( | 223 entry = Simulator::RedirectExternalReference( |
| 224 entry, Simulator::kNativeCall, NativeEntry::kNumCallWrapperArguments); | 224 entry, Simulator::kNativeCall, NativeEntry::kNumCallWrapperArguments); |
| 225 __ LoadImmediate(R2, entry); | 225 __ LoadImmediate(R2, entry); |
| 226 __ blx(R2); | 226 __ blx(R2); |
| 227 #else | 227 #else |
| 228 __ BranchLink(&NativeEntry::NativeCallWrapperLabel()); | 228 __ BranchLink(&NativeEntry::NativeCallWrapperLabel()); |
| 229 #endif | 229 #endif |
| 230 | 230 |
| 231 // Mark that the isolate is executing Dart code. | 231 // Mark that the isolate is executing Dart code. |
| 232 __ LoadImmediate(R2, VMTag::kScriptTagId); | 232 __ LoadImmediate(R2, VMTag::kDartTagId); |
| 233 __ StoreToOffset(kWord, R2, CTX, Isolate::vm_tag_offset()); | 233 __ StoreToOffset(kWord, R2, CTX, Isolate::vm_tag_offset()); |
| 234 | 234 |
| 235 // Reset exit frame information in Isolate structure. | 235 // Reset exit frame information in Isolate structure. |
| 236 __ LoadImmediate(R2, 0); | 236 __ LoadImmediate(R2, 0); |
| 237 __ StoreToOffset(kWord, R2, CTX, Isolate::top_exit_frame_info_offset()); | 237 __ StoreToOffset(kWord, R2, CTX, Isolate::top_exit_frame_info_offset()); |
| 238 | 238 |
| 239 // Load Context pointer from Isolate structure into R2. | 239 // Load Context pointer from Isolate structure into R2. |
| 240 __ LoadFromOffset(kWord, R2, CTX, Isolate::top_context_offset()); | 240 __ LoadFromOffset(kWord, R2, CTX, Isolate::top_context_offset()); |
| 241 | 241 |
| 242 // Reset Context pointer in Isolate structure. | 242 // Reset Context pointer in Isolate structure. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 // Save current Context pointer into Isolate structure. | 279 // Save current Context pointer into Isolate structure. |
| 280 __ StoreToOffset(kWord, CTX, R0, Isolate::top_context_offset()); | 280 __ StoreToOffset(kWord, CTX, R0, Isolate::top_context_offset()); |
| 281 | 281 |
| 282 // Cache Isolate pointer into CTX while executing native code. | 282 // Cache Isolate pointer into CTX while executing native code. |
| 283 __ mov(CTX, Operand(R0)); | 283 __ mov(CTX, Operand(R0)); |
| 284 | 284 |
| 285 #if defined(DEBUG) | 285 #if defined(DEBUG) |
| 286 { Label ok; | 286 { Label ok; |
| 287 // Check that we are always entering from Dart code. | 287 // Check that we are always entering from Dart code. |
| 288 __ LoadFromOffset(kWord, R6, CTX, Isolate::vm_tag_offset()); | 288 __ LoadFromOffset(kWord, R6, CTX, Isolate::vm_tag_offset()); |
| 289 __ CompareImmediate(R6, VMTag::kScriptTagId); | 289 __ CompareImmediate(R6, VMTag::kDartTagId); |
| 290 __ b(&ok, EQ); | 290 __ b(&ok, EQ); |
| 291 __ Stop("Not coming from Dart code."); | 291 __ Stop("Not coming from Dart code."); |
| 292 __ Bind(&ok); | 292 __ Bind(&ok); |
| 293 } | 293 } |
| 294 #endif | 294 #endif |
| 295 | 295 |
| 296 // Mark that the isolate is executing Native code. | 296 // Mark that the isolate is executing Native code. |
| 297 __ StoreToOffset(kWord, R5, CTX, Isolate::vm_tag_offset()); | 297 __ StoreToOffset(kWord, R5, CTX, Isolate::vm_tag_offset()); |
| 298 | 298 |
| 299 // Reserve space for the native arguments structure passed on the stack (the | 299 // Reserve space for the native arguments structure passed on the stack (the |
| (...skipping 21 matching lines...) Expand all Loading... |
| 321 // Passing the structure by value as in runtime calls would require changing | 321 // Passing the structure by value as in runtime calls would require changing |
| 322 // Dart API for native functions. | 322 // Dart API for native functions. |
| 323 // For now, space is reserved on the stack and we pass a pointer to it. | 323 // For now, space is reserved on the stack and we pass a pointer to it. |
| 324 __ stm(IA, SP, (1 << R0) | (1 << R1) | (1 << R2) | (1 << R3)); | 324 __ stm(IA, SP, (1 << R0) | (1 << R1) | (1 << R2) | (1 << R3)); |
| 325 __ mov(R0, Operand(SP)); // Pass the pointer to the NativeArguments. | 325 __ mov(R0, Operand(SP)); // Pass the pointer to the NativeArguments. |
| 326 | 326 |
| 327 // Call native function or redirection via simulator. | 327 // Call native function or redirection via simulator. |
| 328 __ blx(R5); | 328 __ blx(R5); |
| 329 | 329 |
| 330 // Mark that the isolate is executing Dart code. | 330 // Mark that the isolate is executing Dart code. |
| 331 __ LoadImmediate(R2, VMTag::kScriptTagId); | 331 __ LoadImmediate(R2, VMTag::kDartTagId); |
| 332 __ StoreToOffset(kWord, R2, CTX, Isolate::vm_tag_offset()); | 332 __ StoreToOffset(kWord, R2, CTX, Isolate::vm_tag_offset()); |
| 333 | 333 |
| 334 // Reset exit frame information in Isolate structure. | 334 // Reset exit frame information in Isolate structure. |
| 335 __ LoadImmediate(R2, 0); | 335 __ LoadImmediate(R2, 0); |
| 336 __ StoreToOffset(kWord, R2, CTX, Isolate::top_exit_frame_info_offset()); | 336 __ StoreToOffset(kWord, R2, CTX, Isolate::top_exit_frame_info_offset()); |
| 337 | 337 |
| 338 // Load Context pointer from Isolate structure into R2. | 338 // Load Context pointer from Isolate structure into R2. |
| 339 __ LoadFromOffset(kWord, R2, CTX, Isolate::top_context_offset()); | 339 __ LoadFromOffset(kWord, R2, CTX, Isolate::top_context_offset()); |
| 340 | 340 |
| 341 // Reset Context pointer in Isolate structure. | 341 // Reset Context pointer in Isolate structure. |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 750 | 750 |
| 751 // Load Isolate pointer from Context structure into temporary register R8. | 751 // Load Isolate pointer from Context structure into temporary register R8. |
| 752 __ ldr(R8, FieldAddress(CTX, Context::isolate_offset())); | 752 __ ldr(R8, FieldAddress(CTX, Context::isolate_offset())); |
| 753 | 753 |
| 754 // Save the current VMTag on the stack. | 754 // Save the current VMTag on the stack. |
| 755 ASSERT(kSavedVMTagSlotFromEntryFp == -25); | 755 ASSERT(kSavedVMTagSlotFromEntryFp == -25); |
| 756 __ LoadFromOffset(kWord, R5, R8, Isolate::vm_tag_offset()); | 756 __ LoadFromOffset(kWord, R5, R8, Isolate::vm_tag_offset()); |
| 757 __ Push(R5); | 757 __ Push(R5); |
| 758 | 758 |
| 759 // Mark that the isolate is executing Dart code. | 759 // Mark that the isolate is executing Dart code. |
| 760 __ LoadImmediate(R5, VMTag::kScriptTagId); | 760 __ LoadImmediate(R5, VMTag::kDartTagId); |
| 761 __ StoreToOffset(kWord, R5, R8, Isolate::vm_tag_offset()); | 761 __ StoreToOffset(kWord, R5, R8, Isolate::vm_tag_offset()); |
| 762 | 762 |
| 763 // Save the top exit frame info. Use R5 as a temporary register. | 763 // Save the top exit frame info. Use R5 as a temporary register. |
| 764 // StackFrameIterator reads the top exit frame info saved in this frame. | 764 // StackFrameIterator reads the top exit frame info saved in this frame. |
| 765 __ LoadFromOffset(kWord, R5, R8, Isolate::top_exit_frame_info_offset()); | 765 __ LoadFromOffset(kWord, R5, R8, Isolate::top_exit_frame_info_offset()); |
| 766 __ LoadImmediate(R6, 0); | 766 __ LoadImmediate(R6, 0); |
| 767 __ StoreToOffset(kWord, R6, R8, Isolate::top_exit_frame_info_offset()); | 767 __ StoreToOffset(kWord, R6, R8, Isolate::top_exit_frame_info_offset()); |
| 768 | 768 |
| 769 // Save the old Context pointer. Use R4 as a temporary register. | 769 // Save the old Context pointer. Use R4 as a temporary register. |
| 770 // Note that VisitObjectPointers will find this saved Context pointer during | 770 // Note that VisitObjectPointers will find this saved Context pointer during |
| (...skipping 942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1713 ASSERT(kExceptionObjectReg == R0); | 1713 ASSERT(kExceptionObjectReg == R0); |
| 1714 ASSERT(kStackTraceObjectReg == R1); | 1714 ASSERT(kStackTraceObjectReg == R1); |
| 1715 __ mov(IP, Operand(R1)); // Copy Stack pointer into IP. | 1715 __ mov(IP, Operand(R1)); // Copy Stack pointer into IP. |
| 1716 __ mov(LR, Operand(R0)); // Program counter. | 1716 __ mov(LR, Operand(R0)); // Program counter. |
| 1717 __ mov(R0, Operand(R3)); // Exception object. | 1717 __ mov(R0, Operand(R3)); // Exception object. |
| 1718 __ ldr(R1, Address(SP, 0)); // StackTrace object. | 1718 __ ldr(R1, Address(SP, 0)); // StackTrace object. |
| 1719 __ ldr(R3, Address(SP, 4)); // Isolate. | 1719 __ ldr(R3, Address(SP, 4)); // Isolate. |
| 1720 __ mov(FP, Operand(R2)); // Frame_pointer. | 1720 __ mov(FP, Operand(R2)); // Frame_pointer. |
| 1721 __ mov(SP, Operand(IP)); // Set Stack pointer. | 1721 __ mov(SP, Operand(IP)); // Set Stack pointer. |
| 1722 // Set the tag. | 1722 // Set the tag. |
| 1723 __ LoadImmediate(R2, VMTag::kScriptTagId); | 1723 __ LoadImmediate(R2, VMTag::kDartTagId); |
| 1724 __ StoreToOffset(kWord, R2, R3, Isolate::vm_tag_offset()); | 1724 __ StoreToOffset(kWord, R2, R3, Isolate::vm_tag_offset()); |
| 1725 // Clear top exit frame. | 1725 // Clear top exit frame. |
| 1726 __ LoadImmediate(R2, 0); | 1726 __ LoadImmediate(R2, 0); |
| 1727 __ StoreToOffset(kWord, R2, R3, Isolate::top_exit_frame_info_offset()); | 1727 __ StoreToOffset(kWord, R2, R3, Isolate::top_exit_frame_info_offset()); |
| 1728 __ bx(LR); // Jump to the exception handler code. | 1728 __ bx(LR); // Jump to the exception handler code. |
| 1729 } | 1729 } |
| 1730 | 1730 |
| 1731 | 1731 |
| 1732 // Calls to the runtime to optimize the given function. | 1732 // Calls to the runtime to optimize the given function. |
| 1733 // R6: function to be reoptimized. | 1733 // R6: function to be reoptimized. |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1866 const Register right = R0; | 1866 const Register right = R0; |
| 1867 __ ldr(left, Address(SP, 1 * kWordSize)); | 1867 __ ldr(left, Address(SP, 1 * kWordSize)); |
| 1868 __ ldr(right, Address(SP, 0 * kWordSize)); | 1868 __ ldr(right, Address(SP, 0 * kWordSize)); |
| 1869 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); | 1869 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); |
| 1870 __ Ret(); | 1870 __ Ret(); |
| 1871 } | 1871 } |
| 1872 | 1872 |
| 1873 } // namespace dart | 1873 } // namespace dart |
| 1874 | 1874 |
| 1875 #endif // defined TARGET_ARCH_ARM | 1875 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |