| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 757 | 757 |
| 758 | 758 |
| 759 void MacroAssembler::LeaveApiExitFrame() { | 759 void MacroAssembler::LeaveApiExitFrame() { |
| 760 mov(esp, ebp); | 760 mov(esp, ebp); |
| 761 pop(ebp); | 761 pop(ebp); |
| 762 | 762 |
| 763 LeaveExitFrameEpilogue(); | 763 LeaveExitFrameEpilogue(); |
| 764 } | 764 } |
| 765 | 765 |
| 766 | 766 |
| 767 void MacroAssembler::PushTryHandler(CodeLocation try_location, | 767 void MacroAssembler::PushTryHandler(StackHandler::Kind kind, |
| 768 HandlerType type, | |
| 769 int handler_index) { | 768 int handler_index) { |
| 770 // Adjust this code if not the case. | 769 // Adjust this code if not the case. |
| 771 STATIC_ASSERT(StackHandlerConstants::kSize == 5 * kPointerSize); | 770 STATIC_ASSERT(StackHandlerConstants::kSize == 5 * kPointerSize); |
| 772 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0); | 771 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0); |
| 773 STATIC_ASSERT(StackHandlerConstants::kCodeOffset == 1 * kPointerSize); | 772 STATIC_ASSERT(StackHandlerConstants::kCodeOffset == 1 * kPointerSize); |
| 774 STATIC_ASSERT(StackHandlerConstants::kStateOffset == 2 * kPointerSize); | 773 STATIC_ASSERT(StackHandlerConstants::kStateOffset == 2 * kPointerSize); |
| 775 STATIC_ASSERT(StackHandlerConstants::kContextOffset == 3 * kPointerSize); | 774 STATIC_ASSERT(StackHandlerConstants::kContextOffset == 3 * kPointerSize); |
| 776 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 4 * kPointerSize); | 775 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 4 * kPointerSize); |
| 777 | 776 |
| 778 // We will build up the handler from the bottom by pushing on the stack. | 777 // We will build up the handler from the bottom by pushing on the stack. |
| 779 // First compute the state and push the frame pointer and context. | 778 // First push the frame pointer and context. |
| 780 unsigned state = StackHandler::OffsetField::encode(handler_index); | 779 if (kind == StackHandler::JS_ENTRY) { |
| 781 if (try_location == IN_JAVASCRIPT) { | |
| 782 push(ebp); | |
| 783 push(esi); | |
| 784 state |= (type == TRY_CATCH_HANDLER) | |
| 785 ? StackHandler::KindField::encode(StackHandler::TRY_CATCH) | |
| 786 : StackHandler::KindField::encode(StackHandler::TRY_FINALLY); | |
| 787 } else { | |
| 788 ASSERT(try_location == IN_JS_ENTRY); | |
| 789 // The frame pointer does not point to a JS frame so we save NULL for | 780 // The frame pointer does not point to a JS frame so we save NULL for |
| 790 // ebp. We expect the code throwing an exception to check ebp before | 781 // ebp. We expect the code throwing an exception to check ebp before |
| 791 // dereferencing it to restore the context. | 782 // dereferencing it to restore the context. |
| 792 push(Immediate(0)); // NULL frame pointer. | 783 push(Immediate(0)); // NULL frame pointer. |
| 793 push(Immediate(Smi::FromInt(0))); // No context. | 784 push(Immediate(Smi::FromInt(0))); // No context. |
| 794 state |= StackHandler::KindField::encode(StackHandler::ENTRY); | 785 } else { |
| 786 push(ebp); |
| 787 push(esi); |
| 795 } | 788 } |
| 796 | |
| 797 // Push the state and the code object. | 789 // Push the state and the code object. |
| 790 unsigned state = |
| 791 StackHandler::IndexField::encode(handler_index) | |
| 792 StackHandler::KindField::encode(kind); |
| 798 push(Immediate(state)); | 793 push(Immediate(state)); |
| 799 Push(CodeObject()); | 794 Push(CodeObject()); |
| 800 | 795 |
| 801 // Link the current handler as the next handler. | 796 // Link the current handler as the next handler. |
| 802 ExternalReference handler_address(Isolate::kHandlerAddress, isolate()); | 797 ExternalReference handler_address(Isolate::kHandlerAddress, isolate()); |
| 803 push(Operand::StaticVariable(handler_address)); | 798 push(Operand::StaticVariable(handler_address)); |
| 804 // Set this new handler as the current one. | 799 // Set this new handler as the current one. |
| 805 mov(Operand::StaticVariable(handler_address), esp); | 800 mov(Operand::StaticVariable(handler_address), esp); |
| 806 } | 801 } |
| 807 | 802 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 897 ExternalReference handler_address(Isolate::kHandlerAddress, isolate()); | 892 ExternalReference handler_address(Isolate::kHandlerAddress, isolate()); |
| 898 mov(esp, Operand::StaticVariable(handler_address)); | 893 mov(esp, Operand::StaticVariable(handler_address)); |
| 899 | 894 |
| 900 // Unwind the handlers until the top ENTRY handler is found. | 895 // Unwind the handlers until the top ENTRY handler is found. |
| 901 Label fetch_next, check_kind; | 896 Label fetch_next, check_kind; |
| 902 jmp(&check_kind, Label::kNear); | 897 jmp(&check_kind, Label::kNear); |
| 903 bind(&fetch_next); | 898 bind(&fetch_next); |
| 904 mov(esp, Operand(esp, StackHandlerConstants::kNextOffset)); | 899 mov(esp, Operand(esp, StackHandlerConstants::kNextOffset)); |
| 905 | 900 |
| 906 bind(&check_kind); | 901 bind(&check_kind); |
| 907 STATIC_ASSERT(StackHandler::ENTRY == 0); | 902 STATIC_ASSERT(StackHandler::JS_ENTRY == 0); |
| 908 test(Operand(esp, StackHandlerConstants::kStateOffset), | 903 test(Operand(esp, StackHandlerConstants::kStateOffset), |
| 909 Immediate(StackHandler::KindField::kMask)); | 904 Immediate(StackHandler::KindField::kMask)); |
| 910 j(not_zero, &fetch_next); | 905 j(not_zero, &fetch_next); |
| 911 | 906 |
| 912 // Set the top handler address to next handler past the top ENTRY handler. | 907 // Set the top handler address to next handler past the top ENTRY handler. |
| 913 pop(Operand::StaticVariable(handler_address)); | 908 pop(Operand::StaticVariable(handler_address)); |
| 914 | 909 |
| 915 // Remove the code object and state, compute the handler address in edi. | 910 // Remove the code object and state, compute the handler address in edi. |
| 916 pop(edi); // Code object. | 911 pop(edi); // Code object. |
| 917 pop(edx); // Index and state. | 912 pop(edx); // Index and state. |
| (...skipping 1872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2790 cmp(length, Operand(bitmap_scratch, MemoryChunk::kSizeOffset)); | 2785 cmp(length, Operand(bitmap_scratch, MemoryChunk::kSizeOffset)); |
| 2791 Check(less_equal, "Live Bytes Count overflow chunk size"); | 2786 Check(less_equal, "Live Bytes Count overflow chunk size"); |
| 2792 } | 2787 } |
| 2793 | 2788 |
| 2794 bind(&done); | 2789 bind(&done); |
| 2795 } | 2790 } |
| 2796 | 2791 |
| 2797 } } // namespace v8::internal | 2792 } } // namespace v8::internal |
| 2798 | 2793 |
| 2799 #endif // V8_TARGET_ARCH_IA32 | 2794 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |