| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 3904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3915 Label failure; | 3915 Label failure; |
| 3916 __ cmp(eax, NativeRegExpMacroAssembler::FAILURE); | 3916 __ cmp(eax, NativeRegExpMacroAssembler::FAILURE); |
| 3917 __ j(equal, &failure, taken); | 3917 __ j(equal, &failure, taken); |
| 3918 __ cmp(eax, NativeRegExpMacroAssembler::EXCEPTION); | 3918 __ cmp(eax, NativeRegExpMacroAssembler::EXCEPTION); |
| 3919 // If not exception it can only be retry. Handle that in the runtime system. | 3919 // If not exception it can only be retry. Handle that in the runtime system. |
| 3920 __ j(not_equal, &runtime); | 3920 __ j(not_equal, &runtime); |
| 3921 // Result must now be exception. If there is no pending exception already a | 3921 // Result must now be exception. If there is no pending exception already a |
| 3922 // stack overflow (on the backtrack stack) was detected in RegExp code but | 3922 // stack overflow (on the backtrack stack) was detected in RegExp code but |
| 3923 // haven't created the exception yet. Handle that in the runtime system. | 3923 // haven't created the exception yet. Handle that in the runtime system. |
| 3924 // TODO(592): Rerunning the RegExp to get the stack overflow exception. | 3924 // TODO(592): Rerunning the RegExp to get the stack overflow exception. |
| 3925 ExternalReference pending_exception_address = | 3925 ExternalReference pending_exception(Top::k_pending_exception_address); |
| 3926 ExternalReference::pending_exception_address(); | |
| 3927 __ mov(eax, | 3926 __ mov(eax, |
| 3928 Operand::StaticVariable(ExternalReference::the_hole_value_location())); | 3927 Operand::StaticVariable(ExternalReference::the_hole_value_location())); |
| 3929 __ cmp(eax, Operand::StaticVariable(pending_exception_address)); | 3928 __ cmp(eax, Operand::StaticVariable(pending_exception)); |
| 3930 __ j(equal, &runtime); | 3929 __ j(equal, &runtime); |
| 3931 __ bind(&failure); | 3930 __ bind(&failure); |
| 3932 // For failure and exception return null. | 3931 // For failure and exception return null. |
| 3933 __ mov(Operand(eax), Factory::null_value()); | 3932 __ mov(Operand(eax), Factory::null_value()); |
| 3934 __ ret(4 * kPointerSize); | 3933 __ ret(4 * kPointerSize); |
| 3935 | 3934 |
| 3936 // Load RegExp data. | 3935 // Load RegExp data. |
| 3937 __ bind(&success); | 3936 __ bind(&success); |
| 3938 __ mov(eax, Operand(esp, kJSRegExpOffset)); | 3937 __ mov(eax, Operand(esp, kJSRegExpOffset)); |
| 3939 __ mov(ecx, FieldOperand(eax, JSRegExp::kDataOffset)); | 3938 __ mov(ecx, FieldOperand(eax, JSRegExp::kDataOffset)); |
| (...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4709 // If the returned exception is RETRY_AFTER_GC continue at retry label | 4708 // If the returned exception is RETRY_AFTER_GC continue at retry label |
| 4710 STATIC_ASSERT(Failure::RETRY_AFTER_GC == 0); | 4709 STATIC_ASSERT(Failure::RETRY_AFTER_GC == 0); |
| 4711 __ test(eax, Immediate(((1 << kFailureTypeTagSize) - 1) << kFailureTagSize)); | 4710 __ test(eax, Immediate(((1 << kFailureTypeTagSize) - 1) << kFailureTagSize)); |
| 4712 __ j(zero, &retry, taken); | 4711 __ j(zero, &retry, taken); |
| 4713 | 4712 |
| 4714 // Special handling of out of memory exceptions. | 4713 // Special handling of out of memory exceptions. |
| 4715 __ cmp(eax, reinterpret_cast<int32_t>(Failure::OutOfMemoryException())); | 4714 __ cmp(eax, reinterpret_cast<int32_t>(Failure::OutOfMemoryException())); |
| 4716 __ j(equal, throw_out_of_memory_exception); | 4715 __ j(equal, throw_out_of_memory_exception); |
| 4717 | 4716 |
| 4718 // Retrieve the pending exception and clear the variable. | 4717 // Retrieve the pending exception and clear the variable. |
| 4719 ExternalReference pending_exception_address = | 4718 ExternalReference pending_exception_address(Top::k_pending_exception_address); |
| 4720 ExternalReference::pending_exception_address(); | |
| 4721 __ mov(eax, Operand::StaticVariable(pending_exception_address)); | 4719 __ mov(eax, Operand::StaticVariable(pending_exception_address)); |
| 4722 __ mov(edx, | 4720 __ mov(edx, |
| 4723 Operand::StaticVariable(ExternalReference::the_hole_value_location())); | 4721 Operand::StaticVariable(ExternalReference::the_hole_value_location())); |
| 4724 __ mov(Operand::StaticVariable(pending_exception_address), edx); | 4722 __ mov(Operand::StaticVariable(pending_exception_address), edx); |
| 4725 | 4723 |
| 4726 // Special handling of termination exceptions which are uncatchable | 4724 // Special handling of termination exceptions which are uncatchable |
| 4727 // by javascript code. | 4725 // by javascript code. |
| 4728 __ cmp(eax, Factory::termination_exception()); | 4726 __ cmp(eax, Factory::termination_exception()); |
| 4729 __ j(equal, throw_termination_exception); | 4727 __ j(equal, throw_termination_exception); |
| 4730 | 4728 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4762 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0); | 4760 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0); |
| 4763 __ pop(Operand::StaticVariable(handler_address)); | 4761 __ pop(Operand::StaticVariable(handler_address)); |
| 4764 | 4762 |
| 4765 if (type == OUT_OF_MEMORY) { | 4763 if (type == OUT_OF_MEMORY) { |
| 4766 // Set external caught exception to false. | 4764 // Set external caught exception to false. |
| 4767 ExternalReference external_caught(Top::k_external_caught_exception_address); | 4765 ExternalReference external_caught(Top::k_external_caught_exception_address); |
| 4768 __ mov(eax, false); | 4766 __ mov(eax, false); |
| 4769 __ mov(Operand::StaticVariable(external_caught), eax); | 4767 __ mov(Operand::StaticVariable(external_caught), eax); |
| 4770 | 4768 |
| 4771 // Set pending exception and eax to out of memory exception. | 4769 // Set pending exception and eax to out of memory exception. |
| 4772 ExternalReference pending_exception_address = | 4770 ExternalReference pending_exception(Top::k_pending_exception_address); |
| 4773 ExternalReference::pending_exception_address(); | |
| 4774 __ mov(eax, reinterpret_cast<int32_t>(Failure::OutOfMemoryException())); | 4771 __ mov(eax, reinterpret_cast<int32_t>(Failure::OutOfMemoryException())); |
| 4775 __ mov(Operand::StaticVariable(pending_exception_address), eax); | 4772 __ mov(Operand::StaticVariable(pending_exception), eax); |
| 4776 } | 4773 } |
| 4777 | 4774 |
| 4778 // Clear the context pointer. | 4775 // Clear the context pointer. |
| 4779 __ Set(esi, Immediate(0)); | 4776 __ Set(esi, Immediate(0)); |
| 4780 | 4777 |
| 4781 // Restore fp from handler and discard handler state. | 4778 // Restore fp from handler and discard handler state. |
| 4782 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 1 * kPointerSize); | 4779 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 1 * kPointerSize); |
| 4783 __ pop(ebp); | 4780 __ pop(ebp); |
| 4784 __ pop(edx); // State. | 4781 __ pop(edx); // State. |
| 4785 | 4782 |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4881 __ j(not_equal, ¬_outermost_js); | 4878 __ j(not_equal, ¬_outermost_js); |
| 4882 __ mov(Operand::StaticVariable(js_entry_sp), ebp); | 4879 __ mov(Operand::StaticVariable(js_entry_sp), ebp); |
| 4883 __ bind(¬_outermost_js); | 4880 __ bind(¬_outermost_js); |
| 4884 #endif | 4881 #endif |
| 4885 | 4882 |
| 4886 // Call a faked try-block that does the invoke. | 4883 // Call a faked try-block that does the invoke. |
| 4887 __ call(&invoke); | 4884 __ call(&invoke); |
| 4888 | 4885 |
| 4889 // Caught exception: Store result (exception) in the pending | 4886 // Caught exception: Store result (exception) in the pending |
| 4890 // exception field in the JSEnv and return a failure sentinel. | 4887 // exception field in the JSEnv and return a failure sentinel. |
| 4891 ExternalReference pending_exception_address = | 4888 ExternalReference pending_exception(Top::k_pending_exception_address); |
| 4892 ExternalReference::pending_exception_address(); | 4889 __ mov(Operand::StaticVariable(pending_exception), eax); |
| 4893 __ mov(Operand::StaticVariable(pending_exception_address), eax); | |
| 4894 __ mov(eax, reinterpret_cast<int32_t>(Failure::Exception())); | 4890 __ mov(eax, reinterpret_cast<int32_t>(Failure::Exception())); |
| 4895 __ jmp(&exit); | 4891 __ jmp(&exit); |
| 4896 | 4892 |
| 4897 // Invoke: Link this frame into the handler chain. | 4893 // Invoke: Link this frame into the handler chain. |
| 4898 __ bind(&invoke); | 4894 __ bind(&invoke); |
| 4899 __ PushTryHandler(IN_JS_ENTRY, JS_ENTRY_HANDLER); | 4895 __ PushTryHandler(IN_JS_ENTRY, JS_ENTRY_HANDLER); |
| 4900 | 4896 |
| 4901 // Clear any pending exceptions. | 4897 // Clear any pending exceptions. |
| 4902 __ mov(edx, | 4898 __ mov(edx, |
| 4903 Operand::StaticVariable(ExternalReference::the_hole_value_location())); | 4899 Operand::StaticVariable(ExternalReference::the_hole_value_location())); |
| 4904 __ mov(Operand::StaticVariable(pending_exception_address), edx); | 4900 __ mov(Operand::StaticVariable(pending_exception), edx); |
| 4905 | 4901 |
| 4906 // Fake a receiver (NULL). | 4902 // Fake a receiver (NULL). |
| 4907 __ push(Immediate(0)); // receiver | 4903 __ push(Immediate(0)); // receiver |
| 4908 | 4904 |
| 4909 // Invoke the function by calling through JS entry trampoline | 4905 // Invoke the function by calling through JS entry trampoline |
| 4910 // builtin and pop the faked function when we return. Notice that we | 4906 // builtin and pop the faked function when we return. Notice that we |
| 4911 // cannot store a reference to the trampoline code directly in this | 4907 // cannot store a reference to the trampoline code directly in this |
| 4912 // stub, because the builtin stubs may not have been generated yet. | 4908 // stub, because the builtin stubs may not have been generated yet. |
| 4913 if (is_construct) { | 4909 if (is_construct) { |
| 4914 ExternalReference construct_entry(Builtins::JSConstructEntryTrampoline); | 4910 ExternalReference construct_entry(Builtins::JSConstructEntryTrampoline); |
| (...skipping 1572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6487 // Do a tail call to the rewritten stub. | 6483 // Do a tail call to the rewritten stub. |
| 6488 __ jmp(Operand(edi)); | 6484 __ jmp(Operand(edi)); |
| 6489 } | 6485 } |
| 6490 | 6486 |
| 6491 | 6487 |
| 6492 #undef __ | 6488 #undef __ |
| 6493 | 6489 |
| 6494 } } // namespace v8::internal | 6490 } } // namespace v8::internal |
| 6495 | 6491 |
| 6496 #endif // V8_TARGET_ARCH_IA32 | 6492 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |