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 6753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6764 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); | 6764 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); |
6765 __ bind(&skip); | 6765 __ bind(&skip); |
6766 __ ret(0); | 6766 __ ret(0); |
6767 } | 6767 } |
6768 | 6768 |
6769 | 6769 |
6770 void CEntryStub::GenerateCore(MacroAssembler* masm, | 6770 void CEntryStub::GenerateCore(MacroAssembler* masm, |
6771 Label* throw_normal_exception, | 6771 Label* throw_normal_exception, |
6772 Label* throw_termination_exception, | 6772 Label* throw_termination_exception, |
6773 Label* throw_out_of_memory_exception, | 6773 Label* throw_out_of_memory_exception, |
6774 StackFrame::Type frame_type, | 6774 ExitFrame::Mode mode, |
6775 bool do_gc, | 6775 bool do_gc, |
6776 bool always_allocate_scope) { | 6776 bool always_allocate_scope) { |
6777 // rax: result parameter for PerformGC, if any. | 6777 // rax: result parameter for PerformGC, if any. |
6778 // rbx: pointer to C function (C callee-saved). | 6778 // rbx: pointer to C function (C callee-saved). |
6779 // rbp: frame pointer (restored after C call). | 6779 // rbp: frame pointer (restored after C call). |
6780 // rsp: stack pointer (restored after C call). | 6780 // rsp: stack pointer (restored after C call). |
6781 // r14: number of arguments including receiver (C callee-saved). | 6781 // r14: number of arguments including receiver (C callee-saved). |
6782 // r15: pointer to the first argument (C callee-saved). | 6782 // r15: pointer to the first argument (C callee-saved). |
6783 // This pointer is reused in LeaveExitFrame(), so it is stored in a | 6783 // This pointer is reused in LeaveExitFrame(), so it is stored in a |
6784 // callee-saved register. | 6784 // callee-saved register. |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6847 __ movq(rax, Operand(rsp, 6 * kPointerSize)); | 6847 __ movq(rax, Operand(rsp, 6 * kPointerSize)); |
6848 __ movq(rdx, Operand(rsp, 7 * kPointerSize)); | 6848 __ movq(rdx, Operand(rsp, 7 * kPointerSize)); |
6849 } | 6849 } |
6850 #endif | 6850 #endif |
6851 __ lea(rcx, Operand(rax, 1)); | 6851 __ lea(rcx, Operand(rax, 1)); |
6852 // Lower 2 bits of rcx are 0 iff rax has failure tag. | 6852 // Lower 2 bits of rcx are 0 iff rax has failure tag. |
6853 __ testl(rcx, Immediate(kFailureTagMask)); | 6853 __ testl(rcx, Immediate(kFailureTagMask)); |
6854 __ j(zero, &failure_returned); | 6854 __ j(zero, &failure_returned); |
6855 | 6855 |
6856 // Exit the JavaScript to C++ exit frame. | 6856 // Exit the JavaScript to C++ exit frame. |
6857 __ LeaveExitFrame(frame_type, result_size_); | 6857 __ LeaveExitFrame(mode, result_size_); |
6858 __ ret(0); | 6858 __ ret(0); |
6859 | 6859 |
6860 // Handling of failure. | 6860 // Handling of failure. |
6861 __ bind(&failure_returned); | 6861 __ bind(&failure_returned); |
6862 | 6862 |
6863 Label retry; | 6863 Label retry; |
6864 // If the returned exception is RETRY_AFTER_GC continue at retry label | 6864 // If the returned exception is RETRY_AFTER_GC continue at retry label |
6865 ASSERT(Failure::RETRY_AFTER_GC == 0); | 6865 ASSERT(Failure::RETRY_AFTER_GC == 0); |
6866 __ testl(rax, Immediate(((1 << kFailureTypeTagSize) - 1) << kFailureTagSize)); | 6866 __ testl(rax, Immediate(((1 << kFailureTypeTagSize) - 1) << kFailureTagSize)); |
6867 __ j(zero, &retry); | 6867 __ j(zero, &retry); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6977 // rbx: pointer to C function (C callee-saved) | 6977 // rbx: pointer to C function (C callee-saved) |
6978 // rbp: frame pointer of calling JS frame (restored after C call) | 6978 // rbp: frame pointer of calling JS frame (restored after C call) |
6979 // rsp: stack pointer (restored after C call) | 6979 // rsp: stack pointer (restored after C call) |
6980 // rsi: current context (restored) | 6980 // rsi: current context (restored) |
6981 | 6981 |
6982 // NOTE: Invocations of builtins may return failure objects | 6982 // NOTE: Invocations of builtins may return failure objects |
6983 // instead of a proper result. The builtin entry handles | 6983 // instead of a proper result. The builtin entry handles |
6984 // this by performing a garbage collection and retrying the | 6984 // this by performing a garbage collection and retrying the |
6985 // builtin once. | 6985 // builtin once. |
6986 | 6986 |
6987 StackFrame::Type frame_type = is_debug_break ? | 6987 ExitFrame::Mode mode = is_debug_break ? |
6988 StackFrame::EXIT_DEBUG : | 6988 ExitFrame::MODE_DEBUG : |
6989 StackFrame::EXIT; | 6989 ExitFrame::MODE_NORMAL; |
6990 | 6990 |
6991 // Enter the exit frame that transitions from JavaScript to C++. | 6991 // Enter the exit frame that transitions from JavaScript to C++. |
6992 __ EnterExitFrame(frame_type, result_size_); | 6992 __ EnterExitFrame(mode, result_size_); |
6993 | 6993 |
6994 // rax: Holds the context at this point, but should not be used. | 6994 // rax: Holds the context at this point, but should not be used. |
6995 // On entry to code generated by GenerateCore, it must hold | 6995 // On entry to code generated by GenerateCore, it must hold |
6996 // a failure result if the collect_garbage argument to GenerateCore | 6996 // a failure result if the collect_garbage argument to GenerateCore |
6997 // is true. This failure result can be the result of code | 6997 // is true. This failure result can be the result of code |
6998 // generated by a previous call to GenerateCore. The value | 6998 // generated by a previous call to GenerateCore. The value |
6999 // of rax is then passed to Runtime::PerformGC. | 6999 // of rax is then passed to Runtime::PerformGC. |
7000 // rbx: pointer to builtin function (C callee-saved). | 7000 // rbx: pointer to builtin function (C callee-saved). |
7001 // rbp: frame pointer of exit frame (restored after C call). | 7001 // rbp: frame pointer of exit frame (restored after C call). |
7002 // rsp: stack pointer (restored after C call). | 7002 // rsp: stack pointer (restored after C call). |
7003 // r14: number of arguments including receiver (C callee-saved). | 7003 // r14: number of arguments including receiver (C callee-saved). |
7004 // r15: argv pointer (C callee-saved). | 7004 // r15: argv pointer (C callee-saved). |
7005 | 7005 |
7006 Label throw_normal_exception; | 7006 Label throw_normal_exception; |
7007 Label throw_termination_exception; | 7007 Label throw_termination_exception; |
7008 Label throw_out_of_memory_exception; | 7008 Label throw_out_of_memory_exception; |
7009 | 7009 |
7010 // Call into the runtime system. | 7010 // Call into the runtime system. |
7011 GenerateCore(masm, | 7011 GenerateCore(masm, |
7012 &throw_normal_exception, | 7012 &throw_normal_exception, |
7013 &throw_termination_exception, | 7013 &throw_termination_exception, |
7014 &throw_out_of_memory_exception, | 7014 &throw_out_of_memory_exception, |
7015 frame_type, | 7015 mode, |
7016 false, | 7016 false, |
7017 false); | 7017 false); |
7018 | 7018 |
7019 // Do space-specific GC and retry runtime call. | 7019 // Do space-specific GC and retry runtime call. |
7020 GenerateCore(masm, | 7020 GenerateCore(masm, |
7021 &throw_normal_exception, | 7021 &throw_normal_exception, |
7022 &throw_termination_exception, | 7022 &throw_termination_exception, |
7023 &throw_out_of_memory_exception, | 7023 &throw_out_of_memory_exception, |
7024 frame_type, | 7024 mode, |
7025 true, | 7025 true, |
7026 false); | 7026 false); |
7027 | 7027 |
7028 // Do full GC and retry runtime call one final time. | 7028 // Do full GC and retry runtime call one final time. |
7029 Failure* failure = Failure::InternalError(); | 7029 Failure* failure = Failure::InternalError(); |
7030 __ movq(rax, failure, RelocInfo::NONE); | 7030 __ movq(rax, failure, RelocInfo::NONE); |
7031 GenerateCore(masm, | 7031 GenerateCore(masm, |
7032 &throw_normal_exception, | 7032 &throw_normal_exception, |
7033 &throw_termination_exception, | 7033 &throw_termination_exception, |
7034 &throw_out_of_memory_exception, | 7034 &throw_out_of_memory_exception, |
7035 frame_type, | 7035 mode, |
7036 true, | 7036 true, |
7037 true); | 7037 true); |
7038 | 7038 |
7039 __ bind(&throw_out_of_memory_exception); | 7039 __ bind(&throw_out_of_memory_exception); |
7040 GenerateThrowUncatchable(masm, OUT_OF_MEMORY); | 7040 GenerateThrowUncatchable(masm, OUT_OF_MEMORY); |
7041 | 7041 |
7042 __ bind(&throw_termination_exception); | 7042 __ bind(&throw_termination_exception); |
7043 GenerateThrowUncatchable(masm, TERMINATION); | 7043 GenerateThrowUncatchable(masm, TERMINATION); |
7044 | 7044 |
7045 __ bind(&throw_normal_exception); | 7045 __ bind(&throw_normal_exception); |
7046 GenerateThrowTOS(masm); | 7046 GenerateThrowTOS(masm); |
7047 } | 7047 } |
7048 | 7048 |
7049 | 7049 |
| 7050 void ApiGetterEntryStub::Generate(MacroAssembler* masm) { |
| 7051 UNREACHABLE(); |
| 7052 } |
| 7053 |
| 7054 |
7050 void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) { | 7055 void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) { |
7051 Label invoke, exit; | 7056 Label invoke, exit; |
7052 #ifdef ENABLE_LOGGING_AND_PROFILING | 7057 #ifdef ENABLE_LOGGING_AND_PROFILING |
7053 Label not_outermost_js, not_outermost_js_2; | 7058 Label not_outermost_js, not_outermost_js_2; |
7054 #endif | 7059 #endif |
7055 | 7060 |
7056 // Setup frame. | 7061 // Setup frame. |
7057 __ push(rbp); | 7062 __ push(rbp); |
7058 __ movq(rbp, rsp); | 7063 __ movq(rbp, rsp); |
7059 | 7064 |
(...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7873 masm.GetCode(&desc); | 7878 masm.GetCode(&desc); |
7874 // Call the function from C++. | 7879 // Call the function from C++. |
7875 return FUNCTION_CAST<ModuloFunction>(buffer); | 7880 return FUNCTION_CAST<ModuloFunction>(buffer); |
7876 } | 7881 } |
7877 | 7882 |
7878 #endif | 7883 #endif |
7879 | 7884 |
7880 #undef __ | 7885 #undef __ |
7881 | 7886 |
7882 } } // namespace v8::internal | 7887 } } // namespace v8::internal |
OLD | NEW |