OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_PPC | 7 #if V8_TARGET_ARCH_PPC |
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 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1151 } | 1151 } |
1152 | 1152 |
1153 // Retrieve the handler context, SP and FP. | 1153 // Retrieve the handler context, SP and FP. |
1154 __ mov(cp, Operand(pending_handler_context_address)); | 1154 __ mov(cp, Operand(pending_handler_context_address)); |
1155 __ LoadP(cp, MemOperand(cp)); | 1155 __ LoadP(cp, MemOperand(cp)); |
1156 __ mov(sp, Operand(pending_handler_sp_address)); | 1156 __ mov(sp, Operand(pending_handler_sp_address)); |
1157 __ LoadP(sp, MemOperand(sp)); | 1157 __ LoadP(sp, MemOperand(sp)); |
1158 __ mov(fp, Operand(pending_handler_fp_address)); | 1158 __ mov(fp, Operand(pending_handler_fp_address)); |
1159 __ LoadP(fp, MemOperand(fp)); | 1159 __ LoadP(fp, MemOperand(fp)); |
1160 | 1160 |
1161 // If the handler is a JS frame, restore the context to the frame. | 1161 // If the handler is a JS frame, restore the context to the frame. Note that |
1162 // (kind == ENTRY) == (fp == 0) == (cp == 0), so we could test either fp | 1162 // the context will be set to (cp == 0) for non-JS frames. |
1163 // or cp. | |
1164 Label skip; | 1163 Label skip; |
1165 __ cmpi(cp, Operand::Zero()); | 1164 __ cmpi(cp, Operand::Zero()); |
1166 __ beq(&skip); | 1165 __ beq(&skip); |
1167 __ StoreP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 1166 __ StoreP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
1168 __ bind(&skip); | 1167 __ bind(&skip); |
1169 | 1168 |
1170 // Compute the handler entry address and jump to it. | 1169 // Compute the handler entry address and jump to it. |
1171 __ mov(r4, Operand(pending_handler_code_address)); | 1170 __ mov(r4, Operand(pending_handler_code_address)); |
1172 __ LoadP(r4, MemOperand(r4)); | 1171 __ LoadP(r4, MemOperand(r4)); |
1173 __ mov(r5, Operand(pending_handler_offset_address)); | 1172 __ mov(r5, Operand(pending_handler_offset_address)); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1243 __ push(ip); // frame-type | 1242 __ push(ip); // frame-type |
1244 | 1243 |
1245 // Jump to a faked try block that does the invoke, with a faked catch | 1244 // Jump to a faked try block that does the invoke, with a faked catch |
1246 // block that sets the pending exception. | 1245 // block that sets the pending exception. |
1247 __ b(&invoke); | 1246 __ b(&invoke); |
1248 | 1247 |
1249 __ bind(&handler_entry); | 1248 __ bind(&handler_entry); |
1250 handler_offset_ = handler_entry.pos(); | 1249 handler_offset_ = handler_entry.pos(); |
1251 // Caught exception: Store result (exception) in the pending exception | 1250 // Caught exception: Store result (exception) in the pending exception |
1252 // field in the JSEnv and return a failure sentinel. Coming in here the | 1251 // field in the JSEnv and return a failure sentinel. Coming in here the |
1253 // fp will be invalid because the PushTryHandler below sets it to 0 to | 1252 // fp will be invalid because the PushStackHandler below sets it to 0 to |
1254 // signal the existence of the JSEntry frame. | 1253 // signal the existence of the JSEntry frame. |
1255 __ mov(ip, Operand(ExternalReference(Isolate::kPendingExceptionAddress, | 1254 __ mov(ip, Operand(ExternalReference(Isolate::kPendingExceptionAddress, |
1256 isolate()))); | 1255 isolate()))); |
1257 | 1256 |
1258 __ StoreP(r3, MemOperand(ip)); | 1257 __ StoreP(r3, MemOperand(ip)); |
1259 __ LoadRoot(r3, Heap::kExceptionRootIndex); | 1258 __ LoadRoot(r3, Heap::kExceptionRootIndex); |
1260 __ b(&exit); | 1259 __ b(&exit); |
1261 | 1260 |
1262 // Invoke: Link this frame into the handler chain. There's only one | 1261 // Invoke: Link this frame into the handler chain. |
1263 // handler block in this code object, so its index is 0. | |
1264 __ bind(&invoke); | 1262 __ bind(&invoke); |
1265 // Must preserve r0-r4, r5-r7 are available. (needs update for PPC) | 1263 // Must preserve r3-r7. |
1266 __ PushTryHandler(StackHandler::JS_ENTRY, 0); | 1264 __ PushStackHandler(); |
1267 // If an exception not caught by another handler occurs, this handler | 1265 // If an exception not caught by another handler occurs, this handler |
1268 // returns control to the code after the b(&invoke) above, which | 1266 // returns control to the code after the b(&invoke) above, which |
1269 // restores all kCalleeSaved registers (including cp and fp) to their | 1267 // restores all kCalleeSaved registers (including cp and fp) to their |
1270 // saved values before returning a failure to C. | 1268 // saved values before returning a failure to C. |
1271 | 1269 |
1272 // Clear any pending exceptions. | 1270 // Clear any pending exceptions. |
1273 __ mov(r8, Operand(isolate()->factory()->the_hole_value())); | 1271 __ mov(r8, Operand(isolate()->factory()->the_hole_value())); |
1274 __ mov(ip, Operand(ExternalReference(Isolate::kPendingExceptionAddress, | 1272 __ mov(ip, Operand(ExternalReference(Isolate::kPendingExceptionAddress, |
1275 isolate()))); | 1273 isolate()))); |
1276 __ StoreP(r8, MemOperand(ip)); | 1274 __ StoreP(r8, MemOperand(ip)); |
(...skipping 18 matching lines...) Expand all Loading... |
1295 } | 1293 } |
1296 __ LoadP(ip, MemOperand(ip)); // deref address | 1294 __ LoadP(ip, MemOperand(ip)); // deref address |
1297 | 1295 |
1298 // Branch and link to JSEntryTrampoline. | 1296 // Branch and link to JSEntryTrampoline. |
1299 // the address points to the start of the code object, skip the header | 1297 // the address points to the start of the code object, skip the header |
1300 __ addi(ip, ip, Operand(Code::kHeaderSize - kHeapObjectTag)); | 1298 __ addi(ip, ip, Operand(Code::kHeaderSize - kHeapObjectTag)); |
1301 __ mtctr(ip); | 1299 __ mtctr(ip); |
1302 __ bctrl(); // make the call | 1300 __ bctrl(); // make the call |
1303 | 1301 |
1304 // Unlink this frame from the handler chain. | 1302 // Unlink this frame from the handler chain. |
1305 __ PopTryHandler(); | 1303 __ PopStackHandler(); |
1306 | 1304 |
1307 __ bind(&exit); // r3 holds result | 1305 __ bind(&exit); // r3 holds result |
1308 // Check if the current stack frame is marked as the outermost JS frame. | 1306 // Check if the current stack frame is marked as the outermost JS frame. |
1309 Label non_outermost_js_2; | 1307 Label non_outermost_js_2; |
1310 __ pop(r8); | 1308 __ pop(r8); |
1311 __ CmpSmiLiteral(r8, Smi::FromInt(StackFrame::OUTERMOST_JSENTRY_FRAME), r0); | 1309 __ CmpSmiLiteral(r8, Smi::FromInt(StackFrame::OUTERMOST_JSENTRY_FRAME), r0); |
1312 __ bne(&non_outermost_js_2); | 1310 __ bne(&non_outermost_js_2); |
1313 __ mov(r9, Operand::Zero()); | 1311 __ mov(r9, Operand::Zero()); |
1314 __ mov(r8, Operand(ExternalReference(js_entry_sp))); | 1312 __ mov(r8, Operand(ExternalReference(js_entry_sp))); |
1315 __ StoreP(r9, MemOperand(r8)); | 1313 __ StoreP(r9, MemOperand(r8)); |
(...skipping 4272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5588 kStackUnwindSpace, NULL, | 5586 kStackUnwindSpace, NULL, |
5589 MemOperand(fp, 6 * kPointerSize), NULL); | 5587 MemOperand(fp, 6 * kPointerSize), NULL); |
5590 } | 5588 } |
5591 | 5589 |
5592 | 5590 |
5593 #undef __ | 5591 #undef __ |
5594 } | 5592 } |
5595 } // namespace v8::internal | 5593 } // namespace v8::internal |
5596 | 5594 |
5597 #endif // V8_TARGET_ARCH_PPC | 5595 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |