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 6766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6777 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); | 6777 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); |
6778 __ bind(&skip); | 6778 __ bind(&skip); |
6779 __ ret(0); | 6779 __ ret(0); |
6780 } | 6780 } |
6781 | 6781 |
6782 | 6782 |
6783 void CEntryStub::GenerateCore(MacroAssembler* masm, | 6783 void CEntryStub::GenerateCore(MacroAssembler* masm, |
6784 Label* throw_normal_exception, | 6784 Label* throw_normal_exception, |
6785 Label* throw_termination_exception, | 6785 Label* throw_termination_exception, |
6786 Label* throw_out_of_memory_exception, | 6786 Label* throw_out_of_memory_exception, |
6787 ExitFrame::Mode mode, | 6787 StackFrame::Type frame_type, |
6788 bool do_gc, | 6788 bool do_gc, |
6789 bool always_allocate_scope) { | 6789 bool always_allocate_scope) { |
6790 // rax: result parameter for PerformGC, if any. | 6790 // rax: result parameter for PerformGC, if any. |
6791 // rbx: pointer to C function (C callee-saved). | 6791 // rbx: pointer to C function (C callee-saved). |
6792 // rbp: frame pointer (restored after C call). | 6792 // rbp: frame pointer (restored after C call). |
6793 // rsp: stack pointer (restored after C call). | 6793 // rsp: stack pointer (restored after C call). |
6794 // r14: number of arguments including receiver (C callee-saved). | 6794 // r14: number of arguments including receiver (C callee-saved). |
6795 // r15: pointer to the first argument (C callee-saved). | 6795 // r15: pointer to the first argument (C callee-saved). |
6796 // This pointer is reused in LeaveExitFrame(), so it is stored in a | 6796 // This pointer is reused in LeaveExitFrame(), so it is stored in a |
6797 // callee-saved register. | 6797 // callee-saved register. |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6858 __ movq(rax, Operand(rsp, 6 * kPointerSize)); | 6858 __ movq(rax, Operand(rsp, 6 * kPointerSize)); |
6859 __ movq(rdx, Operand(rsp, 7 * kPointerSize)); | 6859 __ movq(rdx, Operand(rsp, 7 * kPointerSize)); |
6860 } | 6860 } |
6861 #endif | 6861 #endif |
6862 __ lea(rcx, Operand(rax, 1)); | 6862 __ lea(rcx, Operand(rax, 1)); |
6863 // Lower 2 bits of rcx are 0 iff rax has failure tag. | 6863 // Lower 2 bits of rcx are 0 iff rax has failure tag. |
6864 __ testl(rcx, Immediate(kFailureTagMask)); | 6864 __ testl(rcx, Immediate(kFailureTagMask)); |
6865 __ j(zero, &failure_returned); | 6865 __ j(zero, &failure_returned); |
6866 | 6866 |
6867 // Exit the JavaScript to C++ exit frame. | 6867 // Exit the JavaScript to C++ exit frame. |
6868 __ LeaveExitFrame(mode, result_size_); | 6868 __ LeaveExitFrame(frame_type, result_size_); |
6869 __ ret(0); | 6869 __ ret(0); |
6870 | 6870 |
6871 // Handling of failure. | 6871 // Handling of failure. |
6872 __ bind(&failure_returned); | 6872 __ bind(&failure_returned); |
6873 | 6873 |
6874 Label retry; | 6874 Label retry; |
6875 // If the returned exception is RETRY_AFTER_GC continue at retry label | 6875 // If the returned exception is RETRY_AFTER_GC continue at retry label |
6876 ASSERT(Failure::RETRY_AFTER_GC == 0); | 6876 ASSERT(Failure::RETRY_AFTER_GC == 0); |
6877 __ testl(rax, Immediate(((1 << kFailureTypeTagSize) - 1) << kFailureTagSize)); | 6877 __ testl(rax, Immediate(((1 << kFailureTypeTagSize) - 1) << kFailureTagSize)); |
6878 __ j(zero, &retry); | 6878 __ j(zero, &retry); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6988 // rbx: pointer to C function (C callee-saved) | 6988 // rbx: pointer to C function (C callee-saved) |
6989 // rbp: frame pointer of calling JS frame (restored after C call) | 6989 // rbp: frame pointer of calling JS frame (restored after C call) |
6990 // rsp: stack pointer (restored after C call) | 6990 // rsp: stack pointer (restored after C call) |
6991 // rsi: current context (restored) | 6991 // rsi: current context (restored) |
6992 | 6992 |
6993 // NOTE: Invocations of builtins may return failure objects | 6993 // NOTE: Invocations of builtins may return failure objects |
6994 // instead of a proper result. The builtin entry handles | 6994 // instead of a proper result. The builtin entry handles |
6995 // this by performing a garbage collection and retrying the | 6995 // this by performing a garbage collection and retrying the |
6996 // builtin once. | 6996 // builtin once. |
6997 | 6997 |
6998 ExitFrame::Mode mode = is_debug_break ? | 6998 StackFrame::Type frame_type = is_debug_break ? |
6999 ExitFrame::MODE_DEBUG : | 6999 StackFrame::EXIT_DEBUG : |
7000 ExitFrame::MODE_NORMAL; | 7000 StackFrame::EXIT; |
7001 | 7001 |
7002 // Enter the exit frame that transitions from JavaScript to C++. | 7002 // Enter the exit frame that transitions from JavaScript to C++. |
7003 __ EnterExitFrame(mode, result_size_); | 7003 __ EnterExitFrame(frame_type, result_size_); |
7004 | 7004 |
7005 // rax: Holds the context at this point, but should not be used. | 7005 // rax: Holds the context at this point, but should not be used. |
7006 // On entry to code generated by GenerateCore, it must hold | 7006 // On entry to code generated by GenerateCore, it must hold |
7007 // a failure result if the collect_garbage argument to GenerateCore | 7007 // a failure result if the collect_garbage argument to GenerateCore |
7008 // is true. This failure result can be the result of code | 7008 // is true. This failure result can be the result of code |
7009 // generated by a previous call to GenerateCore. The value | 7009 // generated by a previous call to GenerateCore. The value |
7010 // of rax is then passed to Runtime::PerformGC. | 7010 // of rax is then passed to Runtime::PerformGC. |
7011 // rbx: pointer to builtin function (C callee-saved). | 7011 // rbx: pointer to builtin function (C callee-saved). |
7012 // rbp: frame pointer of exit frame (restored after C call). | 7012 // rbp: frame pointer of exit frame (restored after C call). |
7013 // rsp: stack pointer (restored after C call). | 7013 // rsp: stack pointer (restored after C call). |
7014 // r14: number of arguments including receiver (C callee-saved). | 7014 // r14: number of arguments including receiver (C callee-saved). |
7015 // r15: argv pointer (C callee-saved). | 7015 // r15: argv pointer (C callee-saved). |
7016 | 7016 |
7017 Label throw_normal_exception; | 7017 Label throw_normal_exception; |
7018 Label throw_termination_exception; | 7018 Label throw_termination_exception; |
7019 Label throw_out_of_memory_exception; | 7019 Label throw_out_of_memory_exception; |
7020 | 7020 |
7021 // Call into the runtime system. | 7021 // Call into the runtime system. |
7022 GenerateCore(masm, | 7022 GenerateCore(masm, |
7023 &throw_normal_exception, | 7023 &throw_normal_exception, |
7024 &throw_termination_exception, | 7024 &throw_termination_exception, |
7025 &throw_out_of_memory_exception, | 7025 &throw_out_of_memory_exception, |
7026 mode, | 7026 frame_type, |
7027 false, | 7027 false, |
7028 false); | 7028 false); |
7029 | 7029 |
7030 // Do space-specific GC and retry runtime call. | 7030 // Do space-specific GC and retry runtime call. |
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 mode, | 7035 frame_type, |
7036 true, | 7036 true, |
7037 false); | 7037 false); |
7038 | 7038 |
7039 // Do full GC and retry runtime call one final time. | 7039 // Do full GC and retry runtime call one final time. |
7040 Failure* failure = Failure::InternalError(); | 7040 Failure* failure = Failure::InternalError(); |
7041 __ movq(rax, failure, RelocInfo::NONE); | 7041 __ movq(rax, failure, RelocInfo::NONE); |
7042 GenerateCore(masm, | 7042 GenerateCore(masm, |
7043 &throw_normal_exception, | 7043 &throw_normal_exception, |
7044 &throw_termination_exception, | 7044 &throw_termination_exception, |
7045 &throw_out_of_memory_exception, | 7045 &throw_out_of_memory_exception, |
7046 mode, | 7046 frame_type, |
7047 true, | 7047 true, |
7048 true); | 7048 true); |
7049 | 7049 |
7050 __ bind(&throw_out_of_memory_exception); | 7050 __ bind(&throw_out_of_memory_exception); |
7051 GenerateThrowUncatchable(masm, OUT_OF_MEMORY); | 7051 GenerateThrowUncatchable(masm, OUT_OF_MEMORY); |
7052 | 7052 |
7053 __ bind(&throw_termination_exception); | 7053 __ bind(&throw_termination_exception); |
7054 GenerateThrowUncatchable(masm, TERMINATION); | 7054 GenerateThrowUncatchable(masm, TERMINATION); |
7055 | 7055 |
7056 __ bind(&throw_normal_exception); | 7056 __ bind(&throw_normal_exception); |
7057 GenerateThrowTOS(masm); | 7057 GenerateThrowTOS(masm); |
7058 } | 7058 } |
7059 | 7059 |
7060 | 7060 |
7061 void ApiGetterEntryStub::Generate(MacroAssembler* masm) { | |
7062 UNREACHABLE(); | |
7063 } | |
7064 | |
7065 | |
7066 void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) { | 7061 void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) { |
7067 Label invoke, exit; | 7062 Label invoke, exit; |
7068 #ifdef ENABLE_LOGGING_AND_PROFILING | 7063 #ifdef ENABLE_LOGGING_AND_PROFILING |
7069 Label not_outermost_js, not_outermost_js_2; | 7064 Label not_outermost_js, not_outermost_js_2; |
7070 #endif | 7065 #endif |
7071 | 7066 |
7072 // Setup frame. | 7067 // Setup frame. |
7073 __ push(rbp); | 7068 __ push(rbp); |
7074 __ movq(rbp, rsp); | 7069 __ movq(rbp, rsp); |
7075 | 7070 |
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7734 masm.GetCode(&desc); | 7729 masm.GetCode(&desc); |
7735 // Call the function from C++. | 7730 // Call the function from C++. |
7736 return FUNCTION_CAST<ModuloFunction>(buffer); | 7731 return FUNCTION_CAST<ModuloFunction>(buffer); |
7737 } | 7732 } |
7738 | 7733 |
7739 #endif | 7734 #endif |
7740 | 7735 |
7741 #undef __ | 7736 #undef __ |
7742 | 7737 |
7743 } } // namespace v8::internal | 7738 } } // namespace v8::internal |
OLD | NEW |