OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 3926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3937 Label failure; | 3937 Label failure; |
3938 __ cmp(eax, NativeRegExpMacroAssembler::FAILURE); | 3938 __ cmp(eax, NativeRegExpMacroAssembler::FAILURE); |
3939 __ j(equal, &failure, taken); | 3939 __ j(equal, &failure, taken); |
3940 __ cmp(eax, NativeRegExpMacroAssembler::EXCEPTION); | 3940 __ cmp(eax, NativeRegExpMacroAssembler::EXCEPTION); |
3941 // If not exception it can only be retry. Handle that in the runtime system. | 3941 // If not exception it can only be retry. Handle that in the runtime system. |
3942 __ j(not_equal, &runtime); | 3942 __ j(not_equal, &runtime); |
3943 // Result must now be exception. If there is no pending exception already a | 3943 // Result must now be exception. If there is no pending exception already a |
3944 // stack overflow (on the backtrack stack) was detected in RegExp code but | 3944 // stack overflow (on the backtrack stack) was detected in RegExp code but |
3945 // haven't created the exception yet. Handle that in the runtime system. | 3945 // haven't created the exception yet. Handle that in the runtime system. |
3946 // TODO(592): Rerunning the RegExp to get the stack overflow exception. | 3946 // TODO(592): Rerunning the RegExp to get the stack overflow exception. |
3947 ExternalReference pending_exception(Top::k_pending_exception_address); | 3947 ExternalReference pending_exception_address = |
| 3948 ExternalReference::pending_exception_address(); |
3948 __ mov(eax, | 3949 __ mov(eax, |
3949 Operand::StaticVariable(ExternalReference::the_hole_value_location())); | 3950 Operand::StaticVariable(ExternalReference::the_hole_value_location())); |
3950 __ cmp(eax, Operand::StaticVariable(pending_exception)); | 3951 __ cmp(eax, Operand::StaticVariable(pending_exception_address)); |
3951 __ j(equal, &runtime); | 3952 __ j(equal, &runtime); |
3952 __ bind(&failure); | 3953 __ bind(&failure); |
3953 // For failure and exception return null. | 3954 // For failure and exception return null. |
3954 __ mov(Operand(eax), Factory::null_value()); | 3955 __ mov(Operand(eax), Factory::null_value()); |
3955 __ ret(4 * kPointerSize); | 3956 __ ret(4 * kPointerSize); |
3956 | 3957 |
3957 // Load RegExp data. | 3958 // Load RegExp data. |
3958 __ bind(&success); | 3959 __ bind(&success); |
3959 __ mov(eax, Operand(esp, kJSRegExpOffset)); | 3960 __ mov(eax, Operand(esp, kJSRegExpOffset)); |
3960 __ mov(ecx, FieldOperand(eax, JSRegExp::kDataOffset)); | 3961 __ mov(ecx, FieldOperand(eax, JSRegExp::kDataOffset)); |
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4731 // If the returned exception is RETRY_AFTER_GC continue at retry label | 4732 // If the returned exception is RETRY_AFTER_GC continue at retry label |
4732 STATIC_ASSERT(Failure::RETRY_AFTER_GC == 0); | 4733 STATIC_ASSERT(Failure::RETRY_AFTER_GC == 0); |
4733 __ test(eax, Immediate(((1 << kFailureTypeTagSize) - 1) << kFailureTagSize)); | 4734 __ test(eax, Immediate(((1 << kFailureTypeTagSize) - 1) << kFailureTagSize)); |
4734 __ j(zero, &retry, taken); | 4735 __ j(zero, &retry, taken); |
4735 | 4736 |
4736 // Special handling of out of memory exceptions. | 4737 // Special handling of out of memory exceptions. |
4737 __ cmp(eax, reinterpret_cast<int32_t>(Failure::OutOfMemoryException())); | 4738 __ cmp(eax, reinterpret_cast<int32_t>(Failure::OutOfMemoryException())); |
4738 __ j(equal, throw_out_of_memory_exception); | 4739 __ j(equal, throw_out_of_memory_exception); |
4739 | 4740 |
4740 // Retrieve the pending exception and clear the variable. | 4741 // Retrieve the pending exception and clear the variable. |
4741 ExternalReference pending_exception_address(Top::k_pending_exception_address); | 4742 ExternalReference pending_exception_address = |
| 4743 ExternalReference::pending_exception_address(); |
4742 __ mov(eax, Operand::StaticVariable(pending_exception_address)); | 4744 __ mov(eax, Operand::StaticVariable(pending_exception_address)); |
4743 __ mov(edx, | 4745 __ mov(edx, |
4744 Operand::StaticVariable(ExternalReference::the_hole_value_location())); | 4746 Operand::StaticVariable(ExternalReference::the_hole_value_location())); |
4745 __ mov(Operand::StaticVariable(pending_exception_address), edx); | 4747 __ mov(Operand::StaticVariable(pending_exception_address), edx); |
4746 | 4748 |
4747 // Special handling of termination exceptions which are uncatchable | 4749 // Special handling of termination exceptions which are uncatchable |
4748 // by javascript code. | 4750 // by javascript code. |
4749 __ cmp(eax, Factory::termination_exception()); | 4751 __ cmp(eax, Factory::termination_exception()); |
4750 __ j(equal, throw_termination_exception); | 4752 __ j(equal, throw_termination_exception); |
4751 | 4753 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4783 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0); | 4785 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0); |
4784 __ pop(Operand::StaticVariable(handler_address)); | 4786 __ pop(Operand::StaticVariable(handler_address)); |
4785 | 4787 |
4786 if (type == OUT_OF_MEMORY) { | 4788 if (type == OUT_OF_MEMORY) { |
4787 // Set external caught exception to false. | 4789 // Set external caught exception to false. |
4788 ExternalReference external_caught(Top::k_external_caught_exception_address); | 4790 ExternalReference external_caught(Top::k_external_caught_exception_address); |
4789 __ mov(eax, false); | 4791 __ mov(eax, false); |
4790 __ mov(Operand::StaticVariable(external_caught), eax); | 4792 __ mov(Operand::StaticVariable(external_caught), eax); |
4791 | 4793 |
4792 // Set pending exception and eax to out of memory exception. | 4794 // Set pending exception and eax to out of memory exception. |
4793 ExternalReference pending_exception(Top::k_pending_exception_address); | 4795 ExternalReference pending_exception_address = |
| 4796 ExternalReference::pending_exception_address(); |
4794 __ mov(eax, reinterpret_cast<int32_t>(Failure::OutOfMemoryException())); | 4797 __ mov(eax, reinterpret_cast<int32_t>(Failure::OutOfMemoryException())); |
4795 __ mov(Operand::StaticVariable(pending_exception), eax); | 4798 __ mov(Operand::StaticVariable(pending_exception_address), eax); |
4796 } | 4799 } |
4797 | 4800 |
4798 // Clear the context pointer. | 4801 // Clear the context pointer. |
4799 __ Set(esi, Immediate(0)); | 4802 __ Set(esi, Immediate(0)); |
4800 | 4803 |
4801 // Restore fp from handler and discard handler state. | 4804 // Restore fp from handler and discard handler state. |
4802 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 1 * kPointerSize); | 4805 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 1 * kPointerSize); |
4803 __ pop(ebp); | 4806 __ pop(ebp); |
4804 __ pop(edx); // State. | 4807 __ pop(edx); // State. |
4805 | 4808 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4901 __ j(not_equal, ¬_outermost_js); | 4904 __ j(not_equal, ¬_outermost_js); |
4902 __ mov(Operand::StaticVariable(js_entry_sp), ebp); | 4905 __ mov(Operand::StaticVariable(js_entry_sp), ebp); |
4903 __ bind(¬_outermost_js); | 4906 __ bind(¬_outermost_js); |
4904 #endif | 4907 #endif |
4905 | 4908 |
4906 // Call a faked try-block that does the invoke. | 4909 // Call a faked try-block that does the invoke. |
4907 __ call(&invoke); | 4910 __ call(&invoke); |
4908 | 4911 |
4909 // Caught exception: Store result (exception) in the pending | 4912 // Caught exception: Store result (exception) in the pending |
4910 // exception field in the JSEnv and return a failure sentinel. | 4913 // exception field in the JSEnv and return a failure sentinel. |
4911 ExternalReference pending_exception(Top::k_pending_exception_address); | 4914 ExternalReference pending_exception_address = |
4912 __ mov(Operand::StaticVariable(pending_exception), eax); | 4915 ExternalReference::pending_exception_address(); |
| 4916 __ mov(Operand::StaticVariable(pending_exception_address), eax); |
4913 __ mov(eax, reinterpret_cast<int32_t>(Failure::Exception())); | 4917 __ mov(eax, reinterpret_cast<int32_t>(Failure::Exception())); |
4914 __ jmp(&exit); | 4918 __ jmp(&exit); |
4915 | 4919 |
4916 // Invoke: Link this frame into the handler chain. | 4920 // Invoke: Link this frame into the handler chain. |
4917 __ bind(&invoke); | 4921 __ bind(&invoke); |
4918 __ PushTryHandler(IN_JS_ENTRY, JS_ENTRY_HANDLER); | 4922 __ PushTryHandler(IN_JS_ENTRY, JS_ENTRY_HANDLER); |
4919 | 4923 |
4920 // Clear any pending exceptions. | 4924 // Clear any pending exceptions. |
4921 __ mov(edx, | 4925 __ mov(edx, |
4922 Operand::StaticVariable(ExternalReference::the_hole_value_location())); | 4926 Operand::StaticVariable(ExternalReference::the_hole_value_location())); |
4923 __ mov(Operand::StaticVariable(pending_exception), edx); | 4927 __ mov(Operand::StaticVariable(pending_exception_address), edx); |
4924 | 4928 |
4925 // Fake a receiver (NULL). | 4929 // Fake a receiver (NULL). |
4926 __ push(Immediate(0)); // receiver | 4930 __ push(Immediate(0)); // receiver |
4927 | 4931 |
4928 // Invoke the function by calling through JS entry trampoline | 4932 // Invoke the function by calling through JS entry trampoline |
4929 // builtin and pop the faked function when we return. Notice that we | 4933 // builtin and pop the faked function when we return. Notice that we |
4930 // cannot store a reference to the trampoline code directly in this | 4934 // cannot store a reference to the trampoline code directly in this |
4931 // stub, because the builtin stubs may not have been generated yet. | 4935 // stub, because the builtin stubs may not have been generated yet. |
4932 if (is_construct) { | 4936 if (is_construct) { |
4933 ExternalReference construct_entry(Builtins::JSConstructEntryTrampoline); | 4937 ExternalReference construct_entry(Builtins::JSConstructEntryTrampoline); |
(...skipping 1572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6506 // Do a tail call to the rewritten stub. | 6510 // Do a tail call to the rewritten stub. |
6507 __ jmp(Operand(edi)); | 6511 __ jmp(Operand(edi)); |
6508 } | 6512 } |
6509 | 6513 |
6510 | 6514 |
6511 #undef __ | 6515 #undef __ |
6512 | 6516 |
6513 } } // namespace v8::internal | 6517 } } // namespace v8::internal |
6514 | 6518 |
6515 #endif // V8_TARGET_ARCH_IA32 | 6519 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |