| 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_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
| 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 2538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2549 __ mov(Operand(esp, 2 * kPointerSize), | 2549 __ mov(Operand(esp, 2 * kPointerSize), |
| 2550 Immediate(ExternalReference::isolate_address(isolate()))); | 2550 Immediate(ExternalReference::isolate_address(isolate()))); |
| 2551 __ CallCFunction(find_handler, 3); | 2551 __ CallCFunction(find_handler, 3); |
| 2552 } | 2552 } |
| 2553 | 2553 |
| 2554 // Retrieve the handler context, SP and FP. | 2554 // Retrieve the handler context, SP and FP. |
| 2555 __ mov(esi, Operand::StaticVariable(pending_handler_context_address)); | 2555 __ mov(esi, Operand::StaticVariable(pending_handler_context_address)); |
| 2556 __ mov(esp, Operand::StaticVariable(pending_handler_sp_address)); | 2556 __ mov(esp, Operand::StaticVariable(pending_handler_sp_address)); |
| 2557 __ mov(ebp, Operand::StaticVariable(pending_handler_fp_address)); | 2557 __ mov(ebp, Operand::StaticVariable(pending_handler_fp_address)); |
| 2558 | 2558 |
| 2559 // If the handler is a JS frame, restore the context to the frame. | 2559 // If the handler is a JS frame, restore the context to the frame. Note that |
| 2560 // (kind == ENTRY) == (ebp == 0) == (esi == 0), so we could test either | 2560 // the context will be set to (esi == 0) for non-JS frames. |
| 2561 // ebp or esi. | |
| 2562 Label skip; | 2561 Label skip; |
| 2563 __ test(esi, esi); | 2562 __ test(esi, esi); |
| 2564 __ j(zero, &skip, Label::kNear); | 2563 __ j(zero, &skip, Label::kNear); |
| 2565 __ mov(Operand(ebp, StandardFrameConstants::kContextOffset), esi); | 2564 __ mov(Operand(ebp, StandardFrameConstants::kContextOffset), esi); |
| 2566 __ bind(&skip); | 2565 __ bind(&skip); |
| 2567 | 2566 |
| 2568 // Compute the handler entry address and jump to it. | 2567 // Compute the handler entry address and jump to it. |
| 2569 __ mov(edi, Operand::StaticVariable(pending_handler_code_address)); | 2568 __ mov(edi, Operand::StaticVariable(pending_handler_code_address)); |
| 2570 __ mov(edx, Operand::StaticVariable(pending_handler_offset_address)); | 2569 __ mov(edx, Operand::StaticVariable(pending_handler_offset_address)); |
| 2571 __ lea(edi, FieldOperand(edi, edx, times_1, Code::kHeaderSize)); | 2570 __ lea(edi, FieldOperand(edi, edx, times_1, Code::kHeaderSize)); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2612 __ bind(&handler_entry); | 2611 __ bind(&handler_entry); |
| 2613 handler_offset_ = handler_entry.pos(); | 2612 handler_offset_ = handler_entry.pos(); |
| 2614 // Caught exception: Store result (exception) in the pending exception | 2613 // Caught exception: Store result (exception) in the pending exception |
| 2615 // field in the JSEnv and return a failure sentinel. | 2614 // field in the JSEnv and return a failure sentinel. |
| 2616 ExternalReference pending_exception(Isolate::kPendingExceptionAddress, | 2615 ExternalReference pending_exception(Isolate::kPendingExceptionAddress, |
| 2617 isolate()); | 2616 isolate()); |
| 2618 __ mov(Operand::StaticVariable(pending_exception), eax); | 2617 __ mov(Operand::StaticVariable(pending_exception), eax); |
| 2619 __ mov(eax, Immediate(isolate()->factory()->exception())); | 2618 __ mov(eax, Immediate(isolate()->factory()->exception())); |
| 2620 __ jmp(&exit); | 2619 __ jmp(&exit); |
| 2621 | 2620 |
| 2622 // Invoke: Link this frame into the handler chain. There's only one | 2621 // Invoke: Link this frame into the handler chain. |
| 2623 // handler block in this code object, so its index is 0. | |
| 2624 __ bind(&invoke); | 2622 __ bind(&invoke); |
| 2625 __ PushTryHandler(StackHandler::JS_ENTRY, 0); | 2623 __ PushStackHandler(); |
| 2626 | 2624 |
| 2627 // Clear any pending exceptions. | 2625 // Clear any pending exceptions. |
| 2628 __ mov(edx, Immediate(isolate()->factory()->the_hole_value())); | 2626 __ mov(edx, Immediate(isolate()->factory()->the_hole_value())); |
| 2629 __ mov(Operand::StaticVariable(pending_exception), edx); | 2627 __ mov(Operand::StaticVariable(pending_exception), edx); |
| 2630 | 2628 |
| 2631 // Fake a receiver (NULL). | 2629 // Fake a receiver (NULL). |
| 2632 __ push(Immediate(0)); // receiver | 2630 __ push(Immediate(0)); // receiver |
| 2633 | 2631 |
| 2634 // Invoke the function by calling through JS entry trampoline builtin and | 2632 // Invoke the function by calling through JS entry trampoline builtin and |
| 2635 // pop the faked function when we return. Notice that we cannot store a | 2633 // pop the faked function when we return. Notice that we cannot store a |
| 2636 // reference to the trampoline code directly in this stub, because the | 2634 // reference to the trampoline code directly in this stub, because the |
| 2637 // builtin stubs may not have been generated yet. | 2635 // builtin stubs may not have been generated yet. |
| 2638 if (type() == StackFrame::ENTRY_CONSTRUCT) { | 2636 if (type() == StackFrame::ENTRY_CONSTRUCT) { |
| 2639 ExternalReference construct_entry(Builtins::kJSConstructEntryTrampoline, | 2637 ExternalReference construct_entry(Builtins::kJSConstructEntryTrampoline, |
| 2640 isolate()); | 2638 isolate()); |
| 2641 __ mov(edx, Immediate(construct_entry)); | 2639 __ mov(edx, Immediate(construct_entry)); |
| 2642 } else { | 2640 } else { |
| 2643 ExternalReference entry(Builtins::kJSEntryTrampoline, isolate()); | 2641 ExternalReference entry(Builtins::kJSEntryTrampoline, isolate()); |
| 2644 __ mov(edx, Immediate(entry)); | 2642 __ mov(edx, Immediate(entry)); |
| 2645 } | 2643 } |
| 2646 __ mov(edx, Operand(edx, 0)); // deref address | 2644 __ mov(edx, Operand(edx, 0)); // deref address |
| 2647 __ lea(edx, FieldOperand(edx, Code::kHeaderSize)); | 2645 __ lea(edx, FieldOperand(edx, Code::kHeaderSize)); |
| 2648 __ call(edx); | 2646 __ call(edx); |
| 2649 | 2647 |
| 2650 // Unlink this frame from the handler chain. | 2648 // Unlink this frame from the handler chain. |
| 2651 __ PopTryHandler(); | 2649 __ PopStackHandler(); |
| 2652 | 2650 |
| 2653 __ bind(&exit); | 2651 __ bind(&exit); |
| 2654 // Check if the current stack frame is marked as the outermost JS frame. | 2652 // Check if the current stack frame is marked as the outermost JS frame. |
| 2655 __ pop(ebx); | 2653 __ pop(ebx); |
| 2656 __ cmp(ebx, Immediate(Smi::FromInt(StackFrame::OUTERMOST_JSENTRY_FRAME))); | 2654 __ cmp(ebx, Immediate(Smi::FromInt(StackFrame::OUTERMOST_JSENTRY_FRAME))); |
| 2657 __ j(not_equal, ¬_outermost_js_2); | 2655 __ j(not_equal, ¬_outermost_js_2); |
| 2658 __ mov(Operand::StaticVariable(js_entry_sp), Immediate(0)); | 2656 __ mov(Operand::StaticVariable(js_entry_sp), Immediate(0)); |
| 2659 __ bind(¬_outermost_js_2); | 2657 __ bind(¬_outermost_js_2); |
| 2660 | 2658 |
| 2661 // Restore the top frame descriptor from the stack. | 2659 // Restore the top frame descriptor from the stack. |
| (...skipping 2743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5405 ApiParameterOperand(2), kStackSpace, nullptr, | 5403 ApiParameterOperand(2), kStackSpace, nullptr, |
| 5406 Operand(ebp, 7 * kPointerSize), NULL); | 5404 Operand(ebp, 7 * kPointerSize), NULL); |
| 5407 } | 5405 } |
| 5408 | 5406 |
| 5409 | 5407 |
| 5410 #undef __ | 5408 #undef __ |
| 5411 | 5409 |
| 5412 } } // namespace v8::internal | 5410 } } // namespace v8::internal |
| 5413 | 5411 |
| 5414 #endif // V8_TARGET_ARCH_IA32 | 5412 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |