OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_ARM | 7 #if V8_TARGET_ARCH_ARM |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1069 } | 1069 } |
1070 | 1070 |
1071 // Retrieve the handler context, SP and FP. | 1071 // Retrieve the handler context, SP and FP. |
1072 __ mov(cp, Operand(pending_handler_context_address)); | 1072 __ mov(cp, Operand(pending_handler_context_address)); |
1073 __ ldr(cp, MemOperand(cp)); | 1073 __ ldr(cp, MemOperand(cp)); |
1074 __ mov(sp, Operand(pending_handler_sp_address)); | 1074 __ mov(sp, Operand(pending_handler_sp_address)); |
1075 __ ldr(sp, MemOperand(sp)); | 1075 __ ldr(sp, MemOperand(sp)); |
1076 __ mov(fp, Operand(pending_handler_fp_address)); | 1076 __ mov(fp, Operand(pending_handler_fp_address)); |
1077 __ ldr(fp, MemOperand(fp)); | 1077 __ ldr(fp, MemOperand(fp)); |
1078 | 1078 |
1079 // If the handler is a JS frame, restore the context to the frame. | 1079 // If the handler is a JS frame, restore the context to the frame. Note that |
1080 // (kind == ENTRY) == (fp == 0) == (cp == 0), so we could test either fp | 1080 // the context will be set to (cp == 0) for non-JS frames. |
1081 // or cp. | |
1082 __ cmp(cp, Operand(0)); | 1081 __ cmp(cp, Operand(0)); |
1083 __ str(cp, MemOperand(fp, StandardFrameConstants::kContextOffset), ne); | 1082 __ str(cp, MemOperand(fp, StandardFrameConstants::kContextOffset), ne); |
1084 | 1083 |
1085 // Compute the handler entry address and jump to it. | 1084 // Compute the handler entry address and jump to it. |
1086 ConstantPoolUnavailableScope constant_pool_unavailable(masm); | 1085 ConstantPoolUnavailableScope constant_pool_unavailable(masm); |
1087 __ mov(r1, Operand(pending_handler_code_address)); | 1086 __ mov(r1, Operand(pending_handler_code_address)); |
1088 __ ldr(r1, MemOperand(r1)); | 1087 __ ldr(r1, MemOperand(r1)); |
1089 __ mov(r2, Operand(pending_handler_offset_address)); | 1088 __ mov(r2, Operand(pending_handler_offset_address)); |
1090 __ ldr(r2, MemOperand(r2)); | 1089 __ ldr(r2, MemOperand(r2)); |
1091 if (FLAG_enable_ool_constant_pool) { | 1090 if (FLAG_enable_ool_constant_pool) { |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1174 | 1173 |
1175 // Block literal pool emission whilst taking the position of the handler | 1174 // Block literal pool emission whilst taking the position of the handler |
1176 // entry. This avoids making the assumption that literal pools are always | 1175 // entry. This avoids making the assumption that literal pools are always |
1177 // emitted after an instruction is emitted, rather than before. | 1176 // emitted after an instruction is emitted, rather than before. |
1178 { | 1177 { |
1179 Assembler::BlockConstPoolScope block_const_pool(masm); | 1178 Assembler::BlockConstPoolScope block_const_pool(masm); |
1180 __ bind(&handler_entry); | 1179 __ bind(&handler_entry); |
1181 handler_offset_ = handler_entry.pos(); | 1180 handler_offset_ = handler_entry.pos(); |
1182 // Caught exception: Store result (exception) in the pending exception | 1181 // Caught exception: Store result (exception) in the pending exception |
1183 // field in the JSEnv and return a failure sentinel. Coming in here the | 1182 // field in the JSEnv and return a failure sentinel. Coming in here the |
1184 // fp will be invalid because the PushTryHandler below sets it to 0 to | 1183 // fp will be invalid because the PushStackHandler below sets it to 0 to |
1185 // signal the existence of the JSEntry frame. | 1184 // signal the existence of the JSEntry frame. |
1186 __ mov(ip, Operand(ExternalReference(Isolate::kPendingExceptionAddress, | 1185 __ mov(ip, Operand(ExternalReference(Isolate::kPendingExceptionAddress, |
1187 isolate()))); | 1186 isolate()))); |
1188 } | 1187 } |
1189 __ str(r0, MemOperand(ip)); | 1188 __ str(r0, MemOperand(ip)); |
1190 __ LoadRoot(r0, Heap::kExceptionRootIndex); | 1189 __ LoadRoot(r0, Heap::kExceptionRootIndex); |
1191 __ b(&exit); | 1190 __ b(&exit); |
1192 | 1191 |
1193 // Invoke: Link this frame into the handler chain. There's only one | 1192 // Invoke: Link this frame into the handler chain. |
1194 // handler block in this code object, so its index is 0. | |
1195 __ bind(&invoke); | 1193 __ bind(&invoke); |
1196 // Must preserve r0-r4, r5-r6 are available. | 1194 // Must preserve r0-r4, r5-r6 are available. |
1197 __ PushTryHandler(StackHandler::JS_ENTRY, 0); | 1195 __ PushStackHandler(); |
1198 // If an exception not caught by another handler occurs, this handler | 1196 // If an exception not caught by another handler occurs, this handler |
1199 // returns control to the code after the bl(&invoke) above, which | 1197 // returns control to the code after the bl(&invoke) above, which |
1200 // restores all kCalleeSaved registers (including cp and fp) to their | 1198 // restores all kCalleeSaved registers (including cp and fp) to their |
1201 // saved values before returning a failure to C. | 1199 // saved values before returning a failure to C. |
1202 | 1200 |
1203 // Clear any pending exceptions. | 1201 // Clear any pending exceptions. |
1204 __ mov(r5, Operand(isolate()->factory()->the_hole_value())); | 1202 __ mov(r5, Operand(isolate()->factory()->the_hole_value())); |
1205 __ mov(ip, Operand(ExternalReference(Isolate::kPendingExceptionAddress, | 1203 __ mov(ip, Operand(ExternalReference(Isolate::kPendingExceptionAddress, |
1206 isolate()))); | 1204 isolate()))); |
1207 __ str(r5, MemOperand(ip)); | 1205 __ str(r5, MemOperand(ip)); |
(...skipping 16 matching lines...) Expand all Loading... |
1224 ExternalReference entry(Builtins::kJSEntryTrampoline, isolate()); | 1222 ExternalReference entry(Builtins::kJSEntryTrampoline, isolate()); |
1225 __ mov(ip, Operand(entry)); | 1223 __ mov(ip, Operand(entry)); |
1226 } | 1224 } |
1227 __ ldr(ip, MemOperand(ip)); // deref address | 1225 __ ldr(ip, MemOperand(ip)); // deref address |
1228 __ add(ip, ip, Operand(Code::kHeaderSize - kHeapObjectTag)); | 1226 __ add(ip, ip, Operand(Code::kHeaderSize - kHeapObjectTag)); |
1229 | 1227 |
1230 // Branch and link to JSEntryTrampoline. | 1228 // Branch and link to JSEntryTrampoline. |
1231 __ Call(ip); | 1229 __ Call(ip); |
1232 | 1230 |
1233 // Unlink this frame from the handler chain. | 1231 // Unlink this frame from the handler chain. |
1234 __ PopTryHandler(); | 1232 __ PopStackHandler(); |
1235 | 1233 |
1236 __ bind(&exit); // r0 holds result | 1234 __ bind(&exit); // r0 holds result |
1237 // Check if the current stack frame is marked as the outermost JS frame. | 1235 // Check if the current stack frame is marked as the outermost JS frame. |
1238 Label non_outermost_js_2; | 1236 Label non_outermost_js_2; |
1239 __ pop(r5); | 1237 __ pop(r5); |
1240 __ cmp(r5, Operand(Smi::FromInt(StackFrame::OUTERMOST_JSENTRY_FRAME))); | 1238 __ cmp(r5, Operand(Smi::FromInt(StackFrame::OUTERMOST_JSENTRY_FRAME))); |
1241 __ b(ne, &non_outermost_js_2); | 1239 __ b(ne, &non_outermost_js_2); |
1242 __ mov(r6, Operand::Zero()); | 1240 __ mov(r6, Operand::Zero()); |
1243 __ mov(r5, Operand(ExternalReference(js_entry_sp))); | 1241 __ mov(r5, Operand(ExternalReference(js_entry_sp))); |
1244 __ str(r6, MemOperand(r5)); | 1242 __ str(r6, MemOperand(r5)); |
(...skipping 4040 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5285 kStackUnwindSpace, NULL, | 5283 kStackUnwindSpace, NULL, |
5286 MemOperand(fp, 6 * kPointerSize), NULL); | 5284 MemOperand(fp, 6 * kPointerSize), NULL); |
5287 } | 5285 } |
5288 | 5286 |
5289 | 5287 |
5290 #undef __ | 5288 #undef __ |
5291 | 5289 |
5292 } } // namespace v8::internal | 5290 } } // namespace v8::internal |
5293 | 5291 |
5294 #endif // V8_TARGET_ARCH_ARM | 5292 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |