OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 6732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6743 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); | 6743 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); |
6744 __ bind(&skip); | 6744 __ bind(&skip); |
6745 __ ret(0); | 6745 __ ret(0); |
6746 } | 6746 } |
6747 | 6747 |
6748 | 6748 |
6749 void CEntryStub::GenerateCore(MacroAssembler* masm, | 6749 void CEntryStub::GenerateCore(MacroAssembler* masm, |
6750 Label* throw_normal_exception, | 6750 Label* throw_normal_exception, |
6751 Label* throw_termination_exception, | 6751 Label* throw_termination_exception, |
6752 Label* throw_out_of_memory_exception, | 6752 Label* throw_out_of_memory_exception, |
6753 StackFrame::Type frame_type, | 6753 ExitFrame::Mode mode, |
6754 bool do_gc, | 6754 bool do_gc, |
6755 bool always_allocate_scope) { | 6755 bool always_allocate_scope) { |
6756 // rax: result parameter for PerformGC, if any. | 6756 // rax: result parameter for PerformGC, if any. |
6757 // rbx: pointer to C function (C callee-saved). | 6757 // rbx: pointer to C function (C callee-saved). |
6758 // rbp: frame pointer (restored after C call). | 6758 // rbp: frame pointer (restored after C call). |
6759 // rsp: stack pointer (restored after C call). | 6759 // rsp: stack pointer (restored after C call). |
6760 // r14: number of arguments including receiver (C callee-saved). | 6760 // r14: number of arguments including receiver (C callee-saved). |
6761 // r15: pointer to the first argument (C callee-saved). | 6761 // r15: pointer to the first argument (C callee-saved). |
6762 // This pointer is reused in LeaveExitFrame(), so it is stored in a | 6762 // This pointer is reused in LeaveExitFrame(), so it is stored in a |
6763 // callee-saved register. | 6763 // callee-saved register. |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6826 __ movq(rax, Operand(rsp, 6 * kPointerSize)); | 6826 __ movq(rax, Operand(rsp, 6 * kPointerSize)); |
6827 __ movq(rdx, Operand(rsp, 7 * kPointerSize)); | 6827 __ movq(rdx, Operand(rsp, 7 * kPointerSize)); |
6828 } | 6828 } |
6829 #endif | 6829 #endif |
6830 __ lea(rcx, Operand(rax, 1)); | 6830 __ lea(rcx, Operand(rax, 1)); |
6831 // Lower 2 bits of rcx are 0 iff rax has failure tag. | 6831 // Lower 2 bits of rcx are 0 iff rax has failure tag. |
6832 __ testl(rcx, Immediate(kFailureTagMask)); | 6832 __ testl(rcx, Immediate(kFailureTagMask)); |
6833 __ j(zero, &failure_returned); | 6833 __ j(zero, &failure_returned); |
6834 | 6834 |
6835 // Exit the JavaScript to C++ exit frame. | 6835 // Exit the JavaScript to C++ exit frame. |
6836 __ LeaveExitFrame(frame_type, result_size_); | 6836 __ LeaveExitFrame(mode, result_size_); |
6837 __ ret(0); | 6837 __ ret(0); |
6838 | 6838 |
6839 // Handling of failure. | 6839 // Handling of failure. |
6840 __ bind(&failure_returned); | 6840 __ bind(&failure_returned); |
6841 | 6841 |
6842 Label retry; | 6842 Label retry; |
6843 // If the returned exception is RETRY_AFTER_GC continue at retry label | 6843 // If the returned exception is RETRY_AFTER_GC continue at retry label |
6844 ASSERT(Failure::RETRY_AFTER_GC == 0); | 6844 ASSERT(Failure::RETRY_AFTER_GC == 0); |
6845 __ testl(rax, Immediate(((1 << kFailureTypeTagSize) - 1) << kFailureTagSize)); | 6845 __ testl(rax, Immediate(((1 << kFailureTypeTagSize) - 1) << kFailureTagSize)); |
6846 __ j(zero, &retry); | 6846 __ j(zero, &retry); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6956 // rbx: pointer to C function (C callee-saved) | 6956 // rbx: pointer to C function (C callee-saved) |
6957 // rbp: frame pointer of calling JS frame (restored after C call) | 6957 // rbp: frame pointer of calling JS frame (restored after C call) |
6958 // rsp: stack pointer (restored after C call) | 6958 // rsp: stack pointer (restored after C call) |
6959 // rsi: current context (restored) | 6959 // rsi: current context (restored) |
6960 | 6960 |
6961 // NOTE: Invocations of builtins may return failure objects | 6961 // NOTE: Invocations of builtins may return failure objects |
6962 // instead of a proper result. The builtin entry handles | 6962 // instead of a proper result. The builtin entry handles |
6963 // this by performing a garbage collection and retrying the | 6963 // this by performing a garbage collection and retrying the |
6964 // builtin once. | 6964 // builtin once. |
6965 | 6965 |
6966 StackFrame::Type frame_type = is_debug_break ? | 6966 ExitFrame::Mode mode = is_debug_break ? |
6967 StackFrame::EXIT_DEBUG : | 6967 ExitFrame::MODE_DEBUG : |
6968 StackFrame::EXIT; | 6968 ExitFrame::MODE_NORMAL; |
6969 | 6969 |
6970 // Enter the exit frame that transitions from JavaScript to C++. | 6970 // Enter the exit frame that transitions from JavaScript to C++. |
6971 __ EnterExitFrame(frame_type, result_size_); | 6971 __ EnterExitFrame(mode, result_size_); |
6972 | 6972 |
6973 // rax: Holds the context at this point, but should not be used. | 6973 // rax: Holds the context at this point, but should not be used. |
6974 // On entry to code generated by GenerateCore, it must hold | 6974 // On entry to code generated by GenerateCore, it must hold |
6975 // a failure result if the collect_garbage argument to GenerateCore | 6975 // a failure result if the collect_garbage argument to GenerateCore |
6976 // is true. This failure result can be the result of code | 6976 // is true. This failure result can be the result of code |
6977 // generated by a previous call to GenerateCore. The value | 6977 // generated by a previous call to GenerateCore. The value |
6978 // of rax is then passed to Runtime::PerformGC. | 6978 // of rax is then passed to Runtime::PerformGC. |
6979 // rbx: pointer to builtin function (C callee-saved). | 6979 // rbx: pointer to builtin function (C callee-saved). |
6980 // rbp: frame pointer of exit frame (restored after C call). | 6980 // rbp: frame pointer of exit frame (restored after C call). |
6981 // rsp: stack pointer (restored after C call). | 6981 // rsp: stack pointer (restored after C call). |
6982 // r14: number of arguments including receiver (C callee-saved). | 6982 // r14: number of arguments including receiver (C callee-saved). |
6983 // r15: argv pointer (C callee-saved). | 6983 // r15: argv pointer (C callee-saved). |
6984 | 6984 |
6985 Label throw_normal_exception; | 6985 Label throw_normal_exception; |
6986 Label throw_termination_exception; | 6986 Label throw_termination_exception; |
6987 Label throw_out_of_memory_exception; | 6987 Label throw_out_of_memory_exception; |
6988 | 6988 |
6989 // Call into the runtime system. | 6989 // Call into the runtime system. |
6990 GenerateCore(masm, | 6990 GenerateCore(masm, |
6991 &throw_normal_exception, | 6991 &throw_normal_exception, |
6992 &throw_termination_exception, | 6992 &throw_termination_exception, |
6993 &throw_out_of_memory_exception, | 6993 &throw_out_of_memory_exception, |
6994 frame_type, | 6994 mode, |
6995 false, | 6995 false, |
6996 false); | 6996 false); |
6997 | 6997 |
6998 // Do space-specific GC and retry runtime call. | 6998 // Do space-specific GC and retry runtime call. |
6999 GenerateCore(masm, | 6999 GenerateCore(masm, |
7000 &throw_normal_exception, | 7000 &throw_normal_exception, |
7001 &throw_termination_exception, | 7001 &throw_termination_exception, |
7002 &throw_out_of_memory_exception, | 7002 &throw_out_of_memory_exception, |
7003 frame_type, | 7003 mode, |
7004 true, | 7004 true, |
7005 false); | 7005 false); |
7006 | 7006 |
7007 // Do full GC and retry runtime call one final time. | 7007 // Do full GC and retry runtime call one final time. |
7008 Failure* failure = Failure::InternalError(); | 7008 Failure* failure = Failure::InternalError(); |
7009 __ movq(rax, failure, RelocInfo::NONE); | 7009 __ movq(rax, failure, RelocInfo::NONE); |
7010 GenerateCore(masm, | 7010 GenerateCore(masm, |
7011 &throw_normal_exception, | 7011 &throw_normal_exception, |
7012 &throw_termination_exception, | 7012 &throw_termination_exception, |
7013 &throw_out_of_memory_exception, | 7013 &throw_out_of_memory_exception, |
7014 frame_type, | 7014 mode, |
7015 true, | 7015 true, |
7016 true); | 7016 true); |
7017 | 7017 |
7018 __ bind(&throw_out_of_memory_exception); | 7018 __ bind(&throw_out_of_memory_exception); |
7019 GenerateThrowUncatchable(masm, OUT_OF_MEMORY); | 7019 GenerateThrowUncatchable(masm, OUT_OF_MEMORY); |
7020 | 7020 |
7021 __ bind(&throw_termination_exception); | 7021 __ bind(&throw_termination_exception); |
7022 GenerateThrowUncatchable(masm, TERMINATION); | 7022 GenerateThrowUncatchable(masm, TERMINATION); |
7023 | 7023 |
7024 __ bind(&throw_normal_exception); | 7024 __ bind(&throw_normal_exception); |
7025 GenerateThrowTOS(masm); | 7025 GenerateThrowTOS(masm); |
7026 } | 7026 } |
7027 | 7027 |
7028 | 7028 |
| 7029 void ApiGetterEntryStub::Generate(MacroAssembler* masm) { |
| 7030 UNREACHABLE(); |
| 7031 } |
| 7032 |
| 7033 |
7029 void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) { | 7034 void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) { |
7030 Label invoke, exit; | 7035 Label invoke, exit; |
7031 #ifdef ENABLE_LOGGING_AND_PROFILING | 7036 #ifdef ENABLE_LOGGING_AND_PROFILING |
7032 Label not_outermost_js, not_outermost_js_2; | 7037 Label not_outermost_js, not_outermost_js_2; |
7033 #endif | 7038 #endif |
7034 | 7039 |
7035 // Setup frame. | 7040 // Setup frame. |
7036 __ push(rbp); | 7041 __ push(rbp); |
7037 __ movq(rbp, rsp); | 7042 __ movq(rbp, rsp); |
7038 | 7043 |
(...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7852 masm.GetCode(&desc); | 7857 masm.GetCode(&desc); |
7853 // Call the function from C++. | 7858 // Call the function from C++. |
7854 return FUNCTION_CAST<ModuloFunction>(buffer); | 7859 return FUNCTION_CAST<ModuloFunction>(buffer); |
7855 } | 7860 } |
7856 | 7861 |
7857 #endif | 7862 #endif |
7858 | 7863 |
7859 #undef __ | 7864 #undef __ |
7860 | 7865 |
7861 } } // namespace v8::internal | 7866 } } // namespace v8::internal |
OLD | NEW |