| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 753 // Reserve room for saved entry sp and code object. | 753 // Reserve room for saved entry sp and code object. |
| 754 sub(sp, sp, Operand(2 * kPointerSize)); | 754 sub(sp, sp, Operand(2 * kPointerSize)); |
| 755 if (emit_debug_code()) { | 755 if (emit_debug_code()) { |
| 756 mov(ip, Operand(0)); | 756 mov(ip, Operand(0)); |
| 757 str(ip, MemOperand(fp, ExitFrameConstants::kSPOffset)); | 757 str(ip, MemOperand(fp, ExitFrameConstants::kSPOffset)); |
| 758 } | 758 } |
| 759 mov(ip, Operand(CodeObject())); | 759 mov(ip, Operand(CodeObject())); |
| 760 str(ip, MemOperand(fp, ExitFrameConstants::kCodeOffset)); | 760 str(ip, MemOperand(fp, ExitFrameConstants::kCodeOffset)); |
| 761 | 761 |
| 762 // Save the frame pointer and the context in top. | 762 // Save the frame pointer and the context in top. |
| 763 mov(ip, Operand(ExternalReference(Isolate::k_c_entry_fp_address, isolate()))); | 763 mov(ip, Operand(ExternalReference(Isolate::kCEntryFPAddress, isolate()))); |
| 764 str(fp, MemOperand(ip)); | 764 str(fp, MemOperand(ip)); |
| 765 mov(ip, Operand(ExternalReference(Isolate::k_context_address, isolate()))); | 765 mov(ip, Operand(ExternalReference(Isolate::kContextAddress, isolate()))); |
| 766 str(cp, MemOperand(ip)); | 766 str(cp, MemOperand(ip)); |
| 767 | 767 |
| 768 // Optionally save all double registers. | 768 // Optionally save all double registers. |
| 769 if (save_doubles) { | 769 if (save_doubles) { |
| 770 DwVfpRegister first = d0; | 770 DwVfpRegister first = d0; |
| 771 DwVfpRegister last = | 771 DwVfpRegister last = |
| 772 DwVfpRegister::from_code(DwVfpRegister::kNumRegisters - 1); | 772 DwVfpRegister::from_code(DwVfpRegister::kNumRegisters - 1); |
| 773 vstm(db_w, sp, first, last); | 773 vstm(db_w, sp, first, last); |
| 774 // Note that d0 will be accessible at | 774 // Note that d0 will be accessible at |
| 775 // fp - 2 * kPointerSize - DwVfpRegister::kNumRegisters * kDoubleSize, | 775 // fp - 2 * kPointerSize - DwVfpRegister::kNumRegisters * kDoubleSize, |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 831 const int offset = 2 * kPointerSize; | 831 const int offset = 2 * kPointerSize; |
| 832 sub(r3, fp, Operand(offset + DwVfpRegister::kNumRegisters * kDoubleSize)); | 832 sub(r3, fp, Operand(offset + DwVfpRegister::kNumRegisters * kDoubleSize)); |
| 833 DwVfpRegister first = d0; | 833 DwVfpRegister first = d0; |
| 834 DwVfpRegister last = | 834 DwVfpRegister last = |
| 835 DwVfpRegister::from_code(DwVfpRegister::kNumRegisters - 1); | 835 DwVfpRegister::from_code(DwVfpRegister::kNumRegisters - 1); |
| 836 vldm(ia, r3, first, last); | 836 vldm(ia, r3, first, last); |
| 837 } | 837 } |
| 838 | 838 |
| 839 // Clear top frame. | 839 // Clear top frame. |
| 840 mov(r3, Operand(0, RelocInfo::NONE)); | 840 mov(r3, Operand(0, RelocInfo::NONE)); |
| 841 mov(ip, Operand(ExternalReference(Isolate::k_c_entry_fp_address, isolate()))); | 841 mov(ip, Operand(ExternalReference(Isolate::kCEntryFPAddress, isolate()))); |
| 842 str(r3, MemOperand(ip)); | 842 str(r3, MemOperand(ip)); |
| 843 | 843 |
| 844 // Restore current context from top and clear it in debug mode. | 844 // Restore current context from top and clear it in debug mode. |
| 845 mov(ip, Operand(ExternalReference(Isolate::k_context_address, isolate()))); | 845 mov(ip, Operand(ExternalReference(Isolate::kContextAddress, isolate()))); |
| 846 ldr(cp, MemOperand(ip)); | 846 ldr(cp, MemOperand(ip)); |
| 847 #ifdef DEBUG | 847 #ifdef DEBUG |
| 848 str(r3, MemOperand(ip)); | 848 str(r3, MemOperand(ip)); |
| 849 #endif | 849 #endif |
| 850 | 850 |
| 851 // Tear down the exit frame, pop the arguments, and return. | 851 // Tear down the exit frame, pop the arguments, and return. |
| 852 mov(sp, Operand(fp)); | 852 mov(sp, Operand(fp)); |
| 853 ldm(ia_w, sp, fp.bit() | lr.bit()); | 853 ldm(ia_w, sp, fp.bit() | lr.bit()); |
| 854 if (argument_count.is_valid()) { | 854 if (argument_count.is_valid()) { |
| 855 add(sp, sp, Operand(argument_count, LSL, kPointerSizeLog2)); | 855 add(sp, sp, Operand(argument_count, LSL, kPointerSizeLog2)); |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1111 | 1111 |
| 1112 // The pc (return address) is passed in register lr. | 1112 // The pc (return address) is passed in register lr. |
| 1113 if (try_location == IN_JAVASCRIPT) { | 1113 if (try_location == IN_JAVASCRIPT) { |
| 1114 if (type == TRY_CATCH_HANDLER) { | 1114 if (type == TRY_CATCH_HANDLER) { |
| 1115 mov(r3, Operand(StackHandler::TRY_CATCH)); | 1115 mov(r3, Operand(StackHandler::TRY_CATCH)); |
| 1116 } else { | 1116 } else { |
| 1117 mov(r3, Operand(StackHandler::TRY_FINALLY)); | 1117 mov(r3, Operand(StackHandler::TRY_FINALLY)); |
| 1118 } | 1118 } |
| 1119 stm(db_w, sp, r3.bit() | cp.bit() | fp.bit() | lr.bit()); | 1119 stm(db_w, sp, r3.bit() | cp.bit() | fp.bit() | lr.bit()); |
| 1120 // Save the current handler as the next handler. | 1120 // Save the current handler as the next handler. |
| 1121 mov(r3, Operand(ExternalReference(Isolate::k_handler_address, isolate()))); | 1121 mov(r3, Operand(ExternalReference(Isolate::kHandlerAddress, isolate()))); |
| 1122 ldr(r1, MemOperand(r3)); | 1122 ldr(r1, MemOperand(r3)); |
| 1123 push(r1); | 1123 push(r1); |
| 1124 // Link this handler as the new current one. | 1124 // Link this handler as the new current one. |
| 1125 str(sp, MemOperand(r3)); | 1125 str(sp, MemOperand(r3)); |
| 1126 } else { | 1126 } else { |
| 1127 // Must preserve r0-r4, r5-r7 are available. | 1127 // Must preserve r0-r4, r5-r7 are available. |
| 1128 ASSERT(try_location == IN_JS_ENTRY); | 1128 ASSERT(try_location == IN_JS_ENTRY); |
| 1129 // The frame pointer does not point to a JS frame so we save NULL | 1129 // The frame pointer does not point to a JS frame so we save NULL |
| 1130 // for fp. We expect the code throwing an exception to check fp | 1130 // for fp. We expect the code throwing an exception to check fp |
| 1131 // before dereferencing it to restore the context. | 1131 // before dereferencing it to restore the context. |
| 1132 mov(r5, Operand(StackHandler::ENTRY)); // State. | 1132 mov(r5, Operand(StackHandler::ENTRY)); // State. |
| 1133 mov(r6, Operand(Smi::FromInt(0))); // Indicates no context. | 1133 mov(r6, Operand(Smi::FromInt(0))); // Indicates no context. |
| 1134 mov(r7, Operand(0, RelocInfo::NONE)); // NULL frame pointer. | 1134 mov(r7, Operand(0, RelocInfo::NONE)); // NULL frame pointer. |
| 1135 stm(db_w, sp, r5.bit() | r6.bit() | r7.bit() | lr.bit()); | 1135 stm(db_w, sp, r5.bit() | r6.bit() | r7.bit() | lr.bit()); |
| 1136 // Save the current handler as the next handler. | 1136 // Save the current handler as the next handler. |
| 1137 mov(r7, Operand(ExternalReference(Isolate::k_handler_address, isolate()))); | 1137 mov(r7, Operand(ExternalReference(Isolate::kHandlerAddress, isolate()))); |
| 1138 ldr(r6, MemOperand(r7)); | 1138 ldr(r6, MemOperand(r7)); |
| 1139 push(r6); | 1139 push(r6); |
| 1140 // Link this handler as the new current one. | 1140 // Link this handler as the new current one. |
| 1141 str(sp, MemOperand(r7)); | 1141 str(sp, MemOperand(r7)); |
| 1142 } | 1142 } |
| 1143 } | 1143 } |
| 1144 | 1144 |
| 1145 | 1145 |
| 1146 void MacroAssembler::PopTryHandler() { | 1146 void MacroAssembler::PopTryHandler() { |
| 1147 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0); | 1147 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0); |
| 1148 pop(r1); | 1148 pop(r1); |
| 1149 mov(ip, Operand(ExternalReference(Isolate::k_handler_address, isolate()))); | 1149 mov(ip, Operand(ExternalReference(Isolate::kHandlerAddress, isolate()))); |
| 1150 add(sp, sp, Operand(StackHandlerConstants::kSize - kPointerSize)); | 1150 add(sp, sp, Operand(StackHandlerConstants::kSize - kPointerSize)); |
| 1151 str(r1, MemOperand(ip)); | 1151 str(r1, MemOperand(ip)); |
| 1152 } | 1152 } |
| 1153 | 1153 |
| 1154 | 1154 |
| 1155 void MacroAssembler::Throw(Register value) { | 1155 void MacroAssembler::Throw(Register value) { |
| 1156 // Adjust this code if not the case. | 1156 // Adjust this code if not the case. |
| 1157 STATIC_ASSERT(StackHandlerConstants::kSize == 5 * kPointerSize); | 1157 STATIC_ASSERT(StackHandlerConstants::kSize == 5 * kPointerSize); |
| 1158 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0 * kPointerSize); | 1158 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0 * kPointerSize); |
| 1159 STATIC_ASSERT(StackHandlerConstants::kStateOffset == 1 * kPointerSize); | 1159 STATIC_ASSERT(StackHandlerConstants::kStateOffset == 1 * kPointerSize); |
| 1160 STATIC_ASSERT(StackHandlerConstants::kContextOffset == 2 * kPointerSize); | 1160 STATIC_ASSERT(StackHandlerConstants::kContextOffset == 2 * kPointerSize); |
| 1161 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 3 * kPointerSize); | 1161 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 3 * kPointerSize); |
| 1162 STATIC_ASSERT(StackHandlerConstants::kPCOffset == 4 * kPointerSize); | 1162 STATIC_ASSERT(StackHandlerConstants::kPCOffset == 4 * kPointerSize); |
| 1163 // r0 is expected to hold the exception. | 1163 // r0 is expected to hold the exception. |
| 1164 if (!value.is(r0)) { | 1164 if (!value.is(r0)) { |
| 1165 mov(r0, value); | 1165 mov(r0, value); |
| 1166 } | 1166 } |
| 1167 | 1167 |
| 1168 // Drop the sp to the top of the handler. | 1168 // Drop the sp to the top of the handler. |
| 1169 mov(r3, Operand(ExternalReference(Isolate::k_handler_address, isolate()))); | 1169 mov(r3, Operand(ExternalReference(Isolate::kHandlerAddress, isolate()))); |
| 1170 ldr(sp, MemOperand(r3)); | 1170 ldr(sp, MemOperand(r3)); |
| 1171 | 1171 |
| 1172 // Restore the next handler. | 1172 // Restore the next handler. |
| 1173 pop(r2); | 1173 pop(r2); |
| 1174 str(r2, MemOperand(r3)); | 1174 str(r2, MemOperand(r3)); |
| 1175 | 1175 |
| 1176 // Restore context and frame pointer, discard state (r3). | 1176 // Restore context and frame pointer, discard state (r3). |
| 1177 ldm(ia_w, sp, r3.bit() | cp.bit() | fp.bit()); | 1177 ldm(ia_w, sp, r3.bit() | cp.bit() | fp.bit()); |
| 1178 | 1178 |
| 1179 // If the handler is a JS frame, restore the context to the frame. | 1179 // If the handler is a JS frame, restore the context to the frame. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1199 STATIC_ASSERT(StackHandlerConstants::kStateOffset == 1 * kPointerSize); | 1199 STATIC_ASSERT(StackHandlerConstants::kStateOffset == 1 * kPointerSize); |
| 1200 STATIC_ASSERT(StackHandlerConstants::kContextOffset == 2 * kPointerSize); | 1200 STATIC_ASSERT(StackHandlerConstants::kContextOffset == 2 * kPointerSize); |
| 1201 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 3 * kPointerSize); | 1201 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 3 * kPointerSize); |
| 1202 STATIC_ASSERT(StackHandlerConstants::kPCOffset == 4 * kPointerSize); | 1202 STATIC_ASSERT(StackHandlerConstants::kPCOffset == 4 * kPointerSize); |
| 1203 // r0 is expected to hold the exception. | 1203 // r0 is expected to hold the exception. |
| 1204 if (!value.is(r0)) { | 1204 if (!value.is(r0)) { |
| 1205 mov(r0, value); | 1205 mov(r0, value); |
| 1206 } | 1206 } |
| 1207 | 1207 |
| 1208 // Drop sp to the top stack handler. | 1208 // Drop sp to the top stack handler. |
| 1209 mov(r3, Operand(ExternalReference(Isolate::k_handler_address, isolate()))); | 1209 mov(r3, Operand(ExternalReference(Isolate::kHandlerAddress, isolate()))); |
| 1210 ldr(sp, MemOperand(r3)); | 1210 ldr(sp, MemOperand(r3)); |
| 1211 | 1211 |
| 1212 // Unwind the handlers until the ENTRY handler is found. | 1212 // Unwind the handlers until the ENTRY handler is found. |
| 1213 Label loop, done; | 1213 Label loop, done; |
| 1214 bind(&loop); | 1214 bind(&loop); |
| 1215 // Load the type of the current stack handler. | 1215 // Load the type of the current stack handler. |
| 1216 const int kStateOffset = StackHandlerConstants::kStateOffset; | 1216 const int kStateOffset = StackHandlerConstants::kStateOffset; |
| 1217 ldr(r2, MemOperand(sp, kStateOffset)); | 1217 ldr(r2, MemOperand(sp, kStateOffset)); |
| 1218 cmp(r2, Operand(StackHandler::ENTRY)); | 1218 cmp(r2, Operand(StackHandler::ENTRY)); |
| 1219 b(eq, &done); | 1219 b(eq, &done); |
| 1220 // Fetch the next handler in the list. | 1220 // Fetch the next handler in the list. |
| 1221 const int kNextOffset = StackHandlerConstants::kNextOffset; | 1221 const int kNextOffset = StackHandlerConstants::kNextOffset; |
| 1222 ldr(sp, MemOperand(sp, kNextOffset)); | 1222 ldr(sp, MemOperand(sp, kNextOffset)); |
| 1223 jmp(&loop); | 1223 jmp(&loop); |
| 1224 bind(&done); | 1224 bind(&done); |
| 1225 | 1225 |
| 1226 // Set the top handler address to next handler past the current ENTRY handler. | 1226 // Set the top handler address to next handler past the current ENTRY handler. |
| 1227 pop(r2); | 1227 pop(r2); |
| 1228 str(r2, MemOperand(r3)); | 1228 str(r2, MemOperand(r3)); |
| 1229 | 1229 |
| 1230 if (type == OUT_OF_MEMORY) { | 1230 if (type == OUT_OF_MEMORY) { |
| 1231 // Set external caught exception to false. | 1231 // Set external caught exception to false. |
| 1232 ExternalReference external_caught( | 1232 ExternalReference external_caught( |
| 1233 Isolate::k_external_caught_exception_address, isolate()); | 1233 Isolate::kExternalCaughtExceptionAddress, isolate()); |
| 1234 mov(r0, Operand(false, RelocInfo::NONE)); | 1234 mov(r0, Operand(false, RelocInfo::NONE)); |
| 1235 mov(r2, Operand(external_caught)); | 1235 mov(r2, Operand(external_caught)); |
| 1236 str(r0, MemOperand(r2)); | 1236 str(r0, MemOperand(r2)); |
| 1237 | 1237 |
| 1238 // Set pending exception and r0 to out of memory exception. | 1238 // Set pending exception and r0 to out of memory exception. |
| 1239 Failure* out_of_memory = Failure::OutOfMemoryException(); | 1239 Failure* out_of_memory = Failure::OutOfMemoryException(); |
| 1240 mov(r0, Operand(reinterpret_cast<int32_t>(out_of_memory))); | 1240 mov(r0, Operand(reinterpret_cast<int32_t>(out_of_memory))); |
| 1241 mov(r2, Operand(ExternalReference(Isolate::k_pending_exception_address, | 1241 mov(r2, Operand(ExternalReference(Isolate::kPendingExceptionAddress, |
| 1242 isolate()))); | 1242 isolate()))); |
| 1243 str(r0, MemOperand(r2)); | 1243 str(r0, MemOperand(r2)); |
| 1244 } | 1244 } |
| 1245 | 1245 |
| 1246 // Stack layout at this point. See also StackHandlerConstants. | 1246 // Stack layout at this point. See also StackHandlerConstants. |
| 1247 // sp -> state (ENTRY) | 1247 // sp -> state (ENTRY) |
| 1248 // cp | 1248 // cp |
| 1249 // fp | 1249 // fp |
| 1250 // lr | 1250 // lr |
| 1251 | 1251 |
| (...skipping 2017 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3269 void CodePatcher::EmitCondition(Condition cond) { | 3269 void CodePatcher::EmitCondition(Condition cond) { |
| 3270 Instr instr = Assembler::instr_at(masm_.pc_); | 3270 Instr instr = Assembler::instr_at(masm_.pc_); |
| 3271 instr = (instr & ~kCondMask) | cond; | 3271 instr = (instr & ~kCondMask) | cond; |
| 3272 masm_.emit(instr); | 3272 masm_.emit(instr); |
| 3273 } | 3273 } |
| 3274 | 3274 |
| 3275 | 3275 |
| 3276 } } // namespace v8::internal | 3276 } } // namespace v8::internal |
| 3277 | 3277 |
| 3278 #endif // V8_TARGET_ARCH_ARM | 3278 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |