| 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 3904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3915 // Special handling of termination exceptions which are uncatchable | 3915 // Special handling of termination exceptions which are uncatchable |
| 3916 // by javascript code. | 3916 // by javascript code. |
| 3917 __ cmp(eax, factory->termination_exception()); | 3917 __ cmp(eax, factory->termination_exception()); |
| 3918 Label throw_termination_exception; | 3918 Label throw_termination_exception; |
| 3919 __ j(equal, &throw_termination_exception, Label::kNear); | 3919 __ j(equal, &throw_termination_exception, Label::kNear); |
| 3920 | 3920 |
| 3921 // Handle normal exception by following handler chain. | 3921 // Handle normal exception by following handler chain. |
| 3922 __ Throw(eax); | 3922 __ Throw(eax); |
| 3923 | 3923 |
| 3924 __ bind(&throw_termination_exception); | 3924 __ bind(&throw_termination_exception); |
| 3925 __ ThrowUncatchable(TERMINATION, eax); | 3925 __ ThrowUncatchable(eax); |
| 3926 | 3926 |
| 3927 __ bind(&failure); | 3927 __ bind(&failure); |
| 3928 // For failure to match, return null. | 3928 // For failure to match, return null. |
| 3929 __ mov(eax, factory->null_value()); | 3929 __ mov(eax, factory->null_value()); |
| 3930 __ ret(4 * kPointerSize); | 3930 __ ret(4 * kPointerSize); |
| 3931 | 3931 |
| 3932 // Load RegExp data. | 3932 // Load RegExp data. |
| 3933 __ bind(&success); | 3933 __ bind(&success); |
| 3934 __ mov(eax, Operand(esp, kJSRegExpOffset)); | 3934 __ mov(eax, Operand(esp, kJSRegExpOffset)); |
| 3935 __ mov(ecx, FieldOperand(eax, JSRegExp::kDataOffset)); | 3935 __ mov(ecx, FieldOperand(eax, JSRegExp::kDataOffset)); |
| (...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4773 } | 4773 } |
| 4774 | 4774 |
| 4775 | 4775 |
| 4776 void CEntryStub::GenerateAheadOfTime() { | 4776 void CEntryStub::GenerateAheadOfTime() { |
| 4777 CEntryStub stub(1, kDontSaveFPRegs); | 4777 CEntryStub stub(1, kDontSaveFPRegs); |
| 4778 Handle<Code> code = stub.GetCode(); | 4778 Handle<Code> code = stub.GetCode(); |
| 4779 code->set_is_pregenerated(true); | 4779 code->set_is_pregenerated(true); |
| 4780 } | 4780 } |
| 4781 | 4781 |
| 4782 | 4782 |
| 4783 void CEntryStub::GenerateThrowTOS(MacroAssembler* masm) { | |
| 4784 __ Throw(eax); | |
| 4785 } | |
| 4786 | |
| 4787 | |
| 4788 void CEntryStub::GenerateCore(MacroAssembler* masm, | 4783 void CEntryStub::GenerateCore(MacroAssembler* masm, |
| 4789 Label* throw_normal_exception, | 4784 Label* throw_normal_exception, |
| 4790 Label* throw_termination_exception, | 4785 Label* throw_termination_exception, |
| 4791 Label* throw_out_of_memory_exception, | 4786 Label* throw_out_of_memory_exception, |
| 4792 bool do_gc, | 4787 bool do_gc, |
| 4793 bool always_allocate_scope) { | 4788 bool always_allocate_scope) { |
| 4794 // eax: result parameter for PerformGC, if any | 4789 // eax: result parameter for PerformGC, if any |
| 4795 // ebx: pointer to C function (C callee-saved) | 4790 // ebx: pointer to C function (C callee-saved) |
| 4796 // ebp: frame pointer (restored after C call) | 4791 // ebp: frame pointer (restored after C call) |
| 4797 // esp: stack pointer (restored after C call) | 4792 // esp: stack pointer (restored after C call) |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4896 __ j(equal, throw_termination_exception); | 4891 __ j(equal, throw_termination_exception); |
| 4897 | 4892 |
| 4898 // Handle normal exception. | 4893 // Handle normal exception. |
| 4899 __ jmp(throw_normal_exception); | 4894 __ jmp(throw_normal_exception); |
| 4900 | 4895 |
| 4901 // Retry. | 4896 // Retry. |
| 4902 __ bind(&retry); | 4897 __ bind(&retry); |
| 4903 } | 4898 } |
| 4904 | 4899 |
| 4905 | 4900 |
| 4906 void CEntryStub::GenerateThrowUncatchable(MacroAssembler* masm, | |
| 4907 UncatchableExceptionType type) { | |
| 4908 __ ThrowUncatchable(type, eax); | |
| 4909 } | |
| 4910 | |
| 4911 | |
| 4912 void CEntryStub::Generate(MacroAssembler* masm) { | 4901 void CEntryStub::Generate(MacroAssembler* masm) { |
| 4913 // eax: number of arguments including receiver | 4902 // eax: number of arguments including receiver |
| 4914 // ebx: pointer to C function (C callee-saved) | 4903 // ebx: pointer to C function (C callee-saved) |
| 4915 // ebp: frame pointer (restored after C call) | 4904 // ebp: frame pointer (restored after C call) |
| 4916 // esp: stack pointer (restored after C call) | 4905 // esp: stack pointer (restored after C call) |
| 4917 // esi: current context (C callee-saved) | 4906 // esi: current context (C callee-saved) |
| 4918 // edi: JS function of the caller (C callee-saved) | 4907 // edi: JS function of the caller (C callee-saved) |
| 4919 | 4908 |
| 4920 // NOTE: Invocations of builtins may return failure objects instead | 4909 // NOTE: Invocations of builtins may return failure objects instead |
| 4921 // of a proper result. The builtin entry handles this by performing | 4910 // of a proper result. The builtin entry handles this by performing |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4955 Failure* failure = Failure::InternalError(); | 4944 Failure* failure = Failure::InternalError(); |
| 4956 __ mov(eax, Immediate(reinterpret_cast<int32_t>(failure))); | 4945 __ mov(eax, Immediate(reinterpret_cast<int32_t>(failure))); |
| 4957 GenerateCore(masm, | 4946 GenerateCore(masm, |
| 4958 &throw_normal_exception, | 4947 &throw_normal_exception, |
| 4959 &throw_termination_exception, | 4948 &throw_termination_exception, |
| 4960 &throw_out_of_memory_exception, | 4949 &throw_out_of_memory_exception, |
| 4961 true, | 4950 true, |
| 4962 true); | 4951 true); |
| 4963 | 4952 |
| 4964 __ bind(&throw_out_of_memory_exception); | 4953 __ bind(&throw_out_of_memory_exception); |
| 4965 GenerateThrowUncatchable(masm, OUT_OF_MEMORY); | 4954 // Set external caught exception to false. |
| 4955 Isolate* isolate = masm->isolate(); |
| 4956 ExternalReference external_caught(Isolate::kExternalCaughtExceptionAddress, |
| 4957 isolate); |
| 4958 __ mov(Operand::StaticVariable(external_caught), Immediate(false)); |
| 4959 |
| 4960 // Set pending exception and eax to out of memory exception. |
| 4961 ExternalReference pending_exception(Isolate::kPendingExceptionAddress, |
| 4962 isolate); |
| 4963 __ mov(eax, reinterpret_cast<int32_t>(Failure::OutOfMemoryException())); |
| 4964 __ mov(Operand::StaticVariable(pending_exception), eax); |
| 4965 // Fall through to the next label. |
| 4966 | 4966 |
| 4967 __ bind(&throw_termination_exception); | 4967 __ bind(&throw_termination_exception); |
| 4968 GenerateThrowUncatchable(masm, TERMINATION); | 4968 __ ThrowUncatchable(eax); |
| 4969 | 4969 |
| 4970 __ bind(&throw_normal_exception); | 4970 __ bind(&throw_normal_exception); |
| 4971 GenerateThrowTOS(masm); | 4971 __ Throw(eax); |
| 4972 } | 4972 } |
| 4973 | 4973 |
| 4974 | 4974 |
| 4975 void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) { | 4975 void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) { |
| 4976 Label invoke, handler_entry, exit; | 4976 Label invoke, handler_entry, exit; |
| 4977 Label not_outermost_js, not_outermost_js_2; | 4977 Label not_outermost_js, not_outermost_js_2; |
| 4978 | 4978 |
| 4979 // Set up frame. | 4979 // Set up frame. |
| 4980 __ push(ebp); | 4980 __ push(ebp); |
| 4981 __ mov(ebp, esp); | 4981 __ mov(ebp, esp); |
| (...skipping 2390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7372 false); | 7372 false); |
| 7373 __ pop(edx); | 7373 __ pop(edx); |
| 7374 __ ret(0); | 7374 __ ret(0); |
| 7375 } | 7375 } |
| 7376 | 7376 |
| 7377 #undef __ | 7377 #undef __ |
| 7378 | 7378 |
| 7379 } } // namespace v8::internal | 7379 } } // namespace v8::internal |
| 7380 | 7380 |
| 7381 #endif // V8_TARGET_ARCH_IA32 | 7381 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |