| 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_X87 | 7 #if V8_TARGET_ARCH_X87 |
| 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 2230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2241 __ mov(Operand(esp, 2 * kPointerSize), | 2241 __ mov(Operand(esp, 2 * kPointerSize), |
| 2242 Immediate(ExternalReference::isolate_address(isolate()))); | 2242 Immediate(ExternalReference::isolate_address(isolate()))); |
| 2243 __ CallCFunction(find_handler, 3); | 2243 __ CallCFunction(find_handler, 3); |
| 2244 } | 2244 } |
| 2245 | 2245 |
| 2246 // Retrieve the handler context, SP and FP. | 2246 // Retrieve the handler context, SP and FP. |
| 2247 __ mov(esi, Operand::StaticVariable(pending_handler_context_address)); | 2247 __ mov(esi, Operand::StaticVariable(pending_handler_context_address)); |
| 2248 __ mov(esp, Operand::StaticVariable(pending_handler_sp_address)); | 2248 __ mov(esp, Operand::StaticVariable(pending_handler_sp_address)); |
| 2249 __ mov(ebp, Operand::StaticVariable(pending_handler_fp_address)); | 2249 __ mov(ebp, Operand::StaticVariable(pending_handler_fp_address)); |
| 2250 | 2250 |
| 2251 // If the handler is a JS frame, restore the context to the frame. | 2251 // If the handler is a JS frame, restore the context to the frame. Note that |
| 2252 // (kind == ENTRY) == (ebp == 0) == (esi == 0), so we could test either | 2252 // the context will be set to (esi == 0) for non-JS frames. |
| 2253 // ebp or esi. | |
| 2254 Label skip; | 2253 Label skip; |
| 2255 __ test(esi, esi); | 2254 __ test(esi, esi); |
| 2256 __ j(zero, &skip, Label::kNear); | 2255 __ j(zero, &skip, Label::kNear); |
| 2257 __ mov(Operand(ebp, StandardFrameConstants::kContextOffset), esi); | 2256 __ mov(Operand(ebp, StandardFrameConstants::kContextOffset), esi); |
| 2258 __ bind(&skip); | 2257 __ bind(&skip); |
| 2259 | 2258 |
| 2260 // Compute the handler entry address and jump to it. | 2259 // Compute the handler entry address and jump to it. |
| 2261 __ mov(edi, Operand::StaticVariable(pending_handler_code_address)); | 2260 __ mov(edi, Operand::StaticVariable(pending_handler_code_address)); |
| 2262 __ mov(edx, Operand::StaticVariable(pending_handler_offset_address)); | 2261 __ mov(edx, Operand::StaticVariable(pending_handler_offset_address)); |
| 2263 __ lea(edi, FieldOperand(edi, edx, times_1, Code::kHeaderSize)); | 2262 __ lea(edi, FieldOperand(edi, edx, times_1, Code::kHeaderSize)); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2304 __ bind(&handler_entry); | 2303 __ bind(&handler_entry); |
| 2305 handler_offset_ = handler_entry.pos(); | 2304 handler_offset_ = handler_entry.pos(); |
| 2306 // Caught exception: Store result (exception) in the pending exception | 2305 // Caught exception: Store result (exception) in the pending exception |
| 2307 // field in the JSEnv and return a failure sentinel. | 2306 // field in the JSEnv and return a failure sentinel. |
| 2308 ExternalReference pending_exception(Isolate::kPendingExceptionAddress, | 2307 ExternalReference pending_exception(Isolate::kPendingExceptionAddress, |
| 2309 isolate()); | 2308 isolate()); |
| 2310 __ mov(Operand::StaticVariable(pending_exception), eax); | 2309 __ mov(Operand::StaticVariable(pending_exception), eax); |
| 2311 __ mov(eax, Immediate(isolate()->factory()->exception())); | 2310 __ mov(eax, Immediate(isolate()->factory()->exception())); |
| 2312 __ jmp(&exit); | 2311 __ jmp(&exit); |
| 2313 | 2312 |
| 2314 // Invoke: Link this frame into the handler chain. There's only one | 2313 // Invoke: Link this frame into the handler chain. |
| 2315 // handler block in this code object, so its index is 0. | |
| 2316 __ bind(&invoke); | 2314 __ bind(&invoke); |
| 2317 __ PushTryHandler(StackHandler::JS_ENTRY, 0); | 2315 __ PushStackHandler(); |
| 2318 | 2316 |
| 2319 // Clear any pending exceptions. | 2317 // Clear any pending exceptions. |
| 2320 __ mov(edx, Immediate(isolate()->factory()->the_hole_value())); | 2318 __ mov(edx, Immediate(isolate()->factory()->the_hole_value())); |
| 2321 __ mov(Operand::StaticVariable(pending_exception), edx); | 2319 __ mov(Operand::StaticVariable(pending_exception), edx); |
| 2322 | 2320 |
| 2323 // Fake a receiver (NULL). | 2321 // Fake a receiver (NULL). |
| 2324 __ push(Immediate(0)); // receiver | 2322 __ push(Immediate(0)); // receiver |
| 2325 | 2323 |
| 2326 // Invoke the function by calling through JS entry trampoline builtin and | 2324 // Invoke the function by calling through JS entry trampoline builtin and |
| 2327 // pop the faked function when we return. Notice that we cannot store a | 2325 // pop the faked function when we return. Notice that we cannot store a |
| 2328 // reference to the trampoline code directly in this stub, because the | 2326 // reference to the trampoline code directly in this stub, because the |
| 2329 // builtin stubs may not have been generated yet. | 2327 // builtin stubs may not have been generated yet. |
| 2330 if (type() == StackFrame::ENTRY_CONSTRUCT) { | 2328 if (type() == StackFrame::ENTRY_CONSTRUCT) { |
| 2331 ExternalReference construct_entry(Builtins::kJSConstructEntryTrampoline, | 2329 ExternalReference construct_entry(Builtins::kJSConstructEntryTrampoline, |
| 2332 isolate()); | 2330 isolate()); |
| 2333 __ mov(edx, Immediate(construct_entry)); | 2331 __ mov(edx, Immediate(construct_entry)); |
| 2334 } else { | 2332 } else { |
| 2335 ExternalReference entry(Builtins::kJSEntryTrampoline, isolate()); | 2333 ExternalReference entry(Builtins::kJSEntryTrampoline, isolate()); |
| 2336 __ mov(edx, Immediate(entry)); | 2334 __ mov(edx, Immediate(entry)); |
| 2337 } | 2335 } |
| 2338 __ mov(edx, Operand(edx, 0)); // deref address | 2336 __ mov(edx, Operand(edx, 0)); // deref address |
| 2339 __ lea(edx, FieldOperand(edx, Code::kHeaderSize)); | 2337 __ lea(edx, FieldOperand(edx, Code::kHeaderSize)); |
| 2340 __ call(edx); | 2338 __ call(edx); |
| 2341 | 2339 |
| 2342 // Unlink this frame from the handler chain. | 2340 // Unlink this frame from the handler chain. |
| 2343 __ PopTryHandler(); | 2341 __ PopStackHandler(); |
| 2344 | 2342 |
| 2345 __ bind(&exit); | 2343 __ bind(&exit); |
| 2346 // Check if the current stack frame is marked as the outermost JS frame. | 2344 // Check if the current stack frame is marked as the outermost JS frame. |
| 2347 __ pop(ebx); | 2345 __ pop(ebx); |
| 2348 __ cmp(ebx, Immediate(Smi::FromInt(StackFrame::OUTERMOST_JSENTRY_FRAME))); | 2346 __ cmp(ebx, Immediate(Smi::FromInt(StackFrame::OUTERMOST_JSENTRY_FRAME))); |
| 2349 __ j(not_equal, ¬_outermost_js_2); | 2347 __ j(not_equal, ¬_outermost_js_2); |
| 2350 __ mov(Operand::StaticVariable(js_entry_sp), Immediate(0)); | 2348 __ mov(Operand::StaticVariable(js_entry_sp), Immediate(0)); |
| 2351 __ bind(¬_outermost_js_2); | 2349 __ bind(¬_outermost_js_2); |
| 2352 | 2350 |
| 2353 // Restore the top frame descriptor from the stack. | 2351 // Restore the top frame descriptor from the stack. |
| (...skipping 2711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5065 ApiParameterOperand(2), kStackSpace, nullptr, | 5063 ApiParameterOperand(2), kStackSpace, nullptr, |
| 5066 Operand(ebp, 7 * kPointerSize), NULL); | 5064 Operand(ebp, 7 * kPointerSize), NULL); |
| 5067 } | 5065 } |
| 5068 | 5066 |
| 5069 | 5067 |
| 5070 #undef __ | 5068 #undef __ |
| 5071 | 5069 |
| 5072 } } // namespace v8::internal | 5070 } } // namespace v8::internal |
| 5073 | 5071 |
| 5074 #endif // V8_TARGET_ARCH_X87 | 5072 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |